⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 activityvariable.java

📁 公司自己开发的工作流引擎
💻 JAVA
字号:
package cn.com.iaspec.workflow.vo.workflow;

import java.io.*;
import java.sql.*;
import java.util.Date;

/**
 *
 * <p>Title:保存活动变量信息 </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2005</p>
 * <p>Company: IASPEC Technologies</p>
 * @author xiesonglin
 * @version 1.0
 */
public class ActivityVariable
    implements Serializable{
  // Fields
  public int attributeType;
  private String stringValue;
  private double doubleValue;
  private byte[] objectValue;
  private String classPath;
  private boolean hasValue;
  private String attributeName;
  private int direction;
  private String globalName;

  public ActivityVariable(){
    stringValue=null;
    doubleValue=0.0D;
    objectValue=null;
    hasValue=false;
  }

  public void setAttributeName(String s)
      throws Exception{
    if(s==null){
      throw new Exception("AttributeName is null");
    }
    else{
      attributeName=s.trim();
      return;
    }
  }

  public String getAttributeName(){
    return attributeName;
  }

  public int getAttributeType(){
    return attributeType;
  }

  public void setClassPath(String s)
      throws Exception{
    classPath=s;
  }

  public String getClassPath(){
    return classPath;
  }

  public byte[] getBinaryValue()
      throws Exception{
    if(!hasValue()){
      throw new Exception("BinaryValue is null");
    }
    if(objectValue==null){
      return null;
    }
    else{
      byte abyte0[]=new byte[objectValue.length];
      System.arraycopy(objectValue,0,abyte0,0,objectValue.length);
      return abyte0;
    }
  }

  public void setBinaryValue(byte abyte0[])
      throws Exception{
    attributeType=10;
    hasValue=true;
    if(abyte0==null){
      objectValue=null;
    }
    else{
      objectValue=new byte[abyte0.length];
      System.arraycopy(abyte0,0,objectValue,0,abyte0.length);
    }
  }

  public Timestamp getTimestampValue()
      throws Exception{
    if(!hasValue){
      throw new Exception("imestampValue is null");
    }
    if(doubleValue==-1D){
      return null;
    }
    else{
      return new Timestamp((long)doubleValue);
    }
  }

  public void setTimestampValue(Timestamp timestamp)
      throws Exception{
    attributeType=5;
    hasValue=true;
    if(timestamp==null){
      doubleValue=-1D;
    }
    else{
      doubleValue=timestamp.getTime();
    }
  }

  public double getDoubleValue()
      throws Exception{
    if(!hasValue){
      throw new Exception("DoubleValue is null");
    }
    else{
      return doubleValue;
    }
  }

  public void setDoubleValue(double d){
    doubleValue=d;
    attributeType=3;
    hasValue=true;
  }

  public int getIntValue()
      throws Exception{
    if(!hasValue){
      //throw new Exception("IntValue is null");
      return-1;
    }
    else{
      return(int)doubleValue;
    }
  }

  public void setIntValue(int i){
    doubleValue=i;
    attributeType=1;
    hasValue=true;
  }

  public String getStringValue()
      throws Exception{
    if(!hasValue){
      //throw new Exception("StringValue is null");
      return "";
    }
    else{
      return stringValue;
    }
  }

  public int getDirection(){
    return direction;
  }

  public String getGlobalName(){
    return globalName;
  }

  public void setStringValue(String s){
    attributeType=4;
    hasValue=true;
    stringValue=s;
  }

  public void setDirection(int direction){
    this.direction=direction;
  }

  public void setGlobalName(String globalName){
    this.globalName=globalName;
  }

  public boolean getBooleanValue()
      throws Exception{
    if(!hasValue){
      throw new Exception("BooleanValue is null");
    }
    else{
      return doubleValue!=0.0D;
    }
  }

  public void setBooleanValue(boolean flag){
    attributeType=2;
    hasValue=true;
    if(flag){
      doubleValue=1.0D;
    }
    else{
      doubleValue=0.0D;
    }
  }

  public Date getDateValue()
      throws Exception{
    if(!hasValue){
      throw new Exception("DateValue is null");
    }
    if(doubleValue==-1D){
      return null;
    }
    else{
      return new Date((long)doubleValue);
    }
  }

  public void setDateValue(Date date){
    attributeType=6;
    hasValue=true;
    if(date==null){
      doubleValue=-1D;
    }
    else{
      doubleValue=date.getTime();
    }
  }

  public Object getObjectValue()
      throws Exception{
    if(!hasValue){
      throw new Exception("ObjectValue is null");
    }
    if(objectValue==null){
      return null;
    }
    else{
      ByteArrayInputStream bytearrayinputstream=new ByteArrayInputStream(
          objectValue);
      ObjectInputStream objectinputstream=new ObjectInputStream(
          bytearrayinputstream);
      Object obj=objectinputstream.readObject();
      objectinputstream.close();
      bytearrayinputstream.close();
      return obj;
    }
  }

  public void setObjectValue(Object obj)
      throws Exception{
    hasValue=true;
    attributeType=9;
    if(obj==null){
      objectValue=null;
    }
    else{
      ByteArrayOutputStream bytearrayoutputstream=new ByteArrayOutputStream();
      ObjectOutputStream objectoutputstream=new ObjectOutputStream(
          bytearrayoutputstream);
      objectoutputstream.writeObject(obj);
      objectoutputstream.flush();
      byte abyte0[]=bytearrayoutputstream.toByteArray();
      bytearrayoutputstream.close();
      objectoutputstream.close();
      objectValue=new byte[abyte0.length];
      System.arraycopy(abyte0,0,objectValue,0,abyte0.length);
    }
  }

  public String getFileValue()
      throws Exception{
    if(!hasValue){
      throw new Exception("FileValue is null");
    }
    if(stringValue==null){
      return null;
    }
    else{
      return stringValue;
    }
  }

  public void setFileValue(String s){
    stringValue=s;
    attributeType=8;
    hasValue=true;
  }

  public Object getArrayValue()
      throws Exception{
    if(!hasValue){
      throw new Exception("ArrayValue is null");
    }
    if(objectValue==null){
      return null;
    }
    else{
      ByteArrayInputStream bytearrayinputstream=new ByteArrayInputStream(
          objectValue);
      ObjectInputStream objectinputstream=new ObjectInputStream(
          bytearrayinputstream);
      Object obj=objectinputstream.readObject();
      objectinputstream.close();
      bytearrayinputstream.close();
      return obj;
    }
  }

  public void setArrayValue(Object obj)
      throws Exception{
    attributeType=7;
    hasValue=true;
    if(obj==null){
      objectValue=null;
    }
    else{
      ByteArrayOutputStream bytearrayoutputstream=new ByteArrayOutputStream();
      ObjectOutputStream objectoutputstream=new ObjectOutputStream(
          bytearrayoutputstream);
      objectoutputstream.writeObject(obj);
      objectoutputstream.flush();
      byte abyte0[]=bytearrayoutputstream.toByteArray();
      bytearrayoutputstream.close();
      objectoutputstream.close();
      objectValue=new byte[abyte0.length];
      System.arraycopy(abyte0,0,objectValue,0,abyte0.length);
    }
  }

  public boolean hasValue(){
    return hasValue;
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -