/** * Converts choices. */ @SuppressWarnings({ "rawtypes" }) private static List<Choice<GregorianCalendar>> convertChoicesDateTime(final Object choices) { if (!(choices instanceof List)) { return null; } List<Choice<GregorianCalendar>> result = new ArrayList<Choice<GregorianCalendar>>(); for (Object obj : (List) choices) { Map<String, Object> choiceMap = getMap(obj); if (choiceMap != null) { ChoiceImpl<GregorianCalendar> choice = new ChoiceImpl<GregorianCalendar>(); choice.setDisplayName(getString(choiceMap, JSON_PROPERTY_TYPE_CHOICE_DISPLAYNAME)); Object choiceValue = choiceMap.get(JSON_PROPERTY_TYPE_CHOICE_VALUE); List<GregorianCalendar> values = new ArrayList<GregorianCalendar>(); if (choiceValue instanceof List) { for (Object value : (List) choiceValue) { values.add((GregorianCalendar) getCMISValue(value, PropertyType.DATETIME)); } } else { values.add((GregorianCalendar) getCMISValue(choiceValue, PropertyType.DATETIME)); } choice.setValue(values); choice.setChoice(convertChoicesDateTime(choiceMap.get(JSON_PROPERTY_TYPE_CHOICE_CHOICE))); result.add(choice); } } return result; }
/** * Converts choices. */ @SuppressWarnings({ "rawtypes" }) private static List<Choice<GregorianCalendar>> convertChoicesDateTime(final Object choices) { if (!(choices instanceof List)) { return null; } List<Choice<GregorianCalendar>> result = new ArrayList<Choice<GregorianCalendar>>(); for (Object obj : (List) choices) { Map<String, Object> choiceMap = getMap(obj); if (choiceMap != null) { ChoiceImpl<GregorianCalendar> choice = new ChoiceImpl<GregorianCalendar>(); choice.setDisplayName(getString(choiceMap, JSON_PROPERTY_TYPE_CHOICE_DISPLAYNAME)); Object choiceValue = choiceMap.get(JSON_PROPERTY_TYPE_CHOICE_VALUE); List<GregorianCalendar> values = new ArrayList<GregorianCalendar>(); if (choiceValue instanceof List) { for (Object value : (List) choiceValue) { values.add((GregorianCalendar) getCMISValue(value, PropertyType.DATETIME)); } } else { values.add((GregorianCalendar) getCMISValue(choiceValue, PropertyType.DATETIME)); } choice.setValue(values); choice.setChoice(convertChoicesDateTime(choiceMap.get(JSON_PROPERTY_TYPE_CHOICE_CHOICE))); result.add(choice); } } return result; }
.setDateTimeResolution(getEnum(json, JSON_PROPERTY_TYPE_RESOLUTION, DateTimeResolution.class)); ((PropertyDateTimeDefinitionImpl) result) .setChoices(convertChoicesDateTime(json.get(JSON_PROPERTY_TYPE_CHOICE))); break; case DECIMAL:
.setDateTimeResolution(getEnum(json, JSON_PROPERTY_TYPE_RESOLUTION, DateTimeResolution.class)); ((PropertyDateTimeDefinitionImpl) result) .setChoices(convertChoicesDateTime(json.get(JSON_PROPERTY_TYPE_CHOICE))); break; case DECIMAL: