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.asexperiment.action.EditExperimentAction Maven / Gradle / Ivy
/**
********************************************************************************
*** EditExperimentAction.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.asexperiment.action;
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 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.asg.util.helper.cmsview.CMSViewHelperUtil;
import net.anotheria.asg.util.helper.cmsview.CMSViewHelperRegistry;
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 ActionForward anoDocExecute(ActionMapping mapping, FormBean af, 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");
addFieldExplanations(req, experiment);
return mapping.findForward("success");
}
private void addFieldExplanations(HttpServletRequest req, Experiment experiment) {
if (!CMSViewHelperRegistry.getCMSViewHelpers("ASExperiment.Experiment").isEmpty()) {
String fieldDescription = null;
fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASExperiment.Experiment", experiment, "name");
if (fieldDescription!=null && fieldDescription.length()>0)
req.setAttribute("description.name", fieldDescription);
fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASExperiment.Experiment", experiment, "active");
if (fieldDescription!=null && fieldDescription.length()>0)
req.setAttribute("description.active", fieldDescription);
fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASExperiment.Experiment", experiment, "distribution");
if (fieldDescription!=null && fieldDescription.length()>0)
req.setAttribute("description.distribution", fieldDescription);
fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASExperiment.Experiment", experiment, "description");
if (fieldDescription!=null && fieldDescription.length()>0)
req.setAttribute("description.description", fieldDescription);
fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASExperiment.Experiment", experiment, "variant1");
if (fieldDescription!=null && fieldDescription.length()>0)
req.setAttribute("description.variant1", fieldDescription);
fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASExperiment.Experiment", experiment, "variant2");
if (fieldDescription!=null && fieldDescription.length()>0)
req.setAttribute("description.variant2", fieldDescription);
fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASExperiment.Experiment", experiment, "variant3");
if (fieldDescription!=null && fieldDescription.length()>0)
req.setAttribute("description.variant3", fieldDescription);
fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASExperiment.Experiment", experiment, "variant4");
if (fieldDescription!=null && fieldDescription.length()>0)
req.setAttribute("description.variant4", fieldDescription);
fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASExperiment.Experiment", experiment, "variant5");
if (fieldDescription!=null && fieldDescription.length()>0)
req.setAttribute("description.variant5", fieldDescription);
fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASExperiment.Experiment", experiment, "variant6");
if (fieldDescription!=null && fieldDescription.length()>0)
req.setAttribute("description.variant6", fieldDescription);
fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASExperiment.Experiment", experiment, "variant7");
if (fieldDescription!=null && fieldDescription.length()>0)
req.setAttribute("description.variant7", fieldDescription);
fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASExperiment.Experiment", experiment, "variant8");
if (fieldDescription!=null && fieldDescription.length()>0)
req.setAttribute("description.variant8", fieldDescription);
fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASExperiment.Experiment", experiment, "variant9");
if (fieldDescription!=null && fieldDescription.length()>0)
req.setAttribute("description.variant9", fieldDescription);
fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASExperiment.Experiment", experiment, "variant10");
if (fieldDescription!=null && fieldDescription.length()>0)
req.setAttribute("description.variant10", fieldDescription);
} //
} //addFieldExplanations END
}