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

net.anotheria.anosite.gen.asexperiment.action.EditExperimentAction Maven / Gradle / Ivy

There is a newer version: 4.1.2
Show newest version
/**
 ********************************************************************************
 *** EditExperimentAction.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.asexperiment.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.asexperiment.bean.EditExperimentFB;
import net.anotheria.anosite.gen.asexperiment.data.Experiment;
import net.anotheria.webutils.bean.LabelValueBean;
import net.anotheria.anosite.gen.shared.data.ExperimentDistributionEnum;
import net.anotheria.asg.data.LockableObject;
import net.anotheria.asg.exception.ConstantNotFoundException;

public class EditExperimentAction extends ShowExperimentsAction{

// 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);
		EditExperimentFB form = new EditExperimentFB() ;
		Experiment experiment = getASExperimentService().getExperiment(id);
		checkExperiments(experiment, req);
		if(experiment instanceof LockableObject && !((LockableObject)experiment).isLocked() && isAutoLockingEnabled())
			lockExperiments(experiment, req);
		form.setId(experiment.getId());
		form.setName(experiment.getName());
		form.setActive(experiment.getActive());
		form.setDistribution(experiment.getDistribution());
		form.setDescription(experiment.getDescription());
		form.setVariant1(experiment.getVariant1());
		form.setVariant2(experiment.getVariant2());
		form.setVariant3(experiment.getVariant3());
		form.setVariant4(experiment.getVariant4());
		form.setVariant5(experiment.getVariant5());
		form.setVariant6(experiment.getVariant6());
		form.setVariant7(experiment.getVariant7());
		form.setVariant8(experiment.getVariant8());
		form.setVariant9(experiment.getVariant9());
		form.setVariant10(experiment.getVariant10());
		form.setLocked(((LockableObject)experiment).isLocked());
		form.setLockerId(((LockableObject)experiment).getLockerId());
		form.setLockingTime(net.anotheria.util.NumberUtils.makeISO8601TimestampString(((LockableObject)experiment).getLockingTime()) + " automatic unlock expected AT : " + net.anotheria.util.NumberUtils.makeISO8601TimestampString(((LockableObject)experiment).getLockingTime() + getLockingTimeout()));

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


		//enumeration ExperimentDistribution
		ExperimentDistributionEnum[] ExperimentDistribution_values = ExperimentDistributionEnum.values();
		List ExperimentDistribution_valuesListValues = new ArrayList(ExperimentDistribution_values.length);
		for (ExperimentDistributionEnum element : ExperimentDistribution_values) {
			LabelValueBean bean = new LabelValueBean(""+element.getValue(), element.name());
			ExperimentDistribution_valuesListValues.add(bean);
		}
		form.setDistributionCollection(ExperimentDistribution_valuesListValues);
		try {
			form.setDistributionCurrentValue(ExperimentDistributionEnum.getConstantByValue(experiment.getDistribution()).name());
		}catch(net.anotheria.asg.exception.ConstantNotFoundException e){
		} //try
		addBeanToRequest(req, "objectId" , experiment.getId());
		addBeanToRequest(req, "EditASExperimentExperimentForm" , form);
		addBeanToRequest(req, "objectInfoString" , experiment.getObjectInfo().toString());
		addBeanToRequest(req, "apply.label.prefix", "Apply");
		addBeanToRequest(req, "save.label.prefix", "Save");
		addBeanToRequest(req, "transfer.label.prefix", "Transfer");

		addFieldExplanations(req, experiment);

		return mapping.success();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy