Beim SciInstitutePublicationsTab kann jetzt eingestellt werden, dass nur Publikationen es Typs WorkingPaper angezeigt werden

bzw. diese ausgeschlossen werden. Wird für bestimmte Anwendungsfälle benötigt.


git-svn-id: https://svn.libreccm.org/ccm/trunk@1276 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2011-11-20 09:49:27 +00:00
parent b37fd9c47e
commit fbb91c0767
1 changed files with 29 additions and 3 deletions

View File

@ -51,6 +51,8 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
private final TextFilter titleFilter = new TextFilter(TITLE_PARAM, private final TextFilter titleFilter = new TextFilter(TITLE_PARAM,
ContentPage.TITLE); ContentPage.TITLE);
private final TextFilter authorFilter; private final TextFilter authorFilter;
private boolean excludeWorkingPapers = false;
private boolean onlyWorkingPapers = false;
static { static {
config.load(); config.load();
@ -66,6 +68,14 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
} }
} }
public void setExcludeWorkingPapers(final boolean excludeWorkingPapers) {
this.excludeWorkingPapers = excludeWorkingPapers;
}
public void setOnlyWorkingPapers(final boolean onlyWorkingPapers) {
this.onlyWorkingPapers = onlyWorkingPapers;
}
public boolean hasData(final GenericOrganizationalUnit orgaunit) { public boolean hasData(final GenericOrganizationalUnit orgaunit) {
final long start = System.currentTimeMillis(); final long start = System.currentTimeMillis();
@ -105,6 +115,22 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
final Element filtersElem = publicationsElem.newChildElement( final Element filtersElem = publicationsElem.newChildElement(
"filters"); "filters");
if (excludeWorkingPapers && onlyWorkingPapers) {
throw new IllegalStateException(
"onlyWorkingPapers and excludeWorkingPapers are both set "
+ "to true. This is not possible.");
}
if (excludeWorkingPapers) {
publications.addFilter(
"objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
}
if (onlyWorkingPapers) {
publications.addFilter(
"objectType = 'com.arsdigita.cms.contenttypes.WorkingPaper'");
}
if (((yearValue == null) || yearValue.trim().isEmpty()) if (((yearValue == null) || yearValue.trim().isEmpty())
&& ((titleValue == null) || titleValue.trim().isEmpty()) && ((titleValue == null) || titleValue.trim().isEmpty())
&& ((authorValue == null) || authorValue.trim().isEmpty())) { && ((authorValue == null) || authorValue.trim().isEmpty())) {