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

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

There is a newer version: 4.1.2
Show newest version
/**
 ********************************************************************************
 *** EditNaviItemAction.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 jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import net.anotheria.maf.action.ActionCommand;
import net.anotheria.maf.action.ActionMapping;
import java.util.List;
import java.util.ArrayList;
import net.anotheria.anosite.gen.assitedata.bean.EditNaviItemFB;
import net.anotheria.anosite.gen.assitedata.data.NaviItem;
import net.anotheria.asg.data.MultilingualObject;
import net.anotheria.webutils.bean.LabelValueBean;
import net.anotheria.asg.data.LockableObject;
import net.anotheria.anosite.gen.aswebdata.data.Pagex;
import net.anotheria.anosite.gen.assitedata.data.PageAlias;
import net.anotheria.anosite.gen.anoaccessconfiguration.data.AccessOperation;

public class EditNaviItemAction extends ShowNaviItemsAction{

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

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

	public ActionCommand anoDocExecute(ActionMapping mapping, HttpServletRequest req, HttpServletResponse res) throws Exception{
		String id = getStringParameter(req, PARAM_ID);
		EditNaviItemFB form = new EditNaviItemFB() ;
		NaviItem naviitem = getASSiteDataService().getNaviItem(id);
		checkNaviItems(naviitem, req);
		if(naviitem instanceof LockableObject && !((LockableObject)naviitem).isLocked() && isAutoLockingEnabled())
			lockNaviItems(naviitem, req);
		form.setId(naviitem.getId());
		form.setNameEN(naviitem.getNameEN());
		form.setNameDE(naviitem.getNameDE());
		form.setTitleEN(naviitem.getTitleEN());
		form.setTitleDE(naviitem.getTitleDE());
		form.setIcon(naviitem.getIcon());
		form.setExternalLink(naviitem.getExternalLink());
		form.setInternalLink(naviitem.getInternalLink());
		form.setPageAlias(naviitem.getPageAlias());
		form.setClassName(naviitem.getClassName());
		// subNavi is a table, storing size only
		form.setSubNavi(naviitem.getSubNaviSize());
		form.setPopup(naviitem.getPopup());
		// guards is a table, storing size only
		form.setGuards(naviitem.getGuardsSize());
		form.setAccessOperation(naviitem.getAccessOperation());
		form.setMultilingualInstanceDisabled(((MultilingualObject)naviitem).isMultilingualDisabledInstance());
		form.setLocked(((LockableObject)naviitem).isLocked());
		form.setLockerId(((LockableObject)naviitem).getLockerId());
		form.setLockingTime(net.anotheria.util.NumberUtils.makeISO8601TimestampString(((LockableObject)naviitem).getLockingTime()) + " automatic unlock expected AT : " + net.anotheria.util.NumberUtils.makeISO8601TimestampString(((LockableObject)naviitem).getLockingTime() + getLockingTimeout()));


		//link internalLink to ASWebData.Pagex
		List pagexs = getASWebDataService().getPagexs();
		List pagexsValues = new ArrayList(pagexs.size()+1);
		pagexsValues.add(new LabelValueBean("", "-----"));
		for (net.anotheria.anosite.gen.aswebdata.data.Pagex pagexTemp : pagexs){
			LabelValueBean bean = new LabelValueBean(pagexTemp.getId(), pagexTemp.getName() + " [" + pagexTemp.getId() + "]" );
			pagexsValues.add(bean);
		}
		form.setInternalLinkCollection(pagexsValues);
		try{
			form.setInternalLinkCurrentValue(getASWebDataService().getPagex(naviitem.getInternalLink()).getName());
		}catch(Exception e){
			form.setInternalLinkCurrentValue("none");
			form.setInternalLinkIdOfCurrentValue("none");
		}

		//link pageAlias to ASSiteData.PageAlias
		List pagealiass = getASSiteDataService().getPageAliass();
		List pagealiassValues = new ArrayList(pagealiass.size()+1);
		pagealiassValues.add(new LabelValueBean("", "-----"));
		for (net.anotheria.anosite.gen.assitedata.data.PageAlias pagealiasTemp : pagealiass){
			LabelValueBean bean = new LabelValueBean(pagealiasTemp.getId(), pagealiasTemp.getName() + " [" + pagealiasTemp.getId() + "]" );
			pagealiassValues.add(bean);
		}
		form.setPageAliasCollection(pagealiassValues);
		try{
			form.setPageAliasCurrentValue(getASSiteDataService().getPageAlias(naviitem.getPageAlias()).getName());
		}catch(Exception e){
			form.setPageAliasCurrentValue("none");
			form.setPageAliasIdOfCurrentValue("none");
		}

		//link accessOperation to AnoAccessConfiguration.AccessOperation
		List accessoperations = getAnoAccessConfigurationService().getAccessOperations();
		List accessoperationsValues = new ArrayList(accessoperations.size()+1);
		accessoperationsValues.add(new LabelValueBean("", "-----"));
		for (net.anotheria.anosite.gen.anoaccessconfiguration.data.AccessOperation accessoperationTemp : accessoperations){
			LabelValueBean bean = new LabelValueBean(accessoperationTemp.getId(), accessoperationTemp.getName() + " [" + accessoperationTemp.getId() + "]" );
			accessoperationsValues.add(bean);
		}
		form.setAccessOperationCollection(accessoperationsValues);
		try{
			form.setAccessOperationCurrentValue(getAnoAccessConfigurationService().getAccessOperation(naviitem.getAccessOperation()).getName());
		}catch(Exception e){
			form.setAccessOperationCurrentValue("none");
			form.setAccessOperationIdOfCurrentValue("none");
		}
		addBeanToRequest(req, "objectId" , naviitem.getId());
		addBeanToRequest(req, "EditASSiteDataNaviItemForm" , form);
		addBeanToRequest(req, "objectInfoString" , naviitem.getObjectInfo().toString());
		addBeanToRequest(req, "apply.label.prefix", "Apply");
		addBeanToRequest(req, "save.label.prefix", "Save");
		addBeanToRequest(req, "transfer.label.prefix", "Transfer");

		addFieldExplanations(req, naviitem);

		return mapping.success();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy