Comply with the new gxRest package organization.

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/resource-management/resource-manager@163181 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Manuele Simi 2018-02-12 05:00:49 +00:00
parent 78919bce5a
commit 58e3ef8a37
8 changed files with 20 additions and 21 deletions

View File

@ -1,6 +1,6 @@
package org.gcube.resourcemanagement.manager.io.rs; package org.gcube.resourcemanagement.manager.io.rs;
import org.gcube.common.gxrest.response.error.ErrorCode; import org.gcube.common.gxrest.response.outbound.ErrorCode;
/** /**
* Error codes returned by the create method of the context resource. * Error codes returned by the create method of the context resource.

View File

@ -1,6 +1,6 @@
package org.gcube.resourcemanagement.manager.io.rs; package org.gcube.resourcemanagement.manager.io.rs;
import org.gcube.common.gxrest.response.error.ErrorCode; import org.gcube.common.gxrest.response.outbound.ErrorCode;
/** /**
* Error codes returned by the delete method of the context resource. * Error codes returned by the delete method of the context resource.

View File

@ -2,7 +2,7 @@ package org.gcube.resourcemanagement.manager.webapp.context;
import java.util.Objects; import java.util.Objects;
import org.gcube.common.gxrest.response.error.LocalCodeException; import org.gcube.common.gxrest.response.outbound.LocalCodeException;
import org.gcube.informationsystem.model.entity.Context; import org.gcube.informationsystem.model.entity.Context;
import org.gcube.informationsystem.model.relation.IsParentOf; import org.gcube.informationsystem.model.relation.IsParentOf;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;

View File

@ -3,8 +3,8 @@ package org.gcube.resourcemanagement.manager.webapp.context;
import java.util.Objects; import java.util.Objects;
import java.util.UUID; import java.util.UUID;
import org.gcube.common.gxrest.response.outbound.LocalCodeException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.common.gxrest.response.error.LocalCodeException;
import org.gcube.resourcemanagement.manager.io.rs.RMDeleteContextCode; import org.gcube.resourcemanagement.manager.io.rs.RMDeleteContextCode;
/** /**

View File

@ -2,10 +2,10 @@ package org.gcube.resourcemanagement.manager.webapp.context;
import java.util.Objects; import java.util.Objects;
import org.gcube.common.gxrest.response.outbound.LocalCodeException;
import org.gcube.informationsystem.resourceregistry.context.ResourceRegistryContextClient; import org.gcube.informationsystem.resourceregistry.context.ResourceRegistryContextClient;
import org.gcube.informationsystem.resourceregistry.context.ResourceRegistryContextClientFactory; import org.gcube.informationsystem.resourceregistry.context.ResourceRegistryContextClientFactory;
import org.gcube.informationsystem.resourceregistry.context.ResourceRegistryContextClientImpl; import org.gcube.informationsystem.resourceregistry.context.ResourceRegistryContextClientImpl;
import org.gcube.common.gxrest.response.error.LocalCodeException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View File

@ -2,7 +2,7 @@ package org.gcube.resourcemanagement.manager.webapp.context;
import java.util.Optional; import java.util.Optional;
import org.gcube.common.gxrest.response.error.ErrorCode; import org.gcube.common.gxrest.response.outbound.ErrorCode;
/** /**

View File

@ -9,13 +9,10 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import org.gcube.common.authorization.library.provider.CalledMethodProvider; import org.gcube.common.authorization.library.provider.CalledMethodProvider;
import org.gcube.common.gxrest.response.error.GXErrorOutboundResponse; import org.gcube.common.gxrest.response.outbound.GXOutboundErrorResponse;
import org.gcube.common.gxrest.response.success.GXOutboundSuccessResponse; import org.gcube.common.gxrest.response.outbound.GXOutboundSuccessResponse;
import org.gcube.informationsystem.model.entity.Context; import org.gcube.informationsystem.model.entity.Context;
import static org.gcube.resourcemanagement.manager.io.rs.RMContextPath.*; import static org.gcube.resourcemanagement.manager.io.rs.RMContextPath.*;
import java.util.UUID;
import org.gcube.resourcemanagement.manager.webapp.ResourceInitializer; import org.gcube.resourcemanagement.manager.webapp.ResourceInitializer;
import org.gcube.resourcemanagement.manager.webapp.context.CreateRequest; import org.gcube.resourcemanagement.manager.webapp.context.CreateRequest;
import org.gcube.resourcemanagement.manager.webapp.context.DeleteRequest; import org.gcube.resourcemanagement.manager.webapp.context.DeleteRequest;
@ -23,6 +20,8 @@ import org.gcube.resourcemanagement.manager.webapp.context.ResponseFromResourceR
import org.gcube.resourcemanagement.manager.webapp.context.ContextHolder; import org.gcube.resourcemanagement.manager.webapp.context.ContextHolder;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.UUID;
/** /**
* Resource methods for {@link Context}. * Resource methods for {@link Context}.
@ -49,11 +48,11 @@ public class RMContext {
ResponseFromResourceRegistry returned = CreateRequest.fromHolder(holder).forceURL(rrURL).submit(); ResponseFromResourceRegistry returned = CreateRequest.fromHolder(holder).forceURL(rrURL).submit();
if (!returned.wasSuccessful()) { if (!returned.wasSuccessful()) {
if (returned.getException().isPresent()) if (returned.getException().isPresent())
GXErrorOutboundResponse.throwException(returned.getException().get()); GXOutboundErrorResponse.throwException(returned.getException().get());
else if (returned.getErrorCode().isPresent()) else if (returned.getErrorCode().isPresent())
GXErrorOutboundResponse.throwErrorCode(returned.getErrorCode().get()); GXOutboundErrorResponse.throwErrorCode(returned.getErrorCode().get());
else else
GXErrorOutboundResponse.throwException(new Exception("Failed to create the context.")); GXOutboundErrorResponse.throwException(new Exception("Failed to create the context."));
} }
return GXOutboundSuccessResponse.newCREATEResponse(null).withMessage("Context successfully created.") return GXOutboundSuccessResponse.newCREATEResponse(null).withMessage("Context successfully created.")
.ofType(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8).build(); .ofType(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8).build();
@ -74,11 +73,11 @@ public class RMContext {
ResponseFromResourceRegistry returned = DeleteRequest.fromUUID(UUID.fromString(uuid)).forceURL(rrURL).submit(); ResponseFromResourceRegistry returned = DeleteRequest.fromUUID(UUID.fromString(uuid)).forceURL(rrURL).submit();
if (!returned.wasSuccessful()) { if (!returned.wasSuccessful()) {
if (returned.getException().isPresent()) if (returned.getException().isPresent())
GXErrorOutboundResponse.throwException(returned.getException().get()); GXOutboundErrorResponse.throwException(returned.getException().get());
else if (returned.getErrorCode().isPresent()) else if (returned.getErrorCode().isPresent())
GXErrorOutboundResponse.throwErrorCode(returned.getErrorCode().get()); GXOutboundErrorResponse.throwErrorCode(returned.getErrorCode().get());
else else
GXErrorOutboundResponse.throwException(new Exception("Failed to delete the context.")); GXOutboundErrorResponse.throwException(new Exception("Failed to delete the context."));
} }
return GXOutboundSuccessResponse.newOKResponse().withMessage("Context successfully deleted.") return GXOutboundSuccessResponse.newOKResponse().withMessage("Context successfully deleted.")
.ofType(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8).build(); .ofType(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8).build();

View File

@ -18,9 +18,9 @@ import org.gcube.common.authorization.client.Constants;
import org.gcube.common.authorization.client.exceptions.ObjectNotFound; import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
import org.gcube.common.authorization.library.AuthorizationEntry; import org.gcube.common.authorization.library.AuthorizationEntry;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.gxrest.response.error.ErrorCode; import org.gcube.common.gxrest.response.outbound.ErrorCode;
import org.gcube.common.gxrest.response.error.deserialization.ErrorEntityManager; import org.gcube.common.gxrest.response.outbound.deserialization.ErrorEntityManager;
import org.gcube.common.gxrest.response.error.deserialization.SerializableErrorEntity; import org.gcube.common.gxrest.response.outbound.deserialization.SerializableErrorEntity;
import org.gcube.common.scope.api.ScopeProvider; import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.informationsystem.impl.entity.ContextImpl; import org.gcube.informationsystem.impl.entity.ContextImpl;
import org.gcube.informationsystem.impl.utils.ISMapper; import org.gcube.informationsystem.impl.utils.ISMapper;
@ -175,7 +175,7 @@ public class RMContextTest extends JerseyTest {
} }
} else if (response.hasErrorCode()) { } else if (response.hasErrorCode()) {
ErrorCode code = response.getErrorCode(); ErrorCode code = response.getErrorCode();
RMCreateContextCode realCode = org.gcube.common.gxrest.response.error.CodeFinder.findAndConvert(code, RMCreateContextCode.values()); RMCreateContextCode realCode = org.gcube.common.gxrest.response.outbound.CodeFinder.findAndConvert(code, RMCreateContextCode.values());
assertEquals(RMCreateContextCode.CONTEXT_ALREADY_EXISTS, realCode); assertEquals(RMCreateContextCode.CONTEXT_ALREADY_EXISTS, realCode);
} else { } else {
assertTrue("Invalid error response returned.", true); assertTrue("Invalid error response returned.", true);