ActionDelete.java :  » Content-Management-System » webman » de » webman » acl » db » queries » Java Open Source

Java Open Source » Content Management System » webman 
webman » de » webman » acl » db » queries » ActionDelete.java
package de.webman.acl.db.queries;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Types;
import com.teamkonzept.webman.mainint.WebmanExceptionHandler;
import com.teamkonzept.db.*;
import com.teamkonzept.webman.mainint.db.queries.accesscontrol.*;

/**
 * $Header: /cvsroot/webman-cms/source/webman/de/webman/acl/db/queries/ActionDelete.java,v 1.2 2001/09/19 11:51:38 markus Exp $
 *
 * @version 0.10
 * @since 0.10
 * @author © 2000 Team-Konzept
 */
public class ActionDelete
  extends TKExtendedPrepQuery
{

  // Constants

  public static final String[] ORDER =
  {
    "WM_ACTION_ID",
    "WM_ACTION_ID"
  };

  public static final Object[][] TYPES =
  {
    {"WM_ACTION_ID", new Integer(Types.INTEGER)},
    {"WM_ACTION_ID", new Integer(Types.INTEGER)}
  };

  public static final boolean[] RELEVANTS =
  {
    false
  };

//  public static final String SQL = (new StringBuffer()).append("DELETE FROM WM_TASK_ACTION WHERE WM_ACTION_ID = ? ")
//                             .append("DELETE FROM WM_ACTION WHERE WM_ACTION_ID = ?")
//                             .toString();

    protected static Class[] queryClasses = {DeleteWMTaskAction.class, DeleteWMAction.class};


  // Method implementations

  public boolean execute() {
    try {
        init(queryClasses);
        boolean isNotOpen = aTKDBConnection.isAutoCommit();
        if (isNotOpen) {
            aTKDBConnection.beginTransaction();
        }

        queries[0].setQueryParams("WM_ACTION_ID", queryParams.get("WM_ACTION_ID"));
        queries[0].execute();

        queries[1].setQueryParams("WM_ACTION_ID", queryParams.get("WM_ACTION_ID"));
        queries[1].execute();

        if (isNotOpen) {
          aTKDBConnection.commitTransaction();
        }
    }
    catch (SQLException sqle) {
      WebmanExceptionHandler.getException(sqle);
      try {
        aTKDBConnection.rollbackTransaction();
      }
      catch (SQLException sqle2) {
        WebmanExceptionHandler.getException(sqle2);
      }
    }
    finally {
        return hasResults();
    }
  }

  public void initQuery (Connection connection)
  {
    super.initQuery(connection,
            true,
            ORDER,
            TYPES,
            RELEVANTS,
            null);
  }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.