Package org.uengine.kernel

Source Code of org.uengine.kernel.MappingActivity

package org.uengine.kernel;

import java.io.File;
import java.io.FileOutputStream;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Locale;
import java.util.Map;
import java.util.Vector;

import org.metaworks.Type;
import org.uengine.contexts.HtmlFormContext;
import org.uengine.contexts.MappingContext;
import org.uengine.processdesigner.ProcessDesigner;
import org.uengine.processdesigner.mapper.Transformer;
import org.uengine.util.UEngineUtil;

public class MappingActivity extends DefaultActivity {

  private static final long serialVersionUID = GlobalContext.SERIALIZATION_UID;
  public final static String FILE_SYSTEM_DIR = GlobalContext.getPropertyString("filesystem.path", ProcessDefinitionFactory.DEFINITION_ROOT);

  public MappingActivity(){
    setName("mapping");
  }
 
  MappingContext mappingContext;
    public MappingContext getMappingContext() {
      return mappingContext;
    }
    public void setMappingContext(MappingContext mappingContext) {
      this.mappingContext = mappingContext;
    }
   
  protected void executeActivity(ProcessInstance instance) throws Exception {
    MappingContext mc= getMappingContext();
    if(mc !=null){
      ParameterContext[] params = mc.getMappingElements();
      for (int i = 0; i < params.length; i++) {
        ParameterContext param = params[i];
       
        String srcVariableName = null;
        String targetFieldName = param.getArgument().getText();
        Object value = null;
       
        if(param.getVariable() == null && param.getTransformerMapping() != null){
          value = param.getTransformerMapping().getTransformer().letTransform(instance, param.getTransformerMapping().getLinkedArgumentName());
        }else{
          srcVariableName = param.getVariable().getName();       
          value = instance.getBeanProperty(srcVariableName); // varA     
        }     
       
        instance.setBeanProperty(targetFieldName, (Serializable)value); //[instance].instanceId
 
     
    }
    fireComplete(instance);
  }
}
TOP

Related Classes of org.uengine.kernel.MappingActivity

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.