return new SecuredActionTemplate(mapping, form, request, response).execute(
new AbstractActionCall(){
public String doInAction(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
ActionsHelper.rememberPage(request, "/showRepository");
User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
if (userLogged==null) {
LOGGER.debug("user try to access repository page without being logged in.");
return ActionsHelper.loginForwardName();
}
UAK uak = null;
try {
uak = getUserUAK(userLogged, request);
} catch (Exception e) {
LOGGER.warn("user cannot be connected due to", e);
}
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);