Package org.exoplatform.services.organization.impl

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


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


    * {@inheritDoc}
    */
   public void addChild(Group parent, Group child, boolean broadcast) throws Exception
   {
      String groupId = "/" + child.getGroupName();
      GroupImpl childImpl = (GroupImpl)child;
      if (parent != null)
      {
         Group parentGroup = findGroupById(parent.getId());
         if (parentGroup == null)
         {
            throw new InvalidNameException("Can't add node to not existed parent " + parent.getId());
         }

         groupId = parentGroup.getId() + "/" + child.getGroupName();
         childImpl.setParentId(parentGroup.getId());
      }
      else if (child.getId() != null)
      {
         groupId = child.getId();
      }

      Object o = findGroupById(groupId);
      if (o != null)
      {
         Object[] args = {child.getGroupName()};
         throw new UniqueObjectException("OrganizationService.unique-group-exception", args);
      }
      childImpl.setId(groupId);

      if (broadcast)
         preSave(child, true);

      Session session = service_.openSession();
View Full Code Here

      listeners_.add(listener);
   }

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

   public void addChild(Group parent, Group child, boolean broadcast) throws Exception
   {
      Session session = service_.openSession();
      String groupId = "/" + child.getGroupName();
      GroupImpl childImpl = (GroupImpl)child;
      if (parent != null)
      {
         Group parentGroup = (Group)session.get(GroupImpl.class, parent.getId());
         groupId = parentGroup.getId() + "/" + child.getGroupName();
         childImpl.setParentId(parentGroup.getId());
      }
      else if (child.getId() != null)
      {
         groupId = child.getId();
      }
      Object o = session.get(GroupImpl.class, groupId);
      if (o != null)
      {
         Object[] args = {child.getGroupName()};
         throw new UniqueObjectException("OrganizationService.unique-group-exception", args);
      }
      if (broadcast)
         preSave(child, true);
      childImpl.setId(groupId);

      session = service_.openSession();
      session.save(childImpl);
      if (broadcast)
         postSave(child, true);
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

    */
   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

   /**
    * {@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

            parentId = idBuffer.toString();
      }
      try
      {
         Attributes attrs = ctx.getAttributes(groupDN);
         GroupImpl group = new GroupImpl();
         group.setGroupName(membershipParts[0]);
         group.setId(idBuffer.toString());
         group.setDescription(ldapAttrMapping.getAttributeValueAsString(attrs, ldapAttrMapping.ldapDescriptionAttr));
         group.setLabel(ldapAttrMapping.getAttributeValueAsString(attrs, ldapAttrMapping.groupLabelAttr));
         group.setParentId(parentId);
         return group;
      }
      catch (NameNotFoundException e)
      {
         if (LOG.isDebugEnabled())
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.