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.assitedata.action.MultiOpSitesMainNaviAction Maven / Gradle / Ivy
/**
********************************************************************************
*** MultiOpSitesMainNaviAction.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.SiteFactory;
import net.anotheria.anosite.gen.assitedata.data.Site;
import net.anotheria.anosite.gen.assitedata.bean.MainNaviElementFB;
import net.anotheria.anosite.gen.assitedata.bean.MainNaviQuickAddFB;
import net.anotheria.anosite.gen.assitedata.data.NaviItem;
import net.anotheria.anosite.gen.assitedata.data.NaviItemSortType;
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 MultiOpSitesMainNaviAction extends BaseSiteAction{
// 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("assitedataSiteMainNaviShow"))
return assitedataSiteMainNaviShow(mapping, af, req, res);
if (path.equals("assitedataSiteMainNaviAdd"))
return assitedataSiteMainNaviAdd(mapping, af, req, res);
if (path.equals("assitedataSiteMainNaviDelete"))
return assitedataSiteMainNaviDelete(mapping, af, req, res);
if (path.equals("assitedataSiteMainNaviMove"))
return assitedataSiteMainNaviMove(mapping, af, req, res);
if (path.equals("assitedataSiteMainNaviQuickAdd"))
return assitedataSiteMainNaviQuickAdd(mapping, af, req, res);
throw new IllegalArgumentException("Unknown path: "+path);
}
// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateListShowActionMethod
public ActionForward assitedataSiteMainNaviShow(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
String id = getStringParameter(req, "ownerId");
Site site = getASSiteDataService().getSite(id);
addBeanToRequest(req, "ownerId", id);
checkSites(site, req);
MainNaviElementFB form = new MainNaviElementFB() ;
form.setPosition(-1);
form.setOwnerId(site.getId());
addBeanToRequest(req, "assitedataSiteMainNaviElementForm", form);
MainNaviQuickAddFB quickAddForm = new MainNaviQuickAddFB() ;
quickAddForm.setOwnerId(site.getId());
addBeanToRequest(req, "assitedataSiteMainNaviQuickAddForm", quickAddForm);
//link item to ASSiteData.NaviItem
List naviitems = getASSiteDataService().getNaviItems(new NaviItemSortType(NaviItemSortType.SORT_BY_NAME));
List naviitemsValues = new ArrayList(naviitems.size());
for (int i=0; i beans = new ArrayList(size);
for (int i=0; i targetList = site.getMainNavi();
String toSwap = targetList.remove(position);
targetList.add(0, toSwap);
site.setMainNavi(targetList);
getASSiteDataService().updateSite(site);
}
private void moveDown(Site site, int position) throws ASGRuntimeException {
if (position targetList = site.getMainNavi();
String toSwap = targetList.remove(position);
targetList.add(toSwap);
site.setMainNavi(targetList);
getASSiteDataService().updateSite(site);
}
// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateListAddRowActionMethod
public ActionForward assitedataSiteMainNaviAdd(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
MainNaviElementFB form = new MainNaviElementFB();
populateFormBean(req, form);
String id = form.getOwnerId();
Site site;
site = getASSiteDataService().getSite(id);
canUpdateSites(site, req);
checkSites(site, req);
site.addMainNaviElement(form.getItem());
getASSiteDataService().updateSite(site);
return assitedataSiteMainNaviShow(mapping, af, req, res);
}
// Generated by: class net.anotheria.asg.generator.view.action.ModuleActionsGenerator.generateListQuickAddActionMethod
public ActionForward assitedataSiteMainNaviQuickAdd(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
MainNaviQuickAddFB form = new MainNaviQuickAddFB();
populateFormBean(req, form);
String id = form.getOwnerId();
Site site;
site = getASSiteDataService().getSite(id);
canUpdateSites(site, req);
checkSites(site, 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++){
site.addMainNaviElement(""+i);
}
}
getASSiteDataService().updateSite(site);
return assitedataSiteMainNaviShow(mapping, af, req, res);
}
}