문제

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?

도움이 되었습니까?

해결책

  List<Choice> ch = value.getChoices();

    for (Choice Choice : ch) {
          System.out.println(choice.getDisplayName());
    }

다른 팁

You should cast the PropertyDefinition to the proper subclass. You can see how they do it in the Converter.java (see the source of the apache chemistry how they did it).

Regards, Magic

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top