Mercurial > hg > ismi-richfaces
diff src/main/java/de/mpiwg/itgroup/ismi/browse/FullEntityRepositoryBean.java @ 169:0b5d02012299 public_by_author
more work on publicByAuthor feature.
author | Robert Casties <casties@mpiwg-berlin.mpg.de> |
---|---|
date | Thu, 31 May 2018 20:26:10 +0200 |
parents | |
children | aa564b1b5e1f |
line wrap: on
line diff
--- /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<Entity>(); + } + // make sure all entities are loaded + WrapperService store = getWrapper(); + for (Entity ent : this.currentEntities) { + if (ent.isLightweight()) { + store.getEntityContent(ent); + } + } + } + + + +}