Package de.danet.an.util

Examples of de.danet.an.util.UniversalPrepStmt$SaveColumn


        Connection con = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        try {
            con = ds.getConnection();
            ps = new UniversalPrepStmt
                (ds, con,
                 "SELECT COUNT(*) FROM WFXMLSUBSCRIPTIONS WHERE "
                 + "OBSERVERKEY=? AND PACKAGEID=? AND PROCESSID=? "
                 + "AND PROCESSKEY=?");
            ps.setString(1, observer);
            ps.setString(2, packageId);
            ps.setString(3, processId);
            ps.setString(4, processKey);
            rs = ps.executeQuery();

            rs.next();
            int n = rs.getInt(1);
            rs.close();
            rs = null;
            ps.close();
            ps = null;

            if (n==0) {
                ps = new UniversalPrepStmt
                    (ds, con,
                     "INSERT INTO WFXMLSUBSCRIPTIONS "
                     + "(OBSERVERKEY, PACKAGEID, PROCESSID, PROCESSKEY, "
                     + "SENDERBASE) VALUES (?, ?, ?, ?, ?)");
                ps.setString(1, observer);
View Full Code Here


        throws SQLException {
        Connection con = null;
        PreparedStatement ps = null;
        try {
            con = ds.getConnection();
            ps = new UniversalPrepStmt
                (ds, con,
                 "DELETE FROM WFXMLSUBSCRIPTIONS WHERE "
                 + "OBSERVERKEY=? AND PACKAGEID=? AND PROCESSID=? "
                 + "AND PROCESSKEY=?");
            ps.setString(1, observer);
View Full Code Here

        throws SQLException {
        Connection con = null;
        PreparedStatement ps = null;
        try {
            con = ds.getConnection();
            ps = new UniversalPrepStmt
                (ds, con,
                 "DELETE FROM WFXMLSUBSCRIPTIONS WHERE "
                 + "PACKAGEID=? AND PROCESSID=? AND PROCESSKEY=?");

            ps.setString(1, packageId);
View Full Code Here

    public void unsubscribe(String observer) throws SQLException {
        Connection con = null;
        PreparedStatement ps = null;
        try {
            con = ds.getConnection();
            ps = new UniversalPrepStmt
                (ds, con,
                 "DELETE FROM WFXMLSUBSCRIPTIONS WHERE OBSERVERKEY=?");
            ps.setString(1, observer);
            ps.executeUpdate();
        } finally {
View Full Code Here

        Connection con = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        try {
            con = ds.getConnection();
            ps = new UniversalPrepStmt
                (ds, con,
                 "SELECT OBSERVERKEY, SENDERBASE "
                 + "FROM WFXMLSUBSCRIPTIONS "
                 + "WHERE PACKAGEID=? AND PROCESSID=? AND PROCESSKEY=?");
            ps.setString(1, packageId);
View Full Code Here

     * @throws IOException in case of i/o problems
     */
    private void storeAuditEvent(WfAuditEvent event)
  throws SQLException, IOException {
  Connection con = null;
  UniversalPrepStmt prepStmt = null;
  try {
      con = ds.getConnection();
      // prepare statement
      prepStmt = new UniversalPrepStmt
    (ds, con, "INSERT INTO AuditEvents "
    + " (DBId, EventTime, EventType, ActivityKey,"
    + " ActivityName, ProcessKey, ProcessName, ProcessMgrName,"
    + " ProcessMgrVersion, EventData1, EventData2,"
    + " EventData3, EventData4, EventData5)"
    + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
      // primary key
      long primKey = EJBUtil.newPrimaryKey("AuditEvents");
      int offset = 1;
      prepStmt.setLong(offset++, primKey);
     
      // misc. data
      setupAuditEventInsertData (event, prepStmt, offset, primKey);
     
      // execute insert statement
      int rowCount = prepStmt.executeUpdate();
      if (rowCount == 0) {
    throw new EJBException
        ("Inserting audit event >>> " + event + " <<< failed.");
      }
     
View Full Code Here

     * @ejb.interface-method view-type="local"
     */
    public void removeAuditEvents (String procKey) {
  try {
      Connection con = null;
      UniversalPrepStmt prepStmt = null;
      try {
    con = ds.getConnection();
    if (dbProperties.isMySQL()
        && dbProperties.driverMajorVersion() == 5) {
                    prepStmt = new UniversalPrepStmt
                        (ds, con, "DELETE DATAAUDITEVENTOLDDATA "
                         + "FROM DATAAUDITEVENTOLDDATA, "
                         + "(SELECT DBID FROM AUDITEVENTS "
                         + "WHERE PROCESSKEY = ?) EVENTS "
                         + "WHERE DATAAUDITEVENTOLDDATA.MAPID = EVENTS.DBID");
    } else {
        prepStmt = new UniversalPrepStmt
            (ds, con, "DELETE FROM DataAuditEventOldData WHERE "
             + "MapId IN (SELECT DBId FROM AuditEvents "
             + "WHERE ProcessKey = ?)");
    }
    prepStmt.setString(1, procKey);
    prepStmt.executeUpdate();
    prepStmt.close ();
    prepStmt = null;

                if (dbProperties.isMySQL()
                    && dbProperties.driverMajorVersion() == 5) {
                    prepStmt = new UniversalPrepStmt
                        (ds, con, "DELETE DATAAUDITEVENTNEWDATA "
                         + "FROM DATAAUDITEVENTNEWDATA, "
                         + "(SELECT DBID FROM AUDITEVENTS "
                         + "WHERE PROCESSKEY = ?) EVENTS "
                         + "WHERE DATAAUDITEVENTNEWDATA.MAPID = EVENTS.DBID");
                } else {
                    prepStmt = new UniversalPrepStmt
                        (ds, con, "DELETE FROM DataAuditEventNewData WHERE "
             + "MapId IN (SELECT DBId FROM AuditEvents "
             + "WHERE ProcessKey = ?)");
                }
    prepStmt.setString(1, procKey);
    prepStmt.executeUpdate();
    prepStmt.close ();
    prepStmt = null;

    prepStmt = new UniversalPrepStmt
        (ds, con, "DELETE FROM AuditEvents WHERE ProcessKey = ?");
    prepStmt.setString(1, procKey);
    prepStmt.executeUpdate();
      } finally {
    JDBCUtil.closeAll(null, prepStmt, con);
      }
  } catch (SQLException e) {
      throw new EJBException (e);
View Full Code Here

     * same id already exist in the database.
     */
    private void insertProcessDefinition
  (DataSource ds, Connection con, ProcessDefinition processDefiniton)
  throws SQLException {
  UniversalPrepStmt prepStmt = null;
  try {
      // Insert new XPDL in archive
      long xpdlKey = EJBUtil.newPrimaryKey ("xpdlarchive");
      prepStmt = new UniversalPrepStmt
          (ds, con, "INSERT INTO XPDLARCHIVE ("
           + "DBID, PACKAGEID, XPDL) VALUES (?, ?, ?)");
      int offset = 1;
      prepStmt.setLong (offset++, xpdlKey);
      prepStmt.setString(offset++, processDefiniton.packageId());
      prepStmt.setLargeString(offset++, processDefiniton.toXPDL());
      prepStmt.executeUpdate();
      prepStmt.close();
      prepStmt = null;
      // Insert new process definition (with reference to XPDL in
      // archive). The XPDL column in processdefinition is deprecated.
      prepStmt = new UniversalPrepStmt
    (ds, con, "INSERT INTO PROCESSDEFINITION ("
     + "DBID, PACKAGEID, PROCESSID, XPDLREF, ENABLED) "
     + "VALUES (?, ?, ?, ?, 'T')");
      offset = 1;
      long procDefKey = EJBUtil.newPrimaryKey ("processdefinition");
      prepStmt.setLong (offset++, procDefKey);
      prepStmt.setString(offset++, processDefiniton.packageId());
      prepStmt.setString(offset++, processDefiniton.processId());
      prepStmt.setLong(offset++, xpdlKey);
      prepStmt.executeUpdate();
      cacheDefinition
          (new ProcessDefinitionInfo
           (procDefKey, new Long(xpdlKey), processDefiniton, true));
  } catch (ResourceNotAvailableException e) {
      throw new SQLException ("Cannot get primary key" + e.getMessage());
View Full Code Here

     * @param packageId the package id
     * @param processId the process id
     */
    private void prepareForRemoval(String packageId, String processId) {
        try {
            UniversalPrepStmt prepStmt = null;
            Connection con = null;
            ResultSet rs = null;
            try {
                con = ds.getConnection();
                prepStmt = new UniversalPrepStmt
                    (ds, con, "SELECT XPDL FROM PROCESSDEFINITION "
                     + "WHERE PACKAGEID = ? AND PROCESSID = ?");
                prepStmt.setString(1, packageId);
                prepStmt.setString(2, processId);
                rs = prepStmt.executeQuery();
                if(!rs.next()) {
                    return;
                }
                String xpdl = JDBCUtil.getString(ds, rs, 1);
                if (xpdl == null) {
                    return;
                }
                rs.close();
                rs = null;
                prepStmt.close();
                prepStmt = null;
                // Add to archive
                long xpdlKey = EJBUtil.newPrimaryKey ("xpdlarchive");
                prepStmt = new UniversalPrepStmt
                    (ds, con, "INSERT INTO XPDLARCHIVE ("
                     + "DBID, PACKAGEID, XPDL) VALUES (?, ?, ?)");
                int offset = 1;
                prepStmt.setLong (offset++, xpdlKey);
                prepStmt.setString(offset++, packageId);
                prepStmt.setLargeString(offset++, xpdl);
                prepStmt.executeUpdate();
                prepStmt.close();
                prepStmt = null;
                // Update processes
                prepStmt = new UniversalPrepStmt
                    (ds, con, "UPDATE PROCESS SET XPDLREF = ? "
                     + "WHERE PACKAGEID = ? AND PROCESSID = ? "
                     + "AND XPDLREF IS NULL AND XPDL IS NULL");
                offset = 1;
                prepStmt.setLong (offset++, xpdlKey);
                prepStmt.setString(offset++, packageId);
                prepStmt.setString(offset++, processId);
                prepStmt.executeUpdate();
            } finally {
                JDBCUtil.closeAll (rs, prepStmt, con);
            }
        } catch (SQLException e) {
            throw new EJBException(e);
View Full Code Here

                prepStmt.close();
                prepStmt = null;
                String xpdl = null;
                // For backward compatibility allow xpdlref to be null
                if (xpdlRef != null) {
                    prepStmt = new UniversalPrepStmt
                        (con, "SELECT XPDL FROM XPDLARCHIVE WHERE DBID = ?");
                    prepStmt.setLong(1, xpdlRef.longValue());
                    rs = prepStmt.executeQuery();
                    if (rs.next()) {
                        xpdl = JDBCUtil.getString(ds, rs, 1);
                    }
                } else {
                    prepStmt = new UniversalPrepStmt
                        (con, "SELECT XPDL FROM PROCESSDEFINITION "
                         + "WHERE DBID = ?");
                    prepStmt.setLong(1, dbid);
                    rs = prepStmt.executeQuery();
                    if (rs.next()) {
View Full Code Here

TOP

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

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.