Package org.apache.chemistry.opencmis.commons.impl.dataobjects

Examples of org.apache.chemistry.opencmis.commons.impl.dataobjects.AllowableActionsImpl


    public static AllowableActions convert(CmisAllowableActionsType allowableActions) {
        if (allowableActions == null) {
            return null;
        }

        AllowableActionsImpl result = new AllowableActionsImpl();

        Set<Action> set = EnumSet.noneOf(Action.class);

        if (Boolean.TRUE.equals(allowableActions.isCanAddObjectToFolder())) {
            set.add(Action.CAN_ADD_OBJECT_TO_FOLDER);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanApplyACL())) {
            set.add(Action.CAN_APPLY_ACL);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanApplyPolicy())) {
            set.add(Action.CAN_APPLY_POLICY);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanCancelCheckOut())) {
            set.add(Action.CAN_CANCEL_CHECK_OUT);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanCheckIn())) {
            set.add(Action.CAN_CHECK_IN);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanCheckOut())) {
            set.add(Action.CAN_CHECK_OUT);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanCreateDocument())) {
            set.add(Action.CAN_CREATE_DOCUMENT);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanCreateFolder())) {
            set.add(Action.CAN_CREATE_FOLDER);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanCreateRelationship())) {
            set.add(Action.CAN_CREATE_RELATIONSHIP);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanDeleteContentStream())) {
            set.add(Action.CAN_DELETE_CONTENT_STREAM);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanDeleteObject())) {
            set.add(Action.CAN_DELETE_OBJECT);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanDeleteTree())) {
            set.add(Action.CAN_DELETE_TREE);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetACL())) {
            set.add(Action.CAN_GET_ACL);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetAllVersions())) {
            set.add(Action.CAN_GET_ALL_VERSIONS);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetAppliedPolicies())) {
            set.add(Action.CAN_GET_APPLIED_POLICIES);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetChildren())) {
            set.add(Action.CAN_GET_CHILDREN);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetContentStream())) {
            set.add(Action.CAN_GET_CONTENT_STREAM);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetDescendants())) {
            set.add(Action.CAN_GET_DESCENDANTS);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetFolderParent())) {
            set.add(Action.CAN_GET_FOLDER_PARENT);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetFolderTree())) {
            set.add(Action.CAN_GET_FOLDER_TREE);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetObjectParents())) {
            set.add(Action.CAN_GET_OBJECT_PARENTS);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetObjectRelationships())) {
            set.add(Action.CAN_GET_OBJECT_RELATIONSHIPS);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetProperties())) {
            set.add(Action.CAN_GET_PROPERTIES);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetRenditions())) {
            set.add(Action.CAN_GET_RENDITIONS);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanMoveObject())) {
            set.add(Action.CAN_MOVE_OBJECT);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanRemoveObjectFromFolder())) {
            set.add(Action.CAN_REMOVE_OBJECT_FROM_FOLDER);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanRemovePolicy())) {
            set.add(Action.CAN_REMOVE_POLICY);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanSetContentStream())) {
            set.add(Action.CAN_SET_CONTENT_STREAM);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanUpdateProperties())) {
            set.add(Action.CAN_UPDATE_PROPERTIES);
        }

        result.setAllowableActions(set);

        // handle extensions
        convertExtension(allowableActions, result);

        return result;
View Full Code Here


            addAction(aas, Action.CAN_SET_CONTENT_STREAM, !userReadOnly && !isReadOnly);
            addAction(aas, Action.CAN_DELETE_CONTENT_STREAM, !userReadOnly && !isReadOnly);
            addAction(aas, Action.CAN_GET_ALL_VERSIONS, true);
        }

        AllowableActionsImpl result = new AllowableActionsImpl();
        result.setAllowableActions(aas);

        return result;
    }
View Full Code Here

            isCheckedOut = ((VersionedDocument) so).isCheckedOut();
            canCheckOut = !((VersionedDocument) so).isCheckedOut();
            canCheckIn = isCheckedOut && ((VersionedDocument) so).getCheckedOutBy().equals(user);
        }
       
        AllowableActionsImpl allowableActions = new AllowableActionsImpl();
        Set<Action> set = allowableActions.getAllowableActions();

        set.add(Action.CAN_DELETE_OBJECT);
        set.add(Action.CAN_UPDATE_PROPERTIES);

        if (isFolder || isDocument) {
            set.add(Action.CAN_GET_PROPERTIES);
            if (!isRootFolder) {
                set.add(Action.CAN_GET_OBJECT_PARENTS);
            }
            set.add(Action.CAN_MOVE_OBJECT);
        }

        if (isFolder) {
            if (!isRootFolder) {
                set.add(Action.CAN_GET_FOLDER_PARENT);
            }
            set.add(Action.CAN_GET_FOLDER_TREE);
            set.add(Action.CAN_GET_DESCENDANTS);

            set.add(Action.CAN_ADD_OBJECT_TO_FOLDER);
            set.add(Action.CAN_REMOVE_OBJECT_FROM_FOLDER);
            set.add(Action.CAN_CREATE_DOCUMENT);
            set.add(Action.CAN_CREATE_FOLDER);
            set.add(Action.CAN_GET_CHILDREN);
            set.add(Action.CAN_DELETE_TREE);
        }

        if (hasContent) {
            set.add(Action.CAN_DELETE_CONTENT_STREAM);
            set.add(Action.CAN_GET_CONTENT_STREAM);
        }

        if (isVersioned) {
            if (canCheckOut) {
                set.add(Action.CAN_CHECK_OUT);
            }
            if (isCheckedOut) {
                set.add(Action.CAN_CANCEL_CHECK_OUT);
            }
            if (canCheckIn) {
                set.add(Action.CAN_CHECK_IN);
            }
            set.add(Action.CAN_GET_ALL_VERSIONS);
        }

        if (isDocument) {
            set.add(Action.CAN_SET_CONTENT_STREAM);
        }

        allowableActions.setAllowableActions(set);
        return allowableActions;
    }
View Full Code Here

            isCheckedOut = ((VersionedDocument) so).isCheckedOut();
            canCheckOut = !((VersionedDocument) so).isCheckedOut();
            canCheckIn = isCheckedOut && ((VersionedDocument) so).getCheckedOutBy().equals(user);
        }
       
        AllowableActionsImpl allowableActions = new AllowableActionsImpl();
        Set<Action> set = allowableActions.getAllowableActions();

        if (!isRootFolder) {
            set.add(Action.CAN_DELETE_OBJECT);
            set.add(Action.CAN_UPDATE_PROPERTIES);
        }

        if (isFolder || isDocument) {
            set.add(Action.CAN_GET_PROPERTIES);
            if (!isRootFolder) {
                set.add(Action.CAN_GET_OBJECT_PARENTS);
            }
            set.add(Action.CAN_MOVE_OBJECT);
        }

        if (isFolder) {
            if (!isRootFolder) {
                set.add(Action.CAN_GET_FOLDER_PARENT);
                set.add(Action.CAN_DELETE_TREE);
            }
            set.add(Action.CAN_GET_FOLDER_TREE);
            set.add(Action.CAN_GET_DESCENDANTS);

            set.add(Action.CAN_CREATE_DOCUMENT);
            set.add(Action.CAN_CREATE_FOLDER);
            set.add(Action.CAN_GET_CHILDREN);
        }

        if (hasContent) {
            set.add(Action.CAN_DELETE_CONTENT_STREAM);
            set.add(Action.CAN_GET_CONTENT_STREAM);
        }

        if (isVersioned) {
            if (canCheckOut) {
                set.add(Action.CAN_CHECK_OUT);
            }
            if (isCheckedOut) {
                set.add(Action.CAN_CANCEL_CHECK_OUT);
            }
            if (canCheckIn) {
                set.add(Action.CAN_CHECK_IN);
            }
            set.add(Action.CAN_GET_ALL_VERSIONS);
        }

        if (isDocument) {
            set.add(Action.CAN_ADD_OBJECT_TO_FOLDER);
            set.add(Action.CAN_REMOVE_OBJECT_FROM_FOLDER);
            if (isVersioned) {
                if (canCheckIn)
                    set.add(Action.CAN_SET_CONTENT_STREAM);
            } else
                set.add(Action.CAN_SET_CONTENT_STREAM);
        }

        allowableActions.setAllowableActions(set);
        return allowableActions;
    }
View Full Code Here

    public static AllowableActions convertAllowableActions(Map<String, Object> json) {
        if (json == null) {
            return null;
        }

        AllowableActionsImpl result = new AllowableActionsImpl();
        Set<Action> allowableActions = new HashSet<Action>();

        for (Action action : Action.values()) {
            Boolean value = getBoolean(json, action.value());
            if (value != null && value.booleanValue()) {
                allowableActions.add(action);
            }
        }

        result.setAllowableActions(allowableActions);

        convertExtension(json, result, ALLOWABLE_ACTIONS_KEYS);

        return result;
    }
View Full Code Here

    public static AllowableActions convert(CmisAllowableActionsType allowableActions) {
        if (allowableActions == null) {
            return null;
        }

        AllowableActionsImpl result = new AllowableActionsImpl();

        Set<Action> set = EnumSet.noneOf(Action.class);

        if (Boolean.TRUE.equals(allowableActions.isCanAddObjectToFolder())) {
            set.add(Action.CAN_ADD_OBJECT_TO_FOLDER);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanApplyACL())) {
            set.add(Action.CAN_APPLY_ACL);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanApplyPolicy())) {
            set.add(Action.CAN_APPLY_POLICY);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanCancelCheckOut())) {
            set.add(Action.CAN_CANCEL_CHECK_OUT);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanCheckIn())) {
            set.add(Action.CAN_CHECK_IN);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanCheckOut())) {
            set.add(Action.CAN_CHECK_OUT);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanCreateDocument())) {
            set.add(Action.CAN_CREATE_DOCUMENT);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanCreateFolder())) {
            set.add(Action.CAN_CREATE_FOLDER);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanCreateRelationship())) {
            set.add(Action.CAN_CREATE_RELATIONSHIP);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanDeleteContentStream())) {
            set.add(Action.CAN_DELETE_CONTENT_STREAM);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanDeleteObject())) {
            set.add(Action.CAN_DELETE_OBJECT);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanDeleteTree())) {
            set.add(Action.CAN_DELETE_TREE);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetACL())) {
            set.add(Action.CAN_GET_ACL);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetAllVersions())) {
            set.add(Action.CAN_GET_ALL_VERSIONS);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetAppliedPolicies())) {
            set.add(Action.CAN_GET_APPLIED_POLICIES);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetChildren())) {
            set.add(Action.CAN_GET_CHILDREN);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetContentStream())) {
            set.add(Action.CAN_GET_CONTENT_STREAM);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetDescendants())) {
            set.add(Action.CAN_GET_DESCENDANTS);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetFolderParent())) {
            set.add(Action.CAN_GET_FOLDER_PARENT);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetFolderTree())) {
            set.add(Action.CAN_GET_FOLDER_TREE);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetObjectParents())) {
            set.add(Action.CAN_GET_OBJECT_PARENTS);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetObjectRelationships())) {
            set.add(Action.CAN_GET_OBJECT_RELATIONSHIPS);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetProperties())) {
            set.add(Action.CAN_GET_PROPERTIES);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanGetRenditions())) {
            set.add(Action.CAN_GET_RENDITIONS);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanMoveObject())) {
            set.add(Action.CAN_MOVE_OBJECT);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanRemoveObjectFromFolder())) {
            set.add(Action.CAN_REMOVE_OBJECT_FROM_FOLDER);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanRemovePolicy())) {
            set.add(Action.CAN_REMOVE_POLICY);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanSetContentStream())) {
            set.add(Action.CAN_SET_CONTENT_STREAM);
        }
        if (Boolean.TRUE.equals(allowableActions.isCanUpdateProperties())) {
            set.add(Action.CAN_UPDATE_PROPERTIES);
        }

        result.setAllowableActions(set);

        // handle extensions
        convertExtension(allowableActions, result);

        return result;
View Full Code Here

            isCheckedOut = ((VersionedDocument) so).isCheckedOut();
            canCheckOut = !((VersionedDocument) so).isCheckedOut();
            canCheckIn = isCheckedOut && ((VersionedDocument) so).getCheckedOutBy().equals(user);
        }
       
        AllowableActionsImpl allowableActions = new AllowableActionsImpl();
        Set<Action> set = allowableActions.getAllowableActions();

        if (!isRootFolder) {
            set.add(Action.CAN_DELETE_OBJECT);
            set.add(Action.CAN_UPDATE_PROPERTIES);
        }

        if (isFolder || isDocument) {
            set.add(Action.CAN_GET_PROPERTIES);
            if (!isRootFolder) {
                set.add(Action.CAN_GET_OBJECT_PARENTS);
            }
            set.add(Action.CAN_MOVE_OBJECT);
        }

        if (isFolder) {
            if (!isRootFolder) {
                set.add(Action.CAN_GET_FOLDER_PARENT);
                set.add(Action.CAN_DELETE_TREE);
            }
            set.add(Action.CAN_GET_FOLDER_TREE);
            set.add(Action.CAN_GET_DESCENDANTS);

            set.add(Action.CAN_CREATE_DOCUMENT);
            set.add(Action.CAN_CREATE_FOLDER);
            set.add(Action.CAN_GET_CHILDREN);
        }

        if (hasContent) {
            set.add(Action.CAN_DELETE_CONTENT_STREAM);
            set.add(Action.CAN_GET_CONTENT_STREAM);
        }

        if (isVersioned) {
            if (canCheckOut) {
                set.add(Action.CAN_CHECK_OUT);
            }
            if (isCheckedOut) {
                set.add(Action.CAN_CANCEL_CHECK_OUT);
            }
            if (canCheckIn) {
                set.add(Action.CAN_CHECK_IN);
            }
            set.add(Action.CAN_GET_ALL_VERSIONS);
        }

        if (isDocument) {
            if (so instanceof Filing && ((Filing)so).hasParent()) {
                set.add(Action.CAN_ADD_OBJECT_TO_FOLDER);
                set.add(Action.CAN_REMOVE_OBJECT_FROM_FOLDER);
            }
            if (isVersioned) {
                if (canCheckIn)
                    set.add(Action.CAN_SET_CONTENT_STREAM);
            } else
                set.add(Action.CAN_SET_CONTENT_STREAM);
        }

        allowableActions.setAllowableActions(set);
        return allowableActions;
    }
View Full Code Here

    /**
     * See CMIS 1.0 section 2.2.4.6 getAllowableActions
     */
    public AllowableActions getAllowableActions() {
        AllowableActionsImpl aas = new AllowableActionsImpl();
        aas.setAllowableActions(compileAllowableActions(new HashSet<Action>()));
        return aas;
    }
View Full Code Here

    /**
     * See CMIS 1.0 section 2.2.4.6 getAllowableActions
     */
    public AllowableActions getAllowableActions() {
        AllowableActionsImpl aas = new AllowableActionsImpl();
        aas.setAllowableActions(compileAllowableActions(new HashSet<Action>()));
        return aas;
    }
View Full Code Here

            addAction(aas, Action.CAN_SET_CONTENT_STREAM, !userReadOnly && !isReadOnly);
            addAction(aas, Action.CAN_DELETE_CONTENT_STREAM, !userReadOnly && !isReadOnly);
            addAction(aas, Action.CAN_GET_ALL_VERSIONS, true);
        }

        AllowableActionsImpl result = new AllowableActionsImpl();
        result.setAllowableActions(aas);

        return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.commons.impl.dataobjects.AllowableActionsImpl

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.