Fixing Exporter

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/is-exporter-se-plugin@177013 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2019-02-06 11:49:43 +00:00
parent 5e00714c1b
commit 41111b3b74
4 changed files with 79 additions and 88 deletions

View File

@ -48,10 +48,8 @@ public class ISExporterPlugin extends Plugin<ISExporterPluginDeclaration> {
logger.debug("Failure Report are filtered (e.g. Failing UUID are not shown to avoid to produce to much uneeded reports)"); logger.debug("Failure Report are filtered (e.g. Failing UUID are not shown to avoid to produce to much uneeded reports)");
/*
GenericResourceExporter genericResourceExporter = new GenericResourceExporter(filteredReport); GenericResourceExporter genericResourceExporter = new GenericResourceExporter(filteredReport);
genericResourceExporter.export(); genericResourceExporter.export();
*/
ServiceEndpointExporter serviceEndpointExporter = new ServiceEndpointExporter(filteredReport); ServiceEndpointExporter serviceEndpointExporter = new ServiceEndpointExporter(filteredReport);
serviceEndpointExporter.export(); serviceEndpointExporter.export();

View File

@ -22,9 +22,9 @@ import org.gcube.informationsystem.exporter.mapper.exception.UpdateException;
import org.gcube.informationsystem.model.reference.ISConstants; import org.gcube.informationsystem.model.reference.ISConstants;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceAvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient; import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory; import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisher; import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisher;
@ -131,9 +131,9 @@ public abstract class GCoreResourceMapper<GR extends org.gcube.common.resources.
try { try {
update = resourceRegistryClient.exists(rClass, uuid); update = resourceRegistryClient.exists(rClass, uuid);
} catch (NotFoundException e) { } catch (ResourceNotFoundException e) {
update = false; update = false;
} catch (AvailableInAnotherContextException e) { } catch (ResourceAvailableInAnotherContextException e) {
// This code should never be reached because this should be fixed in // This code should never be reached because this should be fixed in
// map function // map function
resourceRegistryPublisher.addResourceToCurrentContext(r); resourceRegistryPublisher.addResourceToCurrentContext(r);

View File

@ -13,8 +13,8 @@ import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.model.reference.relations.IsIdentifiedBy; import org.gcube.informationsystem.model.reference.relations.IsIdentifiedBy;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceAvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException;
import org.gcube.resourcemanagement.model.impl.entities.facets.SimpleFacetImpl; import org.gcube.resourcemanagement.model.impl.entities.facets.SimpleFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.SoftwareFacetImpl; import org.gcube.resourcemanagement.model.impl.entities.facets.SoftwareFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.resources.ConfigurationImpl; import org.gcube.resourcemanagement.model.impl.entities.resources.ConfigurationImpl;
@ -24,12 +24,12 @@ import org.gcube.resourcemanagement.model.reference.entities.resources.Configura
import org.json.JSONObject; import org.json.JSONObject;
import org.json.XML; import org.json.XML;
public class GenericResourceExporter extends GCoreResourceMapper<GenericResource, Configuration> { public class GenericResourceExporter extends GCoreResourceMapper<GenericResource,Configuration> {
public static final String FIXED_VERSION = "1.0.0"; public static final String FIXED_VERSION = "1.0.0";
public static final String FULL_BODY = "FULL_BODY"; public static final String FULL_BODY = "FULL_BODY";
public GenericResourceExporter(Boolean filteredReport){ public GenericResourceExporter(Boolean filteredReport) {
super(GenericResource.class, Configuration.class, filteredReport); super(GenericResource.class, Configuration.class, filteredReport);
} }
@ -45,67 +45,65 @@ public class GenericResourceExporter extends GCoreResourceMapper<GenericResource
try { try {
readFromIS = resourceRegistryClient.exists(rClass, uuid); readFromIS = resourceRegistryClient.exists(rClass, uuid);
}catch (NotFoundException e) { } catch(ResourceNotFoundException e) {
readFromIS = false; readFromIS = false;
} catch (AvailableInAnotherContextException e) { } catch(ResourceAvailableInAnotherContextException e) {
resourceRegistryPublisher.addResourceToCurrentContext(Configuration.NAME, uuid); resourceRegistryPublisher.addResourceToCurrentContext(Configuration.NAME, uuid);
Thread.sleep(100); Thread.sleep(100);
readFromIS = true; readFromIS = true;
} }
if(readFromIS) {
if(readFromIS){
configuration = read(uuid); configuration = read(uuid);
//softwareFacet = (SoftwareFacet) configuration.getIdentificationFacets().get(0); //softwareFacet = (SoftwareFacet) configuration.getIdentificationFacets().get(0);
List<ConsistsOf<? extends Resource, ? extends Facet>> consistsOfs = configuration.getConsistsOf(); List<ConsistsOf<? extends Resource,? extends Facet>> consistsOfs = configuration.getConsistsOf();
for(ConsistsOf<? extends Resource, ? extends Facet> c : consistsOfs){ for(ConsistsOf<? extends Resource,? extends Facet> c : consistsOfs) {
Facet target = c.getTarget(); Facet target = c.getTarget();
if(c instanceof IsIdentifiedBy){ if(c instanceof IsIdentifiedBy) {
if(target instanceof SoftwareFacet) { if(target instanceof SoftwareFacet) {
softwareFacet = (SoftwareFacet) target; softwareFacet = (SoftwareFacet) target;
continue; continue;
} }
} }
if(c instanceof ConsistsOf){ if(c instanceof ConsistsOf) {
if(target instanceof SimpleFacet){ if(target instanceof SimpleFacet) {
simpleFacet = (SimpleFacet) target; simpleFacet = (SimpleFacet) target;
continue; continue;
} }
} }
} }
}else{ } else {
configuration = new ConfigurationImpl(); configuration = new ConfigurationImpl();
Header header = new HeaderImpl(uuid); Header header = new HeaderImpl(uuid);
configuration.setHeader(header); configuration.setHeader(header);
} }
/* ----------------------------------------- */ /* ----------------------------------------- */
if(softwareFacet==null){ if(softwareFacet == null) {
softwareFacet = new SoftwareFacetImpl(); softwareFacet = new SoftwareFacetImpl();
IsIdentifiedBy<Configuration, SoftwareFacet> identifiedBy = IsIdentifiedBy<Configuration,SoftwareFacet> identifiedBy = new IsIdentifiedByImpl<Configuration,SoftwareFacet>(
new IsIdentifiedByImpl<Configuration, SoftwareFacet>(configuration, softwareFacet, null); configuration, softwareFacet, null);
configuration.addFacet(identifiedBy); configuration.addFacet(identifiedBy);
} }
softwareFacet.setGroup(profile.type()); softwareFacet.setGroup(profile.type());
softwareFacet.setName(profile.name()); softwareFacet.setName(profile.name());
softwareFacet.setVersion(FIXED_VERSION); softwareFacet.setVersion(FIXED_VERSION);
String description = profile.description(); String description = profile.description();
if(description!=null && description.compareTo("")!=0){ if(description != null && description.compareTo("") != 0) {
softwareFacet.setDescription(getStringAsUTF8(description)); softwareFacet.setDescription(getStringAsUTF8(description));
} }
/* ----------------------------------------- */ /* ----------------------------------------- */
/* ----------------------------------------- */ /* ----------------------------------------- */
String xmlBody = profile.bodyAsString(); String xmlBody = profile.bodyAsString();
JSONObject jsonBody = XML.toJSONObject(getStringAsUTF8(xmlBody)); JSONObject jsonBody = XML.toJSONObject(getStringAsUTF8(xmlBody));
Map<String, Object> map = jsonBody.toMap(); Map<String,Object> map = jsonBody.toMap();
if(simpleFacet==null){ if(simpleFacet == null) {
simpleFacet = new SimpleFacetImpl(); simpleFacet = new SimpleFacetImpl();
configuration.addFacet(simpleFacet); configuration.addFacet(simpleFacet);
@ -115,13 +113,13 @@ public class GenericResourceExporter extends GCoreResourceMapper<GenericResource
SimpleFacet created = resourceRegistryPublisher.createFacet(testSimpleFacet); SimpleFacet created = resourceRegistryPublisher.createFacet(testSimpleFacet);
resourceRegistryPublisher.deleteFacet(created); resourceRegistryPublisher.deleteFacet(created);
simpleFacet.setAdditionalProperties(map); simpleFacet.setAdditionalProperties(map);
}catch (Exception e) { } catch(Exception e) {
simpleFacet.setAdditionalProperty(FULL_BODY, getStringAsUTF8(xmlBody)); simpleFacet.setAdditionalProperty(FULL_BODY, getStringAsUTF8(xmlBody));
} }
}else{ } else {
if(simpleFacet.getAdditionalProperty(FULL_BODY)!=null){ if(simpleFacet.getAdditionalProperty(FULL_BODY) != null) {
simpleFacet.setAdditionalProperty(FULL_BODY, getStringAsUTF8(xmlBody)); simpleFacet.setAdditionalProperty(FULL_BODY, getStringAsUTF8(xmlBody));
}else{ } else {
simpleFacet.setAdditionalProperties(map); simpleFacet.setAdditionalProperties(map);
} }
} }

View File

@ -21,8 +21,8 @@ import org.gcube.informationsystem.model.reference.properties.Encrypted;
import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.model.reference.relations.IsIdentifiedBy; import org.gcube.informationsystem.model.reference.relations.IsIdentifiedBy;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceAvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException;
import org.gcube.informationsystem.utils.ISMapper; import org.gcube.informationsystem.utils.ISMapper;
import org.gcube.resourcemanagement.model.impl.entities.facets.AccessPointFacetImpl; import org.gcube.resourcemanagement.model.impl.entities.facets.AccessPointFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.NetworkingFacetImpl; import org.gcube.resourcemanagement.model.impl.entities.facets.NetworkingFacetImpl;
@ -40,11 +40,11 @@ import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint, EService> { public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint,EService> {
private static Logger logger = LoggerFactory.getLogger(ServiceEndpointExporter.class); private static Logger logger = LoggerFactory.getLogger(ServiceEndpointExporter.class);
public static final String FIXED_VERSION = "1.0.0"; public static final String FIXED_VERSION = "1.0.0";
public static final String PLATFORM = "PLATFORM"; public static final String PLATFORM = "PLATFORM";
public static final String POSITION = "POSITION"; public static final String POSITION = "POSITION";
@ -56,18 +56,18 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
public static final String NAME = "name"; public static final String NAME = "name";
public static final String VALUE = "value"; public static final String VALUE = "value";
public static final String ARRAY = "ARRAY"; public static final String ARRAY = "ARRAY";
public static final String PROPERTIES = "PROPERTIES"; public static final String PROPERTIES = "PROPERTIES";
public static final String NOT_URI_ENDPOINT = "NOT_URI_ENDPOINT"; public static final String NOT_URI_ENDPOINT = "NOT_URI_ENDPOINT";
public ServiceEndpointExporter(boolean filteredReport){ public ServiceEndpointExporter(boolean filteredReport) {
super(ServiceEndpoint.class, EService.class, filteredReport); super(ServiceEndpoint.class, EService.class, filteredReport);
} }
@Override @Override
protected EService map(ServiceEndpoint gr) throws Exception { protected EService map(ServiceEndpoint gr) throws Exception {
Profile profile = gr.profile(); Profile profile = gr.profile();
UUID uuid = UUID.fromString(gr.id()); UUID uuid = UUID.fromString(gr.id());
boolean readFromIS = false; boolean readFromIS = false;
@ -81,9 +81,9 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
try { try {
readFromIS = resourceRegistryClient.exists(rClass, uuid); readFromIS = resourceRegistryClient.exists(rClass, uuid);
}catch (NotFoundException e) { } catch(ResourceNotFoundException e) {
readFromIS = false; readFromIS = false;
}catch (AvailableInAnotherContextException e) { } catch(ResourceAvailableInAnotherContextException e) {
resourceRegistryPublisher.addResourceToCurrentContext(EService.NAME, uuid); resourceRegistryPublisher.addResourceToCurrentContext(EService.NAME, uuid);
Thread.sleep(100); Thread.sleep(100);
readFromIS = true; readFromIS = true;
@ -92,66 +92,66 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
Group<AccessPoint> accessPoints = profile.accessPoints(); Group<AccessPoint> accessPoints = profile.accessPoints();
accessPointFacets = new AccessPointFacet[accessPoints.size()]; accessPointFacets = new AccessPointFacet[accessPoints.size()];
if(readFromIS){ if(readFromIS) {
eService = read(uuid); eService = read(uuid);
//softwareFacet = (SoftwareFacet) eService.getIdentificationFacets().get(0); //softwareFacet = (SoftwareFacet) eService.getIdentificationFacets().get(0);
List<ConsistsOf<? extends Resource, ? extends Facet>> consistsOfs = eService.getConsistsOf(); List<ConsistsOf<? extends Resource,? extends Facet>> consistsOfs = eService.getConsistsOf();
for(ConsistsOf<? extends Resource, ? extends Facet> c : consistsOfs){ for(ConsistsOf<? extends Resource,? extends Facet> c : consistsOfs) {
Facet target = c.getTarget(); Facet target = c.getTarget();
if(c instanceof IsIdentifiedBy){ if(c instanceof IsIdentifiedBy) {
if(target instanceof SoftwareFacet) { if(target instanceof SoftwareFacet) {
softwareFacet = (SoftwareFacet) target; softwareFacet = (SoftwareFacet) target;
continue; continue;
} }
} else { } else {
if(target instanceof AccessPointFacet){ if(target instanceof AccessPointFacet) {
try { try {
Object positionObject = c.getAdditionalProperty(POSITION); Object positionObject = c.getAdditionalProperty(POSITION);
Integer position = Integer.valueOf(positionObject.toString()); Integer position = Integer.valueOf(positionObject.toString());
if(position!=null){ if(position != null) {
accessPointFacets[position] = (AccessPointFacet) target; accessPointFacets[position] = (AccessPointFacet) target;
} }
}catch (Exception e) { } catch(Exception e) {
// Position is used on relation to match the AccessPoint on ServiceEndpoint // Position is used on relation to match the AccessPoint on ServiceEndpoint
logger.error("No POSITION found", e); logger.error("No POSITION found", e);
} }
continue; continue;
} }
if(target instanceof SoftwareFacet){ if(target instanceof SoftwareFacet) {
SoftwareFacet targetSoftwareFacet = (SoftwareFacet) target; SoftwareFacet targetSoftwareFacet = (SoftwareFacet) target;
if(targetSoftwareFacet.getGroup().compareTo(PLATFORM)==0){ if(targetSoftwareFacet.getGroup().compareTo(PLATFORM) == 0) {
platformSoftwareFacet = targetSoftwareFacet; platformSoftwareFacet = targetSoftwareFacet;
} }
continue; continue;
} }
if(target instanceof ServiceStateFacet){ if(target instanceof ServiceStateFacet) {
serviceStateFacet = (ServiceStateFacet) target; serviceStateFacet = (ServiceStateFacet) target;
continue; continue;
} }
if(target instanceof NetworkingFacet){ if(target instanceof NetworkingFacet) {
networkingFacet = (NetworkingFacet) target; networkingFacet = (NetworkingFacet) target;
continue; continue;
} }
} }
} }
}else{ } else {
eService = new EServiceImpl(); eService = new EServiceImpl();
Header header = new HeaderImpl(uuid); Header header = new HeaderImpl(uuid);
eService.setHeader(header); eService.setHeader(header);
} }
/* ----------------------------------------- */ /* ----------------------------------------- */
if(softwareFacet==null){ if(softwareFacet == null) {
softwareFacet = new SoftwareFacetImpl(); softwareFacet = new SoftwareFacetImpl();
IsIdentifiedBy<EService, SoftwareFacet> identifiedBy = IsIdentifiedBy<EService,SoftwareFacet> identifiedBy = new IsIdentifiedByImpl<EService,SoftwareFacet>(
new IsIdentifiedByImpl<EService, SoftwareFacet>(eService, softwareFacet, null); eService, softwareFacet, null);
eService.addFacet(identifiedBy); eService.addFacet(identifiedBy);
} }
@ -159,78 +159,75 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
softwareFacet.setName(profile.name()); softwareFacet.setName(profile.name());
softwareFacet.setVersion(FIXED_VERSION); softwareFacet.setVersion(FIXED_VERSION);
String description = profile.description(); String description = profile.description();
if(description!=null && description.compareTo("")!=0){ if(description != null && description.compareTo("") != 0) {
softwareFacet.setDescription(getStringAsUTF8(description)); softwareFacet.setDescription(getStringAsUTF8(description));
} }
/* ----------------------------------------- */ /* ----------------------------------------- */
/* ----------------------------------------- */ /* ----------------------------------------- */
Platform platform = profile.platform(); Platform platform = profile.platform();
if(platformSoftwareFacet==null){ if(platformSoftwareFacet == null) {
platformSoftwareFacet = new SoftwareFacetImpl(); platformSoftwareFacet = new SoftwareFacetImpl();
eService.addFacet(platformSoftwareFacet); eService.addFacet(platformSoftwareFacet);
} }
platformSoftwareFacet.setGroup(PLATFORM); platformSoftwareFacet.setGroup(PLATFORM);
platformSoftwareFacet.setName(platform.name()); platformSoftwareFacet.setName(platform.name());
String platformVersion = String.format("%d.%d.%d-%d", String platformVersion = String.format("%d.%d.%d-%d", platform.version(), platform.minorVersion(),
platform.version(), platform.minorVersion(),
platform.revisionVersion(), platform.buildVersion()); platform.revisionVersion(), platform.buildVersion());
softwareFacet.setVersion(platformVersion); softwareFacet.setVersion(platformVersion);
/* ----------------------------------------- */ /* ----------------------------------------- */
/* ----------------------------------------- */ /* ----------------------------------------- */
Runtime runTime = profile.runtime(); Runtime runTime = profile.runtime();
if(serviceStateFacet==null){ if(serviceStateFacet == null) {
serviceStateFacet = new ServiceStateFacetImpl(); serviceStateFacet = new ServiceStateFacetImpl();
eService.addFacet(serviceStateFacet); eService.addFacet(serviceStateFacet);
} }
serviceStateFacet.setValue(runTime.status()); serviceStateFacet.setValue(runTime.status());
if(networkingFacet==null){ if(networkingFacet == null) {
networkingFacet = new NetworkingFacetImpl(); networkingFacet = new NetworkingFacetImpl();
eService.addFacet(networkingFacet); eService.addFacet(networkingFacet);
} }
networkingFacet.setHostName(runTime.hostedOn()); networkingFacet.setHostName(runTime.hostedOn());
String ghnID = runTime.ghnId(); String ghnID = runTime.ghnId();
if(ghnID!=null && ghnID.compareTo("")!=0){ if(ghnID != null && ghnID.compareTo("") != 0) {
networkingFacet.setAdditionalProperty(GHN_ID, ghnID); networkingFacet.setAdditionalProperty(GHN_ID, ghnID);
} }
/* ----------------------------------------- */ /* ----------------------------------------- */
/* ----------------------------------------- */ /* ----------------------------------------- */
int i=0; int i = 0;
for(AccessPoint accessPoint : accessPoints){ for(AccessPoint accessPoint : accessPoints) {
if(accessPointFacets[i] == null){ if(accessPointFacets[i] == null) {
accessPointFacets[i] = new AccessPointFacetImpl(); accessPointFacets[i] = new AccessPointFacetImpl();
ConsistsOf<EService, AccessPointFacet> consistsOf = new ConsistsOfImpl<EService, AccessPointFacet>(eService, accessPointFacets[i], null); ConsistsOf<EService,AccessPointFacet> consistsOf = new ConsistsOfImpl<EService,AccessPointFacet>(
eService, accessPointFacets[i], null);
consistsOf.setAdditionalProperty(POSITION, i); consistsOf.setAdditionalProperty(POSITION, i);
eService.addFacet(consistsOf); eService.addFacet(consistsOf);
} }
accessPointFacets[i].setEntryName(accessPoint.name()); accessPointFacets[i].setEntryName(accessPoint.name());
String address = accessPoint.address(); String address = accessPoint.address();
if(address!=null && address.compareTo("")!=0){ if(address != null && address.compareTo("") != 0) {
try { try {
URI uri = URI.create(address); URI uri = URI.create(address);
accessPointFacets[i].setEndpoint(uri); accessPointFacets[i].setEndpoint(uri);
}catch (IllegalArgumentException e) { } catch(IllegalArgumentException e) {
accessPointFacets[i].setAdditionalProperty(NOT_URI_ENDPOINT, address); accessPointFacets[i].setAdditionalProperty(NOT_URI_ENDPOINT, address);
} }
} }
String accessPointDescription = accessPoint.description(); String accessPointDescription = accessPoint.description();
if(accessPointDescription!=null && accessPointDescription.compareTo("")!=0){ if(accessPointDescription != null && accessPointDescription.compareTo("") != 0) {
accessPointFacets[i].setDescription(getStringAsUTF8(accessPointDescription)); accessPointFacets[i].setDescription(getStringAsUTF8(accessPointDescription));
} }
/* Managing Username and Password */ /* Managing Username and Password */
try { try {
String username = accessPoint.username(); String username = accessPoint.username();
String passwordString = accessPoint.password(); String passwordString = accessPoint.password();
@ -238,15 +235,14 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
password.setEncryptedValue(passwordString); password.setEncryptedValue(passwordString);
accessPointFacets[i].setAdditionalProperty(USERNAME, username); accessPointFacets[i].setAdditionalProperty(USERNAME, username);
accessPointFacets[i].setAdditionalProperty(PASSWORD, password); accessPointFacets[i].setAdditionalProperty(PASSWORD, password);
}catch (NullPointerException e) { } catch(NullPointerException e) {
} }
/* END Managing Username and Password */ /* END Managing Username and Password */
/* Managing AccessPoint Properties */ /* Managing AccessPoint Properties */
Group<Property> properties = accessPoint.properties(); Group<Property> properties = accessPoint.properties();
if(properties!=null && properties.size()>0){ if(properties != null && properties.size() > 0) {
ObjectNode propertiesObjectNode = ISMapper.getObjectMapper().createObjectNode(); ObjectNode propertiesObjectNode = ISMapper.getObjectMapper().createObjectNode();
/* /*
* List/Set support is currently disabled due to OrientDB bug see https://github.com/orientechnologies/orientdb/issues/7354 * List/Set support is currently disabled due to OrientDB bug see https://github.com/orientechnologies/orientdb/issues/7354
@ -254,7 +250,7 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
// This is a workaround // This is a workaround
ArrayNode arrayNode = propertiesObjectNode.putArray(ARRAY); ArrayNode arrayNode = propertiesObjectNode.putArray(ARRAY);
for(Property property : properties){ for(Property property : properties) {
ObjectNode objectNode = ISMapper.getObjectMapper().createObjectNode(); ObjectNode objectNode = ISMapper.getObjectMapper().createObjectNode();
objectNode.put(NAME, property.name()); objectNode.put(NAME, property.name());
boolean encryptedValue = property.isEncrypted(); boolean encryptedValue = property.isEncrypted();
@ -262,7 +258,7 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
Encrypted encrypted = new EncryptedImpl(); Encrypted encrypted = new EncryptedImpl();
encrypted.setEncryptedValue(property.value()); encrypted.setEncryptedValue(property.value());
objectNode.put(VALUE, encryptedValue); objectNode.put(VALUE, encryptedValue);
}else { } else {
objectNode.put(VALUE, property.value()); objectNode.put(VALUE, property.value());
} }
@ -277,8 +273,7 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
} }
/* ----------------------------------------- */ /* ----------------------------------------- */
return eService;
return eService;
} }
} }