Package net.sf.archimede.model.group

Examples of net.sf.archimede.model.group.Group


                    if (!node.hasNode(NodesTypes.PREFIX + GROUPS_NODE_NAME)) {
                      return groups;
                    }
                    for (NodeIterator ni = node.getNode(NodesTypes.PREFIX + GROUPS_NODE_NAME).getNodes(); ni.hasNext(); ) {
                        Node groupNode = ni.nextNode();
                        Group group = groupDao.retrieve(groupNode.getUUID());
                        groups.add(group);
                    }
                    this.collection.setGroups(groups);
                    this.isGroupsInit = true;
                    return this.collection.getGroups();
View Full Code Here


        this.newDescription = newDescription1;
    }
   
    public String newGroup() {
        if (this.newName != null && !this.newName.trim().equals("")) {
            Group group = new GroupImpl();
            group.setName(this.newName);
            group.setDescription(this.newDescription);
           
            CollectionBean collectionBean = (CollectionBean) FacesContext.getCurrentInstance().getApplication().createValueBinding(CollectionBean.BEAN_REF).getValue(FacesContext.getCurrentInstance());    
            Collection parentCollection = collectionBean.getSelectedCollection();
           
            group.setParent(parentCollection);
           
            GroupDao.createInstance().save(group);
           
            this.newName = null;
            this.newDescription = null;
View Full Code Here

       
        return "";
    }
   
    public String update() {
        Group selectedGroup = (Group) this.collectionGroups.getRowData();
         
        try {
            GroupDao.createInstance().update(selectedGroup);
        } catch (ObjectLockedException e) {
            // TODO Auto-generated catch block
View Full Code Here

       
        return "";
    }
   
    public String remove() {
        Group selectedGroup = (Group) this.collectionGroups.getRowData();
       
        try {
            GroupDao.createInstance().remove(selectedGroup);
        } catch (ObjectLockedException e) {
            e.printStackTrace();
View Full Code Here

        return "";
    }
   
    public String removeUserFromGroup() throws ObjectLockedException, ObjectExistsException {
        ViewGroup viewGroup = (ViewGroup) collectionGroups.getRowData();
        Group group = viewGroup.getGroup();

        ViewUser viewUser = (ViewUser) viewGroup.getUsersModel().getRowData();
        group.getUsers().remove(viewUser.getUser());
       
        GroupDao.createInstance().update(group);
       
        viewUser.setMember(false);
       
View Full Code Here

   
    public String addUserToGroup() throws ObjectLockedException, ObjectExistsException {
        ViewGroup viewGroup = (ViewGroup) this.collectionGroups.getRowData();
       
        ViewUser viewUser = (ViewUser) viewGroup.getUsersModel().getRowData();
        Group group = viewGroup.getGroup();
        if (group.getUsers() == null) {
            group.setUsers(new ArrayList());
        }
        group.getUsers().add(viewUser.getUser());
       
        GroupDao.createInstance().update(group);
       
        viewUser.setMember(true);
       
View Full Code Here

    public DataModel getGroupsModel() {
        if (this.groups.getWrappedData() == null) {
            List groupsList = this.collection.getGroups();
            List viewGroupsList = new ArrayList(groupsList.size());
            for (Iterator it = groupsList.iterator(); it.hasNext(); ){
                Group currentGroup = (Group) it.next();
                viewGroupsList.add(new ViewGroup(currentGroup));
            }
            Collections.sort(viewGroupsList, new ContentSortComparator());
            this.groups.setWrappedData(viewGroupsList);
        }
View Full Code Here

    public boolean equals(Object object) {
        if (this == object) {
            return true;
        }
        if (object instanceof Group) {
            Group otherGroup = (Group) object;
            return getId().equals(otherGroup.getId());
        }
        return false;
    }
View Full Code Here

    public List getGroupsContentPermissions() {
       
        Map groupsMap = new HashMap();
        List allGroups = GroupDao.createInstance().list();
        for (Iterator it = allGroups.iterator(); it.hasNext(); ) {
            Group currentGroup = (Group) it.next();
            GroupContentPermissions gcp = new GroupContentPermissions(this, currentGroup);
            groupsMap.put(currentGroup, gcp);
        }
       
        if (this.readGroups != null) {
          for (Iterator it = this.readGroups.iterator(); it.hasNext(); ) {
              Group currentGroup = (Group) it.next();
              GroupContentPermissions gcp = (GroupContentPermissions) groupsMap.get(currentGroup);
              gcp.setReadable(true);
              groupsMap.put(currentGroup, gcp);
          }
        }
       
        if (this.writeGroups != null) {
          for (Iterator it = this.writeGroups.iterator(); it.hasNext(); ) {
              Group currentGroup = (Group) it.next();
              GroupContentPermissions gcp = (GroupContentPermissions) groupsMap.get(currentGroup);
              gcp.setWritable(true);
              groupsMap.put(currentGroup, gcp);
          }
        }
       
        if (this.removeGroups != null) {
          for (Iterator it = this.removeGroups.iterator(); it.hasNext(); ) {
              Group currentGroup = (Group) it.next();
              GroupContentPermissions gcp = (GroupContentPermissions) groupsMap.get(currentGroup);
              gcp.setRemoveable(true);
              groupsMap.put(currentGroup, gcp);
          }
        }
       
        if (this.ownerGroups != null) {
          for (Iterator it = this.ownerGroups.iterator(); it.hasNext(); ) {
              Group currentGroup = (Group) it.next();
              GroupContentPermissions gcp = (GroupContentPermissions) groupsMap.get(currentGroup);
              gcp.setOwner(true);
              groupsMap.put(currentGroup, gcp);
          }
        }
View Full Code Here

                    this.addContentMixin(node);
                }
            Value[] values = new Value[readGroups.size()];
            for (ListIterator it = readGroups.listIterator(); it.hasNext(); ) {
                int index = it.nextIndex();
                Group currentGroup = (Group) it.next();
                Node groupNode = node.getSession().getNodeByUUID(currentGroup.getId());
                values[index] = valueFactory.createValue(groupNode);
            }
            node.setProperty(NodesTypes.PREFIX + READ_GROUPS_PROPERTY, values);
          }
        }
       
        {
            node.setProperty(NodesTypes.PREFIX + READ_USERS_PROPERTY, new Value[0]);
          List readUsers = content.getReadUsers();
          if (readUsers != null && !readUsers.isEmpty()) {
                if (!node.isNodeType(NodesTypes.PREFIX + ContentDao.NAME)) {
                    this.addContentMixin(node);
                }
            Value[] values = new Value[readUsers.size()];
            for (ListIterator it = readUsers.listIterator(); it.hasNext(); ) {
                int index = it.nextIndex();
                User currentUser = (User) it.next();
                values[index] = valueFactory.createValue(currentUser.getUsername());
            }
 
            node.setProperty(NodesTypes.PREFIX + READ_USERS_PROPERTY, values);
          }
        }
       
        {
            node.setProperty(NodesTypes.PREFIX + WRITE_GROUPS_PROPERTY, new Value[0]);
          List writeGroups = content.getWriteGroups();
          if (writeGroups != null && !writeGroups.isEmpty()) {
                if (!node.isNodeType(NodesTypes.PREFIX + ContentDao.NAME)) {
                    this.addContentMixin(node);
                }
            Value[] values = new Value[writeGroups.size()];
            for (ListIterator it = writeGroups.listIterator(); it.hasNext(); ) {
                int index = it.nextIndex();
                Group currentGroup = (Group) it.next();
                Node groupNode = node.getSession().getNodeByUUID(currentGroup.getId());
                values[index] = valueFactory.createValue(groupNode);
            }
            node.setProperty(NodesTypes.PREFIX + WRITE_GROUPS_PROPERTY, values);
          }
        }
       
        {
            node.setProperty(NodesTypes.PREFIX + WRITE_USERS_PROPERTY, new Value[0]);
          List writeUsers = content.getWriteUsers();
          if (writeUsers != null && !writeUsers.isEmpty()) {
                if (!node.isNodeType(NodesTypes.PREFIX + ContentDao.NAME)) {
                    this.addContentMixin(node);
                }
            Value[] values = new Value[writeUsers.size()];
            for (ListIterator it = writeUsers.listIterator(); it.hasNext(); ) {
                int index = it.nextIndex();
                    User currentUser = (User) it.next();
                values[index] = valueFactory.createValue(currentUser.getUsername());
            }
            node.setProperty(NodesTypes.PREFIX + WRITE_USERS_PROPERTY, values);
          }
        }
       
        {
            node.setProperty(NodesTypes.PREFIX + REMOVE_GROUPS_PROPERTY, new Value[0]);
          List removeGroups = content.getRemoveGroups();
          if (removeGroups != null && !removeGroups.isEmpty()) {
                if (!node.isNodeType(NodesTypes.PREFIX + ContentDao.NAME)) {
                    this.addContentMixin(node);
                }
            Value[] values = new Value[removeGroups.size()];
            for (ListIterator it = removeGroups.listIterator(); it.hasNext(); ) {
                int index = it.nextIndex();
                Group currentGroup = (Group) it.next();
                Node groupNode = node.getSession().getNodeByUUID(currentGroup.getId());
                values[index] = valueFactory.createValue(groupNode);
            }
            node.setProperty(NodesTypes.PREFIX + REMOVE_GROUPS_PROPERTY, values);
          }
        }
       
        {
            node.setProperty(NodesTypes.PREFIX + REMOVE_USERS_PROPERTY, new Value[0]);
          List removeUsers = content.getRemoveUsers();
          if (removeUsers != null && !removeUsers.isEmpty()) {
                if (!node.isNodeType(NodesTypes.PREFIX + ContentDao.NAME)) {
                    this.addContentMixin(node);
                }
            Value[] values = new Value[removeUsers.size()];
            for (ListIterator it = removeUsers.listIterator(); it.hasNext(); ) {
                int index = it.nextIndex();
                    User currentUser = (User) it.next();
                values[index] = valueFactory.createValue(currentUser.getUsername());
            }
            node.setProperty(NodesTypes.PREFIX + REMOVE_USERS_PROPERTY, values);
          }
        }
       
        {
            node.setProperty(NodesTypes.PREFIX + OWNER_GROUPS_PROPERTY, new Value[0]);
          List ownerGroups = content.getOwnerGroups();
          if (ownerGroups != null && !ownerGroups.isEmpty()) {
                if (!node.isNodeType(NodesTypes.PREFIX + ContentDao.NAME)) {
                    this.addContentMixin(node);
                }
            Value[] values = new Value[ownerGroups.size()];
            for (ListIterator it = ownerGroups.listIterator(); it.hasNext(); ) {
                int index = it.nextIndex();
                Group currentGroup = (Group) it.next();
                Node groupNode = node.getSession().getNodeByUUID(currentGroup.getId());
                values[index] = valueFactory.createValue(groupNode);
            }
            node.setProperty(NodesTypes.PREFIX + OWNER_GROUPS_PROPERTY, values);
          }
        }
View Full Code Here

TOP

Related Classes of net.sf.archimede.model.group.Group

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.