comparison src/main/java/de/mpiwg/itgroup/ismi/event/beans/AbstractEvent.java @ 112:59f26a5ef2b3

AliasListenerObject adds aliases to ListenerObject. Change all forms to enable ALIAS for (historical) PLACE fields. Remove REPOSITORY from event forms.
author casties
date Tue, 13 Dec 2016 19:04:45 +0100
parents 4ec8d4cfad26
children 4aa8c425685d
comparison
equal deleted inserted replaced
111:22a18bfc66b0 112:59f26a5ef2b3
9 import javax.faces.model.SelectItem; 9 import javax.faces.model.SelectItem;
10 10
11 import org.apache.log4j.Logger; 11 import org.apache.log4j.Logger;
12 import org.mpi.openmind.repository.bo.Entity; 12 import org.mpi.openmind.repository.bo.Entity;
13 13
14 import de.mpiwg.itgroup.ismi.auxObjects.AliasListenerObject;
14 import de.mpiwg.itgroup.ismi.auxObjects.ListenerObject; 15 import de.mpiwg.itgroup.ismi.auxObjects.ListenerObject;
15 import de.mpiwg.itgroup.ismi.auxObjects.lo.EventTextLO; 16 import de.mpiwg.itgroup.ismi.auxObjects.lo.EventTextLO;
16 import de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean; 17 import de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean;
17 import de.mpiwg.itgroup.ismi.entry.beans.SessionBean; 18 import de.mpiwg.itgroup.ismi.entry.beans.SessionBean;
18 import de.mpiwg.itgroup.ismi.util.guiComponents.Calendar; 19 import de.mpiwg.itgroup.ismi.util.guiComponents.Calendar;
27 28
28 protected static Logger logger = Logger.getLogger(AbstractEvent.class); 29 protected static Logger logger = Logger.getLogger(AbstractEvent.class);
29 30
30 public static String was_studied_by = "was_studied_by"; 31 public static String was_studied_by = "was_studied_by";
31 public static String was_studied_in = "was_studied_in"; 32 public static String was_studied_in = "was_studied_in";
33 public static String was_studied_in_as = "was_studied_in_as";
32 public static String is_a_study_of = "is_a_study_of"; 34 public static String is_a_study_of = "is_a_study_of";
33 public static String was_advised_by = "was_advised_by"; 35 public static String was_advised_by = "was_advised_by";
34 public static String was_copied_for = "was_copied_for"; 36 public static String was_copied_for = "was_copied_for";
35 public static String has_person_copying_text = "has_person_copying_text"; 37 public static String has_person_copying_text = "has_person_copying_text";
36 public static String was_copied_in = "was_copied_in"; 38 public static String was_copied_in = "was_copied_in";
39 public static String was_copied_in_as = "was_copied_in_as";
37 public static String is_a_copy_of = "is_a_copy_of"; 40 public static String is_a_copy_of = "is_a_copy_of";
38 public static String is_a_transfer_of = "is_a_transfer_of"; 41 public static String is_a_transfer_of = "is_a_transfer_of";
39 public static String was_transferred_from = "was_transferred_from"; 42 public static String was_transferred_from = "was_transferred_from";
40 public static String was_transferred_to = "was_transferred_to"; 43 public static String was_transferred_to = "was_transferred_to";
41 public static String has_original_location = "has_original_location"; 44 public static String has_original_location = "has_original_location";
42 public static String has_new_location = "has_new_location"; 45 public static String has_original_location_as = "has_original_location_as";
46 public static String has_new_location = "has_new_location";
47 public static String has_new_location_as = "has_new_location_as";
43 public static String was_transferred_in = "was_transferred_in"; 48 public static String was_transferred_in = "was_transferred_in";
44 49 public static String was_transferred_in_as = "was_transferred_in_as";
45 protected EventTextLO textLo = new EventTextLO(TEXT, full_title_translit, this); 50
51 protected EventTextLO textLo;
46 protected Entity witness; 52 protected Entity witness;
47 protected Long witnessId; 53 protected Long witnessId;
48 protected List<SelectItem> witnessList; 54 protected List<SelectItem> witnessList;
49 protected Calendar date; 55 protected Calendar date;
50 56
51 protected ListenerObject placeLo = new ListenerObject(PLACE, name); 57 protected AliasListenerObject placeLo;
52 58
59 protected Entity event;
60
53 public AbstractEvent(Entity event){ 61 public AbstractEvent(Entity event){
54 this.setEvent(event); 62 this.setEvent(event);
55 } 63 }
56 64
57 protected Entity event; 65 /* (non-Javadoc)
58 /* 66 * @see de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean#reset()
59 public void listenerChangeText(ValueChangeEvent event) { 67 */
60 this.text = changeListener(event, text, TEXT, full_title_translit); 68 @Override
61 this.witness = null; 69 public void reset() {
62 if(text.entity != null && text.entity.isPersistent()){ 70 super.reset();
63 refreshWitnesses(text.entity); 71 if (textLo != null) {
64 }else{ 72 textLo.reset();
65 this.witnessList = new ArrayList<SelectItem>(); 73 } else {
66 } 74 textLo = new EventTextLO(TEXT, full_title_translit, this);
67 }*/ 75 }
68 76 if (placeLo != null) {
69 public void refreshWitnesses(Entity text){ 77 placeLo.reset();
78 } else {
79 placeLo = new AliasListenerObject(PLACE, name, is_alias_name_of);
80 }
81 }
82
83 public void refreshWitnesses(Entity text){
70 this.witnessList = new ArrayList<SelectItem>(); 84 this.witnessList = new ArrayList<SelectItem>();
71 List<Entity> list = getWrapper().getSourcesForTargetRelation(text, is_exemplar_of, WITNESS, -1); 85 List<Entity> list = getWrapper().getSourcesForTargetRelation(text, is_exemplar_of, WITNESS, -1);
72 System.out.println("Found " + list.size() + " witnesses"); 86 System.out.println("Found " + list.size() + " witnesses");
73 if(list.isEmpty()){ 87 if(list.isEmpty()){
74 witnessList.add(new SelectItem(null, "This text has no witness associated")); 88 witnessList.add(new SelectItem(null, "This text has no witness associated"));
167 181
168 public ListenerObject getPlaceLo() { 182 public ListenerObject getPlaceLo() {
169 return placeLo; 183 return placeLo;
170 } 184 }
171 185
172 public void setPlaceLo(ListenerObject placeLo) { 186 public void setPlaceLo(AliasListenerObject placeLo) {
173 this.placeLo = placeLo; 187 this.placeLo = placeLo;
174 } 188 }
175 189
176 public void test(AjaxBehaviorEvent e){ 190 public void test(AjaxBehaviorEvent e){
177 System.out.println("test(ActionEvent e)"); 191 System.out.println("test(ActionEvent e)");