annotate src/main/java/de/mpiwg/itgroup/ismi/merge/MissingRelationsBean.java @ 180:0d31c8be7c31

new MissingRelations feature and UI. including searchByRelations() with Filter in FullEntityRepositoryBean.
author Robert Casties <casties@mpiwg-berlin.mpg.de>
date Wed, 13 Jun 2018 14:57:13 +0200
parents
children 52aa06772336
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
180
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
1 package de.mpiwg.itgroup.ismi.merge;
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
2
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
3 import java.io.Serializable;
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
4 import java.util.ArrayList;
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
5 import java.util.List;
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
6
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
7 import org.apache.log4j.Logger;
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
8 import org.mpi.openmind.repository.services.utils.RelationFilter;
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
9
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
10 import de.mpiwg.itgroup.ismi.browse.EntityRepositoryBean;
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
11 import de.mpiwg.itgroup.ismi.browse.FullEntityRepositoryBean;
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
12 import de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean;
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
13
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
14 public class MissingRelationsBean extends AbstractISMIBean implements Serializable{
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
15
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
16 private static Logger logger = Logger.getLogger(MissingRelationsBean.class);
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
17
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
18 private static final long serialVersionUID = 1L;
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
19
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
20 private FullEntityRepositoryBean browseBean;
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
21
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
22
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
23 public MissingRelationsBean(){
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
24 //logger.info("AdvancedSearchBean");
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
25 this.reset();
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
26 }
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
27
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
28 public synchronized void reset(){
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
29 logger.info("MissingRelationsBean.reset()");
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
30 browseBean = new FullEntityRepositoryBean();
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
31 browseBean.setObjectClass(TEXT);
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
32
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
33 logger.info("MissingRelationsBean.reset() Done.");
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
34 }
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
35
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
36
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
37 public void actionReset() {
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
38 reset();
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
39 }
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
40
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
41
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
42 public void actionFindMissingAuthors() {
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
43 logger.debug("Start findMissingAuthors...");
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
44 List<RelationFilter> relFilters = new ArrayList<RelationFilter>();
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
45 /*
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
46 * find TEXT without was_created_by PERSON relation
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
47 */
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
48 browseBean.setObjectClass(TEXT);
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
49 RelationFilter relFilter = new RelationFilter();
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
50 relFilter.relObjectClass = "was_created_by";
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
51 relFilter.tarObjectClass = "PERSON";
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
52 relFilter.relationMissing = true;
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
53 relFilters.add(relFilter);
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
54 try {
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
55 browseBean.searchByRelations(relFilters);
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
56 } catch (Exception e) {
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
57 logger.error(e);
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
58 }
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
59 logger.debug("Done findMissingAuthors.");
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
60 }
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
61
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
62 public void actionFindMissingTexts() {
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
63 logger.debug("Start findMissingTexts...");
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
64 List<RelationFilter> relFilters = new ArrayList<RelationFilter>();
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
65 /*
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
66 * find WITNESS without is_exemplar_of TEXT relation
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
67 */
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
68 browseBean.setObjectClass(WITNESS);
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
69 RelationFilter relFilter = new RelationFilter();
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
70 relFilter.relObjectClass = "is_exemplar_of";
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
71 relFilter.tarObjectClass = "TEXT";
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
72 relFilter.relationMissing = true;
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
73 relFilters.add(relFilter);
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
74 try {
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
75 browseBean.searchByRelations(relFilters);
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
76 } catch (Exception e) {
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
77 logger.error(e);
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
78 }
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
79 logger.debug("Done findMissingTexts.");
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
80 }
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
81
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
82 public void actionFindMissingCodices() {
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
83 logger.debug("Start findMissingCodices...");
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
84 List<RelationFilter> relFilters = new ArrayList<RelationFilter>();
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
85 /*
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
86 * find WITNESS without is_part_of CODEX relation
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
87 */
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
88 browseBean.setObjectClass(WITNESS);
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
89 RelationFilter relFilter = new RelationFilter();
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
90 relFilter.relObjectClass = "is_part_of";
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
91 relFilter.tarObjectClass = "CODEX";
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
92 relFilter.relationMissing = true;
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
93 relFilters.add(relFilter);
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
94 try {
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
95 browseBean.searchByRelations(relFilters);
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
96 } catch (Exception e) {
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
97 logger.error(e);
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
98 }
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
99 logger.debug("Done findMissingCodices.");
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
100 }
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
101
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
102 /**
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
103 * @return the browseBean
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
104 */
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
105 public EntityRepositoryBean getBrowseBean() {
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
106 return browseBean;
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
107 }
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
108
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
109
0d31c8be7c31 new MissingRelations feature and UI.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
110 }