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.anoaccessconfiguration.action.MultiOpConstraintsContextInitializersAction Maven / Gradle / Ivy
/**
********************************************************************************
*** MultiOpConstraintsContextInitializersAction.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.anoaccessconfiguration.action;
import java.util.List;
import java.util.ArrayList;
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 net.anotheria.anosite.gen.anoaccessconfiguration.data.ConstraintFactory;
import net.anotheria.anosite.gen.anoaccessconfiguration.data.Constraint;
import net.anotheria.anosite.gen.anoaccessconfiguration.bean.ContextInitializersElementFB;
import net.anotheria.anosite.gen.anoaccessconfiguration.bean.ContextInitializersQuickAddFB;
import net.anotheria.anosite.gen.anoaccessconfiguration.data.ContextInitializer;
import net.anotheria.anosite.gen.anoaccessconfiguration.data.ContextInitializerSortType;
import net.anotheria.webutils.bean.LabelValueBean;
import net.anotheria.anodoc.data.NoSuchDocumentException;
import net.anotheria.util.StringUtils;
import net.anotheria.asg.exception.ASGRuntimeException;
public class MultiOpConstraintsContextInitializersAction extends BaseConstraintAction{
// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateContainerMultiOpAction
public ActionForward anoDocExecute(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
String path = stripPath(mapping.getPath());
if (path.equals("anoaccessconfigurationConstraintContextInitializersShow"))
return anoaccessconfigurationConstraintContextInitializersShow(mapping, af, req, res);
if (path.equals("anoaccessconfigurationConstraintContextInitializersAdd"))
return anoaccessconfigurationConstraintContextInitializersAdd(mapping, af, req, res);
if (path.equals("anoaccessconfigurationConstraintContextInitializersDelete"))
return anoaccessconfigurationConstraintContextInitializersDelete(mapping, af, req, res);
if (path.equals("anoaccessconfigurationConstraintContextInitializersMove"))
return anoaccessconfigurationConstraintContextInitializersMove(mapping, af, req, res);
if (path.equals("anoaccessconfigurationConstraintContextInitializersQuickAdd"))
return anoaccessconfigurationConstraintContextInitializersQuickAdd(mapping, af, req, res);
throw new IllegalArgumentException("Unknown path: "+path);
}
// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateListShowActionMethod
public ActionForward anoaccessconfigurationConstraintContextInitializersShow(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
String id = getStringParameter(req, "ownerId");
Constraint constraint = getAnoAccessConfigurationService().getConstraint(id);
addBeanToRequest(req, "ownerId", id);
checkConstraints(constraint, req);
ContextInitializersElementFB form = new ContextInitializersElementFB() ;
form.setPosition(-1);
form.setOwnerId(constraint.getId());
addBeanToRequest(req, "anoaccessconfigurationConstraintContextInitializersElementForm", form);
ContextInitializersQuickAddFB quickAddForm = new ContextInitializersQuickAddFB() ;
quickAddForm.setOwnerId(constraint.getId());
addBeanToRequest(req, "anoaccessconfigurationConstraintContextInitializersQuickAddForm", quickAddForm);
//link contextInitializer to AnoAccessConfiguration.ContextInitializer
List contextinitializers = getAnoAccessConfigurationService().getContextInitializers(new ContextInitializerSortType(ContextInitializerSortType.SORT_BY_NAME));
List contextinitializersValues = new ArrayList(contextinitializers.size());
for (int i=0; i beans = new ArrayList(size);
for (int i=0; i targetList = constraint.getContextInitializers();
String toSwap = targetList.remove(position);
targetList.add(0, toSwap);
constraint.setContextInitializers(targetList);
getAnoAccessConfigurationService().updateConstraint(constraint);
}
private void moveDown(Constraint constraint, int position) throws ASGRuntimeException {
if (position targetList = constraint.getContextInitializers();
String toSwap = targetList.remove(position);
targetList.add(toSwap);
constraint.setContextInitializers(targetList);
getAnoAccessConfigurationService().updateConstraint(constraint);
}
// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateListAddRowActionMethod
public ActionForward anoaccessconfigurationConstraintContextInitializersAdd(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
ContextInitializersElementFB form = new ContextInitializersElementFB();
populateFormBean(req, form);
String id = form.getOwnerId();
Constraint constraint;
constraint = getAnoAccessConfigurationService().getConstraint(id);
canUpdateConstraints(constraint, req);
checkConstraints(constraint, req);
constraint.addContextInitializersElement(form.getContextInitializer());
getAnoAccessConfigurationService().updateConstraint(constraint);
return anoaccessconfigurationConstraintContextInitializersShow(mapping, af, req, res);
}
// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateListQuickAddActionMethod
public ActionForward anoaccessconfigurationConstraintContextInitializersQuickAdd(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
ContextInitializersQuickAddFB form = new ContextInitializersQuickAddFB();
populateFormBean(req, form);
String id = form.getOwnerId();
Constraint constraint;
constraint = getAnoAccessConfigurationService().getConstraint(id);
canUpdateConstraints(constraint, req);
checkConstraints(constraint, req);
String paramIdsToAdd = form.getQuickAddIds();
String idParameters[] = StringUtils.tokenize(paramIdsToAdd, ',');
for (String anIdParam : idParameters){
String ids[] = StringUtils.tokenize(anIdParam, '-');
for (int i=Integer.parseInt(ids[0]); i<=Integer.parseInt(ids[ids.length-1]); i++){
constraint.addContextInitializersElement(""+i);
}
}
getAnoAccessConfigurationService().updateConstraint(constraint);
return anoaccessconfigurationConstraintContextInitializersShow(mapping, af, req, res);
}
}