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

net.anotheria.anosite.gen.assitedata.action.MultiOpPageAliassPathesAction Maven / Gradle / Ivy

There is a newer version: 4.1.2
Show newest version
/**
 ********************************************************************************
 *** MultiOpPageAliassPathesAction.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.assitedata.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.assitedata.data.PageAliasFactory;
import net.anotheria.anosite.gen.assitedata.data.PageAlias;
import net.anotheria.anosite.gen.assitedata.bean.PathesElementFB;
import net.anotheria.asg.exception.ASGRuntimeException;


public class MultiOpPageAliassPathesAction extends BasePageAliasAction{

	// 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("assitedataPageAliasPathesShow"))
			return assitedataPageAliasPathesShow(mapping, af, req, res);
		if (path.equals("assitedataPageAliasPathesAdd"))
			return assitedataPageAliasPathesAdd(mapping, af, req, res);
		if (path.equals("assitedataPageAliasPathesDelete"))
			return assitedataPageAliasPathesDelete(mapping, af, req, res);
		if (path.equals("assitedataPageAliasPathesMove"))
			return assitedataPageAliasPathesMove(mapping, af, req, res);
		throw new IllegalArgumentException("Unknown path: "+path);
	}

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

	public ActionForward assitedataPageAliasPathesShow(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
		String id = getStringParameter(req, "ownerId");
		PageAlias pagealias = getASSiteDataService().getPageAlias(id);
		addBeanToRequest(req, "ownerId", id);
		checkPageAliass(pagealias, req);

		PathesElementFB form = new PathesElementFB() ;
		form.setPosition(-1);
		form.setOwnerId(pagealias.getId());
		addBeanToRequest(req, "assitedataPageAliasPathesElementForm", form);

		// generate list ...
		int size = pagealias.getPathesSize();
		List beans = new ArrayList(size);
		for (int i=0; i targetList = pagealias.getPathes();
		String toSwap = targetList.remove(position);
		targetList.add(0, toSwap);
		pagealias.setPathes(targetList);
		getASSiteDataService().updatePageAlias(pagealias);
	}

	private void moveDown(PageAlias pagealias, int position) throws ASGRuntimeException {
		if (position targetList = pagealias.getPathes();
		String toSwap = targetList.remove(position);
		targetList.add(toSwap);
		pagealias.setPathes(targetList);
		getASSiteDataService().updatePageAlias(pagealias);
	}

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

	public ActionForward assitedataPageAliasPathesAdd(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
		PathesElementFB form = new PathesElementFB();
		populateFormBean(req, form);
		String id = form.getOwnerId();
		PageAlias pagealias;
		pagealias = getASSiteDataService().getPageAlias(id);
		canUpdatePageAliass(pagealias, req);
		checkPageAliass(pagealias, req);
		pagealias.addPathesElement(form.getPath());
		getASSiteDataService().updatePageAlias(pagealias);
		return assitedataPageAliasPathesShow(mapping, af, req, res);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy