Package center.task

Examples of center.task.CalculateException


        res.setPrmByFullName("tsk", "STATUS_ID", st, false);
        res.info.calculate(TimeState.getInstance(TimeState.Time.after, State.PROCESSING), res);
      } catch (Throwable e) {
        st = State.DONE_ERR;
        res.setPrmByFullName("tsk", "STATUS_ID", st, false);
        throw new CalculateException(owner, e);
      }
      return res;
    } catch (SysException e) {
      throw new CalculateException(owner, e);
    } finally {
      tl.addPointTime(Type.END);
    }
  }
View Full Code Here


        tsk.delete_files(res);
      }
      tl.addPointTime(TimeList.Type.END_WAIT);
      return res;
    } catch (SysException e) {
      throw new CalculateException(owner, e);
    } finally {
      tl.addPointTime(Type.END);
    }
  }
View Full Code Here

          if (obj.parent)
            return r_parent.get(obj.result).getValueIm();
          else
            return r.get(obj.result).getValueIm();
        } catch (Throwable e) {
          throw new CalculateException(owner, e);
        }
      else {
        if (def != null)
          return Prm.getConst(def);
        return null;
View Full Code Here

      if (env_name instanceof Prm)
        try {
          tl.addPointTime(Type.WAIT);
          return ((Prm)env_name).getString(cntx);
        } catch (SysException e) {
          throw new CalculateException(owner, e);
        } finally {
          tl.addPointTime(Type.END_WAIT);
        }
      return null;
    } finally {
View Full Code Here

        try {
          return cntx.getPrm("tsk", nm, 0);
        } catch (CalculateException e) {
          throw e;
        } catch (Throwable e) {
          throw new CalculateException(owner, e);
        }
      return ta.getParamTask(tid, nm);
    } catch (SysException e) {
      throw new CalculateException(owner, e);
    } finally {
      tl.addPointTime(TimeList.Type.END);
    }
  }
View Full Code Here

  public Object calculate(TimeList tl, Context cntxthrows CalculateException {
    try {
      tl.addPointTime(Type.START);
      return System.getProperty(getName(cntx));
    } catch (SysException e) {
      throw new CalculateException(owner, e);
    } finally {
      tl.addPointTime(Type.END);
    }
  }
View Full Code Here

      try {
        tl.addPointTime(TimeList.Type.WAIT);
        o = sw.getObject(cntx);
      } catch (SysException e) {
        if (when_exception != null) ex = e;
        else throw new CalculateException(owner, e);
      } catch (CalculateException e) {
        if (when_exception != null) ex = e;
        else throw e;
      } finally {
        tl.addPointTime(TimeList.Type.END_WAIT);
      }

      if (ex != null) {
        if (when_exception instanceof Prm)
          try {
            return ((Prm) when_exception).getObject(cntx);
          } catch (SysException e) {
            throw new CalculateException(owner, e);
          }
        return when_exception;
      }
     
      if (Null.equ(o)) {
        Object v;
        if (isnull != null)
          v = isnull;
        else
          v = els;
        if (v instanceof Prm)
          try {
            return ((Prm) v).getObject(cntx);
          } catch (SysException e) {
            throw new CalculateException(owner, e);
          }
        return v;
      }
      String k = o.toString();
      Object v = equals.get(k);
      if (v == null) {
        for (Entry<Prm, Object> m : equals_full_scan.entrySet()) {
          try {
            if (k.equals(m.getKey().getString(cntx))) {
              v = m.getValue();
              if (v instanceof Prm)
                try {
                  return ((Prm) v).getObject(cntx);
                } catch (SysException e) {
                  throw new SysRuntimeException(e);
                }
              return v;
            }
          } catch (SysException e) {
            e.printStackTrace(); // TODO To change body of catch statement use
                                  // File | Settings | File Templates.
          }
        }
        v = els;
        if (v instanceof Prm)
          try {
            return ((Prm) v).getObject(cntx);
          } catch (SysException e) {
            throw new CalculateException(owner, e);
          }
        return v;
      }
      if (v instanceof Prm)
        try {
          return ((Prm) v).getObject(cntx);
        } catch (SysException e) {
          throw new CalculateException(owner, e);
        }
      return v;
    } finally {
      tl.addPointTime(TimeList.Type.END);
    }
View Full Code Here

        Object o = n.getValue();
        if (o instanceof Context.WaitValue)
          try {
            st.setParam(k, ((Context.WaitValue)o).getValueWait(), java.sql.Types.OTHER);
          } catch (Throwable e) {
            throw new CalculateException(getOwner(), e);
          }
        else
          st.setParam(k, o, java.sql.Types.OTHER);
      }
      tl.addPointTime(TimeList.Type.END_WAIT);

      Connection con = Manager.getConnection(db);
      PreparedStatement stm = null;
      try {
        try {
          stm = st.getStatement(con);
        } catch (Exception ex) {
          con = Manager.reInitConnection(con);
          stm = st.getStatement(con);
        }
        Record result;
        ResultSet rs = stm.executeQuery();
        if (rs.next()) {
          ResultSetMetaData md = stm.getMetaData(); // TODO надо оптимизировать
          result = new Record();
          for (int i = 1; i <= md.getColumnCount(); i++) {
            result.name.put(md.getColumnName(i), i - 1);
            Object x = rs.getObject(i);
            if (x == null)
              result.value.addLast(Null.NULL);
            else {
              if (x instanceof Blob) {
                InputStream r = ((Blob)x).getBinaryStream();
                OutputByteBuffer wr = ru.vassaev.core.thread.Process
                    .getByteBuffer(8000);
                byte[] buf = new byte[1024];
                int l;
                try {
                while ((l = r.read(buf)) > 0) {
                  wr.write(buf, 0, l);
                }
                wr.close();
                r.close();
                } catch (IOException e) {
                  throw new CalculateException(owner, e);
                }
                x = wr;
              }
              result.value.addLast(x);
            }
View Full Code Here

      return link.getObject(cntx);
      // if (link.isParent && cntx.parent != null)
      // return cntx.parent.getPrmByFullName(link.fullname);
      // return cntx.getPrmByFullName(link.fullname);
    } catch (SysException e) {
      throw new CalculateException(owner, e);
    } finally {
      tl.addPointTime(TimeList.Type.END);
    }
  }
View Full Code Here

        }
        o[i] = Classes.castAs(o[i], cls_[i]);
      }
      return mtd.invoke(cls, o);
    } catch (SysException e) {
      throw new CalculateException(getOwner(),e);
    } catch (InvocationTargetException e) {
      throw new CalculateException(getOwner(),e);
    } catch (IllegalAccessException e) {
      throw new CalculateException(getOwner(),e);
    } finally {
      tl.addPointTime(TimeList.Type.END);
    }
  }
View Full Code Here

TOP

Related Classes of center.task.CalculateException

Copyright © 2018 www.massapicom. 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.