Skip to content

Commit

Permalink
simplify node existence checks in AbstractService and delete commente…
Browse files Browse the repository at this point in the history
…d-out code
  • Loading branch information
barmintor committed Oct 30, 2014
1 parent e9126bc commit 17a767c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
Expand Up @@ -84,12 +84,6 @@ public abstract class AbstractResource {
@Autowired
protected VersionService versionService;

/**
* The fcrepo repository service
*/
//@Autowired
//protected RepositoryService repositoryService;

@Inject
@Optional
protected EventBus eventBus;
Expand Down
Expand Up @@ -57,10 +57,7 @@ protected Node findOrCreateNode(final Session session,

protected Node findNode(final Session session, final String path) {
try {
// Remove leading and trailing slashes ...
final String relPath = path.replaceAll("^/+", "").replaceAll("/+$", "");
final Node root = session.getRootNode();
return root.getNode(relPath);
return session.getNode(path);
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
}
Expand All @@ -84,10 +81,7 @@ private void tagHierarchyWithPairtreeMixin(final Node baseNode,
*/
public boolean exists(final Session session, final String path) {
try {
// Remove leading and trailing slashes ...
final String relPath = path.replaceAll("^/+", "").replaceAll("/+$", "");
final Node root = session.getRootNode();
return root.hasNode(relPath);
return session.nodeExists(path);
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
}
Expand Down

0 comments on commit 17a767c

Please sign in to comment.