diff --git a/grails-app/services/uk/ac/ox/softeng/maurodatamapper/plugins/xmi/visualparadigm/XmiVisualParadigmDataModelImporterProviderService.groovy b/grails-app/services/uk/ac/ox/softeng/maurodatamapper/plugins/xmi/visualparadigm/XmiVisualParadigmDataModelImporterProviderService.groovy index f7ae84d..aa27d28 100644 --- a/grails-app/services/uk/ac/ox/softeng/maurodatamapper/plugins/xmi/visualparadigm/XmiVisualParadigmDataModelImporterProviderService.groovy +++ b/grails-app/services/uk/ac/ox/softeng/maurodatamapper/plugins/xmi/visualparadigm/XmiVisualParadigmDataModelImporterProviderService.groovy @@ -90,7 +90,7 @@ class XmiVisualParadigmDataModelImporterProviderService extends DataModelImporte Map dataTypes = [:] DataModel dataModel = new DataModel() - dataModel.label = umlModel.'@name' + dataModel.label = unescape(umlModel.'@name') dataModel.createdBy = currentUser.emailAddress Map dataClassesById = [:] @@ -109,7 +109,7 @@ class XmiVisualParadigmDataModelImporterProviderService extends DataModelImporte String umlClassName = umlClass.'@name' if(umlClassName && umlClassName != "" && !dataClassesByName[umlClassName]) { DataClass dataClass = new DataClass() - dataClass.label = umlClassName + dataClass.label = unescape(umlClassName) dataClass.description = getCommentForDescription(umlClass) dataClass.createdBy = currentUser.emailAddress @@ -144,7 +144,7 @@ class XmiVisualParadigmDataModelImporterProviderService extends DataModelImporte log.error("Element with no name (classId: umlClassId") } else if(!dataClass.dataElements.find {it.label.equalsIgnoreCase(attribute.@name.toString())}) { DataElement dataElement = new DataElement() - dataElement.label = attribute.@name + dataElement.label = unescape(attribute.@name) dataElement.description = getCommentForDescription(attribute) dataElement.createdBy = currentUser.emailAddress String dataTypeName = attribute.'@type' @@ -211,19 +211,19 @@ class XmiVisualParadigmDataModelImporterProviderService extends DataModelImporte DataType sourceAttributeType = dataTypes[sourceAttributeTypeName] if(!sourceAttributeType) { sourceAttributeType = new ReferenceType() - sourceAttributeType.label = sourceAttributeTypeName + sourceAttributeType.label = unescape(sourceAttributeTypeName) sourceAttributeType.referenceClass = targetClass sourceAttributeType.createdBy = currentUser.emailAddress dataModel.addToDataTypes(sourceAttributeType) dataTypes[sourceAttributeTypeName] = sourceAttributeType } DataElement sourceAttribute = new DataElement() - sourceAttribute.label = umlAssociation.'@name'.toString().trim() + sourceAttribute.label = unescape(umlAssociation.'@name'.toString().trim()) if(!sourceAttribute.label || sourceAttribute.label == "") { - sourceAttribute.label = targetClass.label + sourceAttribute.label = unescape(targetClass.label) } if(sourceClass.dataElements.find { it.label == sourceAttribute.label}) { - sourceAttribute.label = sourceAttribute.label + " " + targetClass.label + sourceAttribute.label = unescape(sourceAttribute.label + " " + targetClass.label) } sourceAttribute.dataType = sourceAttributeType sourceAttribute.description = getCommentForDescription(umlAssociation) @@ -247,19 +247,19 @@ class XmiVisualParadigmDataModelImporterProviderService extends DataModelImporte DataType targetAttributeType = dataTypes[targetAttributeTypeName] if(!targetAttributeType) { targetAttributeType = new ReferenceType() - targetAttributeType.label = targetAttributeTypeName + targetAttributeType.label = unescape(targetAttributeTypeName) targetAttributeType.referenceClass = sourceClass targetAttributeType.createdBy = currentUser.emailAddress dataModel.addToDataTypes(targetAttributeType) dataTypes[targetAttributeTypeName] = targetAttributeType } DataElement targetAttribute = new DataElement() - targetAttribute.label = umlAssociation.'@name'.toString().trim() + targetAttribute.label = unescape(umlAssociation.'@name'.toString().trim()) if(!targetAttribute.label || targetAttribute.label == "") { - targetAttribute.label = sourceClass.label + targetAttribute.label = unescape(sourceClass.label) } if(targetClass.dataElements.find { it.label == targetAttribute.label}) { - targetAttribute.label = targetAttribute.label + " " + sourceClass.label + targetAttribute.label = unescape(targetAttribute.label + " " + sourceClass.label) } targetAttribute.dataType = targetAttributeType targetAttribute.description = getCommentForDescription(umlAssociation) @@ -324,5 +324,10 @@ class XmiVisualParadigmDataModelImporterProviderService extends DataModelImporte } } + static String unescape(def input) { + String inputStr = input.toString() + inputStr.replace('%20', ' ') + } + }