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

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


            f = createResult(FAILURE, "Document name doesn't match with given name!");
            addResult(assertEquals(NAME1, doc1.getName(), null, f));

            // test if check out is required
            boolean checkedout = false;
            DocumentTypeDefinition type = (DocumentTypeDefinition) doc1.getType();
            PropertyDefinition<?> namePropDef = type.getPropertyDefinitions().get(PropertyIds.NAME);
            if (namePropDef.getUpdatability() == Updatability.WHENCHECKEDOUT) {
                workDoc = (Document) session.getObject(doc1.checkOut(), SELECT_ALL_NO_CACHE_OC);
                checkedout = true;
            }
View Full Code Here


        try {
            // create folder and document
            Folder testFolder = createTestFolder(session);

            DocumentTypeDefinition docType = (DocumentTypeDefinition) session
                    .getTypeDefinition(getDocumentTestTypeId());

            if (!docType.isVersionable()) {
                addResult(createResult(SKIPPED, "Test type is not versionable. Test skipped!"));
                return;
            }

            // major version
View Full Code Here

        typeBox = new JComboBox(types);
        typeBox.setSelectedIndex(0);
        typeBox.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                DocumentTypeDefinition type = (DocumentTypeDefinition) ((ObjectTypeItem) typeBox.getSelectedItem())
                        .getObjectType();
                if (type.isVersionable()) {
                    versioningStateMajorButton.setSelected(true);
                } else {
                    versioningStateNoneButton.setSelected(true);
                }
            }
View Full Code Here

        if (!(type instanceof DocumentTypeDefinition)) {
            addResult(createResult(FAILURE, "Type is not a document type! Type: " + objectTypeId, true));
            return null;
        }

        DocumentTypeDefinition docType = (DocumentTypeDefinition) type;
        VersioningState versioningState = (Boolean.TRUE.equals(docType.isVersionable()) ? VersioningState.MAJOR
                : VersioningState.NONE);

        byte[] contentBytes = null;
        Document result = null;
        try {
View Full Code Here

                                createResult(FAILURE,
                                        "Document object has CAN_CHECK_OUT and CAN_CANCEL_CHECK_OUT allowable actions!"));
                    }

                    Document doc = (Document) object;
                    DocumentTypeDefinition docType = (DocumentTypeDefinition) doc.getType();
                    if (doc.isVersionSeriesCheckedOut() != null) {
                        if (doc.isVersionSeriesCheckedOut()) {
                            f = createResult(WARNING, "Document is checked out and has CAN_CHECK_OUT allowable action!");
                            addResult(results, assertNotAllowableAction(object, Action.CAN_CHECK_OUT, null, f));

                            if (doc.getVersionSeriesCheckedOutId() == null) {
                                addResult(
                                        results,
                                        createResult(WARNING,
                                                "Document is checked out and but the property cmis:versionSeriesCheckedOutId is not set!"));
                            } else {
                                if (doc.getVersionSeriesCheckedOutId().equals(object.getId())) {
                                    // object is PWC
                                    f = createResult(FAILURE, "PWC doesn't have CAN_CHECK_IN allowable action!");
                                    addResult(results, assertAllowableAction(object, Action.CAN_CHECK_IN, null, f));

                                    f = createResult(FAILURE, "PWC doesn't have CAN_CANCEL_CHECK_OUT allowable action!");
                                    addResult(results,
                                            assertAllowableAction(object, Action.CAN_CANCEL_CHECK_OUT, null, f));
                                } else {
                                    // object is not PWC
                                    f = createResult(WARNING, "Non-PWC has CAN_CHECK_IN allowable action!");
                                    addResult(results, assertNotAllowableAction(object, Action.CAN_CHECK_IN, null, f));

                                    f = createResult(WARNING, "Non-PWC has CAN_CANCEL_CHECK_OUT allowable action!");
                                    addResult(results,
                                            assertNotAllowableAction(object, Action.CAN_CANCEL_CHECK_OUT, null, f));
                                }
                            }
                        } else {
                            f = createResult(FAILURE,
                                    "Document is not checked out and has CAN_CHECK_IN allowable action!");
                            addResult(results, assertNotAllowableAction(object, Action.CAN_CHECK_IN, null, f));

                            f = createResult(FAILURE,
                                    "Document is not checked out and has CAN_CANCEL_CHECK_OUT allowable action!");
                            addResult(results, assertNotAllowableAction(object, Action.CAN_CANCEL_CHECK_OUT, null, f));

                            // versionable check
                            if (docType.isVersionable()) {
                                if (Boolean.TRUE.equals(doc.isLatestVersion())) {
                                    f = createResult(WARNING,
                                            "Document is versionable and not checked but has no CAN_CHECK_OUT allowable action!");
                                    addResult(results, assertAllowableAction(object, Action.CAN_CHECK_OUT, null, f));
                                }
View Full Code Here

        }

        CmisTestResult f;

        Document doc = (Document) object;
        DocumentTypeDefinition type = (DocumentTypeDefinition) doc.getType();

        // check ContentStreamAllowed flag
        boolean hasContentProperties = (doc.getContentStreamFileName() != null) || (doc.getContentStreamId() != null)
                || (doc.getContentStreamLength() > -1) || (doc.getContentStreamMimeType() != null);

        if (hasContentProperties) {
            if (type.getContentStreamAllowed() == ContentStreamAllowed.NOTALLOWED) {
                addResult(
                        results,
                        createResult(FAILURE,
                                "Content properties have values but the document type doesn't allow content!"));
            }
        } else {
            if (type.getContentStreamAllowed() == ContentStreamAllowed.REQUIRED) {
                addResult(results,
                        createResult(FAILURE, "Content properties are not set but the document type demands content!"));
            }
        }

        // get the content stream
        ContentStream contentStream = doc.getContentStream();

        if (contentStream == null) {
            if (hasContentProperties && doc.getContentStreamLength() > 0) {
                addResult(results,
                        createResult(FAILURE, "Content properties have values but the document has no content!"));
            }

            if (type.getContentStreamAllowed() == ContentStreamAllowed.REQUIRED) {
                addResult(results,
                        createResult(FAILURE, "The document type demands content but the document has no content!"));
            }

            return;
        }

        if (type.getContentStreamAllowed() == ContentStreamAllowed.NOTALLOWED) {
            addResult(results, createResult(FAILURE, "Document type doesn't allow content but document has content!"));
        }

        // file name check
        f = createResult(FAILURE, "Content file names don't match!");
View Full Code Here

            f = createResult(WARNING, "Type description is not set!");
            addResult(results, assertStringNotEmpty(type.getDescription(), null, f));

            if (BaseTypeId.CMIS_DOCUMENT.equals(type.getBaseTypeId())) {
                DocumentTypeDefinition docType = (DocumentTypeDefinition) type;

                f = createResult(FAILURE, "Versionable flag is not set!");
                addResult(results, assertNotNull(docType.isVersionable(), null, f));

                f = createResult(FAILURE, "Content stream allowed flag is not set!");
                addResult(results, assertNotNull(docType.getContentStreamAllowed(), null, f));
            } else if (BaseTypeId.CMIS_FOLDER.equals(type.getBaseTypeId())) {
                if (type.isFileable() != null) {
                    f = createResult(FAILURE, "Folder types must be fileable!");
                    addResult(results, assertIsTrue(type.isFileable(), null, f));
                }
View Full Code Here

            Map<String, PropertyData<?>> props, String checkinComment) {
        for (PropertyData<?> pd : props.values()) {
            log.info("return property id: " + pd.getId() + ", value: " + pd.getValues());
        }

        DocumentTypeDefinition typeDef = (DocumentTypeDefinition) fRepSvc.getTypeDefinition(fRepositoryId,
                VersionTestTypeSystemCreator.VERSION_TEST_DOCUMENT_TYPE_ID, null);
        PropertyBoolean pdb = (PropertyBoolean) props.get(PropertyIds.IS_LATEST_VERSION);
        assertNotNull(pdb);
        boolean bVal = pdb.getFirstValue();
        assertEquals(versioningState != VersioningState.CHECKEDOUT, bVal); // if
View Full Code Here

        if (!(type instanceof DocumentTypeDefinition)) {
            addResult(createResult(FAILURE, "Type is not a document type! Type: " + objectTypeId, true));
            return null;
        }

        DocumentTypeDefinition docType = (DocumentTypeDefinition) type;
        VersioningState versioningState = (Boolean.TRUE.equals(docType.isVersionable()) ? VersioningState.MAJOR
                : VersioningState.NONE);

        byte[] contentBytes = null;
        Document result = null;
        try {
View Full Code Here

                                createResult(FAILURE,
                                        "Document object has CAN_CHECK_OUT and CAN_CANCEL_CHECK_OUT allowable actions!"));
                    }

                    Document doc = (Document) object;
                    DocumentTypeDefinition docType = (DocumentTypeDefinition) doc.getType();
                    if (doc.isVersionSeriesCheckedOut() != null) {
                        if (doc.isVersionSeriesCheckedOut()) {
                            f = createResult(WARNING, "Document is checked out and has CAN_CHECK_OUT allowable action!");
                            addResult(results, assertNotAllowableAction(object, Action.CAN_CHECK_OUT, null, f));

                            if (doc.getVersionSeriesCheckedOutId() == null) {
                                addResult(
                                        results,
                                        createResult(WARNING,
                                                "Document is checked out and but the property cmis:versionSeriesCheckedOutId is not set!"));
                            } else {
                                if (doc.getVersionSeriesCheckedOutId().equals(object.getId())) {
                                    // object is PWC
                                    f = createResult(FAILURE, "PWC doesn't have CAN_CHECK_IN allowable action!");
                                    addResult(results, assertAllowableAction(object, Action.CAN_CHECK_IN, null, f));

                                    f = createResult(FAILURE, "PWC doesn't have CAN_CANCEL_CHECK_OUT allowable action!");
                                    addResult(results,
                                            assertAllowableAction(object, Action.CAN_CANCEL_CHECK_OUT, null, f));
                                } else {
                                    // object is not PWC
                                    f = createResult(WARNING, "Non-PWC has CAN_CHECK_IN allowable action!");
                                    addResult(results, assertNotAllowableAction(object, Action.CAN_CHECK_IN, null, f));

                                    f = createResult(WARNING, "Non-PWC has CAN_CANCEL_CHECK_OUT allowable action!");
                                    addResult(results,
                                            assertNotAllowableAction(object, Action.CAN_CANCEL_CHECK_OUT, null, f));
                                }
                            }
                        } else {
                            f = createResult(FAILURE,
                                    "Document is not checked out and has CAN_CHECK_IN allowable action!");
                            addResult(results, assertNotAllowableAction(object, Action.CAN_CHECK_IN, null, f));

                            f = createResult(FAILURE,
                                    "Document is not checked out and has CAN_CANCEL_CHECK_OUT allowable action!");
                            addResult(results, assertNotAllowableAction(object, Action.CAN_CANCEL_CHECK_OUT, null, f));

                            // versionable check
                            if (docType.isVersionable()) {
                                if (Boolean.TRUE.equals(doc.isLatestVersion())) {
                                    f = createResult(WARNING,
                                            "Document is versionable and not checked but has no CAN_CHECK_OUT allowable action!");
                                    addResult(results, assertAllowableAction(object, Action.CAN_CHECK_OUT, null, f));
                                }
View Full Code Here

TOP

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

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.