X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.xml.sax%2Fsrc%2Forg%2Fsimantics%2Fxml%2Fsax%2FImporterGenerator.java;fp=org.simantics.xml.sax%2Fsrc%2Forg%2Fsimantics%2Fxml%2Fsax%2FImporterGenerator.java;h=58f5748e05e1d4bef1f9af01611c02bcc6dc3128;hb=fc60d91049c46ee5b6107da4d4c54eada4a9f21c;hp=3e02434e797481d721e9e1f5ac0a0290f5a8e322;hpb=ab4fc05981803ce2c430f93f34b8b6a8f85a53ce;p=simantics%2Finterop.git diff --git a/org.simantics.xml.sax/src/org/simantics/xml/sax/ImporterGenerator.java b/org.simantics.xml.sax/src/org/simantics/xml/sax/ImporterGenerator.java index 3e02434..58f5748 100644 --- a/org.simantics.xml.sax/src/org/simantics/xml/sax/ImporterGenerator.java +++ b/org.simantics.xml.sax/src/org/simantics/xml/sax/ImporterGenerator.java @@ -39,10 +39,9 @@ public class ImporterGenerator extends JavaGenerator{ public void createParser() throws IOException { - String parserPackagePostfix = "_elem"; String importerClassPostfix = "Importer"; String parserClassPostfix = "Parser"; - elementPackageName = name+parserPackagePostfix; + importParserDir= new File(converter.getParserDir().getAbsolutePath()+"/"+elementPackageName); if (!importParserDir.exists()) @@ -93,6 +92,11 @@ public class ImporterGenerator extends JavaGenerator{ mainWriter.close(); } + @Override + protected String getPackagePostFix() { + return "_elem"; + } + @Override public void handleSimpleType(SchemaObject parent, SchemaObject simpleTypeObj) { } @@ -231,6 +235,8 @@ public class ImporterGenerator extends JavaGenerator{ @Override public void createReferenceIndicator(SchemaObject parent, RefType referenceType, String refName, String objectName, String primaryClassName, String secondaryClassName, boolean useElementList, boolean useOriginalList) { + if (refName == null) + System.out.println(); FileWriter fw = getWriter(parent); if (referenceType == RefType.Type) { // create internal class for handling the element and child attachment @@ -311,6 +317,8 @@ public class ImporterGenerator extends JavaGenerator{ @Override protected void createElementIndicator(SchemaObject parent, boolean useElementList, String refName, String className, boolean useOriginalList) { + if (refName == null) + System.out.println(); FileWriter fw = getWriter(parent); //if (!reference) fw.writer.println(" addParser(\""+ refName +"\", "+className+".class);"); @@ -370,22 +378,18 @@ public class ImporterGenerator extends JavaGenerator{ public void handle(SchemaObject parent, Attribute attribute) { if (parent == null) return; - String name = attribute.getName(); + String attrName = attribute.getName(); QName primitiveType = attribute.getType(); SimpleType simpleType = attribute.getSimpleType(); QName ref = attribute.getRef(); String relationName; - String attrName; - if (name != null) { - attrName = name; - relationName = ontShort+"has"+name; - if (parent != null) - relationName = ontShort+getName(parent)+"_has"+name; + if (attrName != null) { + relationName = ontShort+getName(parent)+"_has"+base.getName(attribute); } else if (ref != null && parent != null) { attrName = ref.getLocalPart(); - relationName = ontShort+getName(parent)+"_has"+ref.getLocalPart(); + relationName = ontShort+getName(parent)+"_has"+base.getName(ref); Attribute referred = this.base.getRefAttribute(ref); if (referred != null) { @@ -485,7 +489,7 @@ public class ImporterGenerator extends JavaGenerator{ FileWriter fw = getWriter(parent); NamedAttributeGroup group = this.base.getAttributeGroup(attribute.getRef()); fw.writer.println(commentTag+" AttributeGroup " + group.getName()); - SchemaObject obj = new SchemaObject(parent,attribute); + SchemaObject obj = new SchemaObject(base,parent,attribute); for (Annotated annotated : group.getAttributeOrAttributeGroup()) { if (annotated instanceof Attribute) { //handle("AttributeGroups_"+group.getName(),(Attribute)annotated);