diff src/main/java/de/mpiwg/itgroup/annotations/Actor.java @ 15:58357a4b86de

ASSIGNED - # 249: Annotations shared in groups https://it-dev.mpiwg-berlin.mpg.de/tracs/mpdl-project-software/ticket/249
author casties
date Tue, 28 Aug 2012 20:23:12 +0200
parents 629e15b345aa
children 794077e6288c
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/annotations/Actor.java	Fri Jul 13 20:41:02 2012 +0200
+++ b/src/main/java/de/mpiwg/itgroup/annotations/Actor.java	Tue Aug 28 20:23:12 2012 +0200
@@ -3,6 +3,7 @@
  */
 package de.mpiwg.itgroup.annotations;
 
+import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore;
 import de.mpiwg.itgroup.annotations.old.NS;
 
 /**
@@ -21,19 +22,21 @@
     public abstract boolean isGroup();
 
     /**
-     * Returns if this Actor is equivalent to an Actor with this id. If this is
+     * Returns if this Actor is equivalent to Person person. If this is
      * a Group returns true when the Person is in the Group.
      * 
-     * @param userId
+     * @param person
+     * @param store AnnotationStore to check group membership
      * @return
      */
-    public boolean isEquivalentWith(String userId) {
-        if (userId == null) return false;
-        if (userId.equals(getIdString())) {
+    public boolean isEquivalentWith(Person person, AnnotationStore store) {
+        if (person == null) return false;
+        if (person.equals(getIdString())) {
             return true;
         }
-        if (isGroup()) {
-            // TODO: check if person in group
+        if (isGroup() && store != null) {
+            // check if person in group
+            return store.isPersonInGroup(person, (Group) this);            
         }
         return false;
     }