changed delete method and throwing exception higher
This commit is contained in:
parent
fb57363139
commit
97a3c1be96
src/main/java/se/su/dsv/scipro/io
@ -1,6 +1,7 @@
|
|||||||
package se.su.dsv.scipro.io.facade;
|
package se.su.dsv.scipro.io.facade;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||||
import se.su.dsv.scipro.data.dataobjects.ProjectFollower;
|
import se.su.dsv.scipro.data.dataobjects.ProjectFollower;
|
||||||
@ -15,6 +16,7 @@ import se.su.dsv.scipro.io.exceptions.ExternalExportException;
|
|||||||
@Service
|
@Service
|
||||||
public class ExporterFacade {
|
public class ExporterFacade {
|
||||||
|
|
||||||
|
@Qualifier("externalExporter")
|
||||||
@Autowired
|
@Autowired
|
||||||
ExternalExporter externalExporter;
|
ExternalExporter externalExporter;
|
||||||
|
|
||||||
@ -31,7 +33,7 @@ public class ExporterFacade {
|
|||||||
}catch(ExternalExportException eee){
|
}catch(ExternalExportException eee){
|
||||||
externalExporter.deleteProject(""+p.getIdentifier());
|
externalExporter.deleteProject(""+p.getIdentifier());
|
||||||
System.out.println(eee.getMessage());
|
System.out.println(eee.getMessage());
|
||||||
//error(eee.getMessage());
|
throw eee;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ public class ApiClient {
|
|||||||
Client client = getClient();
|
Client client = getClient();
|
||||||
WebResource resource = client.resource(url);
|
WebResource resource = client.resource(url);
|
||||||
ClientResponse clientResponse = resource.accept(MediaType.APPLICATION_JSON_TYPE).delete(ClientResponse.class);
|
ClientResponse clientResponse = resource.accept(MediaType.APPLICATION_JSON_TYPE).delete(ClientResponse.class);
|
||||||
if(clientResponse.getStatus() != 200){
|
if(clientResponse.getStatus() != 204){
|
||||||
throw new ExternalExportException("Could not delete project");
|
throw new ExternalExportException("Could not delete project");
|
||||||
}
|
}
|
||||||
return ""+clientResponse.getStatus();
|
return ""+clientResponse.getStatus();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user