Package org.apache.chemistry.opencmis.commons.definitions

Examples of org.apache.chemistry.opencmis.commons.definitions.TypeDefinition


        if (entry.getId() == null) {
            throw new CmisConnectionException("Received Atom entry is not a CMIS entry!");
        }

        lockTypeLinks();
        TypeDefinition result = null;
        try {
            // clean up cache
            removeTypeLinks(repositoryId, entry.getId());

            // walk through the entry
View Full Code Here


            HttpServletRequest request, HttpServletResponse response) throws Exception {
        // get parameters
        String typeId = getStringParameter(request, Constants.PARAM_TYPE_ID);

        // execute
        TypeDefinition type = service.getTypeDefinition(repositoryId, typeId, null);
        JSONObject jsonType = JSONConverter.convert(type);

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

    public void run(Session session) {
        CmisTestResult failure;

        // document
        try {
            TypeDefinition documentType = session.getTypeDefinition(BaseTypeId.CMIS_DOCUMENT.value());
            addResult(checkTypeDefinition(session, documentType, "Document type spec compliance."));

            failure = createResult(FAILURE, "Document type has the wrong base type: " + documentType.getBaseTypeId());
            addResult(assertEquals(BaseTypeId.CMIS_DOCUMENT, documentType.getBaseTypeId(), null, failure));
        } catch (CmisObjectNotFoundException e) {
            addResult(createResult(FAILURE, "Document type not available!", e, false));
        }

        // folder
        try {
            TypeDefinition folderType = session.getTypeDefinition(BaseTypeId.CMIS_FOLDER.value());

            addResult(checkTypeDefinition(session, folderType, "Folder type spec compliance."));

            failure = createResult(FAILURE, "Folder type has the wrong base type: " + folderType.getBaseTypeId());
            addResult(assertEquals(BaseTypeId.CMIS_FOLDER, folderType.getBaseTypeId(), null, failure));
        } catch (CmisObjectNotFoundException e) {
            addResult(createResult(FAILURE, "Folder type not available!", e, false));
        }

        // relationship
        try {
            TypeDefinition relationshipType = session.getTypeDefinition(BaseTypeId.CMIS_RELATIONSHIP.value());
            addResult(checkTypeDefinition(session, relationshipType, "Relationship type spec compliance."));

            failure = createResult(FAILURE,
                    "Relationship type has the wrong base type: " + relationshipType.getBaseTypeId());
            addResult(assertEquals(BaseTypeId.CMIS_RELATIONSHIP, relationshipType.getBaseTypeId(), null, failure));
        } catch (CmisObjectNotFoundException e) {
            addResult(createResult(WARNING, "Relationship type not available!", e, false));
        }

        // policy
        try {
            TypeDefinition policyType = session.getTypeDefinition(BaseTypeId.CMIS_POLICY.value());
            addResult(checkTypeDefinition(session, policyType, "Policy type spec compliance."));

            failure = createResult(FAILURE, "Policy type has the wrong base type: " + policyType.getBaseTypeId());
            addResult(assertEquals(BaseTypeId.CMIS_POLICY, policyType.getBaseTypeId(), null, failure));
        } catch (CmisObjectNotFoundException e) {
            addResult(createResult(WARNING, "Policy type not available!", e, false));
        }

        int numOfTypes = runTypeChecks(session, session.getTypeDescendants(null, -1, true));
View Full Code Here

                // clear the cache to ensure that the type definition is
                // reloaded from the repository
                session.clear();

                try {
                    TypeDefinition reloadedType = session.getTypeDefinition(tree.getItem().getId());

                    addResult(checkTypeDefinition(session, reloadedType, "Type spec compliance: "
                            + (reloadedType == null ? "?" : reloadedType.getId())));

                    failure = createResult(FAILURE,
                            "Type fetched via getTypeDescendants() is does not macth type fetched via getTypeDefinition(): "
                                    + tree.getItem().getId());
                    addResult(assertEquals(tree.getItem(), reloadedType, null, failure));
View Full Code Here

        Map<String, Object> properties = new HashMap<String, Object>();
        properties.put(PropertyIds.NAME, name);
        properties.put(PropertyIds.OBJECT_TYPE_ID, objectTypeId);

        TypeDefinition type = session.getTypeDefinition(objectTypeId);
        if (!(type instanceof DocumentTypeDefinition)) {
            addResult(createResult(FAILURE, "Type is not a document type! Type: " + objectTypeId, true));
            return null;
        }
View Full Code Here

            HttpServletRequest request, HttpServletResponse response) throws Exception {
        // get parameters
        String typeId = getStringParameter(request, Constants.PARAM_TYPE_ID);

        // execute
        TypeDefinition type = service.getTypeDefinition(repositoryId, typeId, null);
        JSONObject jsonType = JSONConverter.convert(type);

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

    public void testTypeDefinition() {
        log.info("");
        log.info("starting testTypeDefinition() ...");
        String repositoryId = getRepositoryId();
        String typeId = "MyDocType1";
        TypeDefinition ref = UnitTestTypeSystemCreator.getTypeById(typeId);
        TypeDefinition type = fRepSvc.getTypeDefinition(repositoryId, typeId, null);
        assertEquals(ref.getId(), type.getId());
        assertEquals(ref.getDescription(), type.getDescription());
        assertEquals(ref.getDisplayName(), type.getDisplayName());
        assertEquals(ref.getLocalName(), type.getLocalName());
        assertEquals(ref.getLocalNamespace(), type.getLocalNamespace());
        containsAllBasePropertyDefinitions(type);
        log.info("... testTypeDefinition() finished.");
    }
View Full Code Here

        String user = context.getUsername();
        if (null == folderId) {
            List<StoredObject> checkedOuts = fStoreManager.getObjectStore(repositoryId).getCheckedOutDocuments(
                    orderBy, context.getUsername(), includeRelationships);
            for (StoredObject checkedOut : checkedOuts) {
                TypeDefinition td = fStoreManager.getTypeById(repositoryId, checkedOut.getTypeId()).getTypeDefinition();
//                DocumentVersion workingCopy = ((VersionedDocument) checkedOut).getPwc();
//                if (null == workingCopy)
//                  throw new CmisConstraintException("document " + checkedOut + " is checked out but has no working copy");      
                ObjectData od = PropertyCreationHelper.getObjectData(td, checkedOut, filter, user,
                        includeAllowableActions, includeRelationships, renditionFilter, false, false, extension);
View Full Code Here

            ObjectInFolderDataImpl oifd = new ObjectInFolderDataImpl();
            if (includePathSegments != null && includePathSegments) {
                oifd.setPathSegment(spo.getName());
            }

            TypeDefinition typeDef = fStoreManager.getTypeById(repositoryId, spo.getTypeId()).getTypeDefinition();
            ObjectData objectData = PropertyCreationHelper.getObjectData(typeDef, spo, filter, user, includeAllowableActions,
                    includeRelationships, renditionFilter, false, false, null);

            oifd.setObject(objectData);
            folderList.add(oifd);
View Full Code Here

        assertEquals(expectedSize, totalSize);
        assertEquals(2, types.size());

        for (TypeDefinitionContainer type : types) {
            assertNotNull(type);
            TypeDefinition typeDef = type.getTypeDefinition();
            assertNotNull(typeDef);
            assertNotNull(typeDef.getId());
            assertNotNull(typeDef.getBaseTypeId());
            log.info("Found type: " + typeDef.getId() + ", display name is: " + typeDef.getDisplayName());
            log.info("  Base type is: " + typeDef.getBaseTypeId());
            log.info("  Number of children types is: " + type.getChildren().size());
            Map<String, PropertyDefinition<?>> propDefs = type.getTypeDefinition().getPropertyDefinitions();
            log.info("  Number of properties is: " + (propDefs == null ? 0 : propDefs.size()));
            containsAllBasePropertyDefinitions(typeDef);
        }
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.commons.definitions.TypeDefinition

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.