diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/AbstractServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/AbstractServer.java index 17e2a1448aad9e5389f903fefa066bd1c181eacc..323f25e15e2d44e0466db6f82bf02d1427f11977 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/AbstractServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/AbstractServer.java @@ -518,11 +518,15 @@ public abstract class AbstractServer<T> extends AbstractServiceWithLogger<T> imp PersonPE person = session.tryGetPerson(); if (person != null) { - List<EntityVisit> visits = joinVisits(displaySettings, person); - sortAndRemoveMultipleVisits(visits); - for (int i = visits.size() - 1; i >= maxEntityVisits; i--) + if (displaySettings != null) { - visits.remove(i); + @SuppressWarnings("deprecation") + List<EntityVisit> visits = displaySettings.getVisits(); + sortAndRemoveMultipleVisits(visits); + for (int i = visits.size() - 1; i >= maxEntityVisits; i--) + { + visits.remove(i); + } } person.setDisplaySettings(displaySettings); getDAOFactory().getPersonDAO().updatePerson(person); @@ -549,19 +553,6 @@ public abstract class AbstractServer<T> extends AbstractServiceWithLogger<T> imp } } - @SuppressWarnings("deprecation") - private List<EntityVisit> joinVisits(DisplaySettings displaySettings, PersonPE person) - { - List<EntityVisit> personVisits = person.getDisplaySettings().getVisits(); - if (displaySettings == null) - { - return personVisits; - } - List<EntityVisit> visits = displaySettings.getVisits(); - visits.addAll(personVisits); - return visits; - } - public DisplaySettings getDefaultDisplaySettings(String sessionToken) { PersonPE systemUser = diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/CommonServerTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/CommonServerTest.java index 536fef8edf9eda6426c30b278683b4c6b7ac7e1e..f48fb81472a77628145cc100a2a7f7b0bfc48b6a 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/CommonServerTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/CommonServerTest.java @@ -1513,9 +1513,8 @@ public final class CommonServerTest extends AbstractServerTestCase { final PersonPE person = new PersonPE(); EntityVisit v0 = visit(EntityKind.MATERIAL, 0); - EntityVisit v1 = visit(EntityKind.EXPERIMENT, 1); - EntityVisit v2 = visit(EntityKind.SAMPLE, 2); - DisplaySettings currentDisplaySettings = displaySettingsWithVisits(v0, v1, v2); + EntityVisit v1 = visit(EntityKind.SAMPLE, 2); + DisplaySettings currentDisplaySettings = displaySettingsWithVisits(v0, v1); person.setDisplaySettings(currentDisplaySettings); context.checking(new Expectations() { @@ -1528,9 +1527,10 @@ public final class CommonServerTest extends AbstractServerTestCase one(personDAO).updatePerson(person); } }); + EntityVisit v2 = visit(EntityKind.EXPERIMENT, 1); EntityVisit v3 = visit(EntityKind.DATA_SET, 3); EntityVisit v4 = visit(EntityKind.SAMPLE, 2); - DisplaySettings displaySettings = displaySettingsWithVisits(v3, v4); + DisplaySettings displaySettings = displaySettingsWithVisits(v0, v1, v2, v3, v4); createServer().saveDisplaySettings(SESSION_TOKEN, displaySettings, 3);