Integrated `ingnore_errors` in the deleteFileSet
This commit is contained in:
parent
ac5d2a5c63
commit
bdd92cd2ac
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
## [v1.2.0-SNAPSHOT] - 2023-04-26
|
## [v1.2.0-SNAPSHOT] - 2023-04-26
|
||||||
- Added PATCH method [#24985]
|
- Added PATCH method [#24985]
|
||||||
|
- Integrated `ingnore_errors` in the deleteFileSet
|
||||||
|
|
||||||
## [v1.1.2] - 2023-01-10
|
## [v1.1.2] - 2023-01-10
|
||||||
- Pom updates
|
- Pom updates
|
||||||
|
|
|
@ -31,6 +31,15 @@ import lombok.NonNull;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new default documents client.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* May 2, 2023
|
||||||
|
* @param <T> the generic type
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new default documents client.
|
* Instantiates a new default documents client.
|
||||||
*
|
*
|
||||||
|
@ -49,7 +58,6 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
|
||||||
@NonNull
|
@NonNull
|
||||||
protected final Class<T> managedClass;
|
protected final Class<T> managedClass;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the managed class.
|
* Gets the managed class.
|
||||||
*
|
*
|
||||||
|
@ -69,11 +77,11 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
|
||||||
@Override
|
@Override
|
||||||
public T createNew(Document toCreate) throws RemoteException {
|
public T createNew(Document toCreate) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
log.debug("Creating Profiled Document (class {}, useCaseDescriptor {}) with content {} ",
|
log.debug("Creating Profiled Document (class {}, useCaseDescriptor {}) with content {} ", getManagedClass(),
|
||||||
getManagedClass(),profileID, toCreate);
|
profileID, toCreate);
|
||||||
Call<WebTarget, T> call = endpoint -> {
|
Call<WebTarget, T> call = endpoint -> {
|
||||||
return ResponseCommons.check(endpoint.path(profileID).request(MediaType.APPLICATION_JSON).
|
return ResponseCommons.check(endpoint.path(profileID).request(MediaType.APPLICATION_JSON)
|
||||||
post(Entity.entity(toCreate, MediaType.APPLICATION_JSON)),getManagedClass());
|
.post(Entity.entity(toCreate, MediaType.APPLICATION_JSON)), getManagedClass());
|
||||||
};
|
};
|
||||||
T toReturn = delegate.make(call);
|
T toReturn = delegate.make(call);
|
||||||
log.info("Registered {} profiled {} ", toReturn.getId(), profileID);
|
log.info("Registered {} profiled {} ", toReturn.getId(), profileID);
|
||||||
|
@ -110,9 +118,9 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
|
||||||
try {
|
try {
|
||||||
log.debug("Deleting ID {} useCaseDescriptor {} force {} ", id, profileID, force);
|
log.debug("Deleting ID {} useCaseDescriptor {} force {} ", id, profileID, force);
|
||||||
Call<WebTarget, T> call = endpoint -> {
|
Call<WebTarget, T> call = endpoint -> {
|
||||||
return ResponseCommons.check(endpoint.path(profileID).path(id).
|
return ResponseCommons
|
||||||
queryParam(InterfaceConstants.Parameters.FORCE,force).
|
.check(endpoint.path(profileID).path(id).queryParam(InterfaceConstants.Parameters.FORCE, force)
|
||||||
request(MediaType.APPLICATION_JSON).delete(),null);
|
.request(MediaType.APPLICATION_JSON).delete(), null);
|
||||||
};
|
};
|
||||||
delegate.make(call);
|
delegate.make(call);
|
||||||
log.info("Deleted ID {} useCaseDescriptor {} force {} ", id, profileID, force);
|
log.info("Deleted ID {} useCaseDescriptor {} force {} ", id, profileID, force);
|
||||||
|
@ -135,11 +143,10 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
|
||||||
@Override
|
@Override
|
||||||
public T getById(String id) throws RemoteException {
|
public T getById(String id) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
log.info("Loading Document ID {} (class {}, useCaseDescriptor {})",
|
log.info("Loading Document ID {} (class {}, useCaseDescriptor {})", id, getManagedClass(), profileID);
|
||||||
id, getManagedClass(),profileID);
|
|
||||||
Call<WebTarget, T> call = endpoint -> {
|
Call<WebTarget, T> call = endpoint -> {
|
||||||
return ResponseCommons.check(endpoint.path(profileID).path(id).
|
return ResponseCommons.check(
|
||||||
request(MediaType.APPLICATION_JSON).get(), getManagedClass());
|
endpoint.path(profileID).path(id).request(MediaType.APPLICATION_JSON).get(), getManagedClass());
|
||||||
};
|
};
|
||||||
return delegate.make(call);
|
return delegate.make(call);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
@ -162,8 +169,9 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
|
||||||
try {
|
try {
|
||||||
log.info("Loading Configuration for useCaseDescriptor {}", profileID);
|
log.info("Loading Configuration for useCaseDescriptor {}", profileID);
|
||||||
Call<WebTarget, Configuration> call = endpoint -> {
|
Call<WebTarget, Configuration> call = endpoint -> {
|
||||||
return ResponseCommons.check(endpoint.path(profileID).path(InterfaceConstants.Methods.CONFIGURATION_PATH).
|
return ResponseCommons.check(endpoint.path(profileID)
|
||||||
request(MediaType.APPLICATION_JSON).get(), Configuration.class);
|
.path(InterfaceConstants.Methods.CONFIGURATION_PATH).request(MediaType.APPLICATION_JSON).get(),
|
||||||
|
Configuration.class);
|
||||||
};
|
};
|
||||||
return delegate.make(call);
|
return delegate.make(call);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
@ -222,8 +230,9 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
|
||||||
try {
|
try {
|
||||||
log.debug("Querying useCaseDescriptor {} for {}", profileID, request);
|
log.debug("Querying useCaseDescriptor {} for {}", profileID, request);
|
||||||
Call<WebTarget, String> call = endpoint -> {
|
Call<WebTarget, String> call = endpoint -> {
|
||||||
return ResponseCommons.check(endpoint.path(profileID).path(InterfaceConstants.Methods.QUERY_PATH).
|
return ResponseCommons.check(endpoint.path(profileID).path(InterfaceConstants.Methods.QUERY_PATH)
|
||||||
request(MediaType.APPLICATION_JSON).post(Entity.entity(request,MediaType.APPLICATION_JSON)), String.class);
|
.request(MediaType.APPLICATION_JSON).post(Entity.entity(request, MediaType.APPLICATION_JSON)),
|
||||||
|
String.class);
|
||||||
};
|
};
|
||||||
return delegate.make(call);
|
return delegate.make(call);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
@ -246,16 +255,16 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
|
||||||
@Override
|
@Override
|
||||||
public T performStep(String id, StepExecutionRequest request) throws RemoteException {
|
public T performStep(String id, StepExecutionRequest request) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
log.debug("Executing step on {} (class {}, useCaseDescriptor {}) with request {} ",
|
log.debug("Executing step on {} (class {}, useCaseDescriptor {}) with request {} ", id, getManagedClass(),
|
||||||
id, getManagedClass(),profileID, request);
|
profileID, request);
|
||||||
Call<WebTarget, T> call = endpoint -> {
|
Call<WebTarget, T> call = endpoint -> {
|
||||||
return ResponseCommons.check(endpoint.path(profileID).path(InterfaceConstants.Methods.STEP)
|
return ResponseCommons.check(endpoint.path(profileID).path(InterfaceConstants.Methods.STEP).path(id)
|
||||||
.path(id).request(MediaType.APPLICATION_JSON).
|
.request(MediaType.APPLICATION_JSON).post(Entity.entity(request, MediaType.APPLICATION_JSON)),
|
||||||
post(Entity.entity(request, MediaType.APPLICATION_JSON)),getManagedClass());
|
getManagedClass());
|
||||||
};
|
};
|
||||||
T toReturn = delegate.make(call);
|
T toReturn = delegate.make(call);
|
||||||
log.info("Executed STEP {} on {} [useCaseDescriptor {}, class {}] ",request.getStepID(),
|
log.info("Executed STEP {} on {} [useCaseDescriptor {}, class {}] ", request.getStepID(), id, profileID,
|
||||||
id,profileID,getManagedClass());
|
getManagedClass());
|
||||||
return toReturn;
|
return toReturn;
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
log.error("Unexpected error ", e);
|
log.error("Unexpected error ", e);
|
||||||
|
@ -278,17 +287,18 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
|
||||||
@Override
|
@Override
|
||||||
public T registerFileSet(String id, RegisterFileSetRequest req) throws RemoteException, InvalidRequestException {
|
public T registerFileSet(String id, RegisterFileSetRequest req) throws RemoteException, InvalidRequestException {
|
||||||
try {
|
try {
|
||||||
log.debug("Registering FileSet on {} (class {}, useCaseDescriptor {}) with request {} ",
|
log.debug("Registering FileSet on {} (class {}, useCaseDescriptor {}) with request {} ", id,
|
||||||
id, getManagedClass(), profileID, req);
|
getManagedClass(), profileID, req);
|
||||||
req.validate();
|
req.validate();
|
||||||
Call<WebTarget, T> call = endpoint -> {
|
Call<WebTarget, T> call = endpoint -> {
|
||||||
return ResponseCommons.check(endpoint.path(profileID).path(InterfaceConstants.Methods.REGISTER_FILES_PATH)
|
return ResponseCommons.check(endpoint.path(profileID)
|
||||||
.path(id).request(MediaType.APPLICATION_JSON).
|
.path(InterfaceConstants.Methods.REGISTER_FILES_PATH).path(id)
|
||||||
post(Entity.entity(req, MediaType.APPLICATION_JSON)), getManagedClass());
|
.request(MediaType.APPLICATION_JSON).post(Entity.entity(req, MediaType.APPLICATION_JSON)),
|
||||||
|
getManagedClass());
|
||||||
};
|
};
|
||||||
T toReturn = delegate.make(call);
|
T toReturn = delegate.make(call);
|
||||||
log.info("Registered FileSet on {} [useCaseDescriptor {}, class {}] with {}",
|
log.info("Registered FileSet on {} [useCaseDescriptor {}, class {}] with {}", id, profileID,
|
||||||
id, profileID, getManagedClass(), req);
|
getManagedClass(), req);
|
||||||
return toReturn;
|
return toReturn;
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
log.error("Invalid Request ", e);
|
log.error("Invalid Request ", e);
|
||||||
|
@ -315,13 +325,15 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
|
||||||
@Override
|
@Override
|
||||||
public T deleteFileSet(String id, String path, Boolean force, Boolean ignoreErrors) throws RemoteException {
|
public T deleteFileSet(String id, String path, Boolean force, Boolean ignoreErrors) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
log.debug("Deleting Fileset for ID {} [useCaseDescriptor {} , class {}] at {} (force {} )",
|
log.debug(
|
||||||
id, profileID,getManagedClass(),path, force);
|
"Deleting Fileset for ID {} [useCaseDescriptor {} , class {}] at {} (force {} ) (ignoreErrors {} )",
|
||||||
|
id, profileID, getManagedClass(), path, force, ignoreErrors);
|
||||||
Call<WebTarget, T> call = endpoint -> {
|
Call<WebTarget, T> call = endpoint -> {
|
||||||
return ResponseCommons.check(endpoint.path(profileID).path(InterfaceConstants.Methods.DELETE_FILES_PATH).
|
return ResponseCommons.check(endpoint.path(profileID).path(InterfaceConstants.Methods.DELETE_FILES_PATH)
|
||||||
path(id).queryParam(InterfaceConstants.Parameters.FORCE,force).
|
.path(id).queryParam(InterfaceConstants.Parameters.FORCE, force)
|
||||||
request(MediaType.APPLICATION_JSON).
|
.queryParam(InterfaceConstants.Parameters.IGNORE_ERRORS, ignoreErrors)
|
||||||
post(Entity.entity(path, MediaType.APPLICATION_JSON)),getManagedClass());
|
.request(MediaType.APPLICATION_JSON).post(Entity.entity(path, MediaType.APPLICATION_JSON)),
|
||||||
|
getManagedClass());
|
||||||
};
|
};
|
||||||
T toReturn = delegate.make(call);
|
T toReturn = delegate.make(call);
|
||||||
log.info("Deleted ID {} useCaseDescriptor {} force {} ", id, profileID, force);
|
log.info("Deleted ID {} useCaseDescriptor {} force {} ", id, profileID, force);
|
||||||
|
@ -345,12 +357,10 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
|
||||||
@Override
|
@Override
|
||||||
public T forceUnlock(String id) throws RemoteException {
|
public T forceUnlock(String id) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
log.warn("Force Unlock of {} [useCaseDescriptor {} , class {}]",
|
log.warn("Force Unlock of {} [useCaseDescriptor {} , class {}]", id, profileID, getManagedClass());
|
||||||
id, profileID,getManagedClass());
|
|
||||||
Call<WebTarget, T> call = endpoint -> {
|
Call<WebTarget, T> call = endpoint -> {
|
||||||
return ResponseCommons.check(endpoint.path(profileID).path(InterfaceConstants.Methods.FORCE_UNLOCK).path(id).
|
return ResponseCommons.check(endpoint.path(profileID).path(InterfaceConstants.Methods.FORCE_UNLOCK)
|
||||||
request(MediaType.APPLICATION_JSON).
|
.path(id).request(MediaType.APPLICATION_JSON).put(Entity.json("")), getManagedClass());
|
||||||
put(Entity.json("")),getManagedClass());
|
|
||||||
};
|
};
|
||||||
T toReturn = delegate.make(call);
|
T toReturn = delegate.make(call);
|
||||||
log.info("Unlocked ID {} useCaseDescriptor {}", id, profileID);
|
log.info("Unlocked ID {} useCaseDescriptor {}", id, profileID);
|
||||||
|
@ -375,12 +385,13 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
|
||||||
@Override
|
@Override
|
||||||
public T setAccessPolicy(String id, Access toSet) throws RemoteException {
|
public T setAccessPolicy(String id, Access toSet) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
log.info("Setting Access of {} [useCaseDescriptor {} , class {}] as {}",
|
log.info("Setting Access of {} [useCaseDescriptor {} , class {}] as {}", id, profileID, getManagedClass(),
|
||||||
id, profileID,getManagedClass(),toSet);
|
toSet);
|
||||||
Call<WebTarget, T> call = endpoint -> {
|
Call<WebTarget, T> call = endpoint -> {
|
||||||
return ResponseCommons.check(endpoint.path(profileID).path(InterfaceConstants.Methods.SET_PROJECT_ACCESS_POLICY).path(id).
|
return ResponseCommons.check(
|
||||||
request(MediaType.APPLICATION_JSON).
|
endpoint.path(profileID).path(InterfaceConstants.Methods.SET_PROJECT_ACCESS_POLICY).path(id)
|
||||||
put(Entity.json(toSet)),getManagedClass());
|
.request(MediaType.APPLICATION_JSON).put(Entity.json(toSet)),
|
||||||
|
getManagedClass());
|
||||||
};
|
};
|
||||||
T toReturn = delegate.make(call);
|
T toReturn = delegate.make(call);
|
||||||
log.debug("Updated Access of ID {} useCaseDescriptor {}", id, profileID);
|
log.debug("Updated Access of ID {} useCaseDescriptor {}", id, profileID);
|
||||||
|
@ -405,12 +416,11 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
|
||||||
@Override
|
@Override
|
||||||
public T updateDocument(String id, Document updatedDocument) throws RemoteException {
|
public T updateDocument(String id, Document updatedDocument) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
log.debug("Updating {} [useCaseDescriptor {} , class {}] with ",
|
log.debug("Updating {} [useCaseDescriptor {} , class {}] with ", id, profileID, getManagedClass(),
|
||||||
id, profileID,getManagedClass(),updatedDocument);
|
updatedDocument);
|
||||||
Call<WebTarget, T> call = endpoint -> {
|
Call<WebTarget, T> call = endpoint -> {
|
||||||
return ResponseCommons.check(endpoint.path(profileID).path(id).
|
return ResponseCommons.check(endpoint.path(profileID).path(id).request(MediaType.APPLICATION_JSON)
|
||||||
request(MediaType.APPLICATION_JSON).
|
.put(Entity.entity(updatedDocument, MediaType.APPLICATION_JSON)), getManagedClass());
|
||||||
put(Entity.entity(updatedDocument, MediaType.APPLICATION_JSON)),getManagedClass());
|
|
||||||
};
|
};
|
||||||
T toReturn = delegate.make(call);
|
T toReturn = delegate.make(call);
|
||||||
log.info("Updated ID {} useCaseDescriptor {}", id, profileID);
|
log.info("Updated ID {} useCaseDescriptor {}", id, profileID);
|
||||||
|
@ -425,8 +435,7 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Patch document.
|
* Patch document. Added by Francesco Mangiacrapa
|
||||||
* Added by Francesco Mangiacrapa
|
|
||||||
*
|
*
|
||||||
* @param id the id
|
* @param id the id
|
||||||
* @param path the path
|
* @param path the path
|
||||||
|
@ -444,7 +453,8 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
|
||||||
WebTarget webTarget = endpoint.path(profileID).path(id);
|
WebTarget webTarget = endpoint.path(profileID).path(id);
|
||||||
webTarget.queryParam(InterfaceConstants.Parameters.PATH, path);
|
webTarget.queryParam(InterfaceConstants.Parameters.PATH, path);
|
||||||
webTarget.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);
|
webTarget.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);
|
||||||
Response response = webTarget.request(MediaType.APPLICATION_JSON).method("PATCH", Entity.entity(updatedDocument, MediaType.APPLICATION_JSON));
|
Response response = webTarget.request(MediaType.APPLICATION_JSON).method("PATCH",
|
||||||
|
Entity.entity(updatedDocument, MediaType.APPLICATION_JSON));
|
||||||
return ResponseCommons.check(response, getManagedClass());
|
return ResponseCommons.check(response, getManagedClass());
|
||||||
};
|
};
|
||||||
T toReturn = delegate.make(call);
|
T toReturn = delegate.make(call);
|
||||||
|
@ -469,23 +479,18 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
|
||||||
@Override
|
@Override
|
||||||
public Project setRelation(CreateRelationshipRequest request) throws RemoteException {
|
public Project setRelation(CreateRelationshipRequest request) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
log.debug("Setting relationship {}:{} --{}--> {}:{}",
|
log.debug("Setting relationship {}:{} --{}--> {}:{}", profileID, request.getProjectId(),
|
||||||
profileID, request.getProjectId(), request.getRelationshipId(),
|
request.getRelationshipId(), request.getTargetUCD(), request.getTargetId());
|
||||||
request.getTargetUCD(),request.getTargetId());
|
|
||||||
Call<WebTarget, T> call = endpoint -> {
|
Call<WebTarget, T> call = endpoint -> {
|
||||||
return ResponseCommons.check(endpoint.path(profileID).
|
return ResponseCommons.check(endpoint.path(profileID).path(InterfaceConstants.Methods.RELATIONSHIP)
|
||||||
path(InterfaceConstants.Methods.RELATIONSHIP).
|
.path(request.getProjectId()).path(request.getRelationshipId())
|
||||||
path(request.getProjectId()).
|
.queryParam(InterfaceConstants.Parameters.TARGET_ID, request.getTargetId())
|
||||||
path(request.getRelationshipId()).
|
.queryParam(InterfaceConstants.Parameters.TARGET_UCD, request.getTargetUCD())
|
||||||
queryParam(InterfaceConstants.Parameters.TARGET_ID,request.getTargetId()).
|
.request(MediaType.APPLICATION_JSON).put(Entity.json("")), getManagedClass());
|
||||||
queryParam(InterfaceConstants.Parameters.TARGET_UCD,request.getTargetUCD()).
|
|
||||||
request(MediaType.APPLICATION_JSON).
|
|
||||||
put(Entity.json("")),getManagedClass());
|
|
||||||
};
|
};
|
||||||
T toReturn = delegate.make(call);
|
T toReturn = delegate.make(call);
|
||||||
log.info("Set relationship {}:{} --{}--> {}:{}",
|
log.info("Set relationship {}:{} --{}--> {}:{}", profileID, request.getProjectId(),
|
||||||
profileID, request.getProjectId(), request.getRelationshipId(),
|
request.getRelationshipId(), request.getTargetUCD(), request.getTargetId());
|
||||||
request.getTargetUCD(),request.getTargetId());
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
log.error("Unexpected error ", e);
|
log.error("Unexpected error ", e);
|
||||||
|
@ -506,23 +511,18 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
|
||||||
@Override
|
@Override
|
||||||
public Project deleteRelation(DeleteRelationshipRequest request) throws RemoteException {
|
public Project deleteRelation(DeleteRelationshipRequest request) throws RemoteException {
|
||||||
try {
|
try {
|
||||||
log.debug("Deleting relationship {}:{} --{}--> {}:{}",
|
log.debug("Deleting relationship {}:{} --{}--> {}:{}", profileID, request.getProjectId(),
|
||||||
profileID, request.getProjectId(), request.getRelationshipId(),
|
request.getRelationshipId(), request.getTargetUCD(), request.getTargetId());
|
||||||
request.getTargetUCD(),request.getTargetId());
|
|
||||||
Call<WebTarget, T> call = endpoint -> {
|
Call<WebTarget, T> call = endpoint -> {
|
||||||
return ResponseCommons.check(endpoint.path(profileID).
|
return ResponseCommons.check(endpoint.path(profileID).path(InterfaceConstants.Methods.RELATIONSHIP)
|
||||||
path(InterfaceConstants.Methods.RELATIONSHIP).
|
.path(request.getProjectId()).path(request.getRelationshipId())
|
||||||
path(request.getProjectId()).
|
.queryParam(InterfaceConstants.Parameters.TARGET_ID, request.getTargetId())
|
||||||
path(request.getRelationshipId()).
|
.queryParam(InterfaceConstants.Parameters.TARGET_UCD, request.getTargetUCD())
|
||||||
queryParam(InterfaceConstants.Parameters.TARGET_ID,request.getTargetId()).
|
.request(MediaType.APPLICATION_JSON).delete(), getManagedClass());
|
||||||
queryParam(InterfaceConstants.Parameters.TARGET_UCD,request.getTargetUCD()).
|
|
||||||
request(MediaType.APPLICATION_JSON).
|
|
||||||
delete(),getManagedClass());
|
|
||||||
};
|
};
|
||||||
T toReturn = delegate.make(call);
|
T toReturn = delegate.make(call);
|
||||||
log.info("Deleted relationship {}:{} --{}--> {}:{}",
|
log.info("Deleted relationship {}:{} --{}--> {}:{}", profileID, request.getProjectId(),
|
||||||
profileID, request.getProjectId(), request.getRelationshipId(),
|
request.getRelationshipId(), request.getTargetUCD(), request.getTargetId());
|
||||||
request.getTargetUCD(),request.getTargetId());
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
log.error("Unexpected error ", e);
|
log.error("Unexpected error ", e);
|
||||||
|
@ -542,7 +542,8 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
|
||||||
* @throws RemoteException the remote exception
|
* @throws RemoteException the remote exception
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Iterator<RelationshipNavigationObject> getRelationshipChain(String id, String relationId) throws RemoteException {
|
public Iterator<RelationshipNavigationObject> getRelationshipChain(String id, String relationId)
|
||||||
|
throws RemoteException {
|
||||||
return getRelationshipChain(id, relationId, null);
|
return getRelationshipChain(id, relationId, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,21 +557,21 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
|
||||||
* @throws RemoteException the remote exception
|
* @throws RemoteException the remote exception
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Iterator<RelationshipNavigationObject> getRelationshipChain(String id, String relationId, Boolean deep) throws RemoteException {
|
public Iterator<RelationshipNavigationObject> getRelationshipChain(String id, String relationId, Boolean deep)
|
||||||
|
throws RemoteException {
|
||||||
try {
|
try {
|
||||||
log.debug("Get relationship chain ID {} for {} [useCaseDescriptor {} , class {}]",
|
log.debug("Get relationship chain ID {} for {} [useCaseDescriptor {} , class {}]", relationId, id,
|
||||||
relationId, id, profileID,getManagedClass());
|
profileID, getManagedClass());
|
||||||
Call<WebTarget, Iterator<RelationshipNavigationObject>> call = endpoint -> {
|
Call<WebTarget, Iterator<RelationshipNavigationObject>> call = endpoint -> {
|
||||||
|
|
||||||
WebTarget target = endpoint.path(profileID).
|
WebTarget target = endpoint.path(profileID).path(InterfaceConstants.Methods.RELATIONSHIP).path(id)
|
||||||
path(InterfaceConstants.Methods.RELATIONSHIP).
|
.path(relationId);
|
||||||
path(id).
|
|
||||||
path(relationId);
|
|
||||||
|
|
||||||
if(deep!=null) target = target.queryParam(InterfaceConstants.Parameters.DEEP,deep);
|
if (deep != null)
|
||||||
|
target = target.queryParam(InterfaceConstants.Parameters.DEEP, deep);
|
||||||
|
|
||||||
String jsonChain = ResponseCommons.check(target.request(MediaType.APPLICATION_JSON).
|
String jsonChain = ResponseCommons.check(target.request(MediaType.APPLICATION_JSON).get(),
|
||||||
get(),String.class);
|
String.class);
|
||||||
|
|
||||||
return Serialization.readCollection(jsonChain, RelationshipNavigationObject.class);
|
return Serialization.readCollection(jsonChain, RelationshipNavigationObject.class);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue