Bug 123186 - Two Domain Templates with same mappings - only one is used during code generation
Two Domain Templates with same mappings - only one is used during code genera...
Status: VERIFIED FIXED
Product: uml
Classification: Unclassified
Component: Code Generation
6.x
All All
: P2 (vote)
: 6.x
Assigned To: Craig Conover
issues@uml
release601_fixes_candidate2, release6...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-11-30 19:55 UTC by Craig Conover
Modified: 2008-03-20 18:48 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Conover 2007-11-30 19:55:41 UTC
Reproduction steps:

- Create two template files to be used for code generation. For a really simple example, create a file called foo.txt
with the contents "foo". Another file named bar.txt with the contents "bar".
- Goto Tools->Templates: navigate to UML/Code Generation
- Add the two files: foo.txt and bar.txt
- Goto Tools->Options, UML, Templates tab
- Add a new domain (select Java node and click Add button)
- Set properties for the domain:
  Element type = Class
  Stereotype = foobar
  Output Parameters:
  Click Add Template: 
    Filename Format = {name}Foo
    Template File = foo.txt
- Add another new domain (select Java node and click Add button)
- Set properties for the domain:
  Element type = Class
  Stereotype = foobar
  Output Parameters:
  Click Add Template: 
    Filename Format = {name}Bar
    Template File = bar.txt

- Create a UML project with a Class Diagram
- In project customizer, enable the two new Domain Templates
- Add one Class element, name it TestClass
- Add a Stereotype to the class element called twofiles
- Create a Java project
- Generate code for the class element

The result should be two files: TestClassFoo.txt and TestClassBar.txt. 

Only the TestClassBar.txt file is created.

Cause: the hashmap of domain templates is keyed, but elementType:stereotype pairs and each duplicate pairing overwrites
the previous one so only the final one is used for code generation.
Comment 1 Craig Conover 2007-12-05 18:20:11 UTC
Solution was to check if a particular elementType:stereotype key already existed in the domain template hashmap. If so,
get the value (list of templates) and add the new templates to the end of that list and add back to the hashmap.
Comment 2 Craig Conover 2007-12-06 18:02:15 UTC
fix checked in to trunk and unstable_uml_visualcomponent branch
Comment 3 Petr Blaha 2008-02-01 12:32:04 UTC
The bug wasn't verified before cut-off date for 6.0.1patch1 and will be included in 6.0.1patch2.
Comment 4 Peter Lam 2008-02-22 23:55:31 UTC
verified in NB 6.1 build 200802191203.
Also verified in latest Meteora build (unstable_uml_visualcomponent branch).
Comment 5 Marian Mirilovic 2008-02-26 12:12:45 UTC
http://hg.netbeans.org/main/rev/a1a217c9c090
Comment 6 khu 2008-03-05 18:45:35 UTC
The fix has been ported into the release601_fixes branch

Checking in DomainTemplatesManagerPanel.form;
/cvs/uml/codegen/src/org/netbeans/modules/uml/codegen/ui/Attic/DomainTemplatesManagerPanel.form,v  <-- 
DomainTemplatesManagerPanel.form
new revision: 1.13.6.1; previous revision: 1.13
done
Checking in DomainTemplatesManagerPanel.java;
/cvs/uml/codegen/src/org/netbeans/modules/uml/codegen/ui/Attic/DomainTemplatesManagerPanel.java,v  <-- 
DomainTemplatesManagerPanel.java
new revision: 1.27.6.1; previous revision: 1.27
done
Checking in DomainTemplatesRetriever.java;
/cvs/uml/codegen/src/org/netbeans/modules/uml/codegen/dataaccess/Attic/DomainTemplatesRetriever.java,v  <-- 
DomainTemplatesRetriever.java
new revision: 1.7.6.1; previous revision: 1.7
done


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo