contacthelper.java

来自「国外的一套开源CRM」· Java 代码 · 共 72 行

JAVA
72
字号
/*
 * 
 * Copyright (c) 2004 SourceTap - www.sourcetap.com
 *
 *  The contents of this file are subject to the SourceTap Public License 
 * ("License"); You may not use this file except in compliance with the 
 * License. You may obtain a copy of the License at http://www.sourcetap.com/license.htm
 * Software distributed under the License is distributed on an  "AS IS"  basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 */

package com.sourcetap.sfa.contact;



/**
 * DOCUMENT ME!
 *
 */
public class ContactHelper {
    /* use SQL for the moment, since there is no deleteAll in a single transaction */
    /*
        public static void delete( String contactId, GenericDelegator delegator)
                    throws GenericDataSourceException
            {

                    Statement stmt = null;
                    ResultSet rs = null;
                    Connection conn = null;
                boolean useTX = true;

                    try {
                            SQLUtil sqlUtil = new SQLUtil();
                            conn = sqlUtil.getConnection( delegator );

                            try { conn.setAutoCommit(false); }
                            catch(SQLException sqle) { useTX = false; }

                            stmt = conn.createStatement();
                            String contactIdClause = "'" + contactId + "'";

                            // need to delete related info from contacts and deals
                            stmt.executeUpdate("delete from contact where contact_id = " + contactIdClause);
                            stmt.executeUpdate("delete from activity where contact_id = " + contactIdClause);
                            stmt.executeUpdate("delete from address where address_owner_id = " + contactIdClause);
                            stmt.executeUpdate("delete from party where party_id = " + contactIdClause);

                            if(useTX) conn.commit();
                    }
                    catch(SQLException sqle) {
                      //Debug.logWarning("[GenericDAO.insert]: SQL Exception while executing insert. Error was:");
                      //Debug.logWarning(sqle.getMessage());

                      try { if(useTX) conn.rollback(); }
                      catch(SQLException sqle2) {
                        Debug.logWarning("[GenericDAO.insert]: SQL Exception while rolling back store. Error was:");
                        Debug.logWarning(sqle2);
                      }
                      throw new GenericDataSourceException("SQL Exception occured in deleteContact", sqle);
                    }
                    finally {
                      try { if(conn != null) conn.close(); } catch (SQLException sqle) { Debug.logWarning(sqle.getMessage()); }
                    }
            }
    */
}

⌨️ 快捷键说明

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