001 package org.apache.ojb.broker.util;
002
003 /* Copyright 2002-2005 The Apache Software Foundation
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 import java.io.Serializable;
019
020 /**
021 *
022 * The Interface ObjectModification represents information about
023 * modifications of persistence capable objects.
024 * Allows clients of the PersistenceBroker (e.g. a TransactionServer)
025 * to interact with the Broker in order to generate optimized SQL Statements.
026 *
027 * @author Thomas Mahler
028 * @version $Id: ObjectModification.java,v 1.1 2007-08-24 22:17:36 ewestfal Exp $
029 */
030 public interface ObjectModification extends Serializable
031 {
032 static final long serialVersionUID = -3208237880606252967L;
033
034 /**
035 * Default implementation of this interface usable for INSERT.
036 */
037 public static final ObjectModification INSERT = new ObjectModification()
038 {
039 public boolean needsInsert()
040 {
041 return true;
042 }
043
044 public boolean needsUpdate()
045 {
046 return false;
047 }
048 };
049
050 /**
051 * Default implementation of this interface usable for UPDATE.
052 */
053 public static final ObjectModification UPDATE = new ObjectModification()
054 {
055 public boolean needsInsert()
056 {
057 return false;
058 }
059
060 public boolean needsUpdate()
061 {
062 return true;
063 }
064 };
065
066 /**
067 * Returns true if the underlying Object needs an INSERT statement.
068 * else Returns false.
069 */
070 public boolean needsInsert();
071
072 /**
073 * Returns true if the underlying Object needs an UPDATE statement.
074 * else Returns false.
075 */
076 public boolean needsUpdate();
077 }