Print Property Definition

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

Print Property Definition

How to print this variable? How to work with this?

 PropertyDefinition propertyDefinition = someProperty;

5 Replies
Highlighted
Master

Re: Print Property Definition

I am not sure I understand what you mean by your question? For what would you want to "print" the variable? You simply interact with that via its APIs e.g. to retrieve the details of a property as defined in the content model / dictionary.

Highlighted
Member II

Re: Print Property Definition

I used this 

Map<QName, PropertyDefinition> prop = dictionaryService.getType(folder).getProperties();

And then print data with this

for (Entry<QName, PropertyDefinition> entry : prop.entrySet()) {
logger.debug(entry.getKey());
logger.debug(entry.getValue());

}

Problem is that entry.getValue() is type ProperyDefinition and I don't know how to work with this. 

 

entry.getValue().toString();

Return: 

Name: {http://www.alfresco.org/model/content/1.0}name
Title: Name
Description: null
Default Value: null
DataType Name: {http://www.alfresco.org/model/dictionary/1.0}text
ContainerClass Name: {http://www.alfresco.org/model/content/1.0}cmobject
isMultiValued: false
isMandatory: true
isMandatoryEnforced: true
isProtected: false
isIndexed: true
isStoredInIndex: false
isIndexedAtomically: true
indexTokenisation

Mode: BOTH

The question is: how to read data from dictionaryService(Is this way right?)?  And then how to work with returned values? 

Thanks.

Highlighted
Advanced II

Re: Print Property Definition

What do you want to read?

The property value from a specific object?

If that is the case, then what you need is nodeService instead of dictionaryService.

Highlighted
Member II

Re: Print Property Definition

Yes, but I want to create a form and some properties are only created when they are filled. So I want to read all properties from content model, because there are all properties that exist for some specific object.

Highlighted
Member II

Re: Print Property Definition

It's funny. This code is running. I misinterpreted results.