jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r430320 - in /jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state: NodeState.java PropertyState.java SessionItemStateManager.java TransientChangeLog.java WorkspaceItemStateFactory.java
Date Thu, 10 Aug 2006 08:53:45 GMT
Author: mreutegg
Date: Thu Aug 10 01:53:44 2006
New Revision: 430320

URL: http://svn.apache.org/viewvc?rev=430320&view=rev
Log:
Remove PropertyId from PropertyState

Modified:
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientChangeLog.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java?rev=430320&r1=430319&r2=430320&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
Thu Aug 10 01:53:44 2006
@@ -26,6 +26,7 @@
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.ItemId;
+import org.apache.jackrabbit.spi.PropertyId;
 import org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeConflictException;
 import org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeType;
@@ -563,6 +564,18 @@
      */
     public synchronized Collection getPropertyEntries() {
         return Collections.unmodifiableCollection(properties.values());
+    }
+
+    /**
+     * Returns the <code>PropertyId</code> for a property with
+     * <code>propertyName</code>. The property does not necessarily have to
+     * exist on <code>this</code> node state.
+     *
+     * @param propertyName the name of a property.
+     * @return the property id.
+     */
+    PropertyId getPropertyId(QName propertyName) {
+        return idFactory.createPropertyId(getNodeId(), propertyName);
     }
 
     /**

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java?rev=430320&r1=430319&r2=430320&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
Thu Aug 10 01:53:44 2006
@@ -39,9 +39,9 @@
     private static Logger log = LoggerFactory.getLogger(PropertyState.class);
 
     /**
-     * the id of this property state
+     * The name of this property state.
      */
-    private PropertyId id;
+    private QName name;
 
     /**
      * The parent state
@@ -83,13 +83,14 @@
     /**
      * Create a new <code>PropertyState</code>
      *
-     * @param id            id of the property
+     * @param name          the name of the property
      * @param initialStatus the initial status of the property state object
-     * @param isTransient   flag indicating whether this state is transient or not
+     * @param isTransient   flag indicating whether this state is transient or
+     *                      not
      */
-    public PropertyState(PropertyId id, NodeState parent, int initialStatus, boolean isTransient)
{
+    public PropertyState(QName name, NodeState parent, int initialStatus, boolean isTransient)
{
         super(initialStatus, isTransient);
-        this.id = id;
+        this.name = name;
         this.parent = parent;
         type = PropertyType.UNDEFINED;
         values = QValue.EMPTY_ARRAY;
@@ -102,7 +103,7 @@
     protected synchronized void copy(ItemState state) {
         synchronized (state) {
             PropertyState propState = (PropertyState) state;
-            id = propState.id;
+            name = propState.name;
             parent = propState.parent;
             type = propState.type;
             def = propState.def;
@@ -126,7 +127,7 @@
      * {@inheritDoc}
      */
     public ItemId getId() {
-        return id;
+        return getPropertyId();
     }
 
     /**
@@ -135,7 +136,7 @@
      * @return the id of this property.
      */
     public PropertyId getPropertyId() {
-        return id;
+        return parent.getPropertyId(name);
     }
 
     /**
@@ -151,7 +152,7 @@
      * @return the name of this property.
      */
     public QName getQName() {
-        return id.getQName();
+        return name;
     }
 
     /**

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java?rev=430320&r1=430319&r2=430320&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
Thu Aug 10 01:53:44 2006
@@ -47,7 +47,6 @@
 import org.apache.jackrabbit.jcr2spi.operation.AddLabel;
 import org.apache.jackrabbit.jcr2spi.operation.RemoveLabel;
 import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.uuid.UUID;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
 

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientChangeLog.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientChangeLog.java?rev=430320&r1=430319&r2=430320&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientChangeLog.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientChangeLog.java
Thu Aug 10 01:53:44 2006
@@ -364,8 +364,7 @@
      * @see TransientItemStateFactory#createNewPropertyState(QName, NodeState)
      */
     public PropertyState createNewPropertyState(QName name, NodeState parent) {
-        PropertyId id = idFactory.createPropertyId(parent.getNodeId(), name);
-        PropertyState propState = new PropertyState(id, parent,
+        PropertyState propState = new PropertyState(name, parent,
                 ItemState.STATUS_NEW, true);
         // get a notification when this item state is saved or invalidated
         propState.addListener(this);

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java?rev=430320&r1=430319&r2=430320&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
Thu Aug 10 01:53:44 2006
@@ -192,12 +192,11 @@
                                               NodeState parent)
             throws ItemStateException {
         try {
-            // TODO: pass parent in constructor of PropertyState
-
             // build the PropertyState
             // NOTE: unable to retrieve definitionId -> needs to be retrieved
             // by the itemManager upon Property creation.
-            PropertyState state = new PropertyState(info.getId(), parent, ItemState.STATUS_EXISTING,
false);
+            PropertyState state = new PropertyState(info.getQName(), parent,
+                    ItemState.STATUS_EXISTING, false);
             state.setMultiValued(info.isMultiValued());
             state.setType(info.getType());
             QValue[] qValues;



Mime
View raw message