if (uak==null) {
// not identified on master
return "repository.show.error";
} else {
Visibility v = uak.getPublishVisibilityRight();
List visibilities = new ArrayList(Arrays.asList(Visibility.getVisibilitiesUpTo(v)));
if (userLogged.getGroup() == null) {
visibilities.remove(Visibility.PRIVATE);
}
request.setAttribute(Params.REPOSITORY.SHOW.REQUEST.VISIBILITIES, visibilities);
DynaActionForm f = (DynaActionForm)form;
String choosenVisibilityString = f.getString(Params.REPOSITORY.SHOW.FORM.CHOOSEN_VISIBILITY);
String compare = f.getString(Params.REPOSITORY.SHOW.FORM.COMPARE);
String order = f.getString(Params.REPOSITORY.SHOW.FORM.ORDER);
boolean desc = ORDER_DESC.equals(order);
if (StringUtils.isBlank(compare)) {
compare = NO_COMPARATOR_NAME;
}
Visibility choosenVisibility;
if (StringUtils.isBlank(choosenVisibilityString)) {
choosenVisibility = v;
} else {
choosenVisibility = Visibility.fromString(choosenVisibilityString);
}
f.set(Params.REPOSITORY.SHOW.FORM.CHOOSEN_VISIBILITY, choosenVisibility.getName());
request.setAttribute(Params.REPOSITORY.SHOW.FORM.CHOOSEN_VISIBILITY, choosenVisibility.getName());
ServerServicesProvider userSSP = (ServerServicesProvider)request.getSession().getAttribute(Params.GENERAL.REQUEST.USER_SSP);
AreaInfo info = new AreaInfoImpl();
AreaInfo[] orgInfos = null;
List orgs = Collections.EMPTY_LIST;
if (userLogged.getGroup() != null) {
try {
info = userSSP.getModuleManagementService().getAreaInfo(new Long(userLogged.getGroup().getId()), choosenVisibility);
orgInfos = userSSP.getModuleManagementService().getAllAreaInfo(new Long(userLogged.getGroup().getId()), choosenVisibility, null, null);
orgs = Arrays.asList(orgInfos);
Collections.sort(orgs, getComparator(compare, desc));
} catch (org.jayasoft.woj.common.services.ServiceException e) {
LOGGER.warn("cannot retrieve organisations", e);
}
}
request.setAttribute(Params.REPOSITORY.SHOW.REQUEST.ORGANISATIONS, orgs);
request.setAttribute(Params.REPOSITORY.SHOW.REQUEST.AREA_INFO, info);
request.setAttribute(Params.REPOSITORY.SHOW.REQUEST.VISIBILITY_NAME, choosenVisibility.getName());
// request.setAttribute(Params.REPOSITORY.SHOW.REQUEST.AREA_SPACE, new AreaSpace(300, 74));
}
return null;
}