[DS-3024] Move permanence logic from entity class to its service class.

This commit is contained in:
Mark H. Wood
2016-02-03 12:46:43 -05:00
parent b8a862bc1e
commit 65b6e7276e
2 changed files with 6 additions and 6 deletions

View File

@@ -203,11 +203,8 @@ public class Group extends DSpaceObject implements DSpaceObjectLegacySupport
/** Change the name of this Group. */
public void setName(Context context, String name) throws SQLException
{
if (!permanent)
getGroupService().setMetadataSingleValue(context, this,
MetadataSchema.DC_SCHEMA, "title", null, null, name);
else
throw new SQLException("Attempt to rename a permanent Group");
getGroupService().setMetadataSingleValue(context, this,
MetadataSchema.DC_SCHEMA, "title", null, null, name);
}
public boolean isGroupsChanged() {

View File

@@ -90,7 +90,10 @@ public class GroupServiceImpl extends DSpaceObjectServiceImpl<Group> implements
@Override
public void setName(Context context, Group group, String name) throws SQLException {
group.setName(context, name);
if (!group.isPermanent())
group.setName(context, name);
else
throw new SQLException("Attempt to rename a permanent Group");
}
@Override