cmisfilenet-p8apache-chemistry

choice list in filenet


I am learning CMIS and Filenet P8 . using library apache-chemistry for CMIS. I have problem in ChoiceList.

A choice List is associated with the PropertyDefination. I was trying to display the choice list related to each PropertyDefinition.

ItemIterable<ObjectType> v = session.getTypeChildren("cmis:document", true);
Iterator<ObjectType> i = v.iterator();

while(i.hasNext()){
             ObjectType a = i.next();
             if(a!=null)
             {   

                 Map<String, PropertyDefinition<?>> d = a.getPropertyDefinitions();

                 Iterator<String> itr = d.keySet().iterator();
                     while(itr.hasNext()){

                         String key = itr.next().toString();

                         if ((Boolean.FALSE.equals(d.get(key).isInherited()))) {


                            PropertyDefinition<?> value = d.get(key);
// Choice List
                            List<?> ch = value.getChoices();
                            System.out.println("value " + value.getDisplayName()+ " " + " choice list " + ch.toString());
                            for (Object object : ch) {
                                System.out.println(object.toString());
                            }

                            Customproperties properties = new Customproperties(value.getDisplayName(),value.getPropertyType().toString(),value.getCardinality().name(),value.isRequired());
                            customPropertyList1.add(properties);
                        }
                     }


            }
}

Output

value Document Title  choice list []
value From  choice list []
value To  choice list []
value Cc  choice list []
value Subject  choice list [[extensions=null], [extensions=null]]
[extensions=null]
[extensions=null]
value Sent On  choice list []
value Received On  choice list []
value Link IDs  choice list []

// For the propertyDefination Subject there is a choice list but it's showing me null.. I can't retrieve the choice List properly.

How can I solve this issue?


Solution

  •   List<Choice> ch = value.getChoices();
    
        for (Choice Choice : ch) {
              System.out.println(choice.getDisplayName());
        }