annotate src/main/java/de/mpiwg/itgroup/ismi/browse/FullEntityRepositoryBean.java @ 175:3d8b31508128

PublicByAuthor feature works now.
author Robert Casties <casties@mpiwg-berlin.mpg.de>
date Thu, 07 Jun 2018 18:47:18 +0200
parents aa564b1b5e1f
children 0d31c8be7c31
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
169
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
1 package de.mpiwg.itgroup.ismi.browse;
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
2
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
3 import java.util.ArrayList;
173
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
4 import java.util.Collections;
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
5 import java.util.Comparator;
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
6 import java.util.List;
169
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
7
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
8 import org.apache.commons.lang.StringUtils;
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
9 import org.mpi.openmind.cache.WrapperService;
173
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
10 import org.mpi.openmind.repository.bo.Attribute;
169
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
11 import org.mpi.openmind.repository.bo.Entity;
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
12
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
13 /**
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
14 * EntityRepositoryBean for full Entities with Attributes and Relations loaded.
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
15 *
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
16 * @author casties
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
17 *
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
18 */
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
19 public class FullEntityRepositoryBean extends EntityRepositoryBean {
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
20
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
21 private static final long serialVersionUID = 8022526185079972610L;
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
22
173
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
23 protected String sortAttributeName;
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
24
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
25 protected boolean sortAttributeNumerically = false;
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
26
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
27 /*
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
28 * (non-Javadoc)
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
29 *
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
30 * @see de.mpiwg.itgroup.ismi.browse.AbstractEntityRepositoryBean#
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
31 * updateAdvancedEntities()
169
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
32 */
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
33 @Override
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
34 protected void updateAdvancedEntities() {
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
35 if (StringUtils.isNotEmpty(getObjectClass())) {
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
36 this.advancedPaginator.initCount();
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
37 int startRecord = this.advancedPaginator.getCurrentPage() * this.advancedPaginator.getItemsPerPage();
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
38 if ((this.advancedPaginator.getCurrentPage() + 1) == this.advancedPaginator.getNumberOfPages()) {
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
39 int mod = this.entities.size() % advancedPaginator.getItemsPerPage();
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
40 if (mod == 0) {
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
41 this.currentEntities = entities.subList(startRecord,
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
42 startRecord + this.advancedPaginator.getItemsPerPage());
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
43 } else {
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
44 this.currentEntities = entities.subList(startRecord, startRecord + mod);
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
45 }
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
46
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
47 } else {
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
48 this.currentEntities = entities.subList(startRecord,
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
49 startRecord + this.advancedPaginator.getItemsPerPage());
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
50 }
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
51 } else {
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
52 // empty object_class
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
53 this.currentEntities = new ArrayList<Entity>();
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
54 }
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
55 // make sure all entities are loaded
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
56 WrapperService store = getWrapper();
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
57 for (Entity ent : this.currentEntities) {
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
58 if (ent.isLightweight()) {
173
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
59 store.getEntityContent(ent);
169
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
60 }
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
61 }
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
62 }
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
63
173
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
64 public String actionSortByAttributes() {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
65 try {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
66 this.sortByAttributes();
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
67 } catch (Exception e) {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
68 printInternalError(e);
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
69 logger.error(e.getMessage(), e);
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
70 }
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
71 return GOTO_ENTITY_REPOSITORY;
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
72 }
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
73
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
74 public void sortByAttributes() throws Exception {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
75 this.resultMode = MODE_ADVANCED;
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
76 this.setPage("");
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
77 this.entities = new ArrayList<Entity>();
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
78 this.currentEntities = new ArrayList<Entity>();
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
79
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
80 this.resultSummaryMsg = "";
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
81
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
82 /*
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
83 * run search and sort result (by attribute)
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
84 */
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
85 List<Entity> resultList = getWrapper().getEntitiesByDef(this.objectClass);
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
86 // sort List (by ownvalue)
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
87 Collections.sort(resultList,
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
88 getEntityAttributeComparator(this.sortAttributeName, this.sortAttributeNumerically));
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
89 this.entities = resultList;
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
90
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
91 if (resultList.size() > 0) {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
92 this.resultSummaryMsg = resultList.size() + " items were found!";
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
93 this.advancedPaginator.setCurrentPage(0);
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
94 int entitiesCount = this.entities.size();
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
95 this.advancedPaginator.resetNumberOfPages(entitiesCount);
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
96 this.updateAdvancedEntities();
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
97 } else {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
98 this.resultSummaryMsg = "No items were found!";
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
99 }
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
100 }
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
101
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
102 public Comparator<Entity> getEntityAttributeComparator(final String attName, final boolean numerically) {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
103 return new Comparator<Entity>() {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
104 @Override
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
105 public int compare(Entity e1, Entity e2) {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
106 if (e1.isLightweight()) {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
107 e1 = getWrapper().getEntityContent(e1);
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
108 }
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
109 Attribute att1 = e1.getAttributeByName(attName);
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
110 if (e2.isLightweight()) {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
111 e2 = getWrapper().getEntityContent(e2);
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
112 }
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
113 Attribute att2 = e2.getAttributeByName(attName);
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
114 if (att1 == null && att2 != null) {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
115 return 1;
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
116 } else if (att1 != null && att2 == null) {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
117 return -1;
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
118 } else if (att1 == null && att2 == null) {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
119 return 0;
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
120 }
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
121 if (numerically) {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
122 Integer a1 = null;
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
123 Integer a2 = null;
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
124 try {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
125 a1 = Integer.parseInt(att1.getValue());
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
126 } catch (Exception e) {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
127 }
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
128 try {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
129 a2 = Integer.parseInt(att2.getValue());
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
130 } catch (Exception e) {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
131 }
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
132 if (a1 == null && a2 != null) {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
133 return 1;
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
134 } else if (a1 != null && a2 == null) {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
135 return -1;
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
136 } else if (a1 == null && a2 == null) {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
137 return 0;
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
138 }
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
139 return Integer.compare(a1, a2);
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
140 } else {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
141 return att1.getValue().compareTo(att2.getValue());
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
142 }
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
143 }
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
144 };
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
145 }
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
146
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
147 /**
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
148 * @return the sortAttributeName
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
149 */
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
150 public String getSortAttributeName() {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
151 return sortAttributeName;
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
152 }
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
153
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
154 /**
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
155 * @param sortAttributeName
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
156 * the sortAttributeName to set
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
157 */
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
158 public void setSortAttributeName(String sortAttributeName) {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
159 this.sortAttributeName = sortAttributeName;
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
160 }
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
161
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
162 /**
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
163 * @return the sortAttributeNumerical
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
164 */
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
165 public boolean isSortAttributeNumerically() {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
166 return sortAttributeNumerically;
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
167 }
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
168
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
169 /**
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
170 * @param sortAttributeNumerical
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
171 * the sortAttributeNumerical to set
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
172 */
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
173 public void setSortAttributeNumerically(boolean sortAttributeNumerical) {
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
174 this.sortAttributeNumerically = sortAttributeNumerical;
aa564b1b5e1f publicByAuthor feature ui for selecting texts ready.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 169
diff changeset
175 }
169
0b5d02012299 more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
diff changeset
176 }