Skip to content

Commit

Permalink
Fix for #5
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesrwelch committed Apr 19, 2023
1 parent 5d33a34 commit 6a59aa0
Showing 1 changed file with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class XmiVisualParadigmDataModelImporterProviderService extends DataModelImporte
Map<String, DataType> dataTypes = [:]

DataModel dataModel = new DataModel()
dataModel.label = umlModel.'@name'
dataModel.label = unescape(umlModel.'@name')
dataModel.createdBy = currentUser.emailAddress

Map<String, DataClass> dataClassesById = [:]
Expand All @@ -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

Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -324,5 +324,10 @@ class XmiVisualParadigmDataModelImporterProviderService extends DataModelImporte
}
}

static String unescape(def input) {
String inputStr = input.toString()
inputStr.replace('%20', ' ')
}


}

0 comments on commit 6a59aa0

Please sign in to comment.