Package de.danet.an.util

Examples of de.danet.an.util.UniversalPrepStmt


  }
  return sb.toString();
    }

    private int cleanup() throws Exception {
  UniversalPrepStmt deletePrepStmt = new UniversalPrepStmt
      (con, "DELETE FROM ProcessDefinition WHERE"
       + " DBId = 1000000");
  return deletePrepStmt.executeUpdate();
    }
View Full Code Here


     * Insert a new activity info into database.
     */
    private void insertActivity()
  throws SQLException {
  Connection con = null;
  UniversalPrepStmt prepStmt = null;
  try {
      con = ds.getConnection();
      prepStmt = new UniversalPrepStmt
    (ds, con, "INSERT INTO activity (DBId, "
     + "ProcessMgr, ProcessMgrVersion, ProcessName, ProcessDBId, "
     + "Name, Description, BlockActivity, "
     + "Implementation, Performer, Priority, Executor, StartMode, "
     + "FinishMode, State, StateTime, JoinMode, SplitMode, "
     + "ThreadInfo, Subflow, SuspendAccum, PendingException, "
                 + "WaitOnProc, WaitOnChan, Flags) "
     + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "
     + "?, ?, ?, ?, ?, ?, ?, ?)");
      int offset = 1;
      prepStmt.setLong(offset++,
           ((Long)ctx.getPrimaryKey()).longValue());
      prepStmt.setString (offset++, processMgr);
      prepStmt.setString (offset++, processMgrVers);
      prepStmt.setString (offset++, processName);
      prepStmt.setLong(offset++, processPk.longValue());
      prepStmt.setString (offset++, paName);
      prepStmt.setString (offset++, paDescription);
      prepStmt.setLong (offset++, paBlockActivity);
      prepStmt.setBinary (offset++, paActImpl);
      prepStmt.setString (offset++, paPerformer);
      prepStmt.setInt(offset++, paPriority.toInt ());
      prepStmt.setInt (offset++, paExecStat);
      prepStmt.setString (offset++, paStartMode.toString());
      prepStmt.setString (offset++, paFinishMode.toString());
      prepStmt.setString (offset++, paTypedState.toString ());
      prepStmt.setTimestamp
    (offset++, new Timestamp (paLastStateTime.getTime()));
      prepStmt.setString (offset++, paJoinMode.toString ());
      prepStmt.setString (offset++, paSplitMode.toString ());
      prepStmt.setBinary (offset++, paThreadInfo);
      prepStmt.setLong
    (offset++, paSubflow == null ? null : new Long(paSubflow));
      prepStmt.setLong(offset++, new Long (0)); // SuspendAccum
      prepStmt.setString(offset++, null); // PendingException
      prepStmt.setLong(offset++, null); // WaitOnProc
      prepStmt.setString(offset++, null); // WaitOnChan
      prepStmt.setInt(offset++, paFlags); // Flags
      // now execute
      prepStmt.executeUpdate();
      WfProcessEJB.updateDeadlines
    (ds, con, processPk, (Long)ctx.getPrimaryKey(),
     paDeadlines, false);
  } catch (IOException ioe) {
      logger.error (ioe.getMessage(), ioe);
View Full Code Here

    /**
     * Store activity info in the database.
     */
    private void storeActivity() throws SQLException {
  Connection con = null;
  UniversalPrepStmt prepStmt = null;
  try {
      con = ds.getConnection();
      prepStmt = new UniversalPrepStmt
    (ds, con, "UPDATE activity "
     + "SET State = ?, StateTime = ?, Executor = ?, Subflow = ?, "
     + "Flags = ?"
     + (execTimesModified
        ? ", StartTime = ?, SuspendStart = ?, SuspendAccum = ? "
        : "")
     + (threadInfoModified ? ", ThreadInfo = ? " : "")
     + (waitingOnModified ? ", WaitOnProc = ?, WaitOnChan = ? ":"")
     + (slowlyChangingPaModified
        ? (", ProcessName = ?, Name = ?, Description = ?, "
           + "Implementation = ?, Performer = ?, "
           + "Priority = ?, StartMode = ?, "
           + "FinishMode = ?, JoinMode = ?, SplitMode = ?, "
                       + "PendingException = ?")
        : "")
     + " WHERE DBId = ?");
      int offset = 1;
      prepStmt.setString (offset++, paTypedState.toString());
      prepStmt.setTimestamp
    (offset++, new Timestamp (paLastStateTime.getTime()));
      prepStmt.setInt (offset++, paExecStat);
      prepStmt.setLong
    (offset++, paSubflow==null ? null : new Long(paSubflow));
      prepStmt.setInt (offset++, paFlags);
      if (execTimesModified) {
    prepStmt.setTimestamp
        (offset++, (paStartTime == null ? null
        : new Timestamp (paStartTime.getTime())));
    prepStmt.setTimestamp
        (offset++, (paSuspendStart == null ? null
        : new Timestamp (paSuspendStart.getTime())));
    prepStmt.setLong
        (offset++, new Long(paSuspendAccum));
      }
      if (threadInfoModified) {
    prepStmt.setBinary (offset++, paThreadInfo);
      }
      if (waitingOnModified) {
    prepStmt.setLong (offset++, paWaitOnProc);
    prepStmt.setString (offset++, paWaitOnChan);
      }
      if (slowlyChangingPaModified) {
    prepStmt.setString (offset++, processName);
    prepStmt.setString (offset++, paName);
    prepStmt.setString (offset++, paDescription);
    prepStmt.setBinary (offset++, paActImpl);
    prepStmt.setString (offset++, paPerformer);
    prepStmt.setInt(offset++, paPriority.toInt());
    prepStmt.setString (offset++, paStartMode.toString());
    prepStmt.setString (offset++, paFinishMode.toString());
    prepStmt.setString (offset++, paJoinMode.toString());
    prepStmt.setString (offset++, paSplitMode.toString());
                prepStmt.setString (offset++, paPendingException);
      }
      // for where statement
      prepStmt.setLong(offset++,
           ((Long)ctx.getPrimaryKey()).longValue());
      int rowCount = prepStmt.executeUpdate();
      if (rowCount == 0) {
    throw new NoSuchEntityException
        ("Storing row for DBId "
         + (Long)ctx.getPrimaryKey() + " failed.");
      }
View Full Code Here

    public void append(LoggingEvent event) {
  Connection con = null;
  PreparedStatement prepStmt = null;
  try {
      con = ds.getConnection();
      prepStmt = new UniversalPrepStmt
    (ds, con, "INSERT INTO LogMessages "
     + "(Prio, Message, Category, Thread, NDC, LogTime) "
     + "VALUES (?, ?, ?, ?, ?, ?)");
      int offset = 1;
      prepStmt.setString (offset++, "INFO");
View Full Code Here

     * @ejb.interface-method view-type="both"
     */
    public void removeInstance (long instId) {
  try {
      Connection con = null;
      UniversalPrepStmt prepStmt = null;
      try {
    con = ds.getConnection();
    prepStmt = new UniversalPrepStmt
        (ds, con, "DELETE FROM SimpleAppl WHERE DBId = ?");
    prepStmt.setLong (1, instId);
    prepStmt.executeUpdate();
    if (logger.isDebugEnabled()) {
        logger.debug ("Removed application " + instId);
    }
      } finally {
    JDBCUtil.closeAll (null, prepStmt, con);
View Full Code Here

     */
    public SimpleApplicationInfo instanceInfo (long instId)
  throws InvalidKeyException {
  try {
      Connection con = null;
      UniversalPrepStmt prepStmt = null;
      ResultSet rs = null;
      try {
    con = ds.getConnection();
    prepStmt = new UniversalPrepStmt
        (ds, con, "SELECT ActivityKey, ProcessKey, ProcessMgr, "
         + "ResourceKey, AssignedAt, InstData "
         + "FROM SimpleAppl WHERE DBId = ?");
    prepStmt.setLong (1, instId);
    rs = prepStmt.executeQuery();
    if (! rs.next()) {
        throw new InvalidKeyException
      ("No application instance with key = " + instId);
    }
    String actKey = rs.getString (1);
View Full Code Here

     */
    public SimpleApplicationInfo infoByActivity (ActivityUniqueKey auk)
  throws InvalidKeyException {
  try {
      Connection con = null;
      UniversalPrepStmt prepStmt = null;
      ResultSet rs = null;
      try {
    con = ds.getConnection();
    prepStmt = new UniversalPrepStmt
        (ds, con, "SELECT DBId, ResourceKey, AssignedAt, InstData "
         + "FROM SimpleAppl WHERE ActivityKey = ? "
         + "AND ProcessKey = ? AND ProcessMgr = ?");
    prepStmt.setString (1, auk.activityKey());
    prepStmt.setString (2, auk.processKey());
    prepStmt.setString (3, auk.managerName());
    rs = prepStmt.executeQuery();
    if (! rs.next()) {
        throw new InvalidKeyException
      ("No application instance for activity = " + auk);
    }
    long instId = rs.getLong(1);
View Full Code Here

     */
    public Collection infosByApplication (String applName) {
        Collection res = new ArrayList ();
        try {
            Connection con = null;
            UniversalPrepStmt prepStmt = null;
            ResultSet rs = null;
            try {
                con = ds.getConnection();
                prepStmt = new UniversalPrepStmt
                    (ds, con, "SELECT DBId, ActivityKey, ProcessKey, "
                     + "ProcessMgr, ResourceKey, AssignedAt, InstData "
                     + "FROM SimpleAppl WHERE ApplName = ? ");
                prepStmt.setString (1, applName);
                rs = prepStmt.executeQuery();
                while (rs.next()) {
                    int pos = 1;
                    long instId = rs.getLong(pos++);
                    String actKey = rs.getString(pos++);
                    String procKey = rs.getString(pos++);
View Full Code Here

    public Collection infosByKey (String applName, String applInstKey)
        throws InvalidKeyException {
        try {
            Collection res = new ArrayList ();
            Connection con = null;
            UniversalPrepStmt prepStmt = null;
            ResultSet rs = null;
            try {
                con = ds.getConnection();
                prepStmt = new UniversalPrepStmt
                    (ds, con, "SELECT DBId, ActivityKey, ProcessKey, "
                     + "ProcessMgr, ResourceKey, AssignedAt, InstData "
                     + "FROM SimpleAppl WHERE ApplName = ? AND InstKey = ?");
                prepStmt.setString (1, applName);
                prepStmt.setString (2, applInstKey);
                rs = prepStmt.executeQuery();
                while (rs.next()) {
                    int pos = 1;
                    long instId = rs.getLong(pos++);
                    String actKey = rs.getString(pos++);
                    String procKey = rs.getString(pos++);
View Full Code Here

    public Collection infosByResource
        (String applName, String resourceKey) {
        Collection res = new ArrayList ();
        try {
            Connection con = null;
            UniversalPrepStmt prepStmt = null;
            ResultSet rs = null;
            try {
                con = ds.getConnection();
                prepStmt = new UniversalPrepStmt
                    (ds, con, "SELECT DBId, ActivityKey, ProcessKey, "
                     + "ProcessMgr, AssignedAt, InstData "
                     + "FROM SimpleAppl "
                     + "WHERE ApplName = ? AND ResourceKey = ? ");
                prepStmt.setString (1, applName);
                prepStmt.setString (2, resourceKey);
                rs = prepStmt.executeQuery();
                while (rs.next()) {
                    int pos = 1;
                    long instId = rs.getLong(pos++);
                    String actKey = rs.getString(pos++);
                    String procKey = rs.getString(pos++);
View Full Code Here

TOP

Related Classes of de.danet.an.util.UniversalPrepStmt

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.