Fixed Header Issue

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@134322 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2016-11-17 13:50:37 +00:00
parent afc66c822e
commit fb98a6e857
3 changed files with 73 additions and 4 deletions

View File

@ -36,6 +36,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.Schema
import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper;
import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper.PermissionMode;
import org.gcube.informationsystem.resourceregistry.resources.utils.ContextUtility;
import org.gcube.informationsystem.resourceregistry.resources.utils.HeaderOrient;
import org.gcube.informationsystem.resourceregistry.resources.utils.HeaderUtility;
import org.gcube.informationsystem.resourceregistry.resources.utils.Utility;
import org.slf4j.Logger;
@ -128,12 +129,17 @@ public class EntityManagementImpl implements EntityManagement {
private static Header getHeader(JsonNode jsonNode)
throws JsonParseException, JsonMappingException, IOException {
if (jsonNode.has(Resource.HEADER_PROPERTY)) {
JsonNode header = jsonNode.get(Resource.HEADER_PROPERTY);
if (header.isNull()) {
JsonNode headerNode = jsonNode.get(Resource.HEADER_PROPERTY);
if (headerNode.isNull()) {
return null;
}
/*
ObjectMapper mapper = new ObjectMapper();
return mapper.readValue(header.toString(), Header.class);
Header header = mapper.readValue(headerNode.toString(), Header.class);
*/
HeaderOrient headerOrient = new HeaderOrient();
headerOrient.fromJSON(headerNode.toString());
return headerOrient;
}
return null;
}

View File

@ -213,7 +213,7 @@ public class ContextManagementImplTest {
logger.debug("The DB should be now clean");
}
//@Test
@Test
public void createDevContext() throws ContextNotFoundException,
ContextException, InternalException, JsonParseException,
JsonMappingException, IOException {

File diff suppressed because one or more lines are too long