AnsweredAssumed Answered

Questions on getTypeDefinition()

Question asked by rexmao on Apr 7, 2010
Hi, my friends:


In getTypeDefinition method, I firstly got all property definitions in typeDefinition.items. For one of the properties, "QZH", I have a value list definition in the content model xml. I expect I can get the values list from property.choices. But I got a nulll value.

Can anyone give some help?

Thanks
Rex

Here's the model def xml:

<constraints>
<constraint name="cpcc_D:testlist" type="LIST">
      <parameter name="allowedValues">
        <list>
          <value>notallowed</value>
          <value>allowed</value>
          <value>required</value>
        </list>
      </parameter>
    </constraint>

</constraints>
<type name="cpcc_D:amsdocument">
    <title>test_doc</title>
    <parent>cm:content</parent>
    <properties>
        <property name="cpcc_D:QZH">
            <title>test</title>
            <type>d:text</type>
            <mandatory>true</mandatory>
            <default>001</default>
            <constraints>
                <constraint ref="cpcc_D:testlist" />
            </constraints>
        </property>
        <property name="cpcc_D:FLH">
            <type>d:text</type>
            <mandatory>true</mandatory>
            <default>001</default>
        </property>
</properties>
</type>
Here's the code:

cmisTypeDefinitionType typeDefinition = repositoryS.getTypeDefinition(repositoryId, "D:cpcc_D:amsdocument", new RepositoryService.cmisExtensionType());

cmisPropertyDefinitionType[] defs = typeDefinition.Items;

foreach (cmisPropertyDefinitionType def in defs) {

                Console.WriteLine("name:" + def.displayName);              
                Console.WriteLine("required:" + def.required);

                if(def.localName.Equals("QZH")){
           
                cmisPropertyStringDefinitionType cc = (cmisPropertyStringDefinitionType)def;
                   
                Console.WriteLine("***" + cc.choice[0].value);
                   
               
                }
               
}

Outcomes