Skip to content
Snippets Groups Projects
Commit 83d0de41 authored by cramakri's avatar cramakri
Browse files

LMS-1544 Switched plate predicate to use the collection version of the sample...

LMS-1544 Switched plate predicate to use the collection version of the sample owner identifier predicate.

SVN: 16138
parent 5c5adcd0
No related merge requests found
......@@ -16,8 +16,12 @@
package ch.systemsx.cisd.openbis.plugin.screening.shared.api.authorization;
import java.util.ArrayList;
import java.util.List;
import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.ShouldFlattenCollections;
import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.DelegatedPredicate;
import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.SampleOwnerIdentifierPredicate;
import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.SampleOwnerIdentifierCollectionPredicate;
import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.DatabaseInstanceIdentifier;
import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleOwnerIdentifier;
import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SpaceIdentifier;
......@@ -26,20 +30,26 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateIdentifi
/**
* @author Tomasz Pylak
*/
@ShouldFlattenCollections(value = false)
public class ScreenerReadonlyPlatePredicate extends
DelegatedPredicate<SampleOwnerIdentifier, PlateIdentifier>
DelegatedPredicate<List<SampleOwnerIdentifier>, List<PlateIdentifier>>
{
public ScreenerReadonlyPlatePredicate()
{
super(new SampleOwnerIdentifierPredicate(true));
super(new SampleOwnerIdentifierCollectionPredicate(true));
}
@Override
public SampleOwnerIdentifier convert(PlateIdentifier value)
public List<SampleOwnerIdentifier> convert(List<PlateIdentifier> values)
{
return new SampleOwnerIdentifier(new SpaceIdentifier(DatabaseInstanceIdentifier
.createHome(), value.tryGetSpaceCode()));
ArrayList<SampleOwnerIdentifier> soIds = new ArrayList<SampleOwnerIdentifier>();
for (PlateIdentifier value : values)
{
soIds.add(new SampleOwnerIdentifier(new SpaceIdentifier(DatabaseInstanceIdentifier
.createHome(), value.tryGetSpaceCode())));
}
return soIds;
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment