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

net.anotheria.anosite.gen.aswizarddata.action.EditWizardHandlerDefAction Maven / Gradle / Ivy

There is a newer version: 4.3.2.1
Show newest version
/**
 ********************************************************************************
 *** EditWizardHandlerDefAction.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.aswizarddata.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.aswizarddata.bean.EditWizardHandlerDefFB;
import net.anotheria.anosite.gen.aswizarddata.data.WizardHandlerDef;
import net.anotheria.anodoc.query2.QueryProperty;
import net.anotheria.asg.util.bean.LinkToMeBean;
import net.anotheria.anosite.gen.aswizarddata.data.WizardDef;
import net.anotheria.asg.data.LockableObject;

public class EditWizardHandlerDefAction extends ShowWizardHandlerDefsAction{

// 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);
		EditWizardHandlerDefFB form = new EditWizardHandlerDefFB() ;
		WizardHandlerDef wizardhandlerdef = getASWizardDataService().getWizardHandlerDef(id);
		checkWizardHandlerDefs(wizardhandlerdef, req);
		if(wizardhandlerdef instanceof LockableObject && !((LockableObject)wizardhandlerdef).isLocked() && isAutoLockingEnabled())
			lockWizardHandlerDefs(wizardhandlerdef, req);
		form.setId(wizardhandlerdef.getId());
		form.setName(wizardhandlerdef.getName());
		form.setClazz(wizardhandlerdef.getClazz());
		form.setLocked(((LockableObject)wizardhandlerdef).isLocked());
		form.setLockerId(((LockableObject)wizardhandlerdef).getLockerId());
		form.setLockingTime(net.anotheria.util.NumberUtils.makeISO8601TimestampString(((LockableObject)wizardhandlerdef).getLockingTime()) + " automatic unlock expected AT : " + net.anotheria.util.NumberUtils.makeISO8601TimestampString(((LockableObject)wizardhandlerdef).getLockingTime() + getLockingTimeout()));

		addBeanToRequest(req, "objectId" , wizardhandlerdef.getId());
		addBeanToRequest(req, "EditASWizardDataWizardHandlerDefForm" , form);
		addBeanToRequest(req, "objectInfoString" , wizardhandlerdef.getObjectInfo().toString());
		addBeanToRequest(req, "apply.label.prefix", "Apply");
		addBeanToRequest(req, "save.label.prefix", "Save");
		addBeanToRequest(req, "transfer.label.prefix", "Transfer");
		addBeanToRequest(req, "sortTextData.label.prefix", "Sort Text Data");

		addFieldExplanations(req, wizardhandlerdef);


		// Generating back link handling...
		List linksToMe = findLinksToCurrentDocument(wizardhandlerdef.getId());
		if (linksToMe.size()>0)
			req.setAttribute("linksToMe", linksToMe);
		return mapping.success();
	}

	private List findLinksToCurrentDocument(String documentId){
		List ret = new ArrayList();
		try{
			ret.addAll(findLinkToCurrentDocumentInASWizardDataWizardDefHandler(documentId));
		}catch(Exception ignored){
		}
		return ret;
	}
	private List findLinkToCurrentDocumentInASWizardDataWizardDefHandler(String documentId) throws net.anotheria.anosite.gen.aswizarddata.service.ASWizardDataServiceException{
		List ret = new ArrayList();
		QueryProperty p = new QueryProperty(WizardDef.LINK_PROP_HANDLER, documentId);
		// temporarly - replacy with query property
		List list = getASWizardDataService().getWizardDefsByProperty(p.getName(), p.getValue());
		for (WizardDef doc : list ){
			ret.add(new LinkToMeBean(doc, "handler"));
		}
		return ret;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy