All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.anotheria.anosite.gen.aswebdata.action.MultiOpPagexsFooterAction Maven / Gradle / Ivy

There is a newer version: 4.1.2
Show newest version
/**
 ********************************************************************************
 *** MultiOpPagexsFooterAction.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.aswebdata.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.aswebdata.data.PagexFactory;
import net.anotheria.anosite.gen.aswebdata.data.Pagex;
import net.anotheria.anosite.gen.aswebdata.bean.FooterElementFB;
import net.anotheria.asg.util.bean.PopulateUtility;
import net.anotheria.anosite.gen.aswebdata.bean.FooterQuickAddFB;
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 MultiOpPagexsFooterAction extends BasePagexAction{

	// 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("aswebdataPagexFooterShow"))
			return aswebdataPagexFooterShow(mapping, req, res);
		if (path.equals("aswebdataPagexFooterAdd"))
			return aswebdataPagexFooterAdd(mapping, req, res);
		if (path.equals("aswebdataPagexFooterDelete"))
			return aswebdataPagexFooterDelete(mapping, req, res);
		if (path.equals("aswebdataPagexFooterMove"))
			return aswebdataPagexFooterMove(mapping, req, res);
		if (path.equals("aswebdataPagexFooterQuickAdd"))
			return aswebdataPagexFooterQuickAdd(mapping, req, res);
		throw new IllegalArgumentException("Unknown path: "+path);
	}

	// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateListShowActionMethod

	public ActionCommand aswebdataPagexFooterShow(ActionMapping mapping, HttpServletRequest req, HttpServletResponse res) throws Exception{
		String id = getStringParameter(req, "ownerId");
		Pagex pagex = getASWebDataService().getPagex(id);
		addBeanToRequest(req, "ownerId", id);
		checkPagexs(pagex, req);

		FooterElementFB form = new FooterElementFB() ;
		form.setPosition(-1);
		form.setOwnerId(pagex.getId());
		addBeanToRequest(req, "aswebdataPagexFooterElementForm", form);

		FooterQuickAddFB quickAddForm = new FooterQuickAddFB() ;
		quickAddForm.setOwnerId(pagex.getId());
		addBeanToRequest(req, "aswebdataPagexFooterQuickAddForm", 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 = pagex.getFooter();
		String toSwap = targetList.remove(position);
		targetList.add(0, toSwap);
		pagex.setFooter(targetList);
		getASWebDataService().updatePagex(pagex);
	}

	private void moveDown(Pagex pagex, int position) throws ASGRuntimeException {
		if (position targetList = pagex.getFooter();
		String toSwap = targetList.remove(position);
		targetList.add(toSwap);
		pagex.setFooter(targetList);
		getASWebDataService().updatePagex(pagex);
	}

	// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateListAddRowActionMethod

	public ActionCommand aswebdataPagexFooterAdd(ActionMapping mapping, HttpServletRequest req, HttpServletResponse res) throws Exception{
		FooterElementFB form = new FooterElementFB();
		PopulateUtility.populate(form, req);
		String id = form.getOwnerId();
		Pagex pagex;
		pagex = getASWebDataService().getPagex(id);
		canUpdatePagexs(pagex, req);
		checkPagexs(pagex, req);
		pagex.addFooterElement(form.getBox());
		getASWebDataService().updatePagex(pagex);
		return aswebdataPagexFooterShow(mapping, req, res);
	}

	// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateListQuickAddActionMethod

	public ActionCommand aswebdataPagexFooterQuickAdd(ActionMapping mapping, HttpServletRequest req, HttpServletResponse res) throws Exception{
		FooterQuickAddFB form = new FooterQuickAddFB();
		PopulateUtility.populate(form, req);
		String id = form.getOwnerId();
		Pagex pagex;
		pagex = getASWebDataService().getPagex(id);
		canUpdatePagexs(pagex, req);
		checkPagexs(pagex, 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++){
				pagex.addFooterElement(""+i);
			}
		}
		getASWebDataService().updatePagex(pagex);
		return aswebdataPagexFooterShow(mapping, req, res);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy