public static RepositoryCapabilities convertRepositoryCapabilities(final Map<String, Object> json) {
if (json == null) {
return null;
}
RepositoryCapabilitiesImpl result = new RepositoryCapabilitiesImpl();
result.setCapabilityContentStreamUpdates(getEnum(json, JSON_CAP_CONTENT_STREAM_UPDATABILITY,
CapabilityContentStreamUpdates.class));
result.setCapabilityChanges(getEnum(json, JSON_CAP_CHANGES, CapabilityChanges.class));
result.setCapabilityRendition(getEnum(json, JSON_CAP_RENDITIONS, CapabilityRenditions.class));
result.setSupportsGetDescendants(getBoolean(json, JSON_CAP_GET_DESCENDANTS));
result.setSupportsGetFolderTree(getBoolean(json, JSON_CAP_GET_FOLDER_TREE));
result.setSupportsMultifiling(getBoolean(json, JSON_CAP_MULTIFILING));
result.setSupportsUnfiling(getBoolean(json, JSON_CAP_UNFILING));
result.setSupportsVersionSpecificFiling(getBoolean(json, JSON_CAP_VERSION_SPECIFIC_FILING));
result.setIsPwcSearchable(getBoolean(json, JSON_CAP_PWC_SEARCHABLE));
result.setIsPwcUpdatable(getBoolean(json, JSON_CAP_PWC_UPDATABLE));
result.setAllVersionsSearchable(getBoolean(json, JSON_CAP_ALL_VERSIONS_SEARCHABLE));
result.setCapabilityOrderBy(getEnum(json, JSON_CAP_ORDER_BY, CapabilityOrderBy.class));
result.setCapabilityQuery(getEnum(json, JSON_CAP_QUERY, CapabilityQuery.class));
result.setCapabilityJoin(getEnum(json, JSON_CAP_JOIN, CapabilityJoin.class));
result.setCapabilityAcl(getEnum(json, JSON_CAP_ACL, CapabilityAcl.class));
Map<String, Object> creatablePropertyTypesJson = getMap(json.get(JSON_CAP_CREATABLE_PROPERTY_TYPES));
if (creatablePropertyTypesJson != null) {
CreatablePropertyTypesImpl creatablePropertyTypes = new CreatablePropertyTypesImpl();
List<Object> canCreateJson = getList(creatablePropertyTypesJson
.get(JSON_CAP_CREATABLE_PROPERTY_TYPES_CANCREATE));
if (canCreateJson != null) {
Set<PropertyType> canCreate = EnumSet.noneOf(PropertyType.class);
for (Object o : canCreateJson) {
try {
if (o != null) {
canCreate.add(PropertyType.fromValue(o.toString()));
}
} catch (Exception e) {
// ignore
}
}
creatablePropertyTypes.setCanCreate(canCreate);
}
convertExtension(creatablePropertyTypesJson, creatablePropertyTypes, CAP_CREATABLE_PROPERTY_TYPES_KEYS);
result.setCreatablePropertyTypes(creatablePropertyTypes);
}
Map<String, Object> newTypeSettableAttributesJson = getMap(json.get(JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES));
if (newTypeSettableAttributesJson != null) {
NewTypeSettableAttributesImpl newTypeSettableAttributes = new NewTypeSettableAttributesImpl();
newTypeSettableAttributes.setCanSetId(getBoolean(newTypeSettableAttributesJson,
JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_ID));
newTypeSettableAttributes.setCanSetLocalName(getBoolean(newTypeSettableAttributesJson,
JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_LOCALNAME));
newTypeSettableAttributes.setCanSetLocalNamespace(getBoolean(newTypeSettableAttributesJson,
JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_LOCALNAMESPACE));
newTypeSettableAttributes.setCanSetDisplayName(getBoolean(newTypeSettableAttributesJson,
JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_DISPLAYNAME));
newTypeSettableAttributes.setCanSetQueryName(getBoolean(newTypeSettableAttributesJson,
JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_QUERYNAME));
newTypeSettableAttributes.setCanSetDescription(getBoolean(newTypeSettableAttributesJson,
JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_DESCRIPTION));
newTypeSettableAttributes.setCanSetCreatable(getBoolean(newTypeSettableAttributesJson,
JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_CREATEABLE));
newTypeSettableAttributes.setCanSetFileable(getBoolean(newTypeSettableAttributesJson,
JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_FILEABLE));
newTypeSettableAttributes.setCanSetQueryable(getBoolean(newTypeSettableAttributesJson,
JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_QUERYABLE));
newTypeSettableAttributes.setCanSetFulltextIndexed(getBoolean(newTypeSettableAttributesJson,
JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_FULLTEXTINDEXED));
newTypeSettableAttributes.setCanSetIncludedInSupertypeQuery(getBoolean(newTypeSettableAttributesJson,
JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_INCLUDEDINSUPERTYTPEQUERY));
newTypeSettableAttributes.setCanSetControllablePolicy(getBoolean(newTypeSettableAttributesJson,
JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_CONTROLABLEPOLICY));
newTypeSettableAttributes.setCanSetControllableAcl(getBoolean(newTypeSettableAttributesJson,
JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_CONTROLABLEACL));
convertExtension(newTypeSettableAttributesJson, newTypeSettableAttributes,
CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_KEYS);
result.setNewTypeSettableAttributes(newTypeSettableAttributes);
}
// handle extensions
convertExtension(json, result, CAP_KEYS);