org.dspace.eperson.Group.getName()方法的使用及代码示例

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

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

Group.getName介绍

暂无

代码示例

代码示例来源:origin: DSpace/DSpace

@Override
public int hashCode() {
  int hash = 7;
  hash = 59 * hash + this.getID().hashCode();
  hash = 59 * hash + (this.getName() != null ? this.getName().hashCode() : 0);
  return hash;
}

代码示例来源:origin: DSpace/DSpace

@Override
public boolean isDirectMember(Group group, EPerson ePerson) {
  // special, group 0 is anonymous
  return StringUtils.equals(group.getName(), Group.ANONYMOUS) || group.contains(ePerson);
}

代码示例来源:origin: DSpace/DSpace

protected void addSpecialGroupsToGrantedAuthorityList(Context context, HttpServletRequest httpServletRequest,
                           List<SimpleGrantedAuthority> grantedAuthorities)
  throws SQLException {
  List<Group> groups = authenticationService.getSpecialGroups(context, httpServletRequest);
  for (Group group : groups) {
    grantedAuthorities.add(new SimpleGrantedAuthority(group.getName()));
  }
}

代码示例来源:origin: DSpace/DSpace

private Pair<String, String> buildGroupMembershipKey(Group group, EPerson eperson) {
  return new ImmutablePair<>(group == null ? "" : group.getName(),
                eperson == null ? "" : eperson.getID().toString());
}

代码示例来源:origin: DSpace/DSpace

/**
   * Does the item allow anonymous access ? ie. authorizedGroups must include id=0.
   */
  private static boolean anonAccessAllowed(Context context, HarvestedItemInfo itemInfo) throws SQLException {
    List<Group> authorizedGroups = authorizeService.getAuthorizedGroups(context, itemInfo.item, Constants.READ);

    for (Group authorizedGroup : authorizedGroups) {
      if (authorizedGroup.getName().equals(Group.ANONYMOUS)) {
        return true;
      }
    }

    return false;
  }
}

代码示例来源:origin: DSpace/DSpace

@Override
public void setName(Group group, String name) throws SQLException {
  if (group.isPermanent()) {
    log.error("Attempt to rename permanent Group {} to {}.",
         group.getName(), name);
    throw new SQLException("Attempt to rename a permanent Group");
  } else {
    group.setName(name);
  }
}

代码示例来源:origin: org.dspace/dspace-xmlui-api

/**
 * Return the current name for the given group ID.
 * @param context The current DSpace context.
 * @param groupID The group id.
 * @return The group's name.
 */
public static String getName(Context context, int groupID) throws SQLException
{
  if (groupID < 0)
  {
    return "New Group";
  }
  
  Group group = Group.find(context,groupID);
  
  if (group == null)
  {
    return "New Group";
  }
  
  return group.getName();
}

代码示例来源:origin: DSpace/DSpace

private boolean willChangeStatus(Item item) throws SQLException {
  List<ResourcePolicy> policies = authorizeService.getPoliciesActionFilter(context, item, Constants.READ);
  for (ResourcePolicy policy : policies) {
    if ((policy.getGroup() != null) && (policy.getGroup().getName().equals("Anonymous"))) {
      if (policy.getStartDate() != null && policy.getStartDate().after(new Date())) {
        return true;
      }
      if (policy.getEndDate() != null && policy.getEndDate().after(new Date())) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: DSpace/DSpace

/**
 * Set the Permission on a Bitstream.
 *
 * @param c        DSpace Context
 * @param g        Dspace Group
 * @param actionID action identifier
 * @param bs       Bitstream
 * @throws SQLException       if database error
 * @throws AuthorizeException if authorization error
 * @see org.dspace.core.Constants
 */
protected void setPermission(Context c, Group g, int actionID, Bitstream bs)
  throws SQLException, AuthorizeException {
  if (!isTest) {
    // remove the default policy
    authorizeService.removeAllPolicies(c, bs);
    // add the policy
    ResourcePolicy rp = resourcePolicyService.create(c);
    rp.setdSpaceObject(bs);
    rp.setAction(actionID);
    rp.setGroup(g);
    resourcePolicyService.update(c, rp);
  } else {
    if (actionID == Constants.READ) {
      System.out.println("\t\tpermissions: READ for " + g.getName());
    } else if (actionID == Constants.WRITE) {
      System.out.println("\t\tpermissions: WRITE for " + g.getName());
    }
  }
}

代码示例来源:origin: DSpace/DSpace

List<ResourcePolicy> policies = authorizeService.getPoliciesActionFilter(context, item, Constants.READ);
for (ResourcePolicy policy : policies) {
  if ((policy.getGroup() != null) && (policy.getGroup().getName().equals("Anonymous"))) {
    if (policy.getStartDate() != null) {
      dates.add(policy.getStartDate());

代码示例来源:origin: DSpace/DSpace

@Override
public void delete(Context context, Group group) throws SQLException {
  if (group.isPermanent()) {
    log.error("Attempt to delete permanent Group $", group.getName());
    throw new SQLException("Attempt to delete a permanent Group");
  }
  context.addEvent(new Event(Event.DELETE, Constants.GROUP, group.getID(),
                group.getName(), getIdentifiers(context, group)));
  //Remove the supervised group from any workspace items linked to us.
  group.getSupervisedItems().clear();
  // Remove any ResourcePolicies that reference this group
  authorizeService.removeGroupPolicies(context, group);
  group.getMemberGroups().clear();
  group.getParentGroups().clear();
  //Remove all eperson references from this group
  Iterator<EPerson> ePeople = group.getMembers().iterator();
  while (ePeople.hasNext()) {
    EPerson ePerson = ePeople.next();
    ePeople.remove();
    ePerson.getGroups().remove(group);
  }
  // empty out group2groupcache table (if we do it after we delete our object we get an issue with references)
  group2GroupCacheDAO.deleteAll(context);
  // Remove ourself
  groupDAO.delete(context, group);
  rethinkGroupCache(context, false);
  log.info(LogManager.getHeader(context, "delete_group", "group_id="
    + group.getID()));
}

代码示例来源:origin: DSpace/DSpace

} else if (StringUtils.equals(group.getName(), Group.ANONYMOUS)) {
  return true;

代码示例来源:origin: DSpace/DSpace

@Override
public void removeMember(Context context, Group groupParent, Group childGroup) throws SQLException {
  if (groupParent.remove(childGroup)) {
    childGroup.removeParentGroup(groupParent);
    context.addEvent(
      new Event(Event.REMOVE, Constants.GROUP, groupParent.getID(), Constants.GROUP, childGroup.getID(),
           childGroup.getName(), getIdentifiers(context, groupParent)));
  }
}

代码示例来源:origin: DSpace/DSpace

System.out.println("CHECK WARNING: Item " + item.getHandle() + ", Bundle " + bn
    .getName() + " allows READ by " +
    ((rp.getEPerson() != null) ? "Group " + rp.getGroup().getName() :
        "EPerson " + rp.getEPerson().getFullName()));
System.out.println("CHECK WARNING: Item " + item.getHandle() + ", Bitstream " + bs
    .getName() + " (in Bundle " + bn.getName() + ") allows READ by " +
    ((rp.getEPerson() != null) ? "Group " + rp.getGroup().getName() :
        "EPerson " + rp.getEPerson().getFullName()));

代码示例来源:origin: DSpace/DSpace

@Override
public void addMember(Context context, Group groupParent, Group groupChild) throws SQLException {
  // don't add if it's already a member
  // and don't add itself
  if (groupParent.contains(groupChild) || groupParent.getID() == groupChild.getID()) {
    return;
  }
  groupParent.addMember(groupChild);
  groupChild.addParentGroup(groupParent);
  context.addEvent(new Event(Event.ADD, Constants.GROUP, groupParent.getID(), Constants.GROUP, groupChild.getID(),
                groupChild.getName(), getIdentifiers(context, groupParent)));
}

代码示例来源:origin: org.dspace/dspace-xmlui-api

public void addBody(Body body) throws WingException, SQLException, AuthorizeException
  {
    String role = parameters.getParameter("role", null);
    int groupID = parameters.getParameterAsInteger("groupID", -1);
    Group toBeDeleted = Group.find(context, groupID);
    
    
    // DIVISION: main
    Division main = body.addInteractiveDivision("collection-role-delete",contextPath+"/admin/collection",Division.METHOD_POST,"primary administrative collection");
    main.setHead(T_main_head.parameterize(role));
    // Different help message for the default read group to enforce its non-retroactive nature
    if ("DEFAULT_READ".equals(role))
    {
      main.addPara(T_main_para_read.parameterize(toBeDeleted.getName()));
    }
    else
    {
      main.addPara(T_main_para.parameterize(toBeDeleted.getName()));
    }
    
    Para buttonList = main.addPara();
    buttonList.addButton("submit_confirm").setValue(T_submit_confirm);
    buttonList.addButton("submit_cancel").setValue(T_submit_cancel);
        
    
    main.addHidden("administrative-continue").setValue(knot.getId());
  }
}

代码示例来源:origin: DSpace/DSpace

if (StringUtils.equals(g.getName(), Group.ANONYMOUS)) {
  isAnonymousInPlace = true;

代码示例来源:origin: org.dspace/dspace-xmlui-api

row.addCell().addContent(group.getName());
row.addCell().addContent(group.getMembers().length);
row.addCell().addContent(group.getMemberGroups().length);

代码示例来源:origin: org.dspace/dspace-xmlui-api

private void addXMLWorkflowRoles(Collection thisCollection, String baseURL, HashMap<String, Role> roles, Table rolesTable) throws WingException, SQLException {
  Row tableRow;
  if(roles != null){
    //ROLES: show group name instead of role name
    for(String roleId: roles.keySet()){
      Role role = roles.get(roleId);
      if (role.getScope() == Role.Scope.COLLECTION) {
        tableRow = rolesTable.addRow(Row.ROLE_DATA);
        tableRow.addCell(Cell.ROLE_HEADER).addContent(role.getName());
        Group roleGroup = WorkflowUtils.getRoleGroup(context, thisCollection.getID(), role);
        if (roleGroup != null) {
          tableRow.addCell().addXref(baseURL + "&submit_edit_wf_role_" + roleId, roleGroup.getName());
          addAdministratorOnlyButton(tableRow.addCell(), "submit_delete_wf_role_" + roleId, T_delete);
        } else {
          tableRow.addCell().addContent(T_no_role);
          addAdministratorOnlyButton(tableRow.addCell(), "submit_create_wf_role_" + roleId, T_create);
        }
        // help and directions row
        tableRow = rolesTable.addRow(Row.ROLE_DATA);
        tableRow.addCell();
        if (role.getDescription() != null){
          tableRow.addCell(1,2).addHighlight("fade offset").addContent(role.getDescription());
        }
      }
    }
  }
}

代码示例来源:origin: org.dspace/dspace-xmlui-api

public void addBody(Body body) throws WingException, SQLException, AuthorizeException
  {
    String role = parameters.getParameter("role", null);
    int groupID = parameters.getParameterAsInteger("groupID", -1);
    Group toBeDeleted = Group.find(context, groupID);
    
    // DIVISION: main
    Division main = body.addInteractiveDivision("community-role-delete",contextPath+"/admin/community",Division.METHOD_POST,"primary administrative community");
    main.setHead(T_main_head.parameterize(role));
    main.addPara(T_main_para.parameterize(toBeDeleted.getName()));
    
    Para buttonList = main.addPara();
    buttonList.addButton("submit_confirm").setValue(T_submit_confirm);
    buttonList.addButton("submit_cancel").setValue(T_submit_cancel);
        
    
    main.addHidden("administrative-continue").setValue(knot.getId());
  }
}

相关文章