cancel
Showing results for 
Search instead for 
Did you mean: 

Obtain a List with a constraint list allowed values

falcon
Champ in-the-making
Champ in-the-making
Hi,
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 Smiley Happy
11 REPLIES 11

janaka1984
Star Contributor
Star Contributor
hi all

how can i retrieve this LIST data using javascript

regards
janaka

gawadesk
Star Contributor
Star Contributor
we have below repository webscript available by using it we can list down all the constraint associated with particular property. You will have to provide appropriate class name and property name to get details.

/alfresco/s/api/classes/{classname}/property/{propname}

For example in bpmModel.xml we have LIST constraint for bpm:status property and get can get those constraint details as below (values in allowedValues array) :

http://127.0.0.1:8080/alfresco/s/api/classes/imwf_moderatedInvitationSubmitTask/property/bpm_status



   {
      "name" : "bpm:status",
      "title" : "Status",
      "description" : "Status",
      "defaultValues" : "",
      "dataType" : "d:text",
      "multiValued" : false,
      "mandatory" : true,
      "enforced" : false,
      "protected" : false,
      "indexed" : true,
      "indexedAtomically" : true,
      "constraints" :
      [
      {
         "type" : "LIST",
         "parameters" :
         [
            {
               "allowedValues" : ["Not Yet Started","In Progress","On Hold","Cancelled","Completed"]
            }
               ,
            {
               "sorted" : false
            }
               ,
            {
               "caseSensitive" : true
            }
               
         ]
      }
      ],
      "url" : "\/api\/property\/bpm_status"
   }



You can get complete class definition for all deployed types using below web script :

http://127.0.0.1:8080/alfresco/s/api/classes