private Map<String, Object> createObjectContainer(ContainerFactory containerFactory) { if (containerFactory == null) { return new JSONObject(); } Map<String, Object> m = containerFactory.createObjectContainer(); if (m == null) { return new JSONObject(); } return m; }
private Map<String, Object> createObjectContainer(ContainerFactory containerFactory) { if (containerFactory == null) { return new JSONObject(); } Map<String, Object> m = containerFactory.createObjectContainer(); if (m == null) { return new JSONObject(); } return m; }
private static JSONObject convertExtensionList(final List<CmisExtensionElement> extensionList) { if (extensionList == null) { return null; } JSONObject result = new JSONObject(); for (CmisExtensionElement ext : extensionList) { addExtensionToTarget(ext, result); } return result; }
private static JSONObject convertExtensionList(final List<CmisExtensionElement> extensionList) { if (extensionList == null) { return null; } JSONObject result = new JSONObject(); for (CmisExtensionElement ext : extensionList) { addExtensionToTarget(ext, result); } return result; }
/** * Converts allowable actions. */ public static JSONObject convert(final AllowableActions allowableActions) { if (allowableActions == null) { return null; } JSONObject result = new JSONObject(); Set<Action> actionSet = allowableActions.getAllowableActions(); for (Action action : Action.values()) { result.put(action.value(), actionSet.contains(action)); } convertExtension(allowableActions, result); return result; }
/** * Converts allowable actions. */ public static JSONObject convert(final AllowableActions allowableActions) { if (allowableActions == null) { return null; } JSONObject result = new JSONObject(); Set<Action> actionSet = allowableActions.getAllowableActions(); for (Action action : Action.values()) { result.put(action.value(), actionSet.contains(action)); } convertExtension(allowableActions, result); return result; }
public String createCookieValue(int code, String objectId, String ex, String message) { JSONObject result = new JSONObject(); result.put("code", code); result.put("objectId", objectId == null ? "" : objectId); result.put("exception", ex == null ? "" : ex); result.put("message", message == null ? "" : message); return result.toJSONString(); }
/** * Handles logouts. */ protected void logout(final ServletContext servletContext, final HttpServletRequest request, final HttpServletResponse response) throws IOException { String appId = SimpleTokenHandlerSessionHelper.getApplicationIdFromKey(SimpleTokenHandlerSessionHelper .getKey(request)); if (appId != null) { SimpleTokenHandlerSessionHelper.removeApplicationKey(request, appId); } JSONObject result = new JSONObject(); result.put("ok", 1); printJSON(response, result); }
/** * Converts bulk update data. */ public static JSONObject convert(BulkUpdateObjectIdAndChangeToken oc) { if (oc == null) { return null; } JSONObject result = new JSONObject(); setIfNotNull(JSON_BULK_UPDATE_ID, oc.getId(), result); setIfNotNull(JSON_BULK_UPDATE_NEW_ID, oc.getNewId(), result); setIfNotNull(JSON_BULK_UPDATE_CHANGE_TOKEN, oc.getChangeToken(), result); convertExtension(oc, result); return result; }
/** * Converts bulk update data. */ public static JSONObject convert(BulkUpdateObjectIdAndChangeToken oc) { if (oc == null) { return null; } JSONObject result = new JSONObject(); setIfNotNull(JSON_BULK_UPDATE_ID, oc.getId(), result); setIfNotNull(JSON_BULK_UPDATE_NEW_ID, oc.getNewId(), result); setIfNotNull(JSON_BULK_UPDATE_CHANGE_TOKEN, oc.getChangeToken(), result); convertExtension(oc, result); return result; }
/** * Converts an object in a folder list. */ public static JSONObject convert(final ObjectInFolderData objectInFolder, final TypeCache typeCache, final boolean succinct, final DateTimeFormat dateTimeFormat) { if ((objectInFolder == null) || (objectInFolder.getObject() == null)) { return null; } JSONObject result = new JSONObject(); result.put(JSON_OBJECTINFOLDER_OBJECT, convert(objectInFolder.getObject(), typeCache, PropertyMode.OBJECT, succinct, dateTimeFormat)); setIfNotNull(JSON_OBJECTINFOLDER_PATH_SEGMENT, objectInFolder.getPathSegment(), result); convertExtension(objectInFolder, result); return result; }
/** * Converts an object in a folder list. */ public static JSONObject convert(final ObjectInFolderData objectInFolder, final TypeCache typeCache, final boolean succinct, final DateTimeFormat dateTimeFormat) { if ((objectInFolder == null) || (objectInFolder.getObject() == null)) { return null; } JSONObject result = new JSONObject(); result.put(JSON_OBJECTINFOLDER_OBJECT, convert(objectInFolder.getObject(), typeCache, PropertyMode.OBJECT, succinct, dateTimeFormat)); setIfNotNull(JSON_OBJECTINFOLDER_PATH_SEGMENT, objectInFolder.getPathSegment(), result); convertExtension(objectInFolder, result); return result; }
private void printGroupResults(CmisTestGroup group, JSONArray jsonGroups) throws IOException { if (!group.isEnabled()) { return; } JSONObject jsonGroup = new JSONObject(); jsonGroups.add(jsonGroup); jsonGroup.put("name", group.getName()); if (group.getTests() != null && !group.getTests().isEmpty()) { JSONArray jsonTests = new JSONArray(); jsonGroup.put("tests", jsonTests); for (CmisTest test : group.getTests()) { printTestResults(test, jsonTests); } } }
/** * Converts an object parent. */ public static JSONObject convert(final ObjectParentData parent, final TypeCache typeCache, final boolean succinct, final DateTimeFormat dateTimeFormat) { if ((parent == null) || (parent.getObject() == null)) { return null; } JSONObject result = new JSONObject(); result.put(JSON_OBJECTPARENTS_OBJECT, convert(parent.getObject(), typeCache, PropertyMode.OBJECT, succinct, dateTimeFormat)); if (parent.getRelativePathSegment() != null) { result.put(JSON_OBJECTPARENTS_RELATIVE_PATH_SEGMENT, parent.getRelativePathSegment()); } convertExtension(parent, result); return result; }
private static JSONObject convert(final ExtensionFeature feature) { if (feature == null) { return null; } JSONObject jsonFeature = new JSONObject(); setIfNotNull(JSON_FEATURE_ID, feature.getId(), jsonFeature); setIfNotNull(JSON_FEATURE_URL, feature.getUrl(), jsonFeature); setIfNotNull(JSON_FEATURE_COMMON_NAME, feature.getCommonName(), jsonFeature); setIfNotNull(JSON_FEATURE_VERSION_LABEL, feature.getVersionLabel(), jsonFeature); setIfNotNull(JSON_FEATURE_DESCRIPTION, feature.getDescription(), jsonFeature); if (isNotEmpty(feature.getFeatureData())) { JSONObject data = new JSONObject(); data.putAll(feature.getFeatureData()); jsonFeature.put(JSON_FEATURE_DATA, data); } convertExtension(feature, jsonFeature); return jsonFeature; }
private static JSONObject convert(final ExtensionFeature feature) { if (feature == null) { return null; } JSONObject jsonFeature = new JSONObject(); setIfNotNull(JSON_FEATURE_ID, feature.getId(), jsonFeature); setIfNotNull(JSON_FEATURE_URL, feature.getUrl(), jsonFeature); setIfNotNull(JSON_FEATURE_COMMON_NAME, feature.getCommonName(), jsonFeature); setIfNotNull(JSON_FEATURE_VERSION_LABEL, feature.getVersionLabel(), jsonFeature); setIfNotNull(JSON_FEATURE_DESCRIPTION, feature.getDescription(), jsonFeature); if (isNotEmpty(feature.getFeatureData())) { JSONObject data = new JSONObject(); data.putAll(feature.getFeatureData()); jsonFeature.put(JSON_FEATURE_DATA, data); } convertExtension(feature, jsonFeature); return jsonFeature; }
private void printTestResults(CmisTest test, JSONArray jsonTests) throws IOException { if (!test.isEnabled()) { return; } JSONObject jsonTest = new JSONObject(); jsonTests.add(jsonTest); jsonTest.put("name", test.getName()); jsonTest.put("time", test.getTime()); if (test.getResults() != null && !test.getResults().isEmpty()) { JSONArray jsonResults = new JSONArray(); jsonTest.put("results", jsonResults); for (CmisTestResult result : test.getResults()) { printResult(result, jsonResults); } } }
/** * Converts a type definition list. */ public static JSONObject convert(final TypeDefinitionList list, final DateTimeFormat dateTimeFormat) { if (list == null) { return null; } JSONObject result = new JSONObject(); if (list.getList() != null) { JSONArray objects = new JSONArray(); for (TypeDefinition type : list.getList()) { objects.add(convert(type, dateTimeFormat)); } result.put(JSON_TYPESLIST_TYPES, objects); } setIfNotNull(JSON_TYPESLIST_HAS_MORE_ITEMS, list.hasMoreItems(), result); setIfNotNull(JSON_TYPESLIST_NUM_ITEMS, list.getNumItems(), result); convertExtension(list, result); return result; }
/** * Converts a type definition list. */ public static JSONObject convert(final TypeDefinitionList list, final DateTimeFormat dateTimeFormat) { if (list == null) { return null; } JSONObject result = new JSONObject(); if (list.getList() != null) { JSONArray objects = new JSONArray(); for (TypeDefinition type : list.getList()) { objects.add(convert(type, dateTimeFormat)); } result.put(JSON_TYPESLIST_TYPES, objects); } setIfNotNull(JSON_TYPESLIST_HAS_MORE_ITEMS, list.hasMoreItems(), result); setIfNotNull(JSON_TYPESLIST_NUM_ITEMS, list.getNumItems(), result); convertExtension(list, result); return result; }
/** * Converts a type definition container. */ public static JSONObject convert(final TypeDefinitionContainer container, final DateTimeFormat dateTimeFormat) { if (container == null) { return null; } JSONObject result = new JSONObject(); result.put(JSON_TYPESCONTAINER_TYPE, convert(container.getTypeDefinition(), dateTimeFormat)); if (isNotEmpty(container.getChildren())) { JSONArray children = new JSONArray(); for (TypeDefinitionContainer child : container.getChildren()) { children.add(convert(child, dateTimeFormat)); } result.put(JSON_TYPESCONTAINER_CHILDREN, children); } convertExtension(container, result); return result; }