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.aswebdata.action.MultiOpAttributesGuardsAction Maven / Gradle / Ivy
/**
********************************************************************************
*** MultiOpAttributesGuardsAction.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.aswebdata.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.aswebdata.data.AttributeFactory;
import net.anotheria.anosite.gen.aswebdata.data.Attribute;
import net.anotheria.anosite.gen.aswebdata.bean.GuardsElementFB;
import net.anotheria.anosite.gen.aswebdata.bean.GuardsQuickAddFB;
import net.anotheria.anosite.gen.asfederateddata.data.GuardDef;
import net.anotheria.anosite.gen.asfederateddata.data.GuardDefSortType;
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 MultiOpAttributesGuardsAction extends BaseAttributeAction{
// 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("aswebdataAttributeGuardsShow"))
return aswebdataAttributeGuardsShow(mapping, af, req, res);
if (path.equals("aswebdataAttributeGuardsAdd"))
return aswebdataAttributeGuardsAdd(mapping, af, req, res);
if (path.equals("aswebdataAttributeGuardsDelete"))
return aswebdataAttributeGuardsDelete(mapping, af, req, res);
if (path.equals("aswebdataAttributeGuardsMove"))
return aswebdataAttributeGuardsMove(mapping, af, req, res);
if (path.equals("aswebdataAttributeGuardsQuickAdd"))
return aswebdataAttributeGuardsQuickAdd(mapping, af, req, res);
throw new IllegalArgumentException("Unknown path: "+path);
}
// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateListShowActionMethod
public ActionForward aswebdataAttributeGuardsShow(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
String id = getStringParameter(req, "ownerId");
Attribute attribute = getASWebDataService().getAttribute(id);
addBeanToRequest(req, "ownerId", id);
checkAttributes(attribute, req);
GuardsElementFB form = new GuardsElementFB() ;
form.setPosition(-1);
form.setOwnerId(attribute.getId());
addBeanToRequest(req, "aswebdataAttributeGuardsElementForm", form);
GuardsQuickAddFB quickAddForm = new GuardsQuickAddFB() ;
quickAddForm.setOwnerId(attribute.getId());
addBeanToRequest(req, "aswebdataAttributeGuardsQuickAddForm", quickAddForm);
//link guard to ASFederatedData.GuardDef
List guarddefs = getASFederatedDataService().getGuardDefs(new GuardDefSortType(GuardDefSortType.SORT_BY_NAME));
List guarddefsValues = new ArrayList(guarddefs.size());
for (int i=0; i beans = new ArrayList(size);
for (int i=0; i targetList = attribute.getGuards();
String toSwap = targetList.remove(position);
targetList.add(0, toSwap);
attribute.setGuards(targetList);
getASWebDataService().updateAttribute(attribute);
}
private void moveDown(Attribute attribute, int position) throws ASGRuntimeException {
if (position targetList = attribute.getGuards();
String toSwap = targetList.remove(position);
targetList.add(toSwap);
attribute.setGuards(targetList);
getASWebDataService().updateAttribute(attribute);
}
// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateListAddRowActionMethod
public ActionForward aswebdataAttributeGuardsAdd(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
GuardsElementFB form = new GuardsElementFB();
populateFormBean(req, form);
String id = form.getOwnerId();
Attribute attribute;
attribute = getASWebDataService().getAttribute(id);
canUpdateAttributes(attribute, req);
checkAttributes(attribute, req);
attribute.addGuardsElement(form.getGuard());
getASWebDataService().updateAttribute(attribute);
return aswebdataAttributeGuardsShow(mapping, af, req, res);
}
// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateListQuickAddActionMethod
public ActionForward aswebdataAttributeGuardsQuickAdd(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
GuardsQuickAddFB form = new GuardsQuickAddFB();
populateFormBean(req, form);
String id = form.getOwnerId();
Attribute attribute;
attribute = getASWebDataService().getAttribute(id);
canUpdateAttributes(attribute, req);
checkAttributes(attribute, 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++){
attribute.addGuardsElement(""+i);
}
}
getASWebDataService().updateAttribute(attribute);
return aswebdataAttributeGuardsShow(mapping, af, req, res);
}
}