Refs #11905: Use new REST interface in Resource Registry Context Client
Task-Url: https://support.d4science.org/issues/11905 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry-context-client@169017 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e6de5590a4
commit
e207e51eb5
|
@ -60,29 +60,18 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex
|
|||
@Override
|
||||
public String create(String context) throws ContextAlreadyPresentException, ResourceRegistryException {
|
||||
try {
|
||||
logger.trace("Going to create: {}", context);
|
||||
logger.trace("Going to create {}", context);
|
||||
|
||||
String uuid = null;
|
||||
try {
|
||||
uuid = Utility.getUUIDStringFromJsonString(context);
|
||||
}catch (Exception e) {
|
||||
// Creating a context without proving an UUID. This is feasible
|
||||
}
|
||||
String uuid = Utility.getUUIDStringFromJsonString(context);
|
||||
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
stringWriter.append(PATH_SEPARATOR);
|
||||
stringWriter.append(ContextPath.CONTEXTS_PATH_PART);
|
||||
stringWriter.append(PATH_SEPARATOR);
|
||||
stringWriter.append(uuid);
|
||||
|
||||
HTTPCall httpCall = getHTTPCall();
|
||||
String c = null;
|
||||
|
||||
if(uuid==null) {
|
||||
c = httpCall.call(String.class, stringWriter.toString(), HTTPMETHOD.POST, context);
|
||||
}else {
|
||||
stringWriter.append(PATH_SEPARATOR);
|
||||
stringWriter.append(uuid);
|
||||
c = httpCall.call(String.class, stringWriter.toString(), HTTPMETHOD.PUT, context);
|
||||
}
|
||||
String c = httpCall.call(String.class, stringWriter.toString(), HTTPMETHOD.PUT, context);
|
||||
|
||||
logger.trace("{} successfully created", c);
|
||||
return c;
|
||||
|
@ -119,7 +108,7 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex
|
|||
@Override
|
||||
public String read(String uuid) throws ContextNotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
logger.trace("Going to read {} with UUID {}", Context.NAME);
|
||||
logger.trace("Going to read {} with UUID {}", Context.NAME, uuid);
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
stringWriter.append(PATH_SEPARATOR);
|
||||
stringWriter.append(ContextPath.CONTEXTS_PATH_PART);
|
||||
|
@ -159,7 +148,7 @@ public class ResourceRegistryContextClientImpl implements ResourceRegistryContex
|
|||
@Override
|
||||
public String update(String context) throws ResourceRegistryException {
|
||||
try {
|
||||
logger.trace("Going to update: {}", context);
|
||||
logger.trace("Going to update {}", context);
|
||||
|
||||
String uuid = Utility.getUUIDStringFromJsonString(context);
|
||||
|
||||
|
|
Loading…
Reference in New Issue