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,
ContentPage.TITLE);
private final TextFilter authorFilter;
private boolean excludeWorkingPapers = false;
private boolean onlyWorkingPapers = false;
static {
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) {
final long start = System.currentTimeMillis();
@ -105,6 +115,22 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
final Element filtersElem = publicationsElem.newChildElement(
"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())
&& ((titleValue == null) || titleValue.trim().isEmpty())
&& ((authorValue == null) || authorValue.trim().isEmpty())) {
@ -273,7 +299,7 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
}
} else {
/*publicationsFilter.append(String.format("orgaunitId = %s",
orgaunit.getID().toString()));*/
orgaunit.getID().toString()));*/
orgaunitIds.add(orgaunit.getID().toString());
}
@ -296,7 +322,7 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
yearFilter.setValue(yearValue);
}
if ((yearFilter.getFilter() != null)
if ((yearFilter.getFilter() != null)
&& !(yearFilter.getFilter().isEmpty())) {
publications.addFilter(yearFilter.getFilter());
}