Package org.exoplatform.services.organization.impl

Examples of org.exoplatform.services.organization.impl.GroupImpl


   /**
    * {@inheritDoc}
    */
   public final Group createGroupInstance()
   {
      return new GroupImpl();
   }
View Full Code Here


                  if (LOG.isDebugEnabled())
                     LOG.debug("Group " + child + ", parent  " + parent + " already exists. ");
                  return;
               }

               GroupImpl group = (GroupImpl)child;
               if (broadcast)
                  preSave(group, true);
               ctx.createSubcontext(groupDN, ldapAttrMapping.groupToAttributes(child));
               if (broadcast)
                  postSave(group, true);
View Full Code Here

      return buffer.toString();
   }

   protected void setId(Group parent, Group g)
   {
      GroupImpl group = (GroupImpl)g;
      if (parent == null)
      {
         group.setId("/" + group.getGroupName());
         return;
      }
      group.setId(parent.getId() + "/" + group.getGroupName());
      group.setParentId(parent.getId());
   }
View Full Code Here

    */
   public final Group attributesToGroup(Attributes attrs)
   {
      if (attrs == null || attrs.size() == 0)
         return null;
      Group group = new GroupImpl();
      group.setGroupName(getAttributeValueAsString(attrs, groupNameAttr));
      group.setDescription(getAttributeValueAsString(attrs, ldapDescriptionAttr));
      group.setLabel(getAttributeValueAsString(attrs, groupLabelAttr));
      return group;
   }
View Full Code Here

      }
   }
  
   public void testGroupsNode() throws Exception
   {
      GroupImpl group1 = new GroupImpl("platform");
      GroupImpl group2 = new GroupImpl();
      group2.setId("/platform/users");
      GroupImpl group3 = new GroupImpl("my-group-name2");
      group3.setParentId("/platform");
     
      groupListener.preSave(group1, true);
      Node node = (Node)session.getItem("/Groups/Path/Home/" + group1.getGroupName());
      assertNotNull(node);
      node = node.getNode("ApplicationData");
      assertTrue(node.isNodeType("nt:folder"));
      assertFalse(node.canAddMixin("mix:referenceable"));
      assertFalse(node.canAddMixin("exo:privilegeable"));
      assertTrue(((ExtendedNode)node).getACL().hasPermissions());
      assertNotNull(((ExtendedNode)node).getACL().getPermissions("*:/platform/administrators"));     
          
      groupListener.preSave(group2, true);
      node = (Node)session.getItem("/Groups/Path/Home" + group2.getId());
      assertNotNull(node);
      node = node.getNode("ApplicationData");
      assertTrue(node.isNodeType("nt:folder"));
      assertFalse(node.canAddMixin("mix:referenceable"));
      assertFalse(node.canAddMixin("exo:privilegeable"));
      assertTrue(((ExtendedNode)node).getACL().hasPermissions());
      assertNotNull(((ExtendedNode)node).getACL().getPermissions("*:/platform/administrators"));     
      groupListener.preDelete(group2);
      try
      {
         session.getItem("/Groups/Path/Home" + group2.getId());
         fail("A PathNotFoundException is expected");
      }
      catch (PathNotFoundException e)
      {
         // ignore me
      }     
      groupListener.preSave(group3, true);
      node = (Node)session.getItem("/Groups/Path/Home" + group3.getParentId() + "/" + group3.getGroupName());
      assertNotNull(node);
      node = node.getNode("ApplicationData");
      assertTrue(node.isNodeType("nt:folder"));
      assertFalse(node.canAddMixin("mix:referenceable"));
      assertFalse(node.canAddMixin("exo:privilegeable"));
      assertTrue(((ExtendedNode)node).getACL().hasPermissions());
      assertNotNull(((ExtendedNode)node).getACL().getPermissions("*:/platform/administrators"));     
      groupListener.preDelete(group3);
      try
      {
         session.getItem("/Groups/Path/Home" + group3.getParentId() + "/" + group3.getGroupName());
         fail("A PathNotFoundException is expected");
      }
      catch (PathNotFoundException e)
      {
         // ignore me
View Full Code Here

   /**
    * {@inheritDoc}
    */
   public final Group createGroupInstance()
   {
      return new GroupImpl();
   }
View Full Code Here

                     LOG.debug("Group " + child + ", parent  " + parent + " already exists. ");
                  }
                  throw new Exception("Group " + child + ", parent  " + parent + " already exists. ");
               }

               GroupImpl group = (GroupImpl)child;
               if (broadcast)
               {
                  preSave(group, true);
               }
View Full Code Here

      return buffer.toString();
   }

   protected void setId(Group parent, Group g)
   {
      GroupImpl group = (GroupImpl)g;
      if (parent == null)
      {
         group.setId("/" + group.getGroupName());
         return;
      }
      group.setId(parent.getId() + "/" + group.getGroupName());
      group.setParentId(parent.getId());
   }
View Full Code Here

    */
   public final Group attributesToGroup(Attributes attrs)
   {
      if (attrs == null || attrs.size() == 0)
         return null;
      Group group = new GroupImpl();
      group.setGroupName(getAttributeValueAsString(attrs, groupNameAttr));
      group.setDescription(getAttributeValueAsString(attrs, ldapDescriptionAttr));
      group.setLabel(getAttributeValueAsString(attrs, groupLabelAttr));
      return group;
   }
View Full Code Here

      }
   }

   protected Group buildGroup(String groupDN, Attributes attrs) throws NamingException
   {
      GroupImpl group = new GroupImpl();

      // extract group's id, group's name and parent's group from DN
      StringBuffer idBuffer = new StringBuffer();
      String parentId = null;
      String[] baseParts = explodeDN(ldapAttrMapping.groupsURL, true);
      String[] membershipParts = explodeDN(groupDN, true);
      for (int x = (membershipParts.length - baseParts.length - 1); x > -1; x--)
      {
         idBuffer.append("/" + membershipParts[x]);
         if (x == 1)
            parentId = idBuffer.toString();
      }
      group.setGroupName(membershipParts[0]);
      group.setId(idBuffer.toString());
      if (attrs != null)
      {
         group.setDescription(ldapAttrMapping.getAttributeValueAsString(attrs, ldapAttrMapping.ldapDescriptionAttr));
         group.setLabel(ldapAttrMapping.getAttributeValueAsString(attrs, ldapAttrMapping.groupLabelAttr));
      }
      group.setParentId(parentId);

      return group;
   }
View Full Code Here

TOP

Related Classes of org.exoplatform.services.organization.impl.GroupImpl

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.