# HG changeset patch # User Robert Casties # Date 1527791170 -7200 # Node ID 0b5d02012299e9f00a09895d087b2c2173288ddd # Parent e9ab943ec528159fe2f894e8c54e70b7365aa7ef more work on publicByAuthor feature. diff -r e9ab943ec528 -r 0b5d02012299 src/main/java/de/mpiwg/itgroup/ismi/browse/AbstractEntityRepositoryBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/browse/AbstractEntityRepositoryBean.java Wed May 30 20:23:45 2018 +0200 +++ b/src/main/java/de/mpiwg/itgroup/ismi/browse/AbstractEntityRepositoryBean.java Thu May 31 20:26:10 2018 +0200 @@ -22,57 +22,57 @@ private static final long serialVersionUID = 3154642100627969159L; - private static Logger logger = Logger.getLogger(AbstractEntityRepositoryBean.class); + protected static Logger logger = Logger.getLogger(AbstractEntityRepositoryBean.class); public static String MODE_ADVANCED = "advanced"; public static String MODE_ALL = "all"; public static String MODE_NONE = "none"; - private String objectClass = null; - private List entities = new ArrayList(); - private List currentEntities = new ArrayList(); + protected String objectClass = null; + protected List entities = new ArrayList(); + protected List currentEntities = new ArrayList(); - private List definitions = new ArrayList(); + protected List definitions = new ArrayList(); - private transient DataPaginator advancedPaginator = new DataPaginator(); + protected transient DataPaginator advancedPaginator = new DataPaginator(); - private String ocTerm; - private String currentTab; + protected String ocTerm; + protected String currentTab; - private String textFullTitle; - private String textFullTitleTranslit; - private String textShortTitle; + protected String textFullTitle; + protected String textFullTitleTranslit; + protected String textShortTitle; - private String personName; - private String personNameTranslit; + protected String personName; + protected String personNameTranslit; - private String codexIdentifier; + protected String codexIdentifier; - private String collectionName; + protected String collectionName; - private String placeName; - private String placeType; + protected String placeName; + protected String placeType; - private String aliasAlias; + protected String aliasAlias; - private String repositoryName; + protected String repositoryName; - private String witnessFullTitle; - private String witnessFullTitleTranslit; - private String witnessAhlwardtNo; + protected String witnessFullTitle; + protected String witnessFullTitleTranslit; + protected String witnessAhlwardtNo; - private boolean advancedSearch = false; - private String resultMode = MODE_NONE; - private String resultSummaryMsg; + protected boolean advancedSearch = false; + protected String resultMode = MODE_NONE; + protected String resultSummaryMsg; - private String subjectType; - private List suggestedSubjectTypes = new ArrayList(); + protected String subjectType; + protected List suggestedSubjectTypes = new ArrayList(); - private String referenceBibIdNo; + protected String referenceBibIdNo; - private String page; - private String pageMsg; + protected String page; + protected String pageMsg; public static String main_subject = "main_subject"; public static String sub_subject = "sub_subject"; @@ -87,7 +87,7 @@ /** * Put the current subset of this.entites in this.currentEntities. */ - private void updateAdvancedEntities() { + protected void updateAdvancedEntities() { if (StringUtils.isNotEmpty(getObjectClass())) { this.advancedPaginator.initCount(); int startRecord = this.advancedPaginator.getCurrentPage() * this.advancedPaginator.getItemsPerPage(); diff -r e9ab943ec528 -r 0b5d02012299 src/main/java/de/mpiwg/itgroup/ismi/browse/EntityRepositoryBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/browse/EntityRepositoryBean.java Wed May 30 20:23:45 2018 +0200 +++ b/src/main/java/de/mpiwg/itgroup/ismi/browse/EntityRepositoryBean.java Thu May 31 20:26:10 2018 +0200 @@ -23,7 +23,7 @@ private static final long serialVersionUID = -2380877853539157567L; - private transient DataPaginator paginator = new DataPaginator(); + protected transient DataPaginator paginator = new DataPaginator(); public EntityRepositoryBean(){ super(); @@ -36,7 +36,7 @@ } - private void updateEntities() { + protected void updateEntities() { if (StringUtils.isNotEmpty(getObjectClass())) { this.paginator.initCount(); int startRecord = this.paginator.getCurrentPage() * this.paginator.getItemsPerPage(); diff -r e9ab943ec528 -r 0b5d02012299 src/main/java/de/mpiwg/itgroup/ismi/browse/FullEntityRepositoryBean.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/mpiwg/itgroup/ismi/browse/FullEntityRepositoryBean.java Thu May 31 20:26:10 2018 +0200 @@ -0,0 +1,55 @@ +package de.mpiwg.itgroup.ismi.browse; + +import java.util.ArrayList; + +import org.apache.commons.lang.StringUtils; +import org.mpi.openmind.cache.WrapperService; +import org.mpi.openmind.repository.bo.Entity; + +/** + * EntityRepositoryBean for full Entities with Attributes and Relations loaded. + * + * @author casties + * + */ +public class FullEntityRepositoryBean extends EntityRepositoryBean { + + private static final long serialVersionUID = 8022526185079972610L; + + /* (non-Javadoc) + * @see de.mpiwg.itgroup.ismi.browse.AbstractEntityRepositoryBean#updateAdvancedEntities() + */ + @Override + protected void updateAdvancedEntities() { + if (StringUtils.isNotEmpty(getObjectClass())) { + this.advancedPaginator.initCount(); + int startRecord = this.advancedPaginator.getCurrentPage() * this.advancedPaginator.getItemsPerPage(); + if ((this.advancedPaginator.getCurrentPage() + 1) == this.advancedPaginator.getNumberOfPages()) { + int mod = this.entities.size() % advancedPaginator.getItemsPerPage(); + if (mod == 0) { + this.currentEntities = entities.subList(startRecord, + startRecord + this.advancedPaginator.getItemsPerPage()); + } else { + this.currentEntities = entities.subList(startRecord, startRecord + mod); + } + + } else { + this.currentEntities = entities.subList(startRecord, + startRecord + this.advancedPaginator.getItemsPerPage()); + } + } else { + // empty object_class + this.currentEntities = new ArrayList(); + } + // make sure all entities are loaded + WrapperService store = getWrapper(); + for (Entity ent : this.currentEntities) { + if (ent.isLightweight()) { + store.getEntityContent(ent); + } + } + } + + + +} diff -r e9ab943ec528 -r 0b5d02012299 src/main/java/de/mpiwg/itgroup/ismi/merge/PublicByAuthorBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/merge/PublicByAuthorBean.java Wed May 30 20:23:45 2018 +0200 +++ b/src/main/java/de/mpiwg/itgroup/ismi/merge/PublicByAuthorBean.java Thu May 31 20:26:10 2018 +0200 @@ -1,13 +1,18 @@ package de.mpiwg.itgroup.ismi.merge; import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; import javax.faces.event.ActionEvent; import javax.faces.event.ValueChangeEvent; import org.apache.log4j.Logger; +import org.mpi.openmind.repository.bo.Entity; +import org.mpi.openmind.repository.bo.Relation; import de.mpiwg.itgroup.ismi.browse.EntityRepositoryBean; +import de.mpiwg.itgroup.ismi.browse.FullEntityRepositoryBean; import de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean; public class PublicByAuthorBean extends AbstractISMIBean implements Serializable{ @@ -17,8 +22,13 @@ private static final long serialVersionUID = 1L; private String findAuthorName = ""; - private long timeExecution; - + protected Long selectedPersonId = 0l; + + protected Entity selectedPerson; + protected List selectedPersonTexts; + protected List selectedPersonSubjects; + + private EntityRepositoryBean browseBean; @@ -29,34 +39,49 @@ public void reset(){ //logger.info("AdvancedSearchBean.reset()"); - browseBean = new EntityRepositoryBean(); + browseBean = new FullEntityRepositoryBean(); browseBean.setObjectClass("PERSON"); - } - - public void listenerChange(ValueChangeEvent event){ - /* - logger.info(event.getOldValue()); - logger.info(event.getNewValue()); - */ + + selectedPersonTexts = new ArrayList(); } - public void listenerFindAuthorSearch(ActionEvent event){ - try { - long start = System.currentTimeMillis(); - this.search(); - long end = System.currentTimeMillis(); - this.timeExecution = end - start; - logger.info(toString() + " time execution=" + (timeExecution)); - } catch (Exception e) { - logger.error(e.getMessage(), e); - printInternalError(e); - } + public void listenerAuthorIdSearch(ActionEvent event) { + setSelectedPersonById(); + } + private void setSelectedPersonById() { + Entity ent = getWrapper().getEntityById(selectedPersonId); + if (ent != null) { + ent = getWrapper().getEntityContent(ent); + selectedPerson = ent; + updateSelectedPerson(); + } + } + + + + public void updateSelectedPerson() { + // load all texts by this author + selectedPersonTexts = new ArrayList(); + List textRels = selectedPerson.getTargetRelations("was_created_by", "TEXT"); + for (Relation rel : textRels) { + Long textID = rel.getSourceId(); + Entity text = getWrapper().getEntityByIdWithContent(textID); + selectedPersonTexts.add(text); + } } + public String actionSelectPerson() { + Entity entity = (Entity) getRequestBean("entity"); + selectedPersonId = entity.getId(); + setSelectedPersonById(); + // switch tab + getSessionBean().setSelectedPublicByAuthorTab("02"); + return null; + } - public String actionSearch(){ + public String actionSearch(){ this.search(); return null; } @@ -90,4 +115,45 @@ return browseBean; } + /** + * @return the selectedPersonId + */ + public long getSelectedPersonId() { + return selectedPersonId; + } + + /** + * @param selectedPersonId the selectedPersonId to set + */ + public void setSelectedPersonId(long selectedPersonId) { + this.selectedPersonId = selectedPersonId; + } + /** + * @return the selectedPerson + */ + public Entity getSelectedPerson() { + return selectedPerson; + } + + /** + * @return the selectedPersonTexts + */ + public List getSelectedPersonTexts() { + return selectedPersonTexts; + } + + /** + * @return the selectedPersonSubjects + */ + public List getSelectedPersonSubjects() { + return selectedPersonSubjects; + } + + /** + * @param selectedPersonId the selectedPersonId to set + */ + public void setSelectedPersonId(Long selectedPersonId) { + this.selectedPersonId = selectedPersonId; + } + } diff -r e9ab943ec528 -r 0b5d02012299 src/main/webapp/clean/components/findAuthor.xhtml --- a/src/main/webapp/clean/components/findAuthor.xhtml Wed May 30 20:23:45 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r e9ab943ec528 -r 0b5d02012299 src/main/webapp/clean/components/publicFindAuthor.xhtml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/webapp/clean/components/publicFindAuthor.xhtml Thu May 31 20:26:10 2018 +0200 @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MAMS + + + + Person + + + + + + + + + + State + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r e9ab943ec528 -r 0b5d02012299 src/main/webapp/clean/components/publicShowSubjects.xhtml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/webapp/clean/components/publicShowSubjects.xhtml Thu May 31 20:26:10 2018 +0200 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + +
#{titleItem.ownValue}
+
+
+ + + +
+ + + +
+ + diff -r e9ab943ec528 -r 0b5d02012299 src/main/webapp/clean/publicByAuthor.xhtml --- a/src/main/webapp/clean/publicByAuthor.xhtml Wed May 30 20:23:45 2018 +0200 +++ b/src/main/webapp/clean/publicByAuthor.xhtml Thu May 31 20:26:10 2018 +0200 @@ -9,10 +9,10 @@ + + - -
@@ -20,14 +20,17 @@ - - - + + + + +