Package org.json.simple

Examples of org.json.simple.JSONArray


        result.put(REPINFO_CMIS_VERSION_SUPPORTED, repositoryInfo.getCmisVersionSupported());
        result.put(REPINFO_THIN_CLIENT_URI, repositoryInfo.getThinClientUri());
        result.put(REPINFO_CHANGES_INCOMPLETE, repositoryInfo.getChangesIncomplete());

        if (repositoryInfo.getChangesOnType() != null) {
            JSONArray changesOnType = new JSONArray();

            for (BaseTypeId type : repositoryInfo.getChangesOnType()) {
                changesOnType.add(getJSONStringValue(type));
            }

            result.put(REPINFO_CHANGES_ON_TYPE, changesOnType);
        }
View Full Code Here


                getJSONStringValue(capabilities.getSupportedPermissions().value()));
        result.put(JSON_ACLCAP_ACL_PROPAGATION, getJSONStringValue(capabilities.getAclPropagation().value()));

        // permissions
        if (capabilities.getPermissions() != null) {
            JSONArray permissions = new JSONArray();

            for (PermissionDefinition permDef : capabilities.getPermissions()) {
                JSONObject permission = new JSONObject();
                permission.put(JSON_ACLCAP_PERMISSION_PERMISSION, permDef.getId());
                permission.put(JSON_ACLCAP_PERMISSION_DESCRIPTION, permDef.getDescription());

                permissions.add(permission);
            }

            result.put(JSON_ACLCAP_PERMISSIONS, permissions);
        }

        // permission mapping

        if (capabilities.getPermissionMapping() != null) {
            JSONArray permissionMapping = new JSONArray();

            for (PermissionMapping permMap : capabilities.getPermissionMapping().values()) {
                JSONArray mappingPermissions = new JSONArray();
                if (permMap.getPermissions() != null) {
                    for (String p : permMap.getPermissions()) {
                        mappingPermissions.add(p);
                    }
                }

                JSONObject mapping = new JSONObject();
                mapping.put(JSON_ACLCAP_MAPPING_KEY, permMap.getKey());
View Full Code Here

            result.put(JSON_OBJECT_ALLOWABLE_ACTIONS, convert(object.getAllowableActions()));
        }

        // relationships
        if (object.getRelationships() != null) {
            JSONArray relationships = new JSONArray();

            for (ObjectData relationship : object.getRelationships()) {
                relationships.add(convert(relationship, typeCache));
            }

            result.put(JSON_OBJECT_RELATIONSHIPS, relationships);
        }

        // change event info
        if (object.getChangeEventInfo() != null) {
            JSONObject changeEventInfo = new JSONObject();

            ChangeEventInfo cei = object.getChangeEventInfo();
            changeEventInfo.put(JSON_CHANGE_EVENT_TYPE, getJSONStringValue(cei.getChangeType().value()));
            changeEventInfo.put(JSON_CHANGE_EVENT_TIME, getJSONValue(cei.getChangeTime()));

            result.put(JSON_OBJECT_CHANGE_EVENT_INFO, changeEventInfo);
        }

        // ACL
        if ((object.getAcl() != null) && (object.getAcl().getAces() != null)) {
            result.put(JSON_OBJECT_ACL, convert(object.getAcl()));
            result.put(JSON_OBJECT_EXACT_ACL, object.isExactAcl());
        }

        // policy ids
        if ((object.getPolicyIds() != null) && (object.getPolicyIds().getPolicyIds() != null)) {
            JSONArray policyIds = new JSONArray();

            for (String pi : object.getPolicyIds().getPolicyIds()) {
                policyIds.add(pi);
            }

            result.put(JSON_OBJECT_POLICY_IDS, policyIds);
        }

        // renditions
        if (object.getRenditions() != null) {
            JSONArray renditions = new JSONArray();

            for (RenditionData rendition : object.getRenditions()) {
                renditions.add(convert(rendition));
            }

            result.put(JSON_OBJECT_RENDITIONS, renditions);
        }
View Full Code Here

            if ((property.getValues() == null) || (property.getValues().size() == 0)) {
                result.put(JSON_PROPERTY_VALUE, null);
            } else if (propDef.getCardinality() == Cardinality.SINGLE) {
                result.put(JSON_PROPERTY_VALUE, getJSONValue(property.getValues().get(0)));
            } else {
                JSONArray values = new JSONArray();

                for (Object value : property.getValues()) {
                    values.add(getJSONValue(value));
                }

                result.put(JSON_PROPERTY_VALUE, values);
            }
        } else {
            result.put(JSON_PROPERTY_DATATYPE, getJSONPropertyDataType(property));

            if ((property.getValues() == null) || (property.getValues().size() == 0)) {
                result.put(JSON_PROPERTY_VALUE, null);
            } else if (property.getValues().size() == 1) {
                JSONArray values = new JSONArray();

                for (Object value : property.getValues()) {
                    values.add(getJSONValue(value));
                }

                result.put(JSON_PROPERTY_VALUE, values);
            }
        }
View Full Code Here

    public static JSONObject convert(Acl acl) {
        if ((acl == null) || (acl.getAces() == null)) {
            return null;
        }

        JSONArray aceObjects = new JSONArray();

        for (Ace ace : acl.getAces()) {
            JSONArray permissions = new JSONArray();
            if (ace.getPermissions() != null) {
                for (String p : ace.getPermissions()) {
                    permissions.add(p);
                }
            }

            JSONObject aceObject = new JSONObject();
            JSONObject principalObjecy = new JSONObject();
View Full Code Here

    @SuppressWarnings("unchecked")
    public static JSONObject convert(ObjectList list) {
        JSONObject result = new JSONObject();

        if (list != null) {
            JSONArray objects = new JSONArray();
            if (list.getObjects() != null) {
                for (ObjectData object : list.getObjects()) {
                    objects.add(convert(object, null));
                }
            }

            result.put(JSON_OBJECTLIST_OBJECTS, objects);
View Full Code Here

        }

        JSONObject result = new JSONObject();

        if (objectInFolderList.getObjects() != null) {
            JSONArray objects = new JSONArray();

            for (ObjectInFolderData object : objectInFolderList.getObjects()) {
                objects.add(convert(object, typeCache));
            }

            result.put(JSON_OBJECTINFOLDERLIST_OBJECTS, objects);
        }
View Full Code Here

        JSONObject result = new JSONObject();
        result.put(JSON_OBJECTINFOLDERCONTAINER_OBJECT, convert(container.getObject(), typeCache));

        if ((container.getChildren() != null) && (container.getChildren().size() > 0)) {
            JSONArray children = new JSONArray();
            for (ObjectInFolderContainer descendant : container.getChildren()) {
                children.add(JSONConverter.convert(descendant, typeCache));
            }

            result.put(JSON_OBJECTINFOLDERCONTAINER_CHILDREN, children);
        }
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));
            }

            result.put(JSON_TYPESLIST_TYPES, objects);
        }
View Full Code Here

        JSONObject result = new JSONObject();
        result.put(JSON_TYPESCONTAINER_TYPE, convert(container.getTypeDefinition()));

        if ((container.getChildren() != null) && (container.getChildren().size() > 0)) {
            JSONArray children = new JSONArray();
            for (TypeDefinitionContainer child : container.getChildren()) {
                children.add(JSONConverter.convert(child));
            }

            result.put(JSON_TYPESCONTAINER_CHILDREN, children);
        }
View Full Code Here

TOP

Related Classes of org.json.simple.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.