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();
}
DynaActionForm f = (DynaActionForm)form;
String organisation = request.getParameter(Params.REPOSITORY.SHOW_BY_MOD.PARAMS.ORGANISATION);
String module = request.getParameter(Params.REPOSITORY.SHOW_BY_MOD.PARAMS.MODULE);
String visibility = request.getParameter(Params.REPOSITORY.SHOW_BY_MOD.PARAMS.CHOOSEN_VISIBILITY);
f.set(Params.REPOSITORY.SHOW_BY_MOD.FORM.ORGANISATION, organisation);
f.set(Params.REPOSITORY.SHOW_BY_MOD.FORM.MODULE, module);
f.set(Params.REPOSITORY.SHOW_BY_MOD.FORM.CHOOSEN_VISIBILITY, visibility);
request.setAttribute(Params.REPOSITORY.SHOW.FORM.CHOOSEN_VISIBILITY, 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 v = Visibility.fromString(visibility);
ServerServicesProvider userSSP = (ServerServicesProvider)request.getSession().getAttribute(Params.GENERAL.REQUEST.USER_SSP);
String action = request.getParameter(Params.REPOSITORY.SHOW_BY_MOD.PARAMS.ACTION);
if (!StringUtils.isBlank(action)) {
String revision = f.getString(Params.REPOSITORY.SHOW_BY_MOD.FORM.REVISION);
f.set(Params.REPOSITORY.SHOW_BY_MOD.FORM.REVISION, "");
try {
ModuleDescriptor md = userSSP.getModuleManagementService().getModule(v.getId(), organisation, module, revision);
userSSP.getModuleManagementService().removeModule(new Long(md.getId()));
LOGGER.info(MessageFormat.format("deleted {0}|{1}|{2}", new Object[] {organisation, module, revision}));
} catch (org.jayasoft.woj.common.services.ServiceException e) {
LOGGER.warn(MessageFormat.format("cannot delete {0}|{1}|{2}", new Object[] {organisation, module, revision}), e);
}
}
AreaInfo[] revInfos = null;
List revs = Collections.EMPTY_LIST;
try {
revInfos = userSSP.getModuleManagementService().getAllAreaInfo(new Long(userLogged.getGroup().getId()), v, organisation, module);
revs = Arrays.asList(revInfos);
Collections.sort(revs, getComparator(compare, desc));
} catch (org.jayasoft.woj.common.services.ServiceException e) {
LOGGER.warn("cannot retrieve organisations", e);