Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added FedoraObject abstraction for use with ObjectService
- Loading branch information
Showing
9 changed files
with
98 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
package org.fcrepo; | ||
|
||
import static org.modeshape.jcr.api.JcrConstants.NT_FOLDER; | ||
|
||
import java.util.Calendar; | ||
|
||
import javax.jcr.Node; | ||
import javax.jcr.RepositoryException; | ||
import javax.jcr.Session; | ||
import javax.jcr.lock.LockException; | ||
import javax.jcr.nodetype.ConstraintViolationException; | ||
import javax.jcr.nodetype.NoSuchNodeTypeException; | ||
import javax.jcr.version.VersionException; | ||
|
||
import org.modeshape.jcr.api.JcrTools; | ||
|
||
public class FedoraObject extends JcrTools { | ||
|
||
private Node node; | ||
|
||
public FedoraObject(Node n) { | ||
this.node = n; | ||
} | ||
|
||
public FedoraObject(Session session, String path) | ||
throws NoSuchNodeTypeException, VersionException, ConstraintViolationException, LockException, RepositoryException { | ||
this.node = findOrCreateNode(session, path, NT_FOLDER); | ||
node.addMixin("fedora:object"); | ||
node.addMixin("fedora:owned"); | ||
node.setProperty("fedora:ownerId", session.getUserID()); | ||
node.setProperty("jcr:lastModified", Calendar.getInstance()); | ||
node.setProperty("dc:identifier", new String[] {node.getIdentifier(), | ||
node.getName()}); | ||
} | ||
|
||
public Node getNode() { | ||
return node; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.