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

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


    public void repositoryCapabilitiesRenditionSupport() {
        RepositoryInfo r = this.session.getRepositoryInfo();
        Assert.assertNotNull(r);

        // capabilities
        RepositoryCapabilities repcap = r.getCapabilities();
        Assert.assertNotNull(repcap);

        CapabilityRenditions caprend = repcap.getRenditionsCapability();
        Assert.assertNotNull(caprend);
        switch (caprend) {
        case NONE:
        case READ:
            break;
View Full Code Here


    }

    // --- reusable checks ----

    protected boolean isGetDescendantsSupported(Session session) {
        RepositoryCapabilities cap = session.getRepositoryInfo().getCapabilities();

        if (cap == null) {
            return false;
        }

        if (cap.isGetDescendantsSupported() == null) {
            return false;
        }

        return cap.isGetDescendantsSupported().booleanValue();
    }
View Full Code Here

        return cap.isGetDescendantsSupported().booleanValue();
    }

    protected boolean isGetFolderTreeSupported(Session session) {
        RepositoryCapabilities cap = session.getRepositoryInfo().getCapabilities();

        if (cap == null) {
            return false;
        }

        if (cap.isGetFolderTreeSupported() == null) {
            return false;
        }

        return cap.isGetFolderTreeSupported().booleanValue();
    }
View Full Code Here

        // global settings
        info.setHasAcl(false);
        info.setSupportsDescendants(false);
        info.setSupportsFolderTree(false);

        RepositoryCapabilities capabilities = repositoryInfo.getCapabilities();
        if (capabilities != null) {
            info.setHasAcl(capabilities.getAclCapability() == CapabilityAcl.DISCOVER
                    || capabilities.getAclCapability() == CapabilityAcl.MANAGE);
            if (object.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) {
                info.setSupportsDescendants(Boolean.TRUE.equals(capabilities.isGetDescendantsSupported()));
                info.setSupportsFolderTree(Boolean.TRUE.equals(capabilities.isGetFolderTreeSupported()));
            }
        }

        return info;
    }
View Full Code Here

                boolean supportsFolderTree = false;
                boolean supportsRootDescendants = false;
                boolean supportsChanges = false;

                if (infoData.getCapabilities() != null) {
                    RepositoryCapabilities cap = infoData.getCapabilities();

                    if (cap.getQueryCapability() != null) {
                        supportsQuery = (cap.getQueryCapability() != CapabilityQuery.NONE);
                    }

                    if (cap.isUnfilingSupported() != null) {
                        supportsUnFiling = cap.isUnfilingSupported();
                    }

                    if (cap.isMultifilingSupported() != null) {
                        supportsMultifiling = cap.isMultifilingSupported();
                    }

                    if (cap.isGetFolderTreeSupported() != null) {
                        supportsFolderTree = cap.isGetFolderTreeSupported();
                    }

                    if (cap.isGetDescendantsSupported() != null) {
                        supportsRootDescendants = cap.isGetDescendantsSupported();
                    }

                    if (cap.getChangesCapability() != null) {
                        supportsChanges = (cap.getChangesCapability() != CapabilityChanges.NONE);
                    }
                }

                serviceDoc.startWorkspace(infoData.getId());
View Full Code Here

            addYesNoLabel("Changes incomplete:").setValue(is(repInfo.getChangesIncomplete()));
            addLine("Changes on type:").setText(
                    repInfo.getChangesOnType() == null ? "" : repInfo.getChangesOnType().toString());

            if (repInfo.getCapabilities() != null) {
                RepositoryCapabilities cap = repInfo.getCapabilities();

                addLine("Capabilities", true).setText("");

                addYesNoLabel("Get descendants supported:").setValue(is(cap.isGetDescendantsSupported()));
                addYesNoLabel("Get folder tree supported:").setValue(is(cap.isGetFolderTreeSupported()));
                addYesNoLabel("Unfiling supported:").setValue(is(cap.isUnfilingSupported()));
                addYesNoLabel("Multifiling supported:").setValue(is(cap.isMultifilingSupported()));
                addYesNoLabel("Version specific filing supported:").setValue(is(cap.isVersionSpecificFilingSupported()));
                addLine("Query:").setText(str(cap.getQueryCapability()));
                addLine("Joins:").setText(str(cap.getJoinCapability()));
                addYesNoLabel("All versions searchable:").setValue(is(cap.isAllVersionsSearchableSupported()));
                addYesNoLabel("PWC searchable:").setValue(is(cap.isPwcSearchableSupported()));
                addYesNoLabel("PWC updatable:").setValue(is(cap.isPwcUpdatableSupported()));
                addLine("Content stream updates:").setText(str(cap.getContentStreamUpdatesCapability()));
                addLine("Renditions:").setText(str(cap.getRenditionsCapability()));
                addLine("Changes:").setText(str(cap.getChangesCapability()));
                addLine("ACLs:").setText(str(cap.getAclCapability()));
            }

            if (repInfo.getAclCapabilities() != null) {
                AclCapabilities cap = repInfo.getAclCapabilities();

                addLine("ACL Capabilities:", true).setText("");

                addLine("Supported permissions:").setText(str(cap.getSupportedPermissions()));
                addLine("ACL propagation:").setText(str(cap.getAclPropagation()));

                if (cap.getPermissions() != null) {
                    String[][] data = new String[cap.getPermissions().size()][2];

                    int i = 0;
                    for (PermissionDefinition pd : cap.getPermissions()) {
                        data[i][0] = pd.getId();
                        data[i][1] = pd.getDescription();
                        i++;
                    }

                    JTable permTable = new JTable(data, new String[] { "Permission", "Description" });
                    permTable.setFillsViewportHeight(true);
                    addComponent("Permissions:", new JScrollPane(permTable));
                }

                if (cap.getPermissionMapping() != null) {
                    String[][] data = new String[cap.getPermissionMapping().size()][2];

                    int i = 0;
                    for (PermissionMapping pm : cap.getPermissionMapping().values()) {
                        data[i][0] = pm.getKey();
                        data[i][1] = (pm.getPermissions() == null ? "" : pm.getPermissions().toString());
                        i++;
                    }
View Full Code Here

        System.out.println("\nCapabilities...");
        System.out.println("---------------");
        // Check what capabilities our repository supports
        System.out.println("Printing repository capabilities...");
        final RepositoryInfo repInfo = session.getRepositoryInfo();
        RepositoryCapabilities cap = repInfo.getCapabilities();
        System.out.println("\nNavigation Capabilities");
        System.out.println("-----------------------");
        System.out.println("Get descendants supported: "
                + (cap.isGetDescendantsSupported() ? "true" : "false"));
        System.out.println("Get folder tree supported: "
                + (cap.isGetFolderTreeSupported() ? "true" : "false"));
        System.out.println("\nObject Capabilities");
        System.out.println("-----------------------");
        System.out.println("Content Stream: " + cap.getContentStreamUpdatesCapability().value());
        System.out.println("Changes: " + cap.getChangesCapability().value());
        System.out.println("Renditions: " + cap.getRenditionsCapability().value());
        System.out.println("\nFiling Capabilities");
        System.out.println("-----------------------");
        System.out.println("Multifiling supported: "
                + (cap.isMultifilingSupported() ? "true" : "false"));
        System.out.println("Unfiling supported: " + (cap.isUnfilingSupported() ? "true" : "false"));
        System.out.println("Version specific filing supported: "
                + (cap.isVersionSpecificFilingSupported() ? "true" : "false"));
        System.out.println("\nVersioning Capabilities");
        System.out.println("-----------------------");
        System.out
                .println("PWC searchable: " + (cap.isPwcSearchableSupported() ? "true" : "false"));
        System.out.println("PWC Updatable: " + (cap.isPwcUpdatableSupported() ? "true" : "false"));
        System.out.println("All versions searchable: "
                + (cap.isAllVersionsSearchableSupported() ? "true" : "false"));
        System.out.println("\nQuery Capabilities");
        System.out.println("-----------------------");
        System.out.println("Query: " + cap.getQueryCapability().value());
        System.out.println("Join: " + cap.getJoinCapability().value());
        System.out.println("\nACL Capabilities");
        System.out.println("-----------------------");
        System.out.println("ACL: " + cap.getAclCapability().value());
        System.out.println("End of  repository capabilities");

        System.out.println("\nAllowable actions...");
        System.out.println("--------------------");
        // find the current allowable actions for the test.txt document
        System.out.println("Getting the current allowable actions for the " + doc.getName()
                + " document object...");
        for (Action a : doc.getAllowableActions().getAllowableActions()) {
            System.out.println("\t" + a.value());
        }

        // find out if we can currently check out test.txt
        if (doc.getAllowableActions().getAllowableActions().contains(Action.CAN_CHECK_OUT)) {
            System.out.println("can check out " + doc.getName());
        } else {
            System.out.println("can not check out " + doc.getName());
        }

        System.out.println("\nMultifiling and Unfiling...");
        System.out.println("---------------------------");
        // Try out multifiling if it is supported
        System.out.println("Trying out multifiling");
        Folder newFolder2 = null;
        if (!(cap.isMultifilingSupported())) {
            System.out.println("Multifiling not supported by this repository");
        } else {
            // Add a new folder to the root folder
            System.out.println("Creating 'ADGNewFolder 2' in the root folder");
            newFolderProps = new HashMap<String, String>();
            newFolderProps.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
            newFolderProps.put(PropertyIds.NAME, "ADGNewFolder 2");
            newFolder2 = root.createFolder(newFolderProps, null, null, null,
                    session.getDefaultContext());
            System.out.println("Adding " + textFileName + "to 'ADGNewFolder 2' in the root folder");
            doc.addToFolder(newFolder2, true);

            // Did it work?
            children = newFolder.getChildren();
            System.out.println("Now finding the following objects in the 'ADGNewFolder' folder:-");
            for (CmisObject o : children) {
                System.out.println(o.getName());
            }
            children = newFolder2.getChildren();
            System.out
                    .println("Now finding the following objects in the 'ADGNewFolder 2' folder:-");
            for (CmisObject o : children) {
                System.out.println(o.getName());
            }
        }

        // Try out unfiling if it is supported
        System.out.println("Trying out unfiling");
        if (!(cap.isUnfilingSupported())) {
            System.out.println("Unfiling not supported by this repository");
        } else {
            // remove our document from both folders
            System.out.println("removing :" + doc.getName() + "from 'ADGNewFolder':-");
            doc.removeFromFolder(newFolder);
View Full Code Here

                }
            }
            addLine("Changes on type:").setText(sb.toString());

            if (repInfo.getCapabilities() != null) {
                RepositoryCapabilities cap = repInfo.getCapabilities();

                addLine("Capabilities:", true).setText("");

                addYesNoLabel("Get descendants supported:").setValue(is(cap.isGetDescendantsSupported()));
                addYesNoLabel("Get folder tree supported:").setValue(is(cap.isGetFolderTreeSupported()));
                addYesNoLabel("Unfiling supported:").setValue(is(cap.isUnfilingSupported()));
                addYesNoLabel("Multifiling supported:").setValue(is(cap.isMultifilingSupported()));
                addYesNoLabel("Version specific filing supported:")
                        .setValue(is(cap.isVersionSpecificFilingSupported()));
                addLine("Query:").setText(str(cap.getQueryCapability()));
                addLine("Joins:").setText(str(cap.getJoinCapability()));
                addYesNoLabel("All versions searchable:").setValue(is(cap.isAllVersionsSearchableSupported()));
                addYesNoLabel("PWC searchable:").setValue(is(cap.isPwcSearchableSupported()));
                addYesNoLabel("PWC updatable:").setValue(is(cap.isPwcUpdatableSupported()));
                addLine("Content stream updates:").setText(str(cap.getContentStreamUpdatesCapability()));
                addLine("Renditions:").setText(str(cap.getRenditionsCapability()));
                addLine("Changes:").setText(str(cap.getChangesCapability()));
                addLine("ACLs:").setText(str(cap.getAclCapability()));

                sb = new StringBuilder();
                if (cap.getNewTypeSettableAttributes() != null) {
                    if (Boolean.TRUE.equals(cap.getNewTypeSettableAttributes().canSetId())) {
                        appendToString(sb, "id");
                    }

                    if (Boolean.TRUE.equals(cap.getNewTypeSettableAttributes().canSetLocalName())) {
                        appendToString(sb, "localName");
                    }

                    if (Boolean.TRUE.equals(cap.getNewTypeSettableAttributes().canSetLocalNamespace())) {
                        appendToString(sb, "localNamespace");
                    }

                    if (Boolean.TRUE.equals(cap.getNewTypeSettableAttributes().canSetDisplayName())) {
                        appendToString(sb, "displayName");
                    }

                    if (Boolean.TRUE.equals(cap.getNewTypeSettableAttributes().canSetQueryName())) {
                        appendToString(sb, "queryName");
                    }

                    if (Boolean.TRUE.equals(cap.getNewTypeSettableAttributes().canSetDescription())) {
                        appendToString(sb, "description");
                    }

                    if (Boolean.TRUE.equals(cap.getNewTypeSettableAttributes().canSetCreatable())) {
                        appendToString(sb, "creatable");
                    }

                    if (Boolean.TRUE.equals(cap.getNewTypeSettableAttributes().canSetFileable())) {
                        appendToString(sb, "fileable");
                    }

                    if (Boolean.TRUE.equals(cap.getNewTypeSettableAttributes().canSetQueryable())) {
                        appendToString(sb, "queryable");
                    }

                    if (Boolean.TRUE.equals(cap.getNewTypeSettableAttributes().canSetFulltextIndexed())) {
                        appendToString(sb, "fulltextIndexed");
                    }

                    if (Boolean.TRUE.equals(cap.getNewTypeSettableAttributes().canSetIncludedInSupertypeQuery())) {
                        appendToString(sb, "includedInSupertypeQuery");
                    }

                    if (Boolean.TRUE.equals(cap.getNewTypeSettableAttributes().canSetControllablePolicy())) {
                        appendToString(sb, "controllablePolicy");
                    }

                    if (Boolean.TRUE.equals(cap.getNewTypeSettableAttributes().canSetControllableAcl())) {
                        appendToString(sb, "controllableACL");
                    }
                }

                addLine("New type settable attributes:").setText(sb.toString());

                sb = new StringBuilder();
                if (cap.getCreatablePropertyTypes() != null && cap.getCreatablePropertyTypes().canCreate() != null) {
                    for (PropertyType pt : cap.getCreatablePropertyTypes().canCreate()) {
                        appendToString(sb, pt.value());
                    }
                }

                addLine("Creatable property types:").setText(sb.toString());
            }

            if (repInfo.getAclCapabilities() != null) {
                AclCapabilities cap = repInfo.getAclCapabilities();

                addLine("ACL Capabilities:", true).setText("");

                addLine("Supported permissions:").setText(str(cap.getSupportedPermissions()));
                addLine("ACL propagation:").setText(str(cap.getAclPropagation()));

                if (cap.getPermissions() != null) {
                    String[][] data = new String[cap.getPermissions().size()][2];

                    int i = 0;
                    for (PermissionDefinition pd : cap.getPermissions()) {
                        data[i][0] = pd.getId();
                        data[i][1] = pd.getDescription();
                        i++;
                    }

                    JTable permTable = new JTable(data, new String[] { "Permission", "Description" });
                    permTable.setFillsViewportHeight(true);
                    addComponent("Permissions:", new JScrollPane(permTable));
                }

                if (cap.getPermissionMapping() != null) {
                    String[][] data = new String[cap.getPermissionMapping().size()][2];

                    int i = 0;
                    for (PermissionMapping pm : cap.getPermissionMapping().values()) {
                        data[i][0] = pm.getKey();
                        data[i][1] = (pm.getPermissions() == null ? "" : pm.getPermissions().toString());
                        i++;
                    }
View Full Code Here

        // capabilities
        if (ri.getCapabilities() == null) {
            addResult(createResult(FAILURE, "Capabilities are not set!"));
        } else {
            RepositoryCapabilities cap = ri.getCapabilities();

            // ACL capability
            success = createResult(OK, "ACL capability: " + cap.getAclCapability());
            failure = createResult(FAILURE, "ACL capability is not set!");
            addResult(assertNotNull(cap.getAclCapability(), success, failure));

            // changes capability
            success = createResult(OK, "Changes capability: " + cap.getChangesCapability());
            failure = createResult(WARNING, "Changes capability is not set!");
            addResult(assertNotNull(cap.getChangesCapability(), success, failure));

            // content stream updates capability
            success = createResult(OK, "Content stream updates capability: " + cap.getContentStreamUpdatesCapability());
            failure = createResult(FAILURE, "Content stream updates is not set!");
            addResult(assertNotNull(cap.getContentStreamUpdatesCapability(), success, failure));

            // get descendants capability
            success = createResult(OK, "Get descendants capability: " + cap.isGetDescendantsSupported());
            failure = createResult(FAILURE, "Get descendants capability is not set!");
            addResult(assertNotNull(cap.isGetDescendantsSupported(), success, failure));

            // get folder tree capability
            success = createResult(OK, "Get folder tree capability: " + cap.isGetFolderTreeSupported());
            failure = createResult(FAILURE, "Get folder tree capability is not set!");
            addResult(assertNotNull(cap.isGetFolderTreeSupported(), success, failure));

            // multifiling capability
            success = createResult(OK, "Multifiling capability: " + cap.isMultifilingSupported());
            failure = createResult(FAILURE, "Multifiling capability is not set!");
            addResult(assertNotNull(cap.isMultifilingSupported(), success, failure));

            // unfiling capability
            success = createResult(OK, "Unfiling capability: " + cap.isUnfilingSupported());
            failure = createResult(FAILURE, "Unfiling capability is not set!");
            addResult(assertNotNull(cap.isUnfilingSupported(), success, failure));

            // version specific filing capability
            success = createResult(OK, "Version specific filing capability: " + cap.isVersionSpecificFilingSupported());
            failure = createResult(FAILURE, "Version specific filing capability is not set!");
            addResult(assertNotNull(cap.isVersionSpecificFilingSupported(), success, failure));

            // query capability
            success = createResult(OK, "Query capability: " + cap.getQueryCapability());
            failure = createResult(FAILURE, "Query capability is not set!");
            addResult(assertNotNull(cap.getQueryCapability(), success, failure));

            // JOIN capability
            success = createResult(OK, "JOIN capability: " + cap.getJoinCapability());
            failure = createResult(FAILURE, "JOIN capability is not set!");
            addResult(assertNotNull(cap.getJoinCapability(), success, failure));

            // all versions searchable capability
            success = createResult(OK, "All versions searchable capability: " + cap.isAllVersionsSearchableSupported());
            failure = createResult(FAILURE, "All versions searchable capability is not set!");
            addResult(assertNotNull(cap.isAllVersionsSearchableSupported(), success, failure));

            // PWC searchable capability
            success = createResult(OK, "PWC searchable capability: " + cap.isPwcSearchableSupported());
            failure = createResult(FAILURE, "PWC searchable capability is not set!");
            addResult(assertNotNull(cap.isPwcSearchableSupported(), success, failure));

            // PWC updatable capability
            success = createResult(OK, "PWC updatable capability: " + cap.isPwcUpdatableSupported());
            failure = createResult(FAILURE, "PWC updatable capability is not set!");
            addResult(assertNotNull(cap.isPwcUpdatableSupported(), success, failure));

            // renditions capability
            success = createResult(OK, "Renditions capability: " + cap.getRenditionsCapability());
            failure = createResult(FAILURE, "Renditions capability is not set!");
            addResult(assertNotNull(cap.getRenditionsCapability(), success, failure));
        }

        // ACL capabilities
        if (ri.getAclCapabilities() == null) {
            addResult(createResult(WARNING, "ACL capabilities are not set!"));
View Full Code Here

        }
    }

    public synchronized boolean supportsQuery() {
        try {
            RepositoryCapabilities cap = getRepositoryInfo().getCapabilities();
            if (cap == null) {
                return true;
            }

            return (cap.getQueryCapability() != null) && (cap.getQueryCapability() != CapabilityQuery.NONE);
        } catch (Exception e) {
            return false;
        }
    }
View Full Code Here

TOP

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

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.