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

net.anotheria.anosite.gen.anoaccessconfiguration.action.EditAccessOperationAction Maven / Gradle / Ivy

There is a newer version: 4.1.2
Show newest version
/**
 ********************************************************************************
 *** EditAccessOperationAction.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.anoaccessconfiguration.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.anoaccessconfiguration.bean.EditAccessOperationFB;
import net.anotheria.anosite.gen.anoaccessconfiguration.data.AccessOperation;
import net.anotheria.anodoc.query2.QueryProperty;
import net.anotheria.asg.util.bean.LinkToMeBean;
import net.anotheria.anosite.gen.assitedata.data.NaviItem;
import net.anotheria.anosite.gen.aswebdata.data.Pagex;
import net.anotheria.anosite.gen.aswebdata.data.Box;
import net.anotheria.anosite.gen.ascustomaction.data.CustomActionDef;
import net.anotheria.anosite.gen.asfeature.data.Feature;
import net.anotheria.anosite.gen.asfeature.data.BrandFeature;
import net.anotheria.anosite.gen.anoaccessconfiguration.data.Permission;
import net.anotheria.anosite.gen.aswizarddata.data.WizardDef;
import net.anotheria.asg.data.LockableObject;

public class EditAccessOperationAction extends ShowAccessOperationsAction{

// 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);
		EditAccessOperationFB form = new EditAccessOperationFB() ;
		AccessOperation accessoperation = getAnoAccessConfigurationService().getAccessOperation(id);
		checkAccessOperations(accessoperation, req);
		if(accessoperation instanceof LockableObject && !((LockableObject)accessoperation).isLocked() && isAutoLockingEnabled())
			lockAccessOperations(accessoperation, req);
		form.setId(accessoperation.getId());
		form.setName(accessoperation.getName());
		form.setDescription(accessoperation.getDescription());
		form.setLocked(((LockableObject)accessoperation).isLocked());
		form.setLockerId(((LockableObject)accessoperation).getLockerId());
		form.setLockingTime(net.anotheria.util.NumberUtils.makeISO8601TimestampString(((LockableObject)accessoperation).getLockingTime()) + " automatic unlock expected AT : " + net.anotheria.util.NumberUtils.makeISO8601TimestampString(((LockableObject)accessoperation).getLockingTime() + getLockingTimeout()));

		addBeanToRequest(req, "objectId" , accessoperation.getId());
		addBeanToRequest(req, "EditAnoAccessConfigurationAccessOperationForm" , form);
		addBeanToRequest(req, "objectInfoString" , accessoperation.getObjectInfo().toString());
		addBeanToRequest(req, "apply.label.prefix", "Apply");
		addBeanToRequest(req, "save.label.prefix", "Save");
		addBeanToRequest(req, "transfer.label.prefix", "Transfer");

		addFieldExplanations(req, accessoperation);


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

	private List findLinksToCurrentDocument(String documentId){
		List ret = new ArrayList();
		try{
			ret.addAll(findLinkToCurrentDocumentInASSiteDataNaviItemAccessOperation(documentId));
		}catch(Exception ignored){
		}
		try{
			ret.addAll(findLinkToCurrentDocumentInASWebDataPagexAccessOperation(documentId));
		}catch(Exception ignored){
		}
		try{
			ret.addAll(findLinkToCurrentDocumentInASWebDataBoxAccessOperation(documentId));
		}catch(Exception ignored){
		}
		try{
			ret.addAll(findLinkToCurrentDocumentInASCustomActionCustomActionDefAccessOperation(documentId));
		}catch(Exception ignored){
		}
		try{
			ret.addAll(findLinkToCurrentDocumentInASFeatureFeatureAccessOperation(documentId));
		}catch(Exception ignored){
		}
		try{
			ret.addAll(findLinkToCurrentDocumentInASFeatureBrandFeatureAccessOperation(documentId));
		}catch(Exception ignored){
		}
		try{
			ret.addAll(findLinkToCurrentDocumentInAnoAccessConfigurationPermissionAccessOperation(documentId));
		}catch(Exception ignored){
		}
		try{
			ret.addAll(findLinkToCurrentDocumentInASWizardDataWizardDefAccessOperation(documentId));
		}catch(Exception ignored){
		}
		return ret;
	}
	private List findLinkToCurrentDocumentInASSiteDataNaviItemAccessOperation(String documentId) throws net.anotheria.anosite.gen.assitedata.service.ASSiteDataServiceException{
		List ret = new ArrayList();
		QueryProperty p = new QueryProperty(NaviItem.LINK_PROP_ACCESS_OPERATION, documentId);
		// temporarly - replacy with query property
		List list = getASSiteDataService().getNaviItemsByProperty(p.getName(), p.getValue());
		for (NaviItem doc : list ){
			ret.add(new LinkToMeBean(doc, "accessOperation"));
		}
		return ret;
	}
	private List findLinkToCurrentDocumentInASWebDataPagexAccessOperation(String documentId) throws net.anotheria.anosite.gen.aswebdata.service.ASWebDataServiceException{
		List ret = new ArrayList();
		QueryProperty p = new QueryProperty(Pagex.LINK_PROP_ACCESS_OPERATION, documentId);
		// temporarly - replacy with query property
		List list = getASWebDataService().getPagexsByProperty(p.getName(), p.getValue());
		for (Pagex doc : list ){
			ret.add(new LinkToMeBean(doc, "accessOperation"));
		}
		return ret;
	}
	private List findLinkToCurrentDocumentInASWebDataBoxAccessOperation(String documentId) throws net.anotheria.anosite.gen.aswebdata.service.ASWebDataServiceException{
		List ret = new ArrayList();
		QueryProperty p = new QueryProperty(Box.LINK_PROP_ACCESS_OPERATION, documentId);
		// temporarly - replacy with query property
		List list = getASWebDataService().getBoxsByProperty(p.getName(), p.getValue());
		for (Box doc : list ){
			ret.add(new LinkToMeBean(doc, "accessOperation"));
		}
		return ret;
	}
	private List findLinkToCurrentDocumentInASCustomActionCustomActionDefAccessOperation(String documentId) throws net.anotheria.anosite.gen.ascustomaction.service.ASCustomActionServiceException{
		List ret = new ArrayList();
		QueryProperty p = new QueryProperty(CustomActionDef.LINK_PROP_ACCESS_OPERATION, documentId);
		// temporarly - replacy with query property
		List list = getASCustomActionService().getCustomActionDefsByProperty(p.getName(), p.getValue());
		for (CustomActionDef doc : list ){
			ret.add(new LinkToMeBean(doc, "accessOperation"));
		}
		return ret;
	}
	private List findLinkToCurrentDocumentInASFeatureFeatureAccessOperation(String documentId) throws net.anotheria.anosite.gen.asfeature.service.ASFeatureServiceException{
		List ret = new ArrayList();
		QueryProperty p = new QueryProperty(Feature.LINK_PROP_ACCESS_OPERATION, documentId);
		// temporarly - replacy with query property
		List list = getASFeatureService().getFeaturesByProperty(p.getName(), p.getValue());
		for (Feature doc : list ){
			ret.add(new LinkToMeBean(doc, "accessOperation"));
		}
		return ret;
	}
	private List findLinkToCurrentDocumentInASFeatureBrandFeatureAccessOperation(String documentId) throws net.anotheria.anosite.gen.asfeature.service.ASFeatureServiceException{
		List ret = new ArrayList();
		QueryProperty p = new QueryProperty(BrandFeature.LINK_PROP_ACCESS_OPERATION, documentId);
		// temporarly - replacy with query property
		List list = getASFeatureService().getBrandFeaturesByProperty(p.getName(), p.getValue());
		for (BrandFeature doc : list ){
			ret.add(new LinkToMeBean(doc, "accessOperation"));
		}
		return ret;
	}
	private List findLinkToCurrentDocumentInAnoAccessConfigurationPermissionAccessOperation(String documentId) throws net.anotheria.anosite.gen.anoaccessconfiguration.service.AnoAccessConfigurationServiceException{
		List ret = new ArrayList();
		QueryProperty p = new QueryProperty(Permission.LINK_PROP_ACCESS_OPERATION, documentId);
		// temporarly - replacy with query property
		List list = getAnoAccessConfigurationService().getPermissionsByProperty(p.getName(), p.getValue());
		for (Permission doc : list ){
			ret.add(new LinkToMeBean(doc, "accessOperation"));
		}
		return ret;
	}
	private List findLinkToCurrentDocumentInASWizardDataWizardDefAccessOperation(String documentId) throws net.anotheria.anosite.gen.aswizarddata.service.ASWizardDataServiceException{
		List ret = new ArrayList();
		QueryProperty p = new QueryProperty(WizardDef.LINK_PROP_ACCESS_OPERATION, documentId);
		// temporarly - replacy with query property
		List list = getASWizardDataService().getWizardDefsByProperty(p.getName(), p.getValue());
		for (WizardDef doc : list ){
			ret.add(new LinkToMeBean(doc, "accessOperation"));
		}
		return ret;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy