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

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


        List<Object> jsonAces = getList(json.get(JSON_ACL_ACES));
        if (jsonAces != null) {
            for (Object obj : jsonAces) {
                Map<String, Object> entry = getMap(obj);
                if (entry != null) {
                    AccessControlEntryImpl ace = new AccessControlEntryImpl();

                    Boolean isDirect = getBoolean(entry, JSON_ACE_IS_DIRECT);
                    ace.setDirect(isDirect != null ? isDirect.booleanValue() : true);

                    List<Object> jsonPermissions = getList(entry.get(JSON_ACE_PERMISSIONS));
                    if (jsonPermissions != null) {
                        List<String> permissions = new ArrayList<String>();
                        for (Object perm : jsonPermissions) {
                            if (perm != null) {
                                permissions.add(perm.toString());
                            }
                        }
                        ace.setPermissions(permissions);
                    }

                    Map<String, Object> jsonPrincipal = getMap(entry.get(JSON_ACE_PRINCIPAL));
                    if (jsonPrincipal != null) {
                        AccessControlPrincipalDataImpl principal = new AccessControlPrincipalDataImpl();

                        principal.setId(getString(jsonPrincipal, JSON_ACE_PRINCIPAL_ID));

                        convertExtension(jsonPrincipal, principal, PRINCIPAL_KEYS);

                        ace.setPrincipal(principal);
                    }

                    convertExtension(entry, ace, ACE_KEYS);

                    aces.add(ace);
View Full Code Here


                ace.getValue().removeAll(removePermissions);
            }

            // create new ACE
            if (!ace.getValue().isEmpty()) {
                newAces.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(ace.getKey()),
                        new ArrayList<String>(ace.getValue())));
            }
        }

        // find all ACEs that should be added but are not in the original ACE
        // list
        for (Map.Entry<String, Set<String>> ace : adds.entrySet()) {
            if (!originals.containsKey(ace.getKey()) && !ace.getValue().isEmpty()) {
                newAces.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(ace.getKey()),
                        new ArrayList<String>(ace.getValue())));
            }
        }

        return new AccessControlListImpl(newAces);
View Full Code Here

        for (CmisAccessControlEntryType entry : acl.getPermission()) {
            if (entry == null) {
                continue;
            }

            AccessControlEntryImpl ace = new AccessControlEntryImpl();
            ace.setDirect(entry.isDirect());
            ace.setPermissions(entry.getPermission());
            AccessControlPrincipalDataImpl principal = new AccessControlPrincipalDataImpl(
                    entry.getPrincipal() == null ? null : entry.getPrincipal().getPrincipalId());
            convertExtension(entry.getPrincipal(), principal);
            ace.setPrincipal(principal);

            // handle extensions
            convertExtension(entry, ace);

            aces.add(ace);
View Full Code Here

        List<Ace> aces = new ArrayList<Ace>();

        int i = 0;
        for (String principalId : principals) {
            aces.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(principalId), controlParser
                    .getValues(Constants.CONTROL_ADD_ACE_PERMISSION, i)));
            i++;
        }

        return new AccessControlListImpl(aces);
View Full Code Here

        List<Ace> aces = new ArrayList<Ace>();

        int i = 0;
        for (String principalId : principals) {
            aces.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(principalId), controlParser
                    .getValues(Constants.CONTROL_REMOVE_ACE_PERMISSION, i)));
            i++;
        }

        return new AccessControlListImpl(aces);
View Full Code Here

        List<Object> jsonAces = getList(json.get(JSON_ACL_ACES));
        if (jsonAces != null) {
            for (Object obj : jsonAces) {
                Map<String, Object> entry = getMap(obj);
                if (entry != null) {
                    AccessControlEntryImpl ace = new AccessControlEntryImpl();

                    Boolean isDirect = getBoolean(entry, JSON_ACE_IS_DIRECT);
                    ace.setDirect(isDirect != null ? isDirect.booleanValue() : true);

                    List<Object> jsonPermissions = getList(entry.get(JSON_ACE_PERMISSIONS));
                    if (jsonPermissions != null) {
                        List<String> permissions = new ArrayList<String>();
                        for (Object perm : jsonPermissions) {
                            if (perm != null) {
                                permissions.add(perm.toString());
                            }
                        }
                        ace.setPermissions(permissions);
                    }

                    Map<String, Object> jsonPrincipal = getMap(entry.get(JSON_ACE_PRINCIPAL));
                    if (jsonPrincipal != null) {
                        AccessControlPrincipalDataImpl principal = new AccessControlPrincipalDataImpl();

                        principal.setPrincipalId(getString(jsonPrincipal, JSON_ACE_PRINCIPAL_ID));

                        convertExtension(jsonPrincipal, principal, PRINCIPAL_KEYS);

                        ace.setPrincipal(principal);
                    }

                    convertExtension(entry, ace, ACE_KEYS);

                    aces.add(ace);
View Full Code Here

            // create principal
            AccessControlPrincipalDataImpl principal = new AccessControlPrincipalDataImpl();
            principal.setPrincipalId(ue.getKey());

            // create ACE
            AccessControlEntryImpl entry = new AccessControlEntryImpl();
            entry.setPrincipal(principal);
            entry.setPermissions(new ArrayList<String>());
            entry.getPermissions().add(CMIS_READ);
            if (!ue.getValue().booleanValue() && file.canWrite()) {
                entry.getPermissions().add(CMIS_WRITE);
                entry.getPermissions().add(CMIS_ALL);
            }

            entry.setDirect(true);

            // add ACE
            result.getAces().add(entry);
        }
View Full Code Here

                ace.getValue().removeAll(removePermissions);
            }

            // create new ACE
            if (!ace.getValue().isEmpty()) {
                newAces.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(ace.getKey()),
                        new ArrayList<String>(ace.getValue())));
            }
        }

        // find all ACEs that should be added but are not in the original ACE
        // list
        for (Map.Entry<String, Set<String>> ace : adds.entrySet()) {
            if (!originals.containsKey(ace.getKey()) && !ace.getValue().isEmpty()) {
                newAces.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(ace.getKey()),
                        new ArrayList<String>(ace.getValue())));
            }
        }

        return new AccessControlListImpl(newAces);
View Full Code Here

        List<Object> jsonAces = getList(json.get(JSON_ACL_ACES));
        if (jsonAces != null) {
            for (Object obj : jsonAces) {
                Map<String, Object> entry = getMap(obj);
                if (entry != null) {
                    AccessControlEntryImpl ace = new AccessControlEntryImpl();

                    Boolean isDirect = getBoolean(entry, JSON_ACE_IS_DIRECT);
                    ace.setDirect(isDirect != null ? isDirect.booleanValue() : true);

                    List<Object> jsonPermissions = getList(entry.get(JSON_ACE_PERMISSIONS));
                    if (jsonPermissions != null) {
                        List<String> permissions = new ArrayList<String>();
                        for (Object perm : jsonPermissions) {
                            if (perm != null) {
                                permissions.add(perm.toString());
                            }
                        }
                        ace.setPermissions(permissions);
                    }

                    Map<String, Object> jsonPrincipal = getMap(entry.get(JSON_ACE_PRINCIPAL));
                    if (jsonPrincipal != null) {
                        AccessControlPrincipalDataImpl principal = new AccessControlPrincipalDataImpl();

                        principal.setId(getString(jsonPrincipal, JSON_ACE_PRINCIPAL_ID));

                        convertExtension(jsonPrincipal, principal, PRINCIPAL_KEYS);

                        ace.setPrincipal(principal);
                    }

                    convertExtension(entry, ace, ACE_KEYS);

                    aces.add(ace);
View Full Code Here

        for (CmisAccessControlEntryType entry : acl.getPermission()) {
            if (entry == null) {
                continue;
            }

            AccessControlEntryImpl ace = new AccessControlEntryImpl();
            ace.setDirect(entry.isDirect());
            ace.setPermissions(entry.getPermission());
            AccessControlPrincipalDataImpl principal = new AccessControlPrincipalDataImpl(
                    entry.getPrincipal() == null ? null : entry.getPrincipal().getPrincipalId());
            convertExtension(entry.getPrincipal(), principal);
            ace.setPrincipal(principal);

            // handle extensions
            convertExtension(entry, ace);

            aces.add(ace);
View Full Code Here

TOP

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

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.