import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * The Class AcquisitionResource.
+ */
@Path("/acquisitions")
@Consumes("multipart/mixed")
@Produces("multipart/mixed")
public class AcquisitionResource
extends AbstractCollectionSpaceResourceImpl {
+ /** The service name. */
final private String serviceName = "acquisitions";
+
+ /** The logger. */
final Logger logger = LoggerFactory.getLogger(AcquisitionResource.class);
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl#getVersionString()
+ */
@Override
protected String getVersionString() {
/** The last change revision. */
return lastChangeRevision;
}
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl#getServiceName()
+ */
@Override
public String getServiceName() {
return serviceName;
}
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl#createDocumentHandler(org.collectionspace.services.common.context.ServiceContext)
+ */
@Override
public DocumentHandler createDocumentHandler(ServiceContext ctx) throws Exception {
DocumentHandler docHandler = ctx.getDocumentHandler();
return docHandler;
}
+ /**
+ * Instantiates a new acquisition resource.
+ */
public AcquisitionResource() {
// do nothing
}
+ /**
+ * Creates the acquisition.
+ *
+ * @param input the input
+ *
+ * @return the response
+ */
@POST
public Response createAcquisition(MultipartInput input) {
}
}
+ /**
+ * Gets the acquisition.
+ *
+ * @param csid the csid
+ *
+ * @return the acquisition
+ */
@GET
@Path("{csid}")
public MultipartOutput getAcquisition(
return result;
}
+ /**
+ * Gets the acquisition list.
+ *
+ * @param ui the ui
+ * @param keywords the keywords
+ *
+ * @return the acquisition list
+ */
@GET
@Produces("application/xml")
- public AcquisitionsCommonList getAcquisitionList(@Context UriInfo ui) {
- AcquisitionsCommonList acquisitionObjectList = new AcquisitionsCommonList();
+ public AcquisitionsCommonList getAcquisitionList(@Context UriInfo ui,
+ @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords) {
+ AcquisitionsCommonList result = null;
+ if (keywords != null) {
+ result = searchAcquisitions(keywords);
+ } else {
+ result = getAcquisitionsList();
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets the acquisitions list.
+ *
+ * @return the acquisitions list
+ */
+ private AcquisitionsCommonList getAcquisitionsList() {
+ AcquisitionsCommonList acquisitionObjectList;
try {
ServiceContext ctx = MultipartServiceContextFactory.get().createServiceContext(null, getServiceName());
DocumentHandler handler = createDocumentHandler(ctx);
return acquisitionObjectList;
}
+ /**
+ * Update acquisition.
+ *
+ * @param csid the csid
+ * @param theUpdate the the update
+ *
+ * @return the multipart output
+ */
@PUT
@Path("{csid}")
public MultipartOutput updateAcquisition(
return result;
}
+ /**
+ * Delete acquisition.
+ *
+ * @param csid the csid
+ *
+ * @return the response
+ */
@DELETE
@Path("{csid}")
public Response deleteAcquisition(@PathParam("csid") String csid) {
}
}
+ /**
+ * Keywords search acquisitions.
+ *
+ * @param ui the ui
+ * @param keywords the keywords
+ *
+ * @return the acquisitions common list
+ */
@GET
@Path("/search")
@Produces("application/xml")
public AcquisitionsCommonList keywordsSearchAcquisitions(@Context UriInfo ui,
@QueryParam (IQueryManager.SEARCH_TYPE_KEYWORDS) String keywords) {
- AcquisitionsCommonList acquisitionObjectList = new AcquisitionsCommonList();
+ return searchAcquisitions(keywords);
+ }
+
+ /**
+ * Search acquisitions.
+ *
+ * @param keywords the keywords
+ *
+ * @return the acquisitions common list
+ */
+ private AcquisitionsCommonList searchAcquisitions(String keywords) {
+ AcquisitionsCommonList acquisitionObjectList;
try {
ServiceContext ctx = MultipartServiceContextFactory.get().createServiceContext(null, getServiceName());
DocumentHandler handler = createDocumentHandler(ctx);
return acquisitionObjectList;
}
+ /**
+ * Gets the authority refs.
+ *
+ * @param csid the csid
+ * @param ui the ui
+ *
+ * @return the authority refs
+ */
@GET
@Path("{csid}/authorityrefs")
@Produces("application/xml")
}
return result;
}
-
+
+ @GET
+ @Produces("application/xml")
+ public CollectionobjectsCommonList getCollectionObjectList(@Context UriInfo ui,
+ @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords) {
+ CollectionobjectsCommonList result = null;
+ if (keywords != null) {
+ result = searchCollectionObjects(keywords);
+ } else {
+ result = getCollectionObjectList();
+ }
+
+ return result;
+ }
+
/**
* Gets the collection object list.
- *
- * @param ui the ui
- *
- * @return the collection object list
*/
- @GET
- @Produces("application/xml")
- public CollectionobjectsCommonList getCollectionObjectList(@Context UriInfo ui) {
- CollectionobjectsCommonList collectionObjectList = new CollectionobjectsCommonList();
+ private CollectionobjectsCommonList getCollectionObjectList() {
+ CollectionobjectsCommonList collectionObjectList;
try {
ServiceContext ctx = MultipartServiceContextFactory.get().createServiceContext(null, getServiceName());
DocumentHandler handler = createDocumentHandler(ctx);
return result;
}
-
- //FIXME: Replace this "search" resource with a keyword "kw" query parameter
/**
+ * This method is deprecated. Use kwSearchCollectionObjects() method instead.
* Keywords search collection objects.
*
* @param keywords the keywords
@Produces("application/xml")
public CollectionobjectsCommonList keywordsSearchCollectionObjects(
@QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS) String keywords) {
- CollectionobjectsCommonList collectionObjectList = new CollectionobjectsCommonList();
+ return searchCollectionObjects(keywords);
+ }
+
+ private CollectionobjectsCommonList searchCollectionObjects(String keywords) {
+ CollectionobjectsCommonList collectionObjectList;
try {
ServiceContext ctx = MultipartServiceContextFactory.get().createServiceContext(null, getServiceName());
DocumentHandler handler = createDocumentHandler(ctx);
\r
final static String SEARCH_LIKE = "LIKE";\r
final static String SEARCH_TYPE_KEYWORDS = "keywords";\r
+ final static String SEARCH_TYPE_KEYWORDS_KW = "kw";\r
final static String SEARCH_TYPE_PARTIALTERM = "pt";\r
final static String ECM_FULLTEXT_LIKE = "ecm:fulltext " + SEARCH_LIKE;\r
final static String SEARCH_QUALIFIER_AND = "AND";\r
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
+import org.collectionspace.services.collectionobject.CollectionobjectsCommonList;
import org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl;
import org.collectionspace.services.common.ClientType;
import org.collectionspace.services.common.ServiceMain;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * The Class IntakeResource.
+ */
@Path("/intakes")
@Consumes("multipart/mixed")
@Produces("multipart/mixed")
public class IntakeResource extends AbstractCollectionSpaceResourceImpl {
+ /** The Constant serviceName. */
private final static String serviceName = "intakes";
+
+ /** The logger. */
final Logger logger = LoggerFactory.getLogger(IntakeResource.class);
//FIXME retrieve client type from configuration
+ /** The Constant CLIENT_TYPE. */
final static ClientType CLIENT_TYPE = ServiceMain.getInstance().getClientType();
+ /**
+ * Instantiates a new intake resource.
+ */
public IntakeResource() {
// do nothing
}
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl#getVersionString()
+ */
@Override
protected String getVersionString() {
/** The last change revision. */
return lastChangeRevision;
}
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl#getServiceName()
+ */
@Override
public String getServiceName() {
return serviceName;
}
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl#createDocumentHandler(org.collectionspace.services.common.context.ServiceContext)
+ */
@Override
public DocumentHandler createDocumentHandler(ServiceContext ctx) throws Exception {
DocumentHandler docHandler = ctx.getDocumentHandler();
return docHandler;
}
+ /**
+ * Creates the intake.
+ *
+ * @param input the input
+ *
+ * @return the response
+ */
@POST
public Response createIntake(MultipartInput input) {
try {
}
}
+ /**
+ * Gets the intake.
+ *
+ * @param csid the csid
+ *
+ * @return the intake
+ */
@GET
@Path("{csid}")
public MultipartOutput getIntake(
return result;
}
+ /**
+ * Gets the intake list.
+ *
+ * @param ui the ui
+ * @param keywords the keywords
+ *
+ * @return the intake list
+ */
@GET
@Produces("application/xml")
- public IntakesCommonList getIntakeList(@Context UriInfo ui) {
- IntakesCommonList intakeObjectList = new IntakesCommonList();
+ public IntakesCommonList getIntakeList(@Context UriInfo ui,
+ @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords) {
+ IntakesCommonList result = null;
+
+ if (keywords != null) {
+ result = searchIntakes(keywords);
+ } else {
+ result = getIntakeList();
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets the intake list.
+ *
+ * @return the intake list
+ */
+ private IntakesCommonList getIntakeList() {
+ IntakesCommonList intakeObjectList;
try {
ServiceContext ctx = MultipartServiceContextFactory.get().createServiceContext(null, getServiceName());
DocumentHandler handler = createDocumentHandler(ctx);
return intakeObjectList;
}
+ /**
+ * Gets the authority refs.
+ *
+ * @param csid the csid
+ * @param ui the ui
+ *
+ * @return the authority refs
+ */
@GET
@Path("{csid}/authorityrefs")
@Produces("application/xml")
return intakeObjectList;
}
+ /**
+ * Update intake.
+ *
+ * @param csid the csid
+ * @param theUpdate the the update
+ *
+ * @return the multipart output
+ */
@PUT
@Path("{csid}")
public MultipartOutput updateIntake(
return result;
}
+ /**
+ * Delete intake.
+ *
+ * @param csid the csid
+ *
+ * @return the response
+ */
@DELETE
@Path("{csid}")
public Response deleteIntake(@PathParam("csid") String csid) {
}
}
+ /**
+ * Keywords search intakes.
+ *
+ * @param ui the ui
+ * @param keywords the keywords
+ *
+ * @return the intakes common list
+ */
@GET
@Path("/search")
@Produces("application/xml")
public IntakesCommonList keywordsSearchIntakes(@Context UriInfo ui,
@QueryParam (IQueryManager.SEARCH_TYPE_KEYWORDS) String keywords) {
- IntakesCommonList intakesObjectList = new IntakesCommonList();
+ return searchIntakes(keywords);
+ }
+
+ /**
+ * Search intakes.
+ *
+ * @param keywords the keywords
+ *
+ * @return the intakes common list
+ */
+ private IntakesCommonList searchIntakes(String keywords) {
+ IntakesCommonList intakesObjectList;
try {
ServiceContext ctx = MultipartServiceContextFactory.get().createServiceContext(null, getServiceName());
DocumentHandler handler = createDocumentHandler(ctx);