use of org.dcm4chee.arc.delete.StudyNotFoundException in project dcm4chee-arc-light by dcm4che.
the class StudyMgtRS method deleteStudy.
@DELETE
@Path("/studies/{StudyUID}")
public void deleteStudy(@PathParam("StudyUID") String studyUID, @QueryParam("retainObj") @Pattern(regexp = "true|false") @DefaultValue("false") String retainObj) {
logRequest();
ArchiveAEExtension arcAE = getArchiveAE();
try {
deletionService.deleteStudy(studyUID, HttpServletRequestInfo.valueOf(request), arcAE, Boolean.parseBoolean(retainObj));
rsForward.forward(RSOperation.DeleteStudy, arcAE, null, request);
} catch (StudyNotFoundException e) {
throw new WebApplicationException(errResponse(e.getMessage(), Response.Status.NOT_FOUND));
} catch (StudyNotEmptyException e) {
throw new WebApplicationException(errResponse(e.getMessage(), Response.Status.FORBIDDEN));
} catch (Exception e) {
throw new WebApplicationException(errResponseAsTextPlain(exceptionAsString(e), Response.Status.INTERNAL_SERVER_ERROR));
}
}
use of org.dcm4chee.arc.delete.StudyNotFoundException in project dcm4chee-arc-light by dcm4che.
the class ImportStorageRS method reimportStudy.
@POST
@Path("/studies/{study}/reimport")
public void reimportStudy(@Suspended AsyncResponse ar, @PathParam("study") String studyUID) {
Output output = selectMediaType();
ApplicationEntity ae = getApplicationEntity();
try {
ArchiveAEExtension arcAE = ae.getAEExtensionNotNull(ArchiveAEExtension.class);
List<Location> locations = deletionService.reimportStudy(studyUID, HttpServletRequestInfo.valueOf(request), arcAE);
Attributes coerce = new QueryAttributes(uriInfo, null).getQueryKeys();
Date now = reasonForModification != null && !coerce.isEmpty() ? new Date() : null;
Attributes.UpdatePolicy updatePolicy = Attributes.UpdatePolicy.valueOf(this.updatePolicy);
for (Location location : locations) {
if (location.getObjectType() == Location.ObjectType.METADATA)
continue;
Storage storage = storageFactory.getStorage(getStorageDesc(location.getStorageID()));
final StoreSession session = service.newStoreSession(HttpServletRequestInfo.valueOf(request), ae, aet, null).withObjectStorageID(location.getStorageID());
StoreContext ctx = service.newStoreContext(session);
ctx.getLocations().add(location);
importInstanceOnStorage(storage, ctx, coerce, updatePolicy, now, location.getStoragePath());
}
rsForward.forward(RSOperation.ReimportStudy, arcAE, null, request);
} catch (StudyNotFoundException e) {
throw new WebApplicationException(e.getMessage(), Response.Status.NOT_FOUND);
} catch (StudyNotEmptyException e) {
throw new WebApplicationException(e.getMessage(), Response.Status.FORBIDDEN);
} catch (Exception e) {
throw new WebApplicationException(errResponseAsTextPlain(exceptionAsString(e), Response.Status.INTERNAL_SERVER_ERROR));
}
response.setString(Tag.RetrieveURL, VR.UR, retrieveURL());
Response.ResponseBuilder responseBuilder = Response.status(status());
ar.resume(responseBuilder.entity(output.entity(response, ae)).header("Warning", response.getString(Tag.ErrorComment)).build());
}
Aggregations