dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41537
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21159: helper method to get unique AV from idObject
------------------------------------------------------------
revno: 21159
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-11-23 09:54:19 +0700
message:
helper method to get unique AV from idObject
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java 2015-11-19 04:01:09 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java 2015-11-23 02:54:19 +0000
@@ -55,6 +55,7 @@
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import java.util.stream.Collectors;
/**
* @author Bob Jolliffe
@@ -293,6 +294,14 @@
}
@Override
+ public Set<AttributeValue> getUniqueAttributeValues()
+ {
+ return attributeValues.stream()
+ .filter( attributeValue -> attributeValue.getAttribute().isUnique() )
+ .collect( Collectors.toSet() );
+ }
+
+ @Override
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java 2015-11-19 04:01:09 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java 2015-11-23 02:54:19 +0000
@@ -70,6 +70,8 @@
Set<AttributeValue> getAttributeValues();
+ Set<AttributeValue> getUniqueAttributeValues();
+
User getUser();
Set<UserGroupAccess> getUserGroupAccesses();