annotate src/main/java/de/mpiwg/itgroup/ismi/util/guiComponents/AliasEntityList.java @ 173:aa564b1b5e1f public_by_author

publicByAuthor feature ui for selecting texts ready. actual changing of public state not yet implemented.
author Robert Casties <casties@mpiwg-berlin.mpg.de>
date Wed, 06 Jun 2018 21:01:05 +0200
parents 59f26a5ef2b3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
112
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
1 package de.mpiwg.itgroup.ismi.util.guiComponents;
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
2
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
3 import java.util.HashMap;
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
4 import java.util.List;
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
5
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
6 import org.mpi.openmind.repository.bo.Attribute;
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
7 import org.mpi.openmind.repository.bo.Entity;
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
8
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
9 import de.mpiwg.itgroup.ismi.auxObjects.AliasListenerObject;
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
10
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
11 /**
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
12 * EntityList that also takes ALIASes related to the Entities.
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
13 *
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
14 * @author casties
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
15 *
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
16 */
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
17 public class AliasEntityList extends EntityList {
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
18
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
19 private static final long serialVersionUID = 6671675804993282617L;
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
20
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
21 protected String aliasRelName;
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
22 protected String entityClass;
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
23
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
24 /**
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
25 * EntityList that searches in Entity Attributes and also in ALIASes connected by a given Relation.
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
26 *
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
27 * Uses relation ALIAS - aliasRelName -> ENTITY (usually "is_alias_name_of").
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
28 *
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
29 * @param oc
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
30 * @param attName
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
31 * @param alistRelName
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
32 * @param useCalendar
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
33 */
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
34 public AliasEntityList(String oc, String attName, String aliasRelName, boolean useCalendar) {
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
35 this.aliasRelName = aliasRelName;
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
36 this.entityClass = oc;
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
37 this.lo = new AliasListenerObject(oc, attName, aliasRelName);
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
38 this.useCalendar = useCalendar;
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
39 this.calendarMap = new HashMap<Long, Calendar>();
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
40 }
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
41
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
42 /* (non-Javadoc)
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
43 * @see de.mpiwg.itgroup.ismi.util.guiComponents.EntityList#add(org.mpi.openmind.repository.bo.Entity, org.mpi.openmind.repository.bo.Attribute)
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
44 */
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
45 @Override
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
46 public void add(Entity e, Attribute calendarAtt) {
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
47 // check if we add an alias
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
48 if (e.getObjectClass().equals(ALIAS)) {
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
49 // get original object
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
50 List<Entity> ents = getWrapper().getTargetsForSourceRelation(e, aliasRelName, entityClass, 1);
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
51 Entity ent = ents.get(0);
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
52 if (entities.contains(ent)) {
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
53 // original is in the List -- remove it
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
54 super.remove(ent.getId());
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
55 }
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
56 } else {
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
57 // get alias
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
58 List<Entity> ents = getWrapper().getSourcesForTargetRelation(e, aliasRelName, ALIAS, 0);
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
59 if (!ents.isEmpty()) {
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
60 for (Entity ent : ents) {
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
61 if (entities.contains(ent)) {
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
62 // alias is in the List -- leave it
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
63 return;
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
64 }
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
65 }
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
66 }
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
67 }
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
68 super.add(e, calendarAtt);
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
69 }
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
70
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
71
59f26a5ef2b3 AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
casties
parents:
diff changeset
72 }