Wednesday, November 2, 2011

Resources not appearing in workbench

If you are putting resources in the LC repository through the SDK, you'll notice that they don't appear in workbench. You can confirm that they are truly there by going to the address http://server:port/repository, and then to actually get the resource to appear in workbench follow these steps:

1 import com.adobe.repository.infomodel.bean.ResourceProperty; 
    import java.util.Collection;

2. Use: Resource newResource = (Resource) infomodelFactory.newResource (not Resource newResource = (Resource) infomodelFactory.newImage(...) )

3. Add the following lines of code:
ResourceProperty rProperty=new ResourceProperty();
rProperty.setNamespace("System");
rProperty.setName("PRIMARY");
rProperty.setValue(“true”);
Collection rProperties=newResource.getResourceProperties();
rProperties.add(rProperty);