Skip to content

Commit

Permalink
Enhancements to FC, SQL and XSD targets, input loading
Browse files Browse the repository at this point in the history
FeatureCatalogue target:
- add an option to prevent inclusion of inherited constraints (closes
#172)
- add a logo (closes #173)
- add custom style for docx formatted FC (closes #178)

SQL DDL target - replication schema:
- add geometry annotation (closes #174)

XML Schema target:
- support mapping of UML properties to XML elements (closes #176)

TypeConverter transformation:
- dissolve association: define new type by tagged value (closes #175)

Input loading:
- addTaggedValues: '*' loads all tagged values (closes #177)
  • Loading branch information
jechterhoff committed Dec 10, 2018
1 parent fa67a29 commit ba01528
Show file tree
Hide file tree
Showing 106 changed files with 12,854 additions and 5,722 deletions.
Expand Up @@ -47,8 +47,8 @@
import de.interactive_instruments.ShapeChange.Target.TargetOutputProcessor;

/**
* @author Johannes Echterhoff (echterhoff <at> interactive-instruments
* <dot> de)
* @author Johannes Echterhoff (echterhoff <at> interactive-instruments <dot>
* de)
*
*/
public class BasicConfigurationValidator implements MessageSource {
Expand Down Expand Up @@ -198,6 +198,34 @@ public boolean isValid(Options options, ShapeChangeResult result) {
isValid = false;
}
}

for (XsdPropertyMapEntry xpme : xsdConf
.getXsdPropertyMapEntries().values()) {

/*
* Ensure that the targetElement contains a QName like
* string.
*/
if (xpme.hasTargetElement()) {

String targetElement = xpme.getTargetElement();

if (StringUtils.countMatches(targetElement, ":") != 1) {

result.addError(this, 301, xpme.toString());
isValid = false;

} else {

String nsabr = targetElement.split(":")[0];
if (options.fullNamespace(nsabr) == null) {
result.addError(this, 302, xpme.toString(),
nsabr);
isValid = false;
}
}
}
}
}
}

Expand Down Expand Up @@ -237,10 +265,13 @@ public String message(int mnr) {
case 201:
return "Source for descriptor '$1$' is 'tag', but required tag is not provided.";

// 300-399: Validation of XsdMapEntries
// 300-399: Validation of XsdMapEntries and XsdPropertyMapEntries
case 300:
return "XsdMapEntry with @type '$1$' and @xsdEncodingRule '$2$' is invalid because @xmlElementHasSimpleContent is set but @xmlElement has no value.";

case 301:
return "XsdPropertyMapEntry '$1$' is invalid because the @targetElement is not a QName like string.";
case 302:
return "XsdPropertyMapEntry '$1$' is invalid because the configuration does not contain a namespace definition with the namespace prefix '$2$', which is used by the @targetElement.";
default:
return "(" + BasicConfigurationValidator.class.getName()
+ ") Unknown message with number: " + mnr;
Expand Down
Expand Up @@ -220,4 +220,17 @@ public void initialise(ShapeChangeResult r, Options o,
* <code>null</code> if no such property was found
*/
public PropertyInfo propertyByFullNameInSchema(String fullNameInSchema);

/**
* Create a {@link Type} that can be used as value type of a
* {@link PropertyInfo}.
*
* @param typeName
* Name of a class
* @return a {@link Type} with the given name, and id as defined for a class
* with that name, if it exists in the model, otherwise the id is
* set to 'UNKNOWN'
*/
public Type typeByName(String typeName);

}
Expand Up @@ -38,14 +38,13 @@
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;

import de.interactive_instruments.ShapeChange.Options;
import de.interactive_instruments.ShapeChange.ShapeChangeAbortException;
import de.interactive_instruments.ShapeChange.ShapeChangeResult;
import de.interactive_instruments.ShapeChange.Type;
import de.interactive_instruments.ShapeChange.ShapeChangeResult.MessageContext;
import de.interactive_instruments.ShapeChange.Type;
import de.interactive_instruments.ShapeChange.FOL.FolExpression;
import de.interactive_instruments.ShapeChange.Model.Generic.GenericClassInfo;
import de.interactive_instruments.ShapeChange.Model.Generic.GenericPropertyInfo;
import de.interactive_instruments.ShapeChange.SBVR.Sbvr2FolParser;
import de.interactive_instruments.ShapeChange.SBVR.SbvrConstants;
import de.interactive_instruments.ShapeChange.SBVR.SbvrRuleLoader;
Expand Down Expand Up @@ -127,7 +126,8 @@ public abstract class ModelImpl implements Model {
"codeListSource", "codeListSourceCharset",
"codeListSourceRepresentation", "codeListRestriction",
"arcgisDefaultSubtype", "arcgisSubtypeCode", "arcgisUsedBySubtypes",
"arcgisSubtypeInitialValues", "codeListXML", "reportable" };
"arcgisSubtypeInitialValues", "codeListXML", "reportable",
"dissolveAssociationAttributeType" };

/*
* temporary storage for validating the names of the XML Schema documents to
Expand Down Expand Up @@ -501,9 +501,6 @@ public String normalizeTaggedValue(String tag) {
// Now check tag aliases provided in the configuration
tag = options().normalizeTag(tag);

// So, if it's one of these just return the argument ...
if (allowedTags.contains(tag))
return tag;
// Now allow for some deprecated stuff
if (tag.equals("xmlNamespace"))
return "targetNamespace";
Expand All @@ -516,7 +513,8 @@ public String normalizeTaggedValue(String tag) {
if (tag.equals("implementedByNilReason"))
return "gmlImplementedByNilReason";

// TBD: add input parameter to allow any tag
if (options().allowAllTags() || allowedTags.contains(tag))
return tag;

// None of these, return null
return null;
Expand Down Expand Up @@ -651,4 +649,19 @@ public ClassInfo classByIdOrName(Type typeInfo) {
return result;
}
}

@Override
public Type typeByName(String typeName) {

ClassInfo ci = this.classByName(typeName);
Type typeInfo = new Type();
typeInfo.name = typeName;
if (ci != null) {
typeInfo.id = ci.id();
} else {
typeInfo.id = "UNKNOWN";
}

return typeInfo;
}
}

0 comments on commit ba01528

Please sign in to comment.