Folder Schema missing for Assets

HarishDv

12-05-2018

HI Team ,

I am going through a documentation below.

https://helpx.adobe.com/experience-manager/6-3/release-notes/folder-metadata-schema.html

We are using AEM 6.3 CFP2 . However we do not see this option on the tools section of AEM .

Can you please let me know  how to enable this option .

Thanks

Harish

Answers (11)

Answers (11)

Hemant_arora

15-05-2018

Here is a sample AEM fiddle script to add foldermetadataschema to subfolders programatically

package apps.acs_002dtools.components.aemfiddle.fiddle;

import com.day.cq.search.*;

import com.day.cq.wcm.api.*;

import com.day.cq.dam.api.*;

import org.apache.sling.api.*;

import org.apache.sling.api.resource.*;

import org.apache.sling.api.servlets.*;

import java.io.IOException;

import javax.jcr.*;

import java.util.*;

public class fiddle extends SlingAllMethodsServlet {

    @Override

    protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException {

          // Code here

        //response.getWriter().println("Hello from " + request.getResource().getPath());

        Resource resource = request.getResourceResolver().getResource("/content/dam/AEM63App");

     

Resource res = request.getResourceResolver().getResource(resource.getPath()+"/jcr:content");

ValueMap properties = res.adaptTo(ValueMap.class);

String metaDataSchemaValue = properties.get("folderMetadataSchema", String.class);

response.getWriter().write(""+metaDataSchemaValue);

      

Session session =  request.getResourceResolver().adaptTo(Session.class);

        if (resource != null) {

           if (resource != null) {

Iterator<Resource> linkResources = resource.listChildren();

while (linkResources.hasNext()) {

Resource childResource = linkResources.next();

try{

Node childNode = childResource.adaptTo(Node.class);

childNode = childNode.getNode("jcr:content");

childNode.setProperty("folderMetadataSchema",metaDataSchemaValue);

session.save();

response.getWriter().write(""+childNode.getProperty("jcr:title").getString());

    

}catch(RepositoryException re){}

}

}

            response.setStatus(SlingHttpServletResponse.SC_OK);

        } else {

            response.setStatus(SlingHttpServletResponse.SC_INTERNAL_SERVER_ERROR);

            response.getWriter().write("ERROR");

        }

    }

       

    }

Hemant_arora

15-05-2018

Yes, its not inherited if there are existing subfolders inside a folder and you apply schema to only the parent folder.

But in case you have already applied schema to a parent folder and you are creating nee subfolders inside the parent then it will ask you to add a metadata schema while creating subfolder.

1487671_pastedImage_0.png

You can add folder metadata schema to subfolders programatically in case you have more number of subfolders.

You will be required to either write a workflow or event listener which will observe whenever a subfolder is created and the parent of which has a specific metadata schema applied, so copy that property to subfolder too.

of if you have less number of subfoders you can directly select the schema and use the option of apply to folder(s)

or

go to crx/de and add the property to the jcr:content node

folderMetadataSchema       /conf/global/settings/dam/adminui-extension/foldermetadataschema/test

or add that to your code and build it.

But yes when you create a new subfolder you will have to select.

I believe inheritance happens in case of assets only and not in folders.

HarishDv

15-05-2018

Hi Hemant,

There is still an issue here.

The Schema Taxonomy looks like it it applicable for one folder.

The subfolders within this folder do NOT inherit this new schema.

Can we somehow get this applicable to sub folders ?

Thanks

Harish

HarishDv

14-05-2018

Hi Hemant,

Thanks for the above info.

I just realised i am using the version 6.3.1.2 .

Can you please confirm the package i need to install , on top of this to get this feature ?

Thanks

Harish

HarishDv

14-05-2018

Hi Hemant,

I think you are missing my question .

I don't need a schema on assets. I am looking at adding a custom schema for asset folder. In other words I am trying to add some custom metadata on the sling:orderedFolder Node & NOT on dam:Asset.

Please look at my screen shot above.

Thanks

Harish

Hemant_arora

13-05-2018

Go to tools-> assets-> metadata schemas

Create a new schema

Edit the Schema

Add columns and custom fields

save the schema.

Now select this newly created schema and select the apply to folder option

select the folder where you want to apply the schema.

click on overwrite and you are done.

Now go to that folder and select any asset , click on properties , you will see the new custom metadata schema form with the custom fields that you defined.

so all existing and new files in that folder will follow the custom schema that you created and applied.

Here is the link for more information Metadata Schemas

1486882_pastedImage_1.png

1486888_pastedImage_4.png

1486886_pastedImage_2.png

HarishDv

13-05-2018

HI Hemant,

Thanks for your response.

I am actually looking to modify the schema of the Asset folders.

Something like adding another column (as shown on the screen shot)

Can you please provide the steps to be followed to do the same.

1486381_pastedImage_0.png

Thanks in advance.

Thanks

Harish

Hemant_arora

13-05-2018

I believe you are specifically looking for the keyword folder marked in bold in documentation . "folder metadata schema "

I validated the steps mentioned in the document https://forums.adobe.com/external-link.jspa?url=https%3A%2F%2Fhelpx.adobe.com%2Fexperience-manager%2... it works as expected in AEM 6.3.2.0

Correct me if I am wrong and you are not able to see the Metadata Schemas option at all

1486387_pastedImage_1.png

1486511_pastedImage_3.png