net.anotheria.anosite.gen.assitedata.action.MultiOpPageAliassPathesAction Maven / Gradle / Ivy
The newest version!
/**
********************************************************************************
*** MultiOpPageAliassPathesAction.java ***
*** generated by AnoSiteGenerator (ASG), Version: 4.2.2 ***
*** Copyright (C) 2005 - 2025 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.PageAliasFactory;
import net.anotheria.anosite.gen.assitedata.data.PageAlias;
import net.anotheria.anosite.gen.assitedata.bean.PathesElementFB;
import net.anotheria.asg.util.bean.PopulateUtility;
import net.anotheria.asg.exception.ASGRuntimeException;
public class MultiOpPageAliassPathesAction extends BasePageAliasAction{
// 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("assitedataPageAliasPathesShow"))
return assitedataPageAliasPathesShow(mapping, req, res);
if (path.equals("assitedataPageAliasPathesAdd"))
return assitedataPageAliasPathesAdd(mapping, req, res);
if (path.equals("assitedataPageAliasPathesDelete"))
return assitedataPageAliasPathesDelete(mapping, req, res);
if (path.equals("assitedataPageAliasPathesMove"))
return assitedataPageAliasPathesMove(mapping, req, res);
throw new IllegalArgumentException("Unknown path: "+path);
}
// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateListShowActionMethod
public ActionCommand assitedataPageAliasPathesShow(ActionMapping mapping, 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 ActionCommand assitedataPageAliasPathesAdd(ActionMapping mapping, HttpServletRequest req, HttpServletResponse res) throws Exception{
PathesElementFB form = new PathesElementFB();
PopulateUtility.populate(form, req);
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, req, res);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy