Package org.apache.chemistry.opencmis.commons.data

Examples of org.apache.chemistry.opencmis.commons.data.Properties


    @SuppressWarnings("unchecked")
    protected String getPathOfFolder(String id) {
        String path = null;
        try {
            String filter = PropertyIds.PATH;
            Properties res = fObjSvc.getProperties(fRepositoryId, id, filter, null);
            assertNotNull(res);
            PropertyData<String> pd = (PropertyData<String>) res.getProperties().get(PropertyIds.PATH);
            assertNotNull(pd);
            path = pd.getFirstValue();
            assertNotNull(path);
        } catch (Exception e) {
            fail("getProperties() failed with exception: " + e);
View Full Code Here


        // series?
        fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
        String pwcId = idHolder.getValue();
        // test that object is checked out and that all properties are set
        // correctly
        Properties props = fObjSvc.getProperties(fRepositoryId, pwcId, "*", null);
        String changeToken = (String) props.getProperties().get(PropertyIds.CHANGE_TOKEN).getFirstValue();
        checkVersionProperties(pwcId, VersioningState.CHECKEDOUT, props.getProperties(), null);

        // Test that a second checkout is not possible
        try {
            fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
            fail("Checking out a document that is already checked-out should fail.");
View Full Code Here

        // series?
        fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
        String pwcId = idHolder.getValue();

        ContentStream altContent = fCreator.createAlternateContent();
        Properties newProps = fCreator.getUpdatePropertyList(VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE_NEW);
        idHolder = new Holder<String>(pwcId);
//        assertTrue(isCheckedOut(docId));
        assertTrue(isCheckedOut(pwcId));

        // Test check-in and pass content and properties
View Full Code Here

        // series?
        fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
        String pwcId = idHolder.getValue();

        // Set a new content and modify property
        Properties props = fObjSvc.getProperties(fRepositoryId, pwcId, "*", null);
        String changeToken = (String) props.getProperties().get(PropertyIds.CHANGE_TOKEN).getFirstValue();
        ContentStream altContent = fCreator.createAlternateContent();
        idHolder = new Holder<String>(pwcId);
        Holder<String> tokenHolder = new Holder<String>(changeToken);
        fObjSvc.setContentStream(fRepositoryId, idHolder, true, tokenHolder, altContent, null);
        fCreator.updateProperty(idHolder.getValue(), VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE_NEW);
View Full Code Here

        // series?
        fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
        String pwcId = idHolder.getValue();

        ContentStream altContent = fCreator.createAlternateContent();
        Properties newProps = fCreator.getUpdatePropertyList(VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE_NEW);
        idHolder = new Holder<String>(pwcId);
//        assertTrue(isCheckedOut(docId));
        assertTrue(isCheckedOut(pwcId));

        // Test check-in and pass content and properties
        String checkinComment = "Checkin with content and properties.";
        fVerSvc.checkIn(fRepositoryId, idHolder, true, newProps, altContent, checkinComment, null, null, null, null);

        Properties latest = fVerSvc.getPropertiesOfLatestVersion(fRepositoryId, docId, docId, true, "*", null);
        assertNotNull(latest);

        checkVersionProperties(verId, versioningState, latest.getProperties(), checkinComment);
    }
View Full Code Here

        // series?
        fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
        String pwcId = idHolder.getValue();

        ContentStream altContent = fCreator.createAlternateContent();
        Properties newProps = fCreator.getUpdatePropertyList(VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE_NEW);
        idHolder = new Holder<String>(pwcId);
//        assertTrue(isCheckedOut(docId));
        assertTrue(isCheckedOut(pwcId));

        // Test check-in and pass content and properties
View Full Code Here

        for (int i = 0; i < num; i++) {
            List<PropertyData<?>> properties = new ArrayList<PropertyData<?>>();
            properties.add(fFactory.createPropertyIdData(PropertyIds.NAME, "Folder " + i));
            properties.add(fFactory.createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, BaseTypeId.CMIS_FOLDER.value()));
            Properties props = fFactory.createPropertiesData(properties);
            String id = fObjSvc.createFolder(fRepositoryId, props, fRootFolderId, null, null, null, null);
            res[i] = id;
        }
        return res;
    }
View Full Code Here

        assertNotNull(sVal);
        return sVal;
    }

    private boolean isCheckedOut(String objectId) {
        Properties props = fObjSvc.getProperties(fRepositoryId, objectId, "*", null);
        return isCheckedOut(props.getProperties());
    }
View Full Code Here

        Holder<String> idHolder = new Holder<String>(verIdV1);
        Holder<Boolean> contentCopied = new Holder<Boolean>(false);
        fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);

        ContentStream content2 = createContent('a');
        Properties newProps = fCreator.getUpdatePropertyList(VersionTestTypeSystemCreator.PROPERTY_ID,
                "PropertyFromVersion2");
        idHolder = new Holder<String>(verIdV1);
        // Test check-in and pass content and properties
        String checkinComment = "Checkin from Unit Test-2.";
        fVerSvc.checkIn(fRepositoryId, idHolder, true, newProps, content2, checkinComment, null, null, null, null);
View Full Code Here

        }
        log.info("... testCreateObject() finished.");

        // test create a document with a folder type, should fail:
        try {
            Properties props = createDocumentProperties("DocumentWithAFolderType", FOLDER_TYPE_ID);
            id = fObjSvc.createDocument(fRepositoryId, props, fRootFolderId, null, VersioningState.NONE, null, null,
                    null, null);
            assertNotNull(id);
            fail("Creating  document with a folder type should fail.");
        } catch (Exception e) {
            log.info("Creating  document with a folder type failed as expected.");
        }
        // test create a document with an illegal name, should fail:
        try {
            Properties props = createDocumentProperties("abc ()", DOCUMENT_TYPE_ID);
            fObjSvc.createDocument(fRepositoryId, props, fRootFolderId, null, VersioningState.NONE, null, null,
                    null, null);
            fail("Creating  document with an illegal name should fail.");
        } catch (Exception e) {
            assertTrue(e instanceof CmisInvalidArgumentException);
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.commons.data.Properties

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.