Obtain a List with a constraint list allowed values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2009 03:41 AM
I have defined a custom type metadata, like this:
<constraints> <constraint name="my:constraintList" type="LIST"> <parameter name="allowedValues"> <list> <value>OPTION 1</value> <value>OPTION 2</value> <value>OPTION 3</value> </list> </parameter> <parameter name="caseSensitive"> <value>false</value> </parameter> </constraint></constraints><types><type name="my:typeTest"> <title>TEST TYPE</title> <parent>cm:content</parent> <properties> <property name="my:propertyTest"> <title>TEST PROPERTY</title> <type>d:text</type> <mandatory>false</mandatory> <constraints> <constraint ref="my:constraintList" /> </constraints> </property> </properties></type></types>
How can I have a List in Java or Javascritp of the allowed values of my constraint to send it by a webscript?
Thanks for help

- Labels:
-
Archive

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2009 04:31 AM
/** * Method returns a list of constraint values for the given property. * * @param dictionaryService * - might be null, in this case the default dictionaryService * (send by this.getDictionaryService()) will be used * @param qname * - property * @return */ public static ListOfValuesConstraint getListOfValuesConstraint( DictionaryService dictionaryService, QName qname) { ListOfValuesConstraint lovConstraint = null; PropertyDefinition propertyDef = null; // get the property definition for the item if (dictionaryService == null) { propertyDef = getDictionaryService().getProperty(qname); } else { propertyDef = dictionaryService.getProperty(qname); } if (propertyDef != null) { // go through the constaints and see if it has the // list of values constraint List<ConstraintDefinition> constraints = propertyDef .getConstraints(); for (ConstraintDefinition constraintDef : constraints) { Constraint constraint = constraintDef.getConstraint(); if (constraint instanceof ListOfValuesConstraint) { lovConstraint = (ListOfValuesConstraint) constraint; break; } } } return lovConstraint; }
call it with :
getListOfValuesConstraint(dictionaryService, QName.createQName(
"yourURI",
"propertyTest");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2009 02:22 AM
I dont understand where I can find DictionaryService.
Can you give me an example please?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2009 12:08 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2009 12:11 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2009 04:50 AM
Thanks for reply


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2009 04:56 AM
good luck

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2009 09:40 AM
i.e is there a <label> tag you can use or something ?
<value label="id-aaa">aaaa</value>
/Mikael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2010 05:11 AM
propertyDef.getConstraints();
I don't have a getContraints member in PropertyDefinition class. I use the remote WebService API from Alfresco 3.2.What am I doing wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2010 01:53 PM
Can someone help please ?
tnx
