Package org.apache.chemistry.opencmis.commons.impl.json

Examples of org.apache.chemistry.opencmis.commons.impl.json.JSONArray


                if (!propertyDefinition.getDefaultValue().isEmpty()) {
                    result.put(JSON_PROPERTY_TYPE_DEAULT_VALUE,
                            getJSONValue(propertyDefinition.getDefaultValue().get(0), dateTimeFormat));
                }
            } else {
                JSONArray values = new JSONArray();
                for (Object value : propertyDefinition.getDefaultValue()) {
                    values.add(getJSONValue(value, dateTimeFormat));
                }
                result.put(JSON_PROPERTY_TYPE_DEAULT_VALUE, values);
            }
        }
View Full Code Here


        if (choices == null) {
            return null;
        }

        JSONArray result = new JSONArray();

        for (Choice<?> choice : choices) {
            JSONObject jsonChoice = new JSONObject();

            jsonChoice.put(JSON_PROPERTY_TYPE_CHOICE_DISPLAYNAME, choice.getDisplayName());

            if (cardinality == Cardinality.SINGLE) {
                if (!choice.getValue().isEmpty()) {
                    jsonChoice.put(JSON_PROPERTY_TYPE_CHOICE_VALUE,
                            getJSONValue(choice.getValue().get(0), dateTimeFormat));
                }
            } else {
                JSONArray values = new JSONArray();
                for (Object value : choice.getValue()) {
                    values.add(getJSONValue(value, dateTimeFormat));
                }
                jsonChoice.put(JSON_PROPERTY_TYPE_CHOICE_VALUE, values);
            }

            if (isNotEmpty(choice.getChoice())) {
View Full Code Here

        }

        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);
        }
View Full Code Here

        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);
        }
View Full Code Here

            return null;
        }

        JSONObject result = new JSONObject();

        JSONArray ids = new JSONArray();
        if (ftd.getIds() != null) {
            for (String id : ftd.getIds()) {
                ids.add(id);
            }
        }

        result.put(JSON_FAILEDTODELETE_ID, ids);
View Full Code Here

        if (!target.containsKey(ext.getName())) {
            target.put(ext.getName(), value);
        } else {
            Object extValue = target.get(ext.getName());

            JSONArray array;
            if (extValue instanceof JSONArray) {
                array = (JSONArray) extValue;
            } else {
                array = new JSONArray();
                array.add(extValue);
            }

            array.add(value);

            target.put(ext.getName(), array);
        }
    }
View Full Code Here

    public static JSONArray getJSONArrayFromList(final List<?> list) {
        if (list == null) {
            return null;
        }

        JSONArray result = new JSONArray();
        result.addAll(list);

        return result;
    }
View Full Code Here

        if (versions == null) {
            throw new CmisRuntimeException("Versions are null!");
        }

        TypeCache typeCache = new ServerTypeCacheImpl(repositoryId, service);
        JSONArray jsonVersions = new JSONArray();
        for (ObjectData version : versions) {
            jsonVersions.add(JSONConverter.convert(version, typeCache, false, succinct));
        }

        response.setStatus(HttpServletResponse.SC_OK);
        writeJSON(jsonVersions, request, response);
    }
View Full Code Here

        if (typeTree == null) {
            throw new CmisRuntimeException("Type tree is null!");
        }

        JSONArray jsonTypeTree = new JSONArray();
        for (TypeDefinitionContainer container : typeTree) {
            jsonTypeTree.add(JSONConverter.convert(container));
        }

        response.setStatus(HttpServletResponse.SC_OK);
        BrowserBindingUtils.writeJSON(jsonTypeTree, request, response);
    }
View Full Code Here

        // execute
        List<BulkUpdateObjectIdAndChangeToken> result = service.bulkUpdateProperties(repositoryId,
                objectIdAndChangeToken, properties, addSecondaryTypes, removeSecondaryTypes, null);

        // return result
        JSONArray jsonList = new JSONArray();
        if (result != null) {
            for (BulkUpdateObjectIdAndChangeToken oc : result) {
                if (oc != null) {
                    jsonList.add(JSONConverter.convert(oc));
                }
            }
        }

        response.setStatus(HttpServletResponse.SC_OK);
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.commons.impl.json.JSONArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.