Author: aparfonov
Date: 2009-11-06 09:49:54 -0500 (Fri, 06 Nov 2009)
New Revision: 485
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ExtendedSession.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
Log:
EXOJCR-228 : add method
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ExtendedSession.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ExtendedSession.java 2009-11-06
14:47:58 UTC (rev 484)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ExtendedSession.java 2009-11-06
14:49:54 UTC (rev 485)
@@ -26,6 +26,8 @@
import javax.jcr.InvalidSerializedDataException;
import javax.jcr.ItemExistsException;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.Node;
import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
@@ -52,6 +54,16 @@
LocationFactory getLocationFactory();
/**
+ * Get node by unique identifier.
+ *
+ * @param identifier node identifier
+ * @return node with specified identifier
+ * @throws ItemNotFoundException id node with supplied identifier not found
+ * @throws RepositoryException if any repository errors occurs
+ */
+ Node getNodeByIdentifier(String identifier) throws ItemNotFoundException,
RepositoryException;
+
+ /**
* Deserialize an XML document and adds the resulting item subtree as a child of the
node at
* parentAbsPath.
*
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2009-11-06
14:47:58 UTC (rev 484)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2009-11-06
14:49:54 UTC (rev 485)
@@ -622,7 +622,19 @@
{
return getNamespaceURI(prefix);
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public Node getNodeByIdentifier(String identifier) throws ItemNotFoundException,
RepositoryException
+ {
+ Item item = dataManager.getItemByIdentifier(identifier, true);
+ if (item != null && item.isNode())
+ return (Node)item;
+ throw new ItemNotFoundException("Node not found " + identifier + "
at " + workspaceName);
+ }
+
/**
* {@inheritDoc}
*/