07-09-2009 03:41 AM
<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>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;
    }
07-13-2009 02:22 AM
07-13-2009 12:08 PM
07-13-2009 12:11 PM
07-14-2009 04:50 AM
07-15-2009 04:56 AM
08-30-2009 09:40 AM
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.12-13-2010 01:53 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.