Author: dkuleshov
Date: 2011-07-05 02:23:08 -0400 (Tue, 05 Jul 2011)
New Revision: 4590
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/AuditPropertyImpl.java
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
Log:
EXOJCR-1408: added AuditPropertyImpl which extends PropertyImpl to avoid redundant
operations not used during trail audit
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/AuditPropertyImpl.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/AuditPropertyImpl.java
(rev 0)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/AuditPropertyImpl.java 2011-07-05
06:23:08 UTC (rev 4590)
@@ -0,0 +1,56 @@
+package org.exoplatform.services.jcr.impl.core;
+
+import org.exoplatform.services.jcr.core.nodetype.ItemDefinitionData;
+import org.exoplatform.services.jcr.datamodel.ItemData;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.PropertyDefinition;
+
+/**
+ * Created to avoid huge operations on PropertyImpl instance initialization,
+ * as they are not needed for trail audit.
+ *
+ * @author <a href="mailto:dmi3.kuleshov@gmail.com">Dmitry
Kuleshov</a>
+ * @version $Id: $
+ */
+public class AuditPropertyImpl extends PropertyImpl
+{
+
+ AuditPropertyImpl(ItemData data, SessionImpl session) throws RepositoryException,
ConstraintViolationException
+ {
+ super(data, session);
+ }
+
+ /**
+ * The most expensive method. In parent class it fulfills useless operations
+ * in context of trail audit.
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ void loadData(ItemData data) throws RepositoryException
+ {
+ this.qpath = data.getQPath();
+ return;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ItemDefinitionData getItemDefinitionData()
+ {
+ throw new UnsupportedOperationException("getItemDefinitionData method is not
supported by this class");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public PropertyDefinition getDefinition()
+ {
+ throw new UnsupportedOperationException("getItemDefinitionData method is not
supported by this class");
+ }
+
+}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java 2011-07-04
17:19:31 UTC (rev 4589)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java 2011-07-05
06:23:08 UTC (rev 4590)
@@ -478,7 +478,7 @@
{
// update of the property
prevProp = (PropertyImpl)prevItem;
- prevProperty = new PropertyImpl(prevProp.getData(), prevProp.parentData(),
prevProp.getSession());
+ prevProperty = new AuditPropertyImpl(prevProp.getData(),
prevProp.getSession());
isMultiValue = prevProp.isMultiValued();
defs =
ntm.getPropertyDefinitions(propertyName, parentData.getPrimaryTypeName(),
parentData.getMixinTypeNames());
Show replies by date