use of org.eclipse.winery.model.ids.definitions.ArtifactTemplateId in project winery by eclipse.
the class DriverInjection method setDriverProperty.
public static void setDriverProperty(TRelationshipTemplate relationshipTemplate, TDeploymentArtifact driverDeploymentArtifact) throws Exception {
QName DAArtifactTemplateQName = driverDeploymentArtifact.getArtifactRef();
ArtifactTemplateId artifactTemplateId = new ArtifactTemplateId(DAArtifactTemplateQName);
TArtifactTemplate artifactTemplate = RepositoryFactory.getRepository().getElement(artifactTemplateId);
Map<String, String> artifactProperties = ModelUtilities.getPropertiesKV(artifactTemplate);
LinkedHashMap<String, String> relationshipProperties = ModelUtilities.getPropertiesKV(relationshipTemplate);
if ((artifactProperties != null) && (relationshipProperties != null) && artifactProperties.containsKey("Driver") && relationshipProperties.containsKey("Driver")) {
relationshipProperties.put("Driver", artifactProperties.get("Driver"));
ModelUtilities.setPropertiesKV(relationshipTemplate, relationshipProperties);
} else {
throw new WineryRepositoryException("No Property found to set to the driver classname");
}
}
Aggregations