net.anotheria.anosite.gen.assitedata.action.MultiOpPageTemplatesC3firstAction Maven / Gradle / Ivy
/**
********************************************************************************
*** MultiOpPageTemplatesC3firstAction.java ***
*** generated by AnoSiteGenerator (ASG), Version: 3.2.2 ***
*** Copyright (C) 2005 - 2023 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.assitedata.action;
import java.util.List;
import java.util.ArrayList;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import net.anotheria.maf.action.ActionCommand;
import net.anotheria.maf.action.ActionMapping;
import net.anotheria.anosite.gen.assitedata.data.PageTemplateFactory;
import net.anotheria.anosite.gen.assitedata.data.PageTemplate;
import net.anotheria.anosite.gen.assitedata.bean.C3firstElementFB;
import net.anotheria.asg.util.bean.PopulateUtility;
import net.anotheria.anosite.gen.assitedata.bean.C3firstQuickAddFB;
import net.anotheria.anosite.gen.aswebdata.data.Box;
import net.anotheria.anosite.gen.aswebdata.data.BoxSortType;
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 MultiOpPageTemplatesC3firstAction extends BasePageTemplateAction{
// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateContainerMultiOpAction
public ActionCommand anoDocExecute(ActionMapping mapping, HttpServletRequest req, HttpServletResponse res) throws Exception{
String path = stripPath(mapping.getPath());
if (path.equals("assitedataPageTemplateC3firstShow"))
return assitedataPageTemplateC3firstShow(mapping, req, res);
if (path.equals("assitedataPageTemplateC3firstAdd"))
return assitedataPageTemplateC3firstAdd(mapping, req, res);
if (path.equals("assitedataPageTemplateC3firstDelete"))
return assitedataPageTemplateC3firstDelete(mapping, req, res);
if (path.equals("assitedataPageTemplateC3firstMove"))
return assitedataPageTemplateC3firstMove(mapping, req, res);
if (path.equals("assitedataPageTemplateC3firstQuickAdd"))
return assitedataPageTemplateC3firstQuickAdd(mapping, req, res);
throw new IllegalArgumentException("Unknown path: "+path);
}
// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateListShowActionMethod
public ActionCommand assitedataPageTemplateC3firstShow(ActionMapping mapping, HttpServletRequest req, HttpServletResponse res) throws Exception{
String id = getStringParameter(req, "ownerId");
PageTemplate pagetemplate = getASSiteDataService().getPageTemplate(id);
addBeanToRequest(req, "ownerId", id);
checkPageTemplates(pagetemplate, req);
C3firstElementFB form = new C3firstElementFB() ;
form.setPosition(-1);
form.setOwnerId(pagetemplate.getId());
addBeanToRequest(req, "assitedataPageTemplateC3firstElementForm", form);
C3firstQuickAddFB quickAddForm = new C3firstQuickAddFB() ;
quickAddForm.setOwnerId(pagetemplate.getId());
addBeanToRequest(req, "assitedataPageTemplateC3firstQuickAddForm", quickAddForm);
//link box to ASWebData.Box
List boxs = getASWebDataService().getBoxs(new BoxSortType(BoxSortType.SORT_BY_NAME));
List boxsValues = new ArrayList(boxs.size());
for (int i=0; i beans = new ArrayList(size);
for (int i=0; i targetList = pagetemplate.getC3first();
String toSwap = targetList.remove(position);
targetList.add(0, toSwap);
pagetemplate.setC3first(targetList);
getASSiteDataService().updatePageTemplate(pagetemplate);
}
private void moveDown(PageTemplate pagetemplate, int position) throws ASGRuntimeException {
if (position targetList = pagetemplate.getC3first();
String toSwap = targetList.remove(position);
targetList.add(toSwap);
pagetemplate.setC3first(targetList);
getASSiteDataService().updatePageTemplate(pagetemplate);
}
// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateListAddRowActionMethod
public ActionCommand assitedataPageTemplateC3firstAdd(ActionMapping mapping, HttpServletRequest req, HttpServletResponse res) throws Exception{
C3firstElementFB form = new C3firstElementFB();
PopulateUtility.populate(form, req);
String id = form.getOwnerId();
PageTemplate pagetemplate;
pagetemplate = getASSiteDataService().getPageTemplate(id);
canUpdatePageTemplates(pagetemplate, req);
checkPageTemplates(pagetemplate, req);
pagetemplate.addC3firstElement(form.getBox());
getASSiteDataService().updatePageTemplate(pagetemplate);
return assitedataPageTemplateC3firstShow(mapping, req, res);
}
// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateListQuickAddActionMethod
public ActionCommand assitedataPageTemplateC3firstQuickAdd(ActionMapping mapping, HttpServletRequest req, HttpServletResponse res) throws Exception{
C3firstQuickAddFB form = new C3firstQuickAddFB();
PopulateUtility.populate(form, req);
String id = form.getOwnerId();
PageTemplate pagetemplate;
pagetemplate = getASSiteDataService().getPageTemplate(id);
canUpdatePageTemplates(pagetemplate, req);
checkPageTemplates(pagetemplate, 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++){
pagetemplate.addC3firstElement(""+i);
}
}
getASSiteDataService().updatePageTemplate(pagetemplate);
return assitedataPageTemplateC3firstShow(mapping, req, res);
}
}