|
|
@@ -348,8 +348,83 @@ public class RepositoryManagementServiceImpl implements RepositoryManagementServ
|
|
|
|
|
|
@Override
|
|
|
public String delete(String requestXmlString) {
|
|
|
- // TODO Auto-generated method stub
|
|
|
- return null;
|
|
|
+ OperationResult operationResult = new OperationResult();
|
|
|
+ operationResult.setVersion(VERSION);
|
|
|
+ // operationResult.setReturnCode( OperationResult.SUCCESS );
|
|
|
+ try {
|
|
|
+ // Iterator iter = element.getChildElements();
|
|
|
+ // String requestXmlString = ((OMElement) iter.next()).getText();
|
|
|
+
|
|
|
+ // Unmarshall xmlDescriptor request...
|
|
|
+ StringReader xmlStringReader = new StringReader(requestXmlString);
|
|
|
+ Request request = (Request) Unmarshaller.unmarshal(xmlStringReader);
|
|
|
+ // createAuditEvent(request.getOperationName(),
|
|
|
+ // request.getResourceDescriptor().getWsType(),
|
|
|
+ // request.getResourceDescriptor().getIsNew());
|
|
|
+ setLocale(request.getLocale());
|
|
|
+
|
|
|
+ String reportUnitUrl = getArgumentValue(Argument.MODIFY_REPORTUNIT, request.getArguments());
|
|
|
+
|
|
|
+ if (reportUnitUrl != null && reportUnitUrl.length() > 0) {
|
|
|
+ logger.debug("Delete: resource in reportUnit: " + reportUnitUrl);
|
|
|
+
|
|
|
+ // Report unit modification....
|
|
|
+ // ReportUnit reportUnit = (ReportUnit)
|
|
|
+ // repository.getResource(null, reportUnitUrl);
|
|
|
+ // if (reportUnit == null) {
|
|
|
+ // throw new
|
|
|
+ // WSException(WSException.REFERENCED_RESOURCE_NOT_FOUND,
|
|
|
+ // messageSource.getMessage("webservices.error.reportUnitNotFound",
|
|
|
+ // null, getLocale()));
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // SubResourceHandler handler = (SubResourceHandler)
|
|
|
+ // getHandlerRegistry().getHandler(reportUnit);
|
|
|
+ // handler.deleteSubResource(reportUnit,
|
|
|
+ // request.getResourceDescriptor(), this);
|
|
|
+ operationResult.setReturnCode(1);
|
|
|
+ operationResult.setMessage("不支持该类型的资源!");
|
|
|
+ } else {
|
|
|
+ // ResourceDescriptor rd =
|
|
|
+ // createResourceDescriptor(request.getResourceDescriptor().getUriString());
|
|
|
+ ResourceDescriptor resourceDescriptor = basicResourceHandler
|
|
|
+ .locateResourceDescriptor(request.getResourceDescriptor().getUriString());
|
|
|
+ if (resourceDescriptor == null) {
|
|
|
+ logger.error("Delete: no resource : " + request.getResourceDescriptor().getUriString());
|
|
|
+ // or.setReturnCode(2);
|
|
|
+ // or.setMessage("Resource not found");
|
|
|
+ operationResult.setReturnCode(2);
|
|
|
+ operationResult.setMessage("Resource not found");
|
|
|
+ } else {
|
|
|
+ String wsType = resourceDescriptor.getWsType();
|
|
|
+ logger.debug("Delete: resource : " + wsType);
|
|
|
+ // ResourceHandler handler =
|
|
|
+ // getHandlerRegistry().getHandler(wsType);
|
|
|
+ BasicResourceHandler handler = resourceHandlerRegistry.getHandler(wsType);
|
|
|
+ // handler.delete(rd, this);
|
|
|
+ handler.delete(resourceDescriptor);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // if (operationResult.getReturnCode() != 0) {
|
|
|
+ // addExceptionToAllAuditEvents(new
|
|
|
+ // Exception(operationResult.getMessage()));
|
|
|
+ // }
|
|
|
+ } catch (WSException e) {
|
|
|
+ operationResult.setReturnCode(e.getErrorCode());
|
|
|
+ operationResult.setMessage(e.getMessage());
|
|
|
+ // addExceptionToAllAuditEvents(e);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ logger.error("caught exception: " + e.getMessage(), e);
|
|
|
+
|
|
|
+ operationResult.setReturnCode(1);
|
|
|
+ operationResult.setMessage(e.getMessage());
|
|
|
+ // addExceptionToAllAuditEvents(e);
|
|
|
+ }
|
|
|
+
|
|
|
+ logger.debug("Marshalling response");
|
|
|
+ return marshalResponse(operationResult);
|
|
|
}
|
|
|
|
|
|
@Override
|