Skip to content

Commit

Permalink
Object Profile now returns a simple idea of object models: JCR node m…
Browse files Browse the repository at this point in the history
…ixin types
  • Loading branch information
ajs6f committed Feb 5, 2013
1 parent b15fdf0 commit 185c431
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
15 changes: 14 additions & 1 deletion src/main/java/org/fcrepo/modeshape/FedoraObjects.java
@@ -1,5 +1,7 @@
package org.fcrepo.modeshape;

import static com.google.common.collect.Collections2.transform;
import static com.google.common.collect.ImmutableSet.copyOf;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static javax.ws.rs.core.MediaType.TEXT_XML;
import static javax.ws.rs.core.Response.created;
Expand All @@ -13,6 +15,7 @@
import javax.jcr.NodeIterator;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.nodetype.NodeType;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
Expand All @@ -25,6 +28,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.base.Function;

@Path("/objects")
public class FedoraObjects extends AbstractResource {

Expand Down Expand Up @@ -81,7 +86,7 @@ public Response ingest(@PathParam("pid") final String pid)

@GET
@Path("/{pid}")
@Produces({TEXT_XML, APPLICATION_JSON})
@Produces({ TEXT_XML, APPLICATION_JSON })
public Response getObject(@PathParam("pid") final String pid)
throws RepositoryException, IOException {

Expand All @@ -102,6 +107,14 @@ public Response getObject(@PathParam("pid") final String pid)
objectProfile.objItemIndexViewURL = uriInfo
.getAbsolutePathBuilder().path("datastreams").build();
objectProfile.objState = A;
objectProfile.objModels = transform(
copyOf(obj.getMixinNodeTypes()),
new Function<NodeType, String>() {
@Override
public String apply(NodeType type) {
return type.getName();
}
});

session.logout();
return ok(objectProfile).build();
Expand Down
@@ -1,9 +1,10 @@
package org.fcrepo.modeshape.jaxb.responses;

import java.net.URI;
import java.util.List;
import java.util.Collection;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "objectProfile", namespace = "http://www.fedora.info/definitions/1/0/access/")
Expand All @@ -15,8 +16,9 @@ public class ObjectProfile {
@XmlElement
public String objOwnerId;

@XmlElement
public List<String> objModels;
@XmlElementWrapper(name = "objModels")
@XmlElement(name = "model")
public Collection<String> objModels;

@XmlElement
public String objCreateDate;
Expand Down

0 comments on commit 185c431

Please sign in to comment.