added support for tags attached to more than one element BLD200306050100
authormmatula@netbeans.org
Wed, 04 Jun 2003 18:25:24 +0000
changeset 128971fead187264
parent 1288 6cfbd4788058
child 1290 97c40ff3906b
added support for tags attached to more than one element
mdr/extras/uml2mof/src/org/netbeans/lib/jmi/uml2mof/Transformer.java
     1.1 --- a/mdr/extras/uml2mof/src/org/netbeans/lib/jmi/uml2mof/Transformer.java	Wed Jun 04 14:35:02 2003 +0000
     1.2 +++ b/mdr/extras/uml2mof/src/org/netbeans/lib/jmi/uml2mof/Transformer.java	Wed Jun 04 18:25:24 2003 +0000
     1.3 @@ -136,6 +136,8 @@
     1.4      private HashMap primitives;
     1.5      // packages that need to import PrimitiveTypes package
     1.6      private final HashSet ptImports = new HashSet();
     1.7 +    // tags that are attached to more than one element
     1.8 +    private final HashMap multiTags = new HashMap();
     1.9      
    1.10      // indicates, whether the package that is being processed has implicit references
    1.11      private boolean implicitReferences;
    1.12 @@ -554,9 +556,23 @@
    1.13            && !tagName.startsWith("org.omg.uml2mof.") 
    1.14            && !tagName.startsWith("org.netbeans.uml2mof.")) {
    1.15              info("copying tag: " + tagName);
    1.16 -            Tag mofTag = mof.getTag().createTag(tagName, getAnnotation(tag), tagName,
    1.17 -            new ArrayList(tag.getDataValue()));
    1.18 -            mofTag.setContainer(outermost);
    1.19 +            int hash = tagName.indexOf('#');
    1.20 +            String name = tagName;
    1.21 +            Collection value = tag.getDataValue();
    1.22 +            value.remove("");
    1.23 +            Tag mofTag = null;
    1.24 +            if (hash > -1) {
    1.25 +                name = name.substring(0, hash);
    1.26 +                mofTag = (Tag) multiTags.get(tagName);
    1.27 +            }
    1.28 +            if (mofTag == null) {
    1.29 +                mofTag = mof.getTag().createTag(name, getAnnotation(tag), name, null);
    1.30 +                mofTag.setContainer(outermost);
    1.31 +                if (hash > -1) {
    1.32 +                    multiTags.put(tagName, mofTag);
    1.33 +                }
    1.34 +            }
    1.35 +            mofTag.getValues().addAll(value);
    1.36              mofTag.getElements().add(mofElement);
    1.37              elements.put(tag, mofTag);
    1.38          }