Search in sources :

Example 21 with PaaSNodeTemplate

use of alien4cloud.paas.model.PaaSNodeTemplate in project yorc-a4c-plugin by ystia.

the class MappingTosca method quoteProperties.

public static void quoteProperties(final PaaSTopologyDeploymentContext ctx) {
    PaaSTopology ptopo = ctx.getPaaSTopology();
    for (PaaSNodeTemplate node : ptopo.getAllNodes().values()) {
        NodeTemplate nt = node.getTemplate();
        Map<String, AbstractPropertyValue> ntProperties = nt.getProperties();
        for (String prop : ntProperties.keySet()) {
            AbstractPropertyValue absval = ntProperties.get(prop);
            if (absval instanceof ScalarPropertyValue) {
                ScalarPropertyValue scaval = (ScalarPropertyValue) absval;
                if (scaval.getValue().contains("\"")) {
                    scaval.setValue(scaval.getValue().replace("\"", "\\\""));
                }
                log.debug("Property: " + prop + "=" + ((ScalarPropertyValue) nt.getProperties().get(prop)).getValue());
            }
        }
    }
}
Also used : PaaSTopology(alien4cloud.paas.model.PaaSTopology) PaaSNodeTemplate(alien4cloud.paas.model.PaaSNodeTemplate) NodeTemplate(org.alien4cloud.tosca.model.templates.NodeTemplate) PaaSNodeTemplate(alien4cloud.paas.model.PaaSNodeTemplate) ScalarPropertyValue(org.alien4cloud.tosca.model.definitions.ScalarPropertyValue) AbstractPropertyValue(org.alien4cloud.tosca.model.definitions.AbstractPropertyValue)

Aggregations

PaaSNodeTemplate (alien4cloud.paas.model.PaaSNodeTemplate)21 PaaSRelationshipTemplate (alien4cloud.paas.model.PaaSRelationshipTemplate)7 Test (org.junit.Test)7 AbstractToscaParserSimpleProfileTest (alien4cloud.tosca.parser.AbstractToscaParserSimpleProfileTest)5 NodeTemplate (org.alien4cloud.tosca.model.templates.NodeTemplate)5 PaaSTopology (alien4cloud.paas.model.PaaSTopology)4 Capability (org.alien4cloud.tosca.model.templates.Capability)3 DeploymentTopology (alien4cloud.model.deployment.DeploymentTopology)2 NodeGroup (org.alien4cloud.tosca.model.templates.NodeGroup)2 RelationshipTemplate (org.alien4cloud.tosca.model.templates.RelationshipTemplate)2 Location (alien4cloud.model.orchestrators.locations.Location)1 ParsingException (alien4cloud.tosca.parser.ParsingException)1 Closeable (java.io.Closeable)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1