annotate src/main/java/de/mpiwg/itgroup/ismi/merge/NonpublicEntitiesBean.java @ 216:93d33f138c9e default tip

update medeniyet image server URL.
author casties
date Wed, 26 Jan 2022 16:39:32 +0100
parents dedd218ad565
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
188
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
1 package de.mpiwg.itgroup.ismi.merge;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
2
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
3 import java.io.Serializable;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
4 import java.util.ArrayList;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
5 import java.util.List;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
6
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
7 import org.apache.log4j.Logger;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
8 import org.mpi.openmind.repository.bo.Entity;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
9 import org.mpi.openmind.repository.bo.Relation;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
10 import org.mpi.openmind.repository.services.utils.RelationFilter;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
11 import org.richfaces.event.ItemChangeEvent;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
12
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
13 import de.mpiwg.itgroup.ismi.browse.EntityRepositoryBean;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
14 import de.mpiwg.itgroup.ismi.browse.FullEntityRepositoryBean;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
15 import de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
16 import de.mpiwg.itgroup.ismi.entry.utils.PrivacityUtils;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
17
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
18 public class NonpublicEntitiesBean extends AbstractISMIBean implements Serializable{
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
19
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
20 private static Logger logger = Logger.getLogger(NonpublicEntitiesBean.class);
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
21
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
22 private static final long serialVersionUID = 1L;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
23
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
24 protected FullEntityRepositoryBean browseBean;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
25
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
26 protected String selectedTab = "aut";
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
27
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
28
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
29 public NonpublicEntitiesBean(){
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
30 //logger.info("AdvancedSearchBean");
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
31 this.reset();
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
32 }
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
33
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
34 public synchronized void reset(){
190
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
35 logger.info("NonpublicEntitiesBean.reset()");
188
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
36 browseBean = new FullEntityRepositoryBean();
190
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
37 logger.info("NonpublicEntitiesBean.reset() Done.");
188
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
38 }
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
39
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
40
190
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
41 /**
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
42 * Find non-public DIGITALIZATIONs of public CODEXs.
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
43 */
188
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
44 public void actionFindNonpublicDigitalizations() {
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
45 logger.debug("Start findNonpublicDigitalizations...");
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
46 List<RelationFilter> relFilters = new ArrayList<RelationFilter>();
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
47 /*
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
48 * find DIGITALIZATION is_digitalization_of CODEX relation
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
49 */
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
50 browseBean = new FullEntityRepositoryBean();
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
51 browseBean.setObjectClass(DIGITALIZATION);
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
52 RelationFilter relFilter = new RelationFilter();
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
53 relFilter.relObjectClass = "is_digitalization_of";
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
54 relFilter.tarObjectClass = "CODEX";
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
55 relFilters.add(relFilter);
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
56 try {
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
57 // search all digitalizations
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
58 browseBean.searchByRelations(relFilters);
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
59 // filter out non-public DIGITALIZATIONs of public CODEXs
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
60 List<Entity> entities = browseBean.getEntities();
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
61 List<Entity> nonpublicEntities = new ArrayList<Entity>();
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
62 for (Entity ent : entities) {
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
63 if (!ent.getIsPublic()) {
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
64 List<Relation> rels = ent.getSourceRelations("is_digitalization_of", CODEX);
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
65 for (Relation rel : rels) {
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
66 Entity tar = getWrapper().getEntityById(rel.getTargetId());
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
67 if (tar.getIsPublic()) {
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
68 nonpublicEntities.add(ent);
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
69 break;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
70 }
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
71 }
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
72 }
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
73 }
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
74 browseBean.updateEntities(nonpublicEntities);
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
75
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
76 } catch (Exception e) {
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
77 logger.error(e);
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
78 }
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
79 logger.debug("Done findNonpublicDigitalizations.");
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
80 }
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
81
196
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
82 /**
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
83 * Find non-public ALIASes with source relations to public entities.
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
84 */
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
85 public void actionFindNonpublicAliasSrcs() {
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
86 logger.debug("Start findNonpublicAliasSrcs...");
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
87 List<RelationFilter> relFilters = new ArrayList<RelationFilter>();
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
88 /*
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
89 * find ALIAS -*-> * relations
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
90 */
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
91 browseBean = new FullEntityRepositoryBean();
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
92 browseBean.setObjectClass(ALIAS);
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
93 RelationFilter relFilter = new RelationFilter();
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
94 relFilter.relObjectClass = "*";
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
95 relFilter.tarObjectClass = "*";
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
96 relFilters.add(relFilter);
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
97 try {
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
98 // search all aliases with target relations
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
99 browseBean.searchByRelations(relFilters);
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
100 // filter out non-public ALIASes of public entities
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
101 List<Entity> entities = browseBean.getEntities();
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
102 List<Entity> nonpublicEntities = new ArrayList<Entity>();
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
103 for (Entity ent : entities) {
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
104 if (!ent.getIsPublic()) {
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
105 List<Relation> rels = ent.getSourceRelations("*", "*");
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
106 for (Relation rel : rels) {
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
107 Entity tar = getWrapper().getEntityById(rel.getTargetId());
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
108 if (tar.getIsPublic()) {
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
109 nonpublicEntities.add(ent);
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
110 break;
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
111 }
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
112 }
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
113 }
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
114 }
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
115 browseBean.updateEntities(nonpublicEntities);
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
116
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
117 } catch (Exception e) {
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
118 logger.error(e);
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
119 }
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
120 logger.debug("Done findNonpublicAliasSrcs.");
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
121 }
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
122
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
123 /**
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
124 * Find non-public ALIASes with target relations to public entities.
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
125 */
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
126 public void actionFindNonpublicAliasTars() {
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
127 logger.debug("Start findNonpublicAliasTars...");
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
128 List<RelationFilter> relFilters = new ArrayList<RelationFilter>();
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
129 /*
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
130 * find ALIAS <-*- * relations
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
131 */
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
132 browseBean = new FullEntityRepositoryBean();
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
133 browseBean.setObjectClass(ALIAS);
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
134 RelationFilter relFilter = new RelationFilter();
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
135 relFilter.relObjectClass = "*";
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
136 relFilter.srcObjectClass = "*";
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
137 relFilters.add(relFilter);
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
138 try {
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
139 // search all aliases with target relations
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
140 browseBean.searchByRelations(relFilters);
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
141 // filter out non-public ALIASes of public entities
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
142 List<Entity> entities = browseBean.getEntities();
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
143 List<Entity> nonpublicEntities = new ArrayList<Entity>();
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
144 for (Entity ent : entities) {
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
145 if (!ent.getIsPublic()) {
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
146 List<Relation> rels = ent.getTargetRelations("*", "*");
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
147 for (Relation rel : rels) {
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
148 Entity tar = getWrapper().getEntityById(rel.getSourceId());
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
149 if (tar.getIsPublic()) {
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
150 nonpublicEntities.add(ent);
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
151 break;
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
152 }
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
153 }
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
154 }
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
155 }
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
156 browseBean.updateEntities(nonpublicEntities);
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
157
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
158 } catch (Exception e) {
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
159 logger.error(e);
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
160 }
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
161 logger.debug("Done findNonpublicAliasTars.");
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
162 }
dedd218ad565 new find-non-public-entities function for aliases with source or target relations.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 190
diff changeset
163
188
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
164 /**
190
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
165 * Makes the selected Entities public.
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
166 * Uses PrivacityUtils.changeEntityPrivacity().
188
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
167 * @return
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
168 */
190
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
169 public String actionMakeSelectedEntitiesPublic() {
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
170 logger.info("MAKE SELECTED ENTITIES PUBLIC");
188
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
171 List<String> textMsg = new ArrayList<String>();
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
172 try {
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
173 List<Entity> entities = browseBean.getEntities();
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
174 if (entities.size() == 0) return null;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
175 for (Entity ent : entities) {
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
176 PrivacityUtils.changeEntityPrivacity(ent, true, getWrapper());
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
177 textMsg.add("Set public=true on "+ent.getShortString()+"\n");
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
178 }
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
179 // save only public state
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
180 getWrapper().saveEntityListAsNodeWithoutContent(entities, null);
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
181 } catch (Exception e) {
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
182 logger.error(e);
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
183 }
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
184 for (String msg : textMsg) {
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
185 this.addGeneralMsg(msg);
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
186 logger.debug(msg);
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
187 }
190
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
188 addGeneralMsg(browseBean.getEntities().size() + " Entities were made public!");
188
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
189 return null;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
190 }
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
191
190
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
192 /**
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
193 * Find non-public REFERENCEs of public Entities.
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
194 */
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
195 public void actionFindNonpublicReferences() {
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
196 logger.debug("Start findNonpublicReferences...");
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
197 List<RelationFilter> relFilters = new ArrayList<RelationFilter>();
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
198 /*
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
199 * find REFERENCE is_reference_of * relations
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
200 */
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
201 browseBean = new FullEntityRepositoryBean();
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
202 browseBean.setObjectClass(REFERENCE);
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
203 RelationFilter relFilter = new RelationFilter();
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
204 relFilter.relObjectClass = "is_reference_of";
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
205 relFilter.tarObjectClass = "*";
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
206 relFilters.add(relFilter);
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
207 try {
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
208 // search all References
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
209 browseBean.searchByRelations(relFilters);
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
210 // filter out non-public REFERENCEs of public Entities
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
211 List<Entity> entities = browseBean.getEntities();
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
212 List<Entity> nonpublicEntities = new ArrayList<Entity>();
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
213 for (Entity ent : entities) {
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
214 if (!ent.getIsPublic()) {
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
215 List<Relation> rels = ent.getSourceRelations("is_reference_of", "*");
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
216 for (Relation rel : rels) {
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
217 Entity tar = getWrapper().getEntityById(rel.getTargetId());
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
218 if (tar.getIsPublic()) {
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
219 nonpublicEntities.add(ent);
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
220 break;
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
221 }
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
222 }
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
223 }
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
224 }
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
225 browseBean.updateEntities(nonpublicEntities);
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
226
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
227 } catch (Exception e) {
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
228 logger.error(e);
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
229 }
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
230 logger.debug("Done findNonpublicReferences.");
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
231 }
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
232
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
233 /**
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
234 * Find non-public WITNESSes of public TEXTs.
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
235 */
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
236 public void actionFindNonpublicWitnesses() {
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
237 logger.debug("Start findNonpublicWitnesses...");
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
238 List<RelationFilter> relFilters = new ArrayList<RelationFilter>();
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
239 /*
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
240 * find WITNESS is_exemplar_of TEXT relation
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
241 */
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
242 browseBean = new FullEntityRepositoryBean();
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
243 browseBean.setObjectClass(WITNESS);
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
244 RelationFilter relFilter = new RelationFilter();
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
245 relFilter.relObjectClass = "is_exemplar_of";
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
246 relFilter.tarObjectClass = "TEXT";
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
247 relFilters.add(relFilter);
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
248 try {
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
249 // search all Witnesses
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
250 browseBean.searchByRelations(relFilters);
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
251 // filter out non-public Witnesses of public CODEXs
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
252 List<Entity> entities = browseBean.getEntities();
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
253 List<Entity> nonpublicEntities = new ArrayList<Entity>();
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
254 for (Entity ent : entities) {
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
255 if (!ent.getIsPublic()) {
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
256 List<Relation> rels = ent.getSourceRelations("is_exemplar_of", TEXT);
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
257 for (Relation rel : rels) {
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
258 Entity tar = getWrapper().getEntityById(rel.getTargetId());
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
259 if (tar.getIsPublic()) {
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
260 nonpublicEntities.add(ent);
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
261 break;
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
262 }
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
263 }
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
264 }
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
265 }
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
266 browseBean.updateEntities(nonpublicEntities);
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
267
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
268 } catch (Exception e) {
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
269 logger.error(e);
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
270 }
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
271 logger.debug("Done findNonpublicWitnesses.");
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
272 }
b36a57a452a6 new Clean UI to find non-public references and witnesses and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 188
diff changeset
273
188
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
274
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
275 public EntityRepositoryBean getBrowseBean() {
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
276 return browseBean;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
277 }
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
278
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
279 public void listenerTabChange(ItemChangeEvent event) {
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
280 reset();
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
281 String url = "?formIndex=" + selectedTab;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
282 redirect(null, url);
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
283 }
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
284
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
285 public String getSelectedTab() {
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
286 return selectedTab;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
287 }
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
288
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
289 public void setSelectedTab(String selectedMissingRelationsTab) {
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
290 selectedTab = selectedMissingRelationsTab;
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
291 }
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
292
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
293
34ac2e1b323a new Clean UI to find non-public digitalizations of public codices and make them public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
294 }