Question

The only way I know is to iterate through property templates of object store and find the one I need by comparing symbolic name with some String:

String propertySymName = "someName";
ObjectStore os = Factory.ObjectStore.fetchInstance(...); //assume object store is fetched correctly

String[] properties = {PropertyNames.PROPERTY_TEMPLATES};
os.fetchProperties(properties);
PropertyTemplateSet propertyTemplates = os.get_PropertyTemplates();
Iterator<?> iterator = propertyTemplates.iterator();
while (iterator.hasNext()) {
    PropertyTemplate propertyTemplate = (PropertyTemplate) iterator.next();
    String[] arg = {PropertyNames.SYMBOLIC_NAME};
    propertyTemplate.refresh(arg);
    if (propertyTemplate.get_SymbolicName().equals(propertySymName)) {
       //do some stuff
    }

}

But if object store has a plenty of property templates, it could be rather slow. Any ideas? I'm using CE API 5.1

Was it helpful?

Solution

You can search for it by symbolic name:

SELECT This FROM PropertyTemplate WHERE (SymbolicName = 'DocumentTitle')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top