Changeset 10:90911b2da322 in AnnotationManagerN4J for src/main/java/de/mpiwg/itgroup/annotations/Actor.java
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/de/mpiwg/itgroup/annotations/Actor.java
r9 r10 4 4 package de.mpiwg.itgroup.annotations; 5 5 6 import de.mpiwg.itgroup.annotations.old.NS; 7 6 8 /** 7 9 * @author casties 8 10 * 9 11 */ 10 public class Actor {12 public abstract class Actor { 11 13 12 public boolean isGroup;13 14 public String uri; 14 15 public String name; 16 public String id; 15 17 16 18 /** 17 * @param isGroup 18 * @param id 19 * @param uri 20 * @param name 19 * @return if this Actor is a Group 21 20 */ 22 public Actor(boolean isGroup, String uri, String name) { 23 super(); 24 this.isGroup = isGroup; 25 this.uri = uri; 26 this.name = name; 27 } 21 public abstract boolean isGroup(); 28 22 29 /**30 * @return the isGroup31 */32 public boolean isGroup() {33 return isGroup;34 }35 /**36 * @param isGroup the isGroup to set37 */38 public void setGroup(boolean isGroup) {39 this.isGroup = isGroup;40 }41 23 /** 42 24 * @return the uri … … 63 45 this.name = name; 64 46 } 47 48 /** 49 * @return the id 50 */ 51 public String getId() { 52 return id; 53 } 54 55 /** 56 * Returns id as a String starting with "group:" for groups. 57 * 58 * @return 59 */ 60 public abstract String getIdString(); 61 62 /** 63 * @param id the id to set 64 */ 65 public void setId(String id) { 66 this.id = id; 67 } 68 69 /** 70 * Returns a short id from an uri. 71 * 72 * @param uri 73 * @return 74 */ 75 public static String getIdFromUri(String uri, boolean isGroup) { 76 String id = null; 77 String prefix = NS.MPIWG_PERSONS_URL; 78 if (isGroup) { 79 prefix = NS.MPIWG_GROUPS_URL; 80 } 81 if (uri != null && uri.startsWith(prefix)) { 82 id = uri.replace(prefix, ""); 83 } 84 return id; 85 } 86 87 /** 88 * Returns an uri from a short id. 89 * 90 * @param id 91 * @return 92 */ 93 public static String getUriFromId(String id, boolean isGroup) { 94 String uri = null; 95 String prefix = NS.MPIWG_PERSONS_URL; 96 if (isGroup) { 97 prefix = NS.MPIWG_GROUPS_URL; 98 } 99 if (id != null && ! id.startsWith("http://")) { 100 uri = prefix + id; 101 } 102 return uri; 103 } 104 65 105 }
Note: See TracChangeset
for help on using the changeset viewer.