Fix für Behandlung Alias in PersonalProjects

git-svn-id: https://svn.libreccm.org/ccm/trunk@1433 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2012-01-09 07:21:20 +00:00
parent ed4b6497ac
commit b63235878c
1 changed files with 28 additions and 4 deletions

View File

@ -153,26 +153,50 @@ public class PersonalProjects implements ContentGenerator {
} }
if (person.getAlias() != null) { if (person.getAlias() != null) {
collectProjects(person.getAlias(), projects); collectProjects(person.getAlias(), projects, language);
} }
return projects; return projects;
} }
private void collectProjects(final GenericPerson alias, private void collectProjects(final GenericPerson alias,
final List<SciProject> projects) { final List<SciProject> projects,
final String language) {
final DataCollection collection = (DataCollection) alias.get( final DataCollection collection = (DataCollection) alias.get(
"organizationalunit"); "organizationalunit");
final List<BigDecimal> processed = new ArrayList<BigDecimal>();
collection.addFilter(String.format("language = '%s'", language));
DomainObject obj; DomainObject obj;
while (collection.next()) { while (collection.next()) {
obj = DomainObjectFactory.newInstance(collection.getDataObject()); obj = DomainObjectFactory.newInstance(collection.getDataObject());
if (obj instanceof SciProject) { if (obj instanceof SciProject) {
processed.add(((SciProject) obj).getParent().getID());
projects.add((SciProject) obj); projects.add((SciProject) obj);
} }
} }
if (Kernel.getConfig().languageIndependentItems()) {
final DataCollection collectionLi = (DataCollection) alias.get(
"organizationalunit");
collectionLi.addFilter(
String.format("language = '%s'",
GlobalizationHelper.LANG_INDEPENDENT));
while (collectionLi.next()) {
obj =
DomainObjectFactory.newInstance(collectionLi.getDataObject());
if (obj instanceof SciProject) {
if (!(processed.contains(((SciProject) obj).getParent().
getID()))) {
projects.add((SciProject) obj);
}
}
}
}
if (alias.getAlias() != null) { if (alias.getAlias() != null) {
collectProjects(alias.getAlias(), projects); collectProjects(alias.getAlias(), projects, language);
} }
} }