cz.metacentrum.perun.core.api.Group.getName()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(14.6k)|赞(0)|评价(0)|浏览(92)

本文整理了Java中cz.metacentrum.perun.core.api.Group.getName()方法的一些代码示例,展示了Group.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Group.getName()方法的具体详情如下:
包路径:cz.metacentrum.perun.core.api.Group
类名称:Group
方法名:getName

Group.getName介绍

暂无

代码示例

代码示例来源:origin: CESNET/perun

@Override
public int compareTo(PerunBean perunBean) {
  if(perunBean == null) throw new NullPointerException("PerunBean to compare with is null.");
  if(perunBean instanceof Group) {
    Group group = (Group) perunBean;
    if (this.getName() == null && group.getName() != null) return -1;
    if (group.getName() == null && this.getName() != null) return 1;
    if (this.getName() == null && group.getName() == null) return 0;
    return this.getName().compareToIgnoreCase(group.getName());
  } else {
    return (this.getId() - perunBean.getId());
  }
}

代码示例来源:origin: CESNET/perun

/**
 * VOOTGroup represents group encoded according to the OpenSocial Social Data Specification using in VOOT protocol.
 *
 * @param group                   group
 * @param voShortName             short name of vo
 * @param voot_membership_role    membership role of person in group
 */
public VOOTGroup(Group group, String voShortName, String voot_membership_role) throws VOOTException{
  //group must be in vo
  if(voShortName == null) throw new VOOTException("internal_error_exception");
  this.id = voShortName.concat(":").concat(group.getName());
  this.title = group.getName();
  this.description = group.getDescription();
  this.voot_membership_role = voot_membership_role;
}

代码示例来源:origin: CESNET/perun

@Override
public String serializeToString() {
  StringBuilder str = new StringBuilder();
  return str.append(this.getClass().getSimpleName()).append(":[").append(
    "id=<").append(getId()).append(">").append(
    ", parentGroupId=<").append(getParentGroupId() == null ? "\\0" : getParentGroupId()).append(">").append(
    ", name=<").append(getName() == null ? "\\0" : BeansUtils.createEscaping(getName())).append(">").append(
    ", shortName=<").append(getShortName() == null ? "\\0" : BeansUtils.createEscaping(getShortName())).append(">").append(
    ", description=<").append(getDescription() == null ? "\\0" : BeansUtils.createEscaping(getDescription())).append(">").append(
    ", voId=<").append(getVoId()).append(">").append(
    ']').toString();
}

代码示例来源:origin: CESNET/perun

/**
 * Check members states in groups from given Vos.
 *
 * @param vos vos
 * @throws InternalErrorException internal error
 */
private void checkGroupMembersState(List<Vo> vos) throws InternalErrorException {
  List<Group> allGroups = new ArrayList<>();
  for (Vo vo : vos) {
    allGroups.addAll(perun.getGroupsManagerBl().getGroups(sess, vo));
  }
  Calendar today = Calendar.getInstance();
  // remove member groups
  allGroups = allGroups.stream()
      .filter(group -> !group.getName().equals("members"))
      .collect(Collectors.toList());
  for (Group group : allGroups) {
    // check members which should expire today
    checkGroupMemberExpiration(group, today);
    // check members which should be validated today
    checkGroupMemberValidation(group, today);
  }
}

代码示例来源:origin: CESNET/perun

/**
 * Replace link for mail invitation not concerning authz type
 *
 * @param vo vo to get invite link for
 * @param group group if is for group application
 * @param text base of URL for invitation
 * @return full URL to application form
 */
private String buildInviteURL(Vo vo, Group group, String text) {
  if (text == null || text.isEmpty()) return "";
  text += "?vo=" + getEncodedString(vo.getShortName());
  if (group != null) {
    // application for group too
    text += "&group="+getEncodedString(group.getName());
  }
  return text;
}

代码示例来源:origin: CESNET/perun

text += "&group="+getEncodedString(group.getName());
    newValue += namespace + "/registrar/";
    newValue += "?vo="+getEncodedString(vo.getShortName());
    newValue += ((group != null) ? "&group="+getEncodedString(group.getName()) : "");
    newValue += "&page=apps";

代码示例来源:origin: CESNET/perun

/**
 * Update basic group attributes (name and description) in LDAP
 *
 * @param group group after update
 *
 * @throws InternalErrorException
 */
private void updateGroup(Group group) throws InternalErrorException {
  Map<LdapOperation, List<Pair<String,String>>> attributes = new HashMap<>();
  List<Pair<String,String>> listAttributesToBeRemoved = new ArrayList<>();
  List<Pair<String,String>> listAttributesToBeReplaced = new ArrayList<>();
  //change name
  listAttributesToBeReplaced.add(new Pair(ldapAttrCommonName,this.group.getName()));
  listAttributesToBeReplaced.add(new Pair(ldapAttrPerunUniqueGroupName, ldapConnector.getVoShortName(this.group.getVoId()) + ":" + this.group.getName()));
  //change description (or remove it if there is none)
  if(group.getDescription() != null && !group.getDescription().isEmpty()) {
    listAttributesToBeReplaced.add(new Pair(ldapAttrDescription, this.group.getDescription()));
  } else {
    if(ldapConnector.groupAttributeExist(group, ldapAttrDescription)) {
      listAttributesToBeRemoved.add(new Pair(ldapAttrDescription, null));
    }
  }
  //Add all attributes which will be replaced for the group (that also mean added if not exists yet)
  attributes.put(LdapOperation.REPLACE_ATTRIBUTE, listAttributesToBeReplaced);
  //Add all attributes (if any) which will be removed for group
  if(!listAttributesToBeReplaced.isEmpty()) attributes.put(LdapOperation.REMOVE_ATTRIBUTE, listAttributesToBeRemoved);
  //update attributes in LDAP for group
  updateGroupAttributes(attributes, group);
}

代码示例来源:origin: CESNET/perun

List<Pair<String,String>> listAttributesToBeReplaced = new ArrayList<>();
listAttributesToBeReplaced.add(new Pair(ldapAttrCommonName,group.getName()));
listAttributesToBeReplaced.add(new Pair(ldapAttrPerunUniqueGroupName, ldapConnector.getVoShortName(group.getVoId()) + ":" + group.getName()));
if(group.getName().contains(":")) {

代码示例来源:origin: CESNET/perun

private GroupSCIM mapPerunGroupToScimGroup(Group perunGroup) {
  List<String> schemas = new ArrayList<>();
  schemas.add(URN_GROUP);
  GroupSCIM result = new GroupSCIM();
  result.setSchemas(schemas);
  result.setDisplayName(perunGroup.getName());
  result.setId(new Long(perunGroup.getId()));
  try {
    List<Member> perunGroupMembers = perunBl.getGroupsManagerBl().getGroupMembers(session, perunGroup);
    result.setMembers(mapPerunMembersToScimMembers(perunGroupMembers));
  } catch (InternalErrorException ex) {
    log.error("Cannot obtain members of group " + perunGroup.getId() + " in VO " + perunGroup.getVoId(), ex);
  }
  return result;
}

代码示例来源:origin: CESNET/perun

cn+= group.getName();
perunUniqueGroupName+= vo.getShortName() + ":" + group.getName();

代码示例来源:origin: CESNET/perun

@Override
public ApplicationForm getFormForGroup(final Group group) throws PerunException {
  if (group == null) throw new InternalErrorException("Group can't be null");
  try {
    return jdbc.queryForObject(FORM_SELECT + " where vo_id=? and group_id=?", new RowMapper<ApplicationForm>() {
      @Override
      public ApplicationForm mapRow(ResultSet rs, int arg1) throws SQLException {
        ApplicationForm form = new ApplicationForm();
        form.setId(rs.getInt("id"));
        form.setAutomaticApproval(rs.getBoolean("automatic_approval"));
        form.setAutomaticApprovalExtension(rs.getBoolean("automatic_approval_extension"));
        form.setModuleClassName(rs.getString("module_name"));
        form.setGroup(group);
        try {
          form.setVo(vosManager.getVoById(registrarSession, group.getVoId()));
        } catch (Exception ex) {
          // we don't care, shouldn't happen for internal identity.
        }
        return form;
      }
    }, group.getVoId(), group.getId());
  } catch (EmptyResultDataAccessException ex) {
    throw new FormNotExistsException("Form for Group: "+group.getName()+" doesn't exists.");
  }
}

代码示例来源:origin: CESNET/perun

public void addGroup(Group group) throws InternalErrorException {
  // Create a set of attributes
  Attributes attributes = new BasicAttributes();
  // Create the objectclass to add
  Attribute objClasses = new BasicAttribute(EventProcessorImpl.ldapAttrObjectClass);
  objClasses.add(EventProcessorImpl.objectClassTop);
  objClasses.add(EventProcessorImpl.objectClassPerunGroup);
  // Add attributes
  attributes.put(objClasses);
  attributes.put(EventProcessorImpl.ldapAttrCommonName, group.getName());
  attributes.put(EventProcessorImpl.ldapAttrPerunGroupId, String.valueOf(group.getId()));
  attributes.put(EventProcessorImpl.ldapAttrPerunUniqueGroupName, new String(this.getVoShortName(group.getVoId()) + ":" + group.getName()));
  attributes.put(EventProcessorImpl.ldapAttrPerunVoId, String.valueOf(group.getVoId()));
  if(group.getDescription() != null && !group.getDescription().isEmpty()) attributes.put(EventProcessorImpl.ldapAttrDescription, group.getDescription());
  if(group.getParentGroupId() != null) {
    attributes.put(EventProcessorImpl.ldapAttrPerunParentGroup, EventProcessorImpl.ldapAttrPerunGroupId + "=" + group.getParentGroupId().toString() + "," + EventProcessorImpl.ldapAttrPerunVoId + "=" + group.getVoId() + "," + ldapProperties.getLdapBase());
    attributes.put(EventProcessorImpl.ldapAttrPerunParentGroupId, group.getParentGroupId().toString());
  }
  // Create the entry
  try {
    ldapTemplate.bind(getGroupDN(String.valueOf(group.getVoId()), String.valueOf(group.getId())), null, attributes);
    log.debug("New entry created in LDAP: Group {} in Vo with Id=" + group.getVoId() + ".", group);
  } catch (NameNotFoundException e) {
    throw new InternalErrorException(e);
  }
}

代码示例来源:origin: CESNET/perun

public void removeMemberFromGroup(Member member, Group group) throws InternalErrorException {
  //Remove member from group
  Attribute uniqueMember = new BasicAttribute(EventProcessorImpl.ldapAttrUniqueMember, EventProcessorImpl.ldapAttrPerunUserId + "=" + member.getUserId() + "," + EventProcessorImpl.organizationalUnitPeople + "," + ldapProperties.getLdapBase());
  ModificationItem uniqueMemberItem = new ModificationItem(DirContext.REMOVE_ATTRIBUTE, uniqueMember);
  this.updateGroup(group, new ModificationItem[] {uniqueMemberItem});
  //Remove member from vo if this group is membersGroup
  if(group.getName().equals(VosManager.MEMBERS_GROUP) && group.getParentGroupId() == null) {
    //Remove info from vo
    this.updateVo(group.getVoId(), new ModificationItem[] {uniqueMemberItem});
    //Remove also information from user
    Attribute memberOfPerunVo = new BasicAttribute(EventProcessorImpl.ldapAttrMemberOfPerunVo, String.valueOf(group.getVoId()));
    ModificationItem memberOfPerunVoItem = new ModificationItem(DirContext.REMOVE_ATTRIBUTE, memberOfPerunVo);
    this.updateUserWithUserId(String.valueOf(member.getUserId()), new ModificationItem[] {memberOfPerunVoItem});
  }
  //Remove group info from member
  Attribute memberOf = new BasicAttribute(EventProcessorImpl.ldapAttrMemberOf, EventProcessorImpl.ldapAttrPerunGroupId + "=" + group.getId() + "," + EventProcessorImpl.ldapAttrPerunVoId + "=" + group.getVoId() + "," + ldapProperties.getLdapBase());
  ModificationItem memberOfItem = new ModificationItem(DirContext.REMOVE_ATTRIBUTE, memberOf);
  this.updateUserWithUserId(String.valueOf(member.getUserId()), new ModificationItem[] {memberOfItem});
}

代码示例来源:origin: CESNET/perun

public void addMemberToGroup(Member member, Group group) throws InternalErrorException {
  //Add member to group
  Attribute uniqueMember = new BasicAttribute(EventProcessorImpl.ldapAttrUniqueMember, EventProcessorImpl.ldapAttrPerunUserId + "=" + member.getUserId() + "," + EventProcessorImpl.organizationalUnitPeople + "," + ldapProperties.getLdapBase());
  ModificationItem uniqueMemberItem = new ModificationItem(DirContext.ADD_ATTRIBUTE, uniqueMember);
  this.updateGroup(group, new ModificationItem[] {uniqueMemberItem});
  //Add member to vo if this group is memebrsGroup
  if(group.getName().equals(VosManager.MEMBERS_GROUP) && group.getParentGroupId() == null) {
    //Add info to vo
    this.updateVo(group.getVoId(), new ModificationItem[] {uniqueMemberItem});
    //Add info also to user
    Attribute memberOfPerunVo = new BasicAttribute(EventProcessorImpl.ldapAttrMemberOfPerunVo, String.valueOf(group.getVoId()));
    ModificationItem memberOfPerunVoItem = new ModificationItem(DirContext.ADD_ATTRIBUTE, memberOfPerunVo);
    this.updateUserWithUserId(String.valueOf(member.getUserId()), new ModificationItem[] {memberOfPerunVoItem});
  }
  //Add group info to member
  Attribute memberOf = new BasicAttribute("memberOf", EventProcessorImpl.ldapAttrPerunGroupId + "=" + group.getId() + "," + EventProcessorImpl.ldapAttrPerunVoId + "=" + group.getVoId() + "," + ldapProperties.getLdapBase());
  ModificationItem memberOfItem = new ModificationItem(DirContext.ADD_ATTRIBUTE, memberOf);
  this.updateUserWithUserId(String.valueOf(member.getUserId()), new ModificationItem[] {memberOfItem});
}

代码示例来源:origin: CESNET/perun

public RichGroup(Group group, List<Attribute> attrs) {
  super(group.getId(), group.getName(), group.getDescription(),
      group.getCreatedAt(), group.getCreatedBy(),
      group.getModifiedAt(), group.getModifiedBy(),
      group.getParentGroupId(), group.getCreatedByUid(),
      group.getModifiedByUid());
  this.setVoId(group.getVoId());
  this.groupAttributes = attrs;
}

代码示例来源:origin: CESNET/perun

if (app.getGroup() != null && app.getGroup().getName().equals(ADD_NEW_NETWORKS_GROUP_NAME)) {
  perun.getGroupsManager().removeMember(session, app.getGroup(), member);

代码示例来源:origin: CESNET/perun

if (app.getGroup() != null && app.getGroup().getName().equals(ADD_NEW_COLLECTIONS_GROUP_NAME)) {
  perun.getGroupsManager().removeMember(session, app.getGroup(), member);

代码示例来源:origin: CESNET/perun

((application.getGroup() != null) ? application.getGroup().getName() : "nogroup") +
application.getCreatedBy()+application.getExtSourceName()+application.getExtSourceType();

代码示例来源:origin: CESNET/perun

if (g.contains(group)) {
      throw new AlreadyRegisteredException("You are already member of group "+group.getName()+".");
    } else {
      if (!regs.isEmpty()) {
        throw new DuplicateRegistrationAttemptException("Initial application for Group: "+group.getName()+" already exists.", actor, extSourceName, regs.get(0));
    if (!regs.isEmpty()) {
      throw new DuplicateRegistrationAttemptException("Initial application for Group: "+group.getName()+" already exists.", actor, extSourceName, regs.get(0));
    throw new DuplicateRegistrationAttemptException("Initial application for Group: "+group.getName()+" already exists.", actor, extSourceName, regs.get(0));
if (!regs.isEmpty()) {
  throw new DuplicateRegistrationAttemptException("Extension application for Group: " + group.getName() + " already exists.", actor, extSourceName, regs.get(0));

代码示例来源:origin: CESNET/perun

newValue += namespace + "/registrar/";
    newValue += "?vo="+getEncodedString(app.getVo().getShortName());
    newValue += ((app.getGroup() != null) ? "&group="+getEncodedString(app.getGroup().getName()) : "");
    try {
      newValue += "&i=" + URLEncoder.encode(i, "UTF-8") + "&m=" + URLEncoder.encode(m, "UTF-8");
if (url != null && !url.isEmpty()) url += "&group=" + getEncodedString(app.getGroup().getName());

相关文章