Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
net.anotheria.anosite.gen.asgenericdata.action.MultiOpDialogGenericBoxHandlerDefsAction Maven / Gradle / Ivy
/**
********************************************************************************
*** MultiOpDialogGenericBoxHandlerDefsAction.java ***
*** generated by AnoSiteGenerator (ASG), Version: 2.6.3 ***
*** Copyright (C) 2005 - 2010 Anotheria.net, www.anotheria.net ***
*** All Rights Reserved. ***
********************************************************************************
*** Don't edit this code, if you aren't sure ***
*** that you do exactly know what you are doing! ***
*** It's better to invest time in the generator, as into the generated code. ***
********************************************************************************
*/
package net.anotheria.anosite.gen.asgenericdata.action;
import net.anotheria.util.NumberUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.anotheria.maf.action.ActionForward;
import net.anotheria.maf.action.ActionMapping;
import net.anotheria.maf.bean.FormBean;
import java.util.List;
import java.util.ArrayList;
import net.anotheria.anosite.gen.asgenericdata.data.GenericBoxHandlerDefFactory;
import net.anotheria.anosite.gen.asgenericdata.data.GenericBoxHandlerDef;
import net.anotheria.anosite.gen.asgenericdata.bean.EditGenericBoxHandlerDefFB;
import net.anotheria.asg.data.LockableObject;
import net.anotheria.asg.util.locking.helper.DocumentLockingHelper;
import net.anotheria.maf.bean.annotations.Form;
public class MultiOpDialogGenericBoxHandlerDefsAction extends BaseGenericBoxHandlerDefAction{
// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateMultiOpDialogAction
@Override
public ActionForward execute(ActionMapping mapping, @Form(EditGenericBoxHandlerDefFB.class) FormBean formBean, HttpServletRequest req, HttpServletResponse res) throws Exception{
return super.execute(mapping, formBean, req, res);
} //execute
public ActionForward anoDocExecute(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
String path = stripPath(mapping.getPath());
if (path.equals("asgenericdataGenericBoxHandlerDefDelete"))
return asgenericdataGenericBoxHandlerDefDelete(mapping, af, req, res);
if (path.equals("asgenericdataGenericBoxHandlerDefDuplicate"))
return asgenericdataGenericBoxHandlerDefDuplicate(mapping, af, req, res);
if (path.equals("asgenericdataGenericBoxHandlerDefUpdate"))
return asgenericdataGenericBoxHandlerDefUpdate(mapping, af, req, res);
if (path.equals("asgenericdataGenericBoxHandlerDefClose"))
return asgenericdataGenericBoxHandlerDefClose(mapping, af, req, res);
if (path.equals("asgenericdataGenericBoxHandlerDefLock"))
return asgenericdataGenericBoxHandlerDefLock(mapping, af, req, res);
if (path.equals("asgenericdataGenericBoxHandlerDefUnLock"))
return asgenericdataGenericBoxHandlerDefUnLock(mapping, af, req, res);
throw new IllegalArgumentException("Unknown path: "+path);
}
public ActionForward asgenericdataGenericBoxHandlerDefDelete(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
String[] iDs = req.getParameterValues(PARAM_ID);
if (iDs == null){
throw new RuntimeException("Parameter " + PARAM_ID + " is not set.");
}
for (String id : iDs){
GenericBoxHandlerDef genericboxhandlerdefCurr = getASGenericDataService().getGenericBoxHandlerDef(id);
if (genericboxhandlerdefCurr instanceof LockableObject){
LockableObject lockable = (LockableObject)genericboxhandlerdefCurr;
DocumentLockingHelper.delete.checkExecutionPermission(lockable, false, getUserId(req));
}
getASGenericDataService().deleteGenericBoxHandlerDef(id);
}
res.sendRedirect("asgenericdataGenericBoxHandlerDefShow?ts="+System.currentTimeMillis());
return null;
}
public ActionForward asgenericdataGenericBoxHandlerDefDuplicate(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
String id = getStringParameter(req, PARAM_ID);
GenericBoxHandlerDef genericboxhandlerdefSrc = getASGenericDataService().getGenericBoxHandlerDef(id);
GenericBoxHandlerDef genericboxhandlerdefDest = GenericBoxHandlerDefFactory.createGenericBoxHandlerDef(genericboxhandlerdefSrc);
GenericBoxHandlerDef genericboxhandlerdefCreated = getASGenericDataService().createGenericBoxHandlerDef(genericboxhandlerdefDest);
res.sendRedirect("asgenericdataGenericBoxHandlerDefEdit?ts="+System.currentTimeMillis()+"&"+PARAM_ID+"="+genericboxhandlerdefCreated.getId());
return null;
}
// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateUpdateActionMethod
public ActionForward asgenericdataGenericBoxHandlerDefUpdate(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
EditGenericBoxHandlerDefFB form = (EditGenericBoxHandlerDefFB) af;
boolean create = false;
GenericBoxHandlerDef genericboxhandlerdef = null;
if (form.getId()==null) {
res.sendRedirect("asresourcedataLocalizationBundleShow?ts="+System.currentTimeMillis());
return null;
}
if (form.getId().length()>0){
genericboxhandlerdef = (GenericBoxHandlerDef)getASGenericDataService().getGenericBoxHandlerDef(form.getId()).clone();
}else{
genericboxhandlerdef = GenericBoxHandlerDefFactory.createGenericBoxHandlerDef();
create = true;
}
String nextAction = req.getParameter("nextAction");
if (nextAction == null || nextAction.length() == 0)
nextAction = "close";
//skipped id because it's readonly.
genericboxhandlerdef.setName(form.getName());
genericboxhandlerdef.setClazz(form.getClazz());
GenericBoxHandlerDef updatedCopy = null;
if (create){
updatedCopy = getASGenericDataService().createGenericBoxHandlerDef(genericboxhandlerdef);
}else{
canUpdateGenericBoxHandlerDefs(genericboxhandlerdef, req);
checkGenericBoxHandlerDefs(genericboxhandlerdef, req);
updatedCopy = getASGenericDataService().updateGenericBoxHandlerDef(genericboxhandlerdef);
}
if (nextAction.equalsIgnoreCase("stay")){
res.sendRedirect("asgenericdataGenericBoxHandlerDefEdit?ts="+System.currentTimeMillis()+"&pId="+updatedCopy.getId());
}else{
unlockAfterUpdate(genericboxhandlerdef, req);
res.sendRedirect("asgenericdataGenericBoxHandlerDefShow?ts="+System.currentTimeMillis());
}
return null;
}
/**
* Simply unlocks document after updation.
*/
private void unlockAfterUpdate(GenericBoxHandlerDef genericboxhandlerdef, HttpServletRequest req) throws Exception{
if(((LockableObject)genericboxhandlerdef).isLocked())
unLockGenericBoxHandlerDefs(genericboxhandlerdef, req, false);
}
public ActionForward asgenericdataGenericBoxHandlerDefLock(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
String id = getStringParameter(req, PARAM_ID);
GenericBoxHandlerDef genericboxhandlerdefCurr = id != null && !id.equals("") ? getASGenericDataService().getGenericBoxHandlerDef(id) : null;
if(genericboxhandlerdefCurr != null && genericboxhandlerdefCurr instanceof LockableObject){
LockableObject lockable = (LockableObject)genericboxhandlerdefCurr;
DocumentLockingHelper.lock.checkExecutionPermission(lockable,false,getUserId(req));
lockGenericBoxHandlerDefs(genericboxhandlerdefCurr, req);
}
res.sendRedirect(getRedirectUrl(req, genericboxhandlerdefCurr));
return null;
}
public ActionForward asgenericdataGenericBoxHandlerDefUnLock(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
String id = getStringParameter(req, PARAM_ID);
GenericBoxHandlerDef genericboxhandlerdefCurr = id != null && !id.equals("") ? getASGenericDataService().getGenericBoxHandlerDef(id) : null;
if(genericboxhandlerdefCurr != null && genericboxhandlerdefCurr instanceof LockableObject){
LockableObject lockable = (LockableObject)genericboxhandlerdefCurr;
DocumentLockingHelper.unLock.checkExecutionPermission(lockable,isUserInRole(req, "admin"),getUserId(req));
unLockGenericBoxHandlerDefs(genericboxhandlerdefCurr, req, false);
}
res.sendRedirect(getRedirectUrl(req, genericboxhandlerdefCurr));
return null;
}
/**
* Simplest method for redirect url creation. nextAction == showEdit - going to 'editView', to 'listView' otherwise.
*/
private String getRedirectUrl(HttpServletRequest req, GenericBoxHandlerDef item){
String nextAction = req.getParameter("nextAction");
if (item==null || nextAction == null || nextAction.length() == 0)
return "asgenericdataGenericBoxHandlerDefShow?ts="+System.currentTimeMillis();
else
return nextAction.equals("showEdit") ? "asgenericdataGenericBoxHandlerDefEdit?ts="+System.currentTimeMillis()+"&pId="+item.getId()
: "asgenericdataGenericBoxHandlerDefShow?ts="+System.currentTimeMillis();
}
public ActionForward asgenericdataGenericBoxHandlerDefClose(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
String id = getStringParameter(req, PARAM_ID);
GenericBoxHandlerDef genericboxhandlerdefCurr = id != null && !id.equals("") ? getASGenericDataService().getGenericBoxHandlerDef(id) : null;
if(genericboxhandlerdefCurr != null && genericboxhandlerdefCurr instanceof LockableObject && ((LockableObject)genericboxhandlerdefCurr).isLocked())
unLockGenericBoxHandlerDefs(genericboxhandlerdefCurr, req, false);
res.sendRedirect("asgenericdataGenericBoxHandlerDefShow?ts="+System.currentTimeMillis());
return null;
}
}