You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tv...@apache.org on 2016/07/27 12:26:54 UTC

svn commit: r1754260 - in /db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om: ObjectModel.java Persistent.java

Author: tv
Date: Wed Jul 27 12:26:53 2016
New Revision: 1754260

URL: http://svn.apache.org/viewvc?rev=1754260&view=rev
Log:
Introduce additional interface layer to allow better generification

Added:
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ObjectModel.java   (with props)
Modified:
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/Persistent.java

Added: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ObjectModel.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ObjectModel.java?rev=1754260&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ObjectModel.java (added)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ObjectModel.java Wed Jul 27 12:26:53 2016
@@ -0,0 +1,87 @@
+package org.apache.torque.om;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.torque.TorqueException;
+
+/**
+ * This interface defines methods related to object referencing and tracking
+ *
+ * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
+ * @version $Id: Persistent.java 1152582 2011-07-31 13:59:17Z tfischer $
+ */
+public interface ObjectModel
+{
+    /**
+     * getter for the object primaryKey.
+     *
+     * @return the object primaryKey as an Object
+     */
+    ObjectKey getPrimaryKey();
+
+    /**
+     * Sets the PrimaryKey for the object.
+     *
+     * @param primaryKey The new PrimaryKey for the object.
+     * @throws TorqueException This method might throw an exception
+     */
+    void setPrimaryKey(ObjectKey primaryKey) throws TorqueException;
+
+    /**
+     * Sets the PrimaryKey for the object.
+     *
+     * @param primaryKey the String should be of the form produced by
+     *        ObjectKey.toString().
+     * @throws TorqueException This method might throw an exception
+     */
+    void setPrimaryKey(String primaryKey) throws TorqueException;
+
+    /**
+     * Returns whether the object has been modified, since it was
+     * last retrieved from storage.
+     *
+     * @return True if the object has been modified.
+     */
+    boolean isModified();
+
+    /**
+     * Returns whether the object has ever been saved.  This will
+     * be false, if the object was retrieved from storage or was created
+     * and then saved.
+     *
+     * @return true, if the object has never been persisted.
+     */
+    boolean isNew();
+
+    /**
+     * Setter for the isNew attribute.  This method will be called
+     * by Torque-generated children and Peers.
+     *
+     * @param b the state of the object.
+     */
+    void setNew(boolean b);
+
+    /**
+     * Sets the modified state for the object.
+     *
+     * @param m The new modified state for the object.
+     */
+    void setModified(boolean m);
+}

Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ObjectModel.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/Persistent.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/Persistent.java?rev=1754260&r1=1754259&r2=1754260&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/Persistent.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/Persistent.java Wed Jul 27 12:26:53 2016
@@ -21,8 +21,6 @@ package org.apache.torque.om;
 
 import java.sql.Connection;
 
-import org.apache.torque.TorqueException;
-
 /**
  * This interface defines methods related to saving an object
  *
@@ -30,65 +28,9 @@ import org.apache.torque.TorqueException
  * @author <a href="mailto:fedor@apache.org">Fedor K.</a>
  * @version $Id$
  */
-public interface Persistent
+public interface Persistent extends ObjectModel
 {
     /**
-     * getter for the object primaryKey.
-     *
-     * @return the object primaryKey as an Object
-     */
-    ObjectKey getPrimaryKey();
-
-    /**
-     * Sets the PrimaryKey for the object.
-     *
-     * @param primaryKey The new PrimaryKey for the object.
-     * @throws TorqueException This method might throw an exception
-     */
-    void setPrimaryKey(ObjectKey primaryKey) throws TorqueException;
-
-    /**
-     * Sets the PrimaryKey for the object.
-     *
-     * @param primaryKey the String should be of the form produced by
-     *        ObjectKey.toString().
-     * @throws TorqueException This method might throw an exception
-     */
-    void setPrimaryKey(String primaryKey) throws TorqueException;
-
-    /**
-     * Returns whether the object has been modified, since it was
-     * last retrieved from storage.
-     *
-     * @return True if the object has been modified.
-     */
-    boolean isModified();
-
-    /**
-     * Returns whether the object has ever been saved.  This will
-     * be false, if the object was retrieved from storage or was created
-     * and then saved.
-     *
-     * @return true, if the object has never been persisted.
-     */
-    boolean isNew();
-
-    /**
-     * Setter for the isNew attribute.  This method will be called
-     * by Torque-generated children and Peers.
-     *
-     * @param b the state of the object.
-     */
-    void setNew(boolean b);
-
-    /**
-     * Sets the modified state for the object.
-     *
-     * @param m The new modified state for the object.
-     */
-    void setModified(boolean m);
-
-    /**
      * Saves the object.
      *
      * @throws Exception This method might throw an exception



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org