Package org.jbpm.identity

Examples of org.jbpm.identity.Group


    public void handleAction(JbpmJsfContext context, ActionEvent event) {
        try {
            final FacesContext facesContext = FacesContext.getCurrentInstance();
            final ELContext elContext = facesContext.getELContext();
            final Group group = (Group) groupExpression.getValue(elContext);
            context.getJbpmContext().getSession().delete(group);
            context.addSuccessMessage("Successfully deleted group");
        } catch (Exception ex) {
            context.setError("Failed to delete group", ex);
        }
View Full Code Here


            if (nameValue == null) {
                context.setError("Error loading group", "The group name value is null");
                return;
            }
            final String groupName = nameValue.toString();
            final Group group = identitySession.getGroupByName(groupName);
            if (group == null) {
                context.setError("Error loading group", "No group was found named '" + groupName + "'");
                return;
            }
            targetExpression.setValue(elContext, group);
View Full Code Here

            final Object groupNameValue = groupNameExpression.getValue(elContext);
            if (groupNameValue == null) {
                context.setError("Error creating group", "The group name value is null");
                return;
            }
            final Group group = new Group(groupNameValue.toString());
            if (parentGroupExpression != null) {
                final Object parentGroupValue = parentGroupExpression.getValue(elContext);
                if (parentGroupValue instanceof Group) {
                    group.setParent((Group)parentGroupValue);
                } else if (parentGroupValue != null) {
                    context.setError("Error creating group", "The parent group is not a Group instance");
                    return;
                }
            }
            if (typeExpression != null) {
                final Object typeValue = typeExpression.getValue(elContext);
                if (typeValue == null) {
                    context.setError("Error creating group", "The type value is null");
                    return;
                }
                group.setType(typeValue.toString());
            }
            identitySession.saveGroup(group);
            if (targetExpression != null) {
                targetExpression.setValue(elContext, group);
            }
View Full Code Here

            if (idValue instanceof Long) {
                id = ((Long)idValue).longValue();
            } else {
                id = Long.valueOf(idValue.toString()).longValue();
            }
            final Group group = identitySession.loadGroup(id);
            if (group == null) {
                context.setError("Error loading group", "No group was found with an ID of " + id);
                return;
            }
            targetExpression.setValue(elContext, group);
View Full Code Here

            if (userValue == null) {
                context.setError("Error adding membership", "User value is null");
                return;
            }
            user = (User) userValue;
            final Group group;
            if (groupExpression == null) {
                context.setError("Error adding membership", "Group expression is required");
                return;
            }
            final Object groupValue = groupExpression.getValue(elContext);
View Full Code Here

    while (iter.hasNext()) {
      Element groupElement = (Element) iter.next();
      String name = groupElement.attributeValue("name");
      String type = groupElement.attributeValue("type");
     
      Group group = new Group(name);
      group.setType(type);
      entities.add(group);
      groups.put(name, group);
    }
  }
View Full Code Here

      Element groupElement = (Element) iter.next();
      String childName = groupElement.attributeValue("name");
      String parentName = groupElement.attributeValue("parent");
     
      if (parentName!=null) {
        Group parent = (Group) groups.get(parentName);
        if (parent==null) throw new RuntimeException("unexisting parent group '"+parentName+"'");
        Group child = (Group) groups.get(childName);
       
        parent.addChild(child);
      }
    }
  }
View Full Code Here

      String role = membershipElement.attributeValue("role");
      String userName = membershipElement.attributeValue("user");
      User user = (User) users.get(userName);
      if (user==null) throw new RuntimeException("unexisting membership user '"+userName+"'");
      String groupName = membershipElement.attributeValue("group");
      Group group = (Group) groups.get(groupName);
      if (group==null) throw new RuntimeException("unexisting membership group '"+groupName+"'");
     
      Membership membership = new Membership();
      membership.setRole(role);
      group.addMembership(membership);
      user.addMembership(membership);
     
      entities.add(membership);
    }
  }
View Full Code Here

      entity = (Entity) groups.iterator().next();
     
    } else if ( (term.startsWith("member("))
            && (term.endsWith(")")) ) {
      String roleName = term.substring(7,term.length()-1).trim();
      Group group = (Group) entity;
      Set users = group.getUsersForMembershipName(roleName);
      if (users.size()==0) {
        throw new ExpressionAssignmentException("no users in role '"+roleName+"'");
      }
      entity = (Entity) users.iterator().next();
View Full Code Here

    Token token = executionContext.getToken();
    return executionContext.getContextInstance().getVariable(variableName, token);
  }

  protected Entity getGroupByName(String groupName) {
    Group group = null;
    group = expressionSession.getGroupByName(groupName);
    if (group==null) {
      throw new ExpressionAssignmentException("group '"+groupName+"' couldn't be fetched from the user db");
    }
    return group;
View Full Code Here

TOP

Related Classes of org.jbpm.identity.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.