mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-13 21:13:19 +00:00
DS-3004: Refactored GroupService so that it doesn't use dc.title anymore to search for a group by name
This commit is contained in:
@@ -7,22 +7,7 @@
|
||||
*/
|
||||
package org.dspace.content.packager;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PipedInputStream;
|
||||
import java.io.PipedOutputStream;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.stream.XMLOutputFactory;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamWriter;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
@@ -33,12 +18,19 @@ import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.dspace.eperson.PasswordHash;
|
||||
|
||||
import org.dspace.eperson.factory.EPersonServiceFactory;
|
||||
import org.dspace.eperson.service.EPersonService;
|
||||
import org.dspace.eperson.service.GroupService;
|
||||
import org.jdom.Namespace;
|
||||
|
||||
import javax.xml.stream.XMLOutputFactory;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamWriter;
|
||||
import java.io.*;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Plugin to export all Group and EPerson objects in XML, perhaps for reloading.
|
||||
*
|
||||
@@ -549,7 +541,7 @@ public class RoleDisseminator implements PackageDisseminator
|
||||
{
|
||||
// @TODO FIXME -- if there was a way to ONLY export Groups which are NOT
|
||||
// associated with a Community or Collection, we should be doing that instead!
|
||||
return groupService.findAll(context, GroupService.NAME);
|
||||
return groupService.findAll(context, null);
|
||||
}
|
||||
else if(object.getType()==Constants.COMMUNITY)
|
||||
{
|
||||
|
@@ -16,7 +16,6 @@ import org.dspace.authorize.service.AuthorizeService;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.DSpaceObjectServiceImpl;
|
||||
import org.dspace.content.MetadataField;
|
||||
import org.dspace.content.MetadataSchema;
|
||||
import org.dspace.content.service.CollectionService;
|
||||
import org.dspace.content.service.CommunityService;
|
||||
import org.dspace.core.Constants;
|
||||
@@ -50,9 +49,6 @@ public class GroupServiceImpl extends DSpaceObjectServiceImpl<Group> implements
|
||||
@Autowired(required = true)
|
||||
protected GroupDAO groupDAO;
|
||||
|
||||
// @Autowired(required = true)
|
||||
// protected Group2GroupDAO group2GroupDAO;
|
||||
|
||||
@Autowired(required = true)
|
||||
protected Group2GroupCacheDAO group2GroupCacheDAO;
|
||||
|
||||
@@ -275,22 +271,25 @@ public class GroupServiceImpl extends DSpaceObjectServiceImpl<Group> implements
|
||||
return groupDAO.findByName(context, name);
|
||||
}
|
||||
|
||||
/** DEPRECATED: Please use findAll(Context context, List<MetadataField> metadataSortFields) instead */
|
||||
@Override
|
||||
public List<Group> findAll(Context context, int sortField) throws SQLException
|
||||
{
|
||||
List<MetadataField> metadataFieldsSort = new ArrayList<>();
|
||||
switch (sortField)
|
||||
{
|
||||
case NAME:
|
||||
metadataFieldsSort.add(metadataFieldService.findByElement(context, MetadataSchema.DC_SCHEMA, "title", null));
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
metadataFieldsSort.add(metadataFieldService.findByElement(context, MetadataSchema.DC_SCHEMA, "title", null));
|
||||
@Deprecated
|
||||
public List<Group> findAll(Context context, int sortField) throws SQLException {
|
||||
if(sortField == GroupService.NAME) {
|
||||
return findAll(context, null);
|
||||
} else {
|
||||
throw new UnsupportedOperationException("You can only find all groups sorted by name with this method");
|
||||
}
|
||||
}
|
||||
|
||||
return groupDAO.findAll(context, metadataFieldsSort, null);
|
||||
@Override
|
||||
public List<Group> findAll(Context context, List<MetadataField> metadataSortFields) throws SQLException
|
||||
{
|
||||
if(CollectionUtils.isEmpty(metadataSortFields)) {
|
||||
return groupDAO.findAll(context);
|
||||
} else {
|
||||
return groupDAO.findAll(context, metadataSortFields);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -672,4 +671,9 @@ public class GroupServiceImpl extends DSpaceObjectServiceImpl<Group> implements
|
||||
public int countTotal(Context context) throws SQLException {
|
||||
return groupDAO.countRows(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Group> findByMetadataField(final Context context, final String searchValue, final MetadataField metadataField) throws SQLException {
|
||||
return groupDAO.findByMetadataField(context, searchValue, metadataField);
|
||||
}
|
||||
}
|
||||
|
@@ -28,23 +28,104 @@ import java.util.UUID;
|
||||
*/
|
||||
public interface GroupDAO extends DSpaceObjectDAO<Group>, DSpaceObjectLegacySupportDAO<Group> {
|
||||
|
||||
Group findByMetadataField(Context context, String searchValue, MetadataField metadataField) throws SQLException;
|
||||
/**
|
||||
* Look up groups based on their value for a certain metadata field (NOTE: name is not stored as metadata)
|
||||
* @param context The DSpace context
|
||||
* @param searchValue The value to match
|
||||
* @param metadataField The metadata field to search in
|
||||
* @return The groups that have a matching value for specified metadata field
|
||||
* @throws SQLException
|
||||
*/
|
||||
List<Group> findByMetadataField(Context context, String searchValue, MetadataField metadataField) throws SQLException;
|
||||
|
||||
List<Group> findAll(Context context, List<MetadataField> metadataFields, String sortColumn) throws SQLException;
|
||||
/**
|
||||
* Find all groups ordered by the specified metadata fields ascending
|
||||
* @param context The DSpace context
|
||||
* @param sortMetadataFields The metadata fields to sort on
|
||||
* @return A list of all groups, ordered by metadata fields
|
||||
* @throws SQLException
|
||||
*/
|
||||
List<Group> findAll(Context context, List<MetadataField> sortMetadataFields) throws SQLException;
|
||||
|
||||
/**
|
||||
* Find all groups ordered by name ascending
|
||||
* @param context The DSpace context
|
||||
* @return A list of all groups, ordered by name
|
||||
* @throws SQLException
|
||||
*/
|
||||
List<Group> findAll(Context context) throws SQLException;
|
||||
|
||||
/**
|
||||
* Find all groups that the given ePerson belongs to
|
||||
* @param context The DSpace context
|
||||
* @param ePerson The EPerson to match
|
||||
* @return A list of all groups to which the given EPerson belongs
|
||||
* @throws SQLException
|
||||
*/
|
||||
List<Group> findByEPerson(Context context, EPerson ePerson) throws SQLException;
|
||||
|
||||
/**
|
||||
* Get a list of all direct parent - child group relations in the database
|
||||
* @param context The DSpace context
|
||||
* @param flushQueries Flush all pending queries
|
||||
* @return A list of pairs indicating parent - child
|
||||
* @throws SQLException
|
||||
*/
|
||||
List<Pair<UUID, UUID>> getGroup2GroupResults(Context context, boolean flushQueries) throws SQLException;
|
||||
|
||||
/**
|
||||
* Return all empty groups
|
||||
* @param context The DSpace context
|
||||
* @return All empty groups
|
||||
* @throws SQLException
|
||||
*/
|
||||
List<Group> getEmptyGroups(Context context) throws SQLException;
|
||||
|
||||
/**
|
||||
* Count the number of groups in DSpace
|
||||
* @param context The DSpace context
|
||||
* @return The number of groups
|
||||
* @throws SQLException
|
||||
*/
|
||||
int countRows(Context context) throws SQLException;
|
||||
|
||||
/**
|
||||
* Find a group by its name (exact match)
|
||||
* @param context The DSpace context
|
||||
* @param name The name of the group to look for
|
||||
* @return The group with the specified name
|
||||
* @throws SQLException
|
||||
*/
|
||||
Group findByName(Context context, String name) throws SQLException;
|
||||
|
||||
/**
|
||||
* Find a group by its name (fuzzy match)
|
||||
* @param context The DSpace context
|
||||
* @param groupName Part of the group's name to search for
|
||||
* @param offset Offset to use for pagination (-1 to disable)
|
||||
* @param limit The maximum number of results to return (-1 to disable)
|
||||
* @return Groups matching the query
|
||||
* @throws SQLException
|
||||
*/
|
||||
List<Group> findByNameLike(Context context, String groupName, int offset, int limit) throws SQLException;
|
||||
|
||||
/**
|
||||
* Count the number of groups that have a name that contains the given string
|
||||
* @param context The DSpace context
|
||||
* @param groupName Part of the group's name to search for
|
||||
* @return The number of matching groups
|
||||
* @throws SQLException
|
||||
*/
|
||||
int countByNameLike(Context context, String groupName) throws SQLException;
|
||||
|
||||
/**
|
||||
* Find a group by its name and the membership of the given EPerson
|
||||
* @param context The DSpace context
|
||||
* @param groupName The name of the group to look for
|
||||
* @param ePerson The EPerson which has to be a member
|
||||
* @return The group with the specified name
|
||||
* @throws SQLException
|
||||
*/
|
||||
Group findByNameAndEPerson(Context context, String groupName, EPerson ePerson) throws SQLException;
|
||||
|
||||
List<Group> findByNameLike(Context context, String groupIdentifier, int offset, int limit) throws SQLException;
|
||||
|
||||
int countByNameLike(Context context, String groupIdentifier) throws SQLException;
|
||||
}
|
||||
|
@@ -38,6 +38,8 @@ public class Group2GroupCacheDAOImpl extends AbstractHibernateDAO<Group2GroupCac
|
||||
public List<Group2GroupCache> findByParent(Context context, Group group) throws SQLException {
|
||||
Criteria criteria = createCriteria(context, Group2GroupCache.class);
|
||||
criteria.add(Restrictions.eq("parent", group));
|
||||
criteria.setCacheable(true);
|
||||
|
||||
return list(criteria);
|
||||
}
|
||||
|
||||
@@ -52,6 +54,8 @@ public class Group2GroupCacheDAOImpl extends AbstractHibernateDAO<Group2GroupCac
|
||||
}
|
||||
|
||||
criteria.add(orDisjunction);
|
||||
criteria.setCacheable(true);
|
||||
|
||||
return list(criteria);
|
||||
}
|
||||
|
||||
@@ -60,6 +64,7 @@ public class Group2GroupCacheDAOImpl extends AbstractHibernateDAO<Group2GroupCac
|
||||
Criteria criteria = createCriteria(context, Group2GroupCache.class);
|
||||
criteria.add(Restrictions.eq("parent", parent));
|
||||
criteria.add(Restrictions.eq("child", child));
|
||||
criteria.setCacheable(true);
|
||||
return uniqueResult(criteria);
|
||||
}
|
||||
|
||||
|
@@ -37,7 +37,7 @@ public class GroupDAOImpl extends AbstractHibernateDSODAO<Group> implements Grou
|
||||
}
|
||||
|
||||
@Override
|
||||
public Group findByMetadataField(Context context, String searchValue, MetadataField metadataField) throws SQLException
|
||||
public List<Group> findByMetadataField(Context context, String searchValue, MetadataField metadataField) throws SQLException
|
||||
{
|
||||
StringBuilder queryBuilder = new StringBuilder();
|
||||
String groupTableName = "g";
|
||||
@@ -50,26 +50,35 @@ public class GroupDAOImpl extends AbstractHibernateDSODAO<Group> implements Grou
|
||||
query.setParameter(metadataField.toString(), metadataField.getFieldID());
|
||||
query.setParameter("queryParam", searchValue);
|
||||
|
||||
return uniqueResult(query);
|
||||
return list(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Group> findAll(Context context, List<MetadataField> sortFields, String sortColumn) throws SQLException
|
||||
public List<Group> findAll(Context context, List<MetadataField> sortMetadataFields) throws SQLException
|
||||
{
|
||||
StringBuilder queryBuilder = new StringBuilder();
|
||||
String groupTableName = "g";
|
||||
queryBuilder.append("SELECT ").append(groupTableName).append(" FROM Group as ").append(groupTableName);
|
||||
|
||||
addMetadataLeftJoin(queryBuilder, groupTableName, sortFields);
|
||||
addMetadataSortQuery(queryBuilder, sortFields, Collections.singletonList(sortColumn));
|
||||
addMetadataLeftJoin(queryBuilder, groupTableName, sortMetadataFields);
|
||||
addMetadataSortQuery(queryBuilder, sortMetadataFields, null);
|
||||
|
||||
Query query = createQuery(context, queryBuilder.toString());
|
||||
for (MetadataField sortField : sortFields) {
|
||||
for (MetadataField sortField : sortMetadataFields) {
|
||||
query.setParameter(sortField.toString(), sortField.getFieldID());
|
||||
}
|
||||
return list(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Group> findAll(Context context) throws SQLException {
|
||||
Query query = createQuery(context,
|
||||
"SELECT g FROM Group g ORDER BY g.name ASC");
|
||||
query.setCacheable(true);
|
||||
|
||||
return list(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Group> findByEPerson(Context context, EPerson ePerson) throws SQLException {
|
||||
Query query = createQuery(context, "from Group where (from EPerson e where e.id = :eperson_id) in elements(epeople)");
|
||||
|
@@ -11,6 +11,7 @@ import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.MetadataField;
|
||||
import org.dspace.content.service.DSpaceObjectLegacySupportService;
|
||||
import org.dspace.content.service.DSpaceObjectService;
|
||||
import org.dspace.core.Context;
|
||||
@@ -155,13 +156,16 @@ public interface GroupService extends DSpaceObjectService<Group>, DSpaceObjectLe
|
||||
*
|
||||
* @param context
|
||||
* DSpace context
|
||||
* @param sortField
|
||||
* field to sort by -- Group.ID or Group.NAME
|
||||
* @param metadataSortFields
|
||||
* metadata fields to sort by, leave empty to sort by Name
|
||||
*
|
||||
* @return array of all groups in the site
|
||||
*/
|
||||
public List<Group> findAll(Context context, int sortField) throws SQLException;
|
||||
public List<Group> findAll(Context context, List<MetadataField> metadataSortFields) throws SQLException;
|
||||
|
||||
/** DEPRECATED: Please use findAll(Context context, List<MetadataField> metadataFieldsSort) instead */
|
||||
@Deprecated
|
||||
public List<Group> findAll(Context context, int sortField) throws SQLException;
|
||||
|
||||
/**
|
||||
* Find the groups that match the search query across eperson_group_id or name
|
||||
@@ -219,7 +223,29 @@ public interface GroupService extends DSpaceObjectService<Group>, DSpaceObjectLe
|
||||
*/
|
||||
public void initDefaultGroupNames(Context context) throws SQLException, AuthorizeException;
|
||||
|
||||
/**
|
||||
* Find all empty groups in DSpace
|
||||
* @param context The DSpace context
|
||||
* @return All empty groups
|
||||
* @throws SQLException
|
||||
*/
|
||||
List<Group> getEmptyGroups(Context context) throws SQLException;
|
||||
|
||||
/**
|
||||
* Count the total number of groups in DSpace
|
||||
* @param context The DSpace context
|
||||
* @return The total number of groups
|
||||
* @throws SQLException
|
||||
*/
|
||||
int countTotal(Context context) throws SQLException;
|
||||
|
||||
/**
|
||||
* Look up groups based on their value for a certain metadata field (NOTE: name is not stored as metadata)
|
||||
* @param context The DSpace context
|
||||
* @param searchValue The value to match
|
||||
* @param metadataField The metadata field to search in
|
||||
* @return The groups that have a matching value for specified metadata field
|
||||
* @throws SQLException
|
||||
*/
|
||||
List<Group> findByMetadataField(Context context, String searchValue, MetadataField metadataField) throws SQLException;
|
||||
}
|
||||
|
@@ -157,7 +157,7 @@ public class GroupTest extends AbstractUnitTest {
|
||||
|
||||
@Test
|
||||
public void findAll() throws SQLException {
|
||||
List<Group> groups = groupService.findAll(context, GroupService.NAME);
|
||||
List<Group> groups = groupService.findAll(context, null);
|
||||
assertThat("findAll 1", groups, notNullValue());
|
||||
System.out.println("TEST GROUP OUTPUT " + groups);
|
||||
assertTrue("findAll 2", 0 < groups.size());
|
||||
@@ -184,7 +184,7 @@ public class GroupTest extends AbstractUnitTest {
|
||||
@Test
|
||||
public void findAllNameSort() throws SQLException {
|
||||
// Retrieve groups sorted by name
|
||||
List<Group> groups = groupService.findAll(context, GroupService.NAME);
|
||||
List<Group> groups = groupService.findAll(context, null);
|
||||
|
||||
assertThat("findAllNameSort 1", groups, notNullValue());
|
||||
|
||||
|
@@ -394,7 +394,7 @@ public class AccessSettingTag extends TagSupport
|
||||
}
|
||||
|
||||
if (groups == null || groups.size() == 0){
|
||||
groups = groupService.findAll(context, GroupService.NAME);
|
||||
groups = groupService.findAll(context, null);
|
||||
}
|
||||
|
||||
return groups;
|
||||
|
@@ -7,18 +7,6 @@
|
||||
*/
|
||||
package org.dspace.app.webui.servlet.admin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang.time.DateUtils;
|
||||
import org.dspace.app.util.AuthorizeUtil;
|
||||
import org.dspace.app.webui.servlet.DSpaceServlet;
|
||||
@@ -29,18 +17,10 @@ import org.dspace.authorize.PolicySet;
|
||||
import org.dspace.authorize.ResourcePolicy;
|
||||
import org.dspace.authorize.factory.AuthorizeServiceFactory;
|
||||
import org.dspace.authorize.service.ResourcePolicyService;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.content.Bundle;
|
||||
import org.dspace.content.*;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.BitstreamService;
|
||||
import org.dspace.content.service.BundleService;
|
||||
import org.dspace.content.service.CollectionService;
|
||||
import org.dspace.content.service.CommunityService;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.content.service.*;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
@@ -51,6 +31,13 @@ import org.dspace.eperson.service.GroupService;
|
||||
import org.dspace.handle.factory.HandleServiceFactory;
|
||||
import org.dspace.handle.service.HandleService;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Servlet for editing permissions
|
||||
*
|
||||
@@ -123,7 +110,7 @@ public class AuthorizeAdminServlet extends DSpaceServlet
|
||||
{
|
||||
// select a collections to work on
|
||||
List<Collection> collections = collectionService.findAll(c);
|
||||
List<Group> groups = groupService.findAll(c, GroupService.NAME);
|
||||
List<Group> groups = groupService.findAll(c, null);
|
||||
|
||||
request.setAttribute("collections", collections);
|
||||
request.setAttribute("groups", groups);
|
||||
@@ -188,7 +175,7 @@ public class AuthorizeAdminServlet extends DSpaceServlet
|
||||
ResourcePolicy policy = authorizeService.createResourcePolicy(c, item,
|
||||
groupService.findByName(c, Group.ANONYMOUS), null, -1, null);
|
||||
|
||||
List<Group> groups = groupService.findAll(c, GroupService.NAME);
|
||||
List<Group> groups = groupService.findAll(c, null);
|
||||
List<EPerson> epeople = personService.findAll(c, EPerson.EMAIL);
|
||||
|
||||
// return to item permission page
|
||||
@@ -215,7 +202,7 @@ public class AuthorizeAdminServlet extends DSpaceServlet
|
||||
|
||||
policy = resourcePolicyService.find(c, policyId);
|
||||
|
||||
List<Group> groups = groupService.findAll(c, GroupService.NAME);
|
||||
List<Group> groups = groupService.findAll(c, null);
|
||||
List<EPerson> epeople = personService.findAll(c, EPerson.EMAIL);
|
||||
|
||||
// return to collection permission page
|
||||
@@ -240,7 +227,7 @@ public class AuthorizeAdminServlet extends DSpaceServlet
|
||||
ResourcePolicy policy = authorizeService.createResourcePolicy(c, bundle,
|
||||
groupService.findByName(c, Group.ANONYMOUS), null, -1, null);
|
||||
|
||||
List<Group> groups = groupService.findAll(c, GroupService.NAME);
|
||||
List<Group> groups = groupService.findAll(c, null);
|
||||
List<EPerson> epeople = personService.findAll(c, EPerson.EMAIL);
|
||||
|
||||
// return to item permission page
|
||||
@@ -268,7 +255,7 @@ public class AuthorizeAdminServlet extends DSpaceServlet
|
||||
ResourcePolicy policy = authorizeService.createResourcePolicy(c, bitstream,
|
||||
groupService.findByName(c, Group.ANONYMOUS), null, -1, null);
|
||||
|
||||
List<Group> groups = groupService.findAll(c, GroupService.NAME);
|
||||
List<Group> groups = groupService.findAll(c, null);
|
||||
List<EPerson> epeople = personService.findAll(c, EPerson.EMAIL);
|
||||
|
||||
// return to item permission page
|
||||
@@ -317,7 +304,7 @@ public class AuthorizeAdminServlet extends DSpaceServlet
|
||||
groupService.findByName(c, Group.ANONYMOUS), null, -1, null);
|
||||
|
||||
|
||||
List<Group> groups = groupService.findAll(c, GroupService.NAME);
|
||||
List<Group> groups = groupService.findAll(c, null);
|
||||
List<EPerson> epeople = personService.findAll(c, EPerson.EMAIL);
|
||||
|
||||
// return to collection permission page
|
||||
@@ -410,7 +397,7 @@ public class AuthorizeAdminServlet extends DSpaceServlet
|
||||
policy = resourcePolicyService.find(c, policyId);
|
||||
}
|
||||
|
||||
List<Group> groups = groupService.findAll(c, GroupService.NAME);
|
||||
List<Group> groups = groupService.findAll(c, null);
|
||||
List<EPerson> epeople = personService.findAll(c, EPerson.EMAIL);
|
||||
|
||||
// return to collection permission page
|
||||
@@ -447,7 +434,7 @@ public class AuthorizeAdminServlet extends DSpaceServlet
|
||||
policy = resourcePolicyService.find(c, policyId);
|
||||
}
|
||||
|
||||
List<Group> groups = groupService.findAll(c, GroupService.NAME);
|
||||
List<Group> groups = groupService.findAll(c, null);
|
||||
List<EPerson> epeople = personService.findAll(c, EPerson.EMAIL);
|
||||
|
||||
// return to collection permission page
|
||||
@@ -473,7 +460,7 @@ public class AuthorizeAdminServlet extends DSpaceServlet
|
||||
groupService.findByName(c, Group.ANONYMOUS), null, -1, null);
|
||||
|
||||
|
||||
List<Group> groups = groupService.findAll(c, GroupService.NAME);
|
||||
List<Group> groups = groupService.findAll(c, null);
|
||||
List<EPerson> epeople = personService.findAll(c, EPerson.EMAIL);
|
||||
|
||||
// return to collection permission page
|
||||
@@ -500,7 +487,7 @@ public class AuthorizeAdminServlet extends DSpaceServlet
|
||||
groupService.findByName(c, Group.ANONYMOUS), null, -1, null);
|
||||
|
||||
|
||||
List<Group> groups = groupService.findAll(c, GroupService.NAME);
|
||||
List<Group> groups = groupService.findAll(c, null);
|
||||
List<EPerson> epeople = personService.findAll(c, EPerson.EMAIL);
|
||||
|
||||
// return to collection permission page
|
||||
|
@@ -7,17 +7,6 @@
|
||||
*/
|
||||
package org.dspace.app.webui.servlet.admin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.dspace.app.webui.servlet.DSpaceServlet;
|
||||
import org.dspace.app.webui.util.JSPManager;
|
||||
import org.dspace.app.webui.util.UIUtil;
|
||||
@@ -30,6 +19,16 @@ import org.dspace.eperson.factory.EPersonServiceFactory;
|
||||
import org.dspace.eperson.service.EPersonService;
|
||||
import org.dspace.eperson.service.GroupService;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Servlet for editing groups
|
||||
*
|
||||
@@ -279,7 +278,7 @@ public class GroupEditServlet extends DSpaceServlet
|
||||
HttpServletResponse response) throws ServletException, IOException,
|
||||
SQLException, AuthorizeException
|
||||
{
|
||||
List<Group> groups = groupService.findAll(c, GroupService.NAME);
|
||||
List<Group> groups = groupService.findAll(c, null);
|
||||
|
||||
// if( groups == null ) { System.out.println("groups are null"); }
|
||||
// else System.out.println("# of groups: " + groups.length);
|
||||
|
@@ -7,10 +7,6 @@
|
||||
*/
|
||||
package org.dspace.app.xmlui.aspect.administrative.authorization;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.apache.cocoon.environment.ObjectModelHelper;
|
||||
import org.apache.cocoon.environment.Request;
|
||||
import org.dspace.app.xmlui.cocoon.AbstractDSpaceTransformer;
|
||||
@@ -25,6 +21,10 @@ import org.dspace.eperson.Group;
|
||||
import org.dspace.eperson.factory.EPersonServiceFactory;
|
||||
import org.dspace.eperson.service.GroupService;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* @author Alexey Maslov
|
||||
*/
|
||||
@@ -145,7 +145,7 @@ public class AdvacedAuthorizationsForm extends AbstractDSpaceTransformer
|
||||
if (errors.contains("groupIDs")){
|
||||
groupSelect.addError(T_error_groupIds);
|
||||
}
|
||||
for (Group group : groupService.findAll(context, GroupService.NAME))
|
||||
for (Group group : groupService.findAll(context, null))
|
||||
{
|
||||
if(wasElementSelected(group.getID().toString(), groupIDs)){
|
||||
groupSelect.addOption(true, group.getID().toString(), group.getName());
|
||||
|
@@ -268,7 +268,7 @@ public class EditPolicyForm extends AbstractDSpaceTransformer
|
||||
// currently set group
|
||||
actionsList.addLabel(T_policy_currentGroup);
|
||||
Select groupSelect = actionsList.addItem().addSelect("group_id");
|
||||
for (Group group : groupService.findAll(context, GroupService.NAME))
|
||||
for (Group group : groupService.findAll(context, null))
|
||||
{
|
||||
if (group == currentGroup)
|
||||
{
|
||||
|
@@ -129,7 +129,7 @@ public class AccessStepUtil extends AbstractDSpaceTransformer {
|
||||
loadedGroups= uiGroup.getMemberGroups();
|
||||
}
|
||||
if(loadedGroups==null || loadedGroups.size() ==0){
|
||||
loadedGroups = groupService.findAll(context, GroupService.NAME);
|
||||
loadedGroups = groupService.findAll(context, null);
|
||||
}
|
||||
|
||||
// if no group selected for default set anonymous
|
||||
|
Reference in New Issue
Block a user