Difference between revisions of "Artefact:Template/org/ooem/templates/wiml-1.0-ooem-multipart-1.0"

From OOModels
Jump to navigationJump to search
Line 14: Line 14:
  import org.oomodels.wiml.*;
  import org.oomodels.wiml.*;
  ▼…
  ▼…
  ▲…
  ⊏ signature(String wiml_code) ⊐…
  protected boolean hasAssociations(CallContext context, WIMLClass wc) {
  « try { wc = WIMLClass.parseWIML(wiml_code); object = wc;
  boolean has_associations = false;
   ∀(‖"Ⓟ/Attributes"){
   ∀(‖"Ⓟ/Attributes"){
     if (‖"Ⓟ/Association"!=null) { return true; }
     if (‖"Ⓟ/Association"!=null) { has_associations = true; }
   }/∀
   }/∀
  return false;
}
protected WIMLClass wc;
▲…
⊏ signature(String wiml_code) ⊐…
« try { wc = WIMLClass.parseWIML(wiml_code); object = wc;
  boolean has_associations = hasAssociations(context, wc);
  »…
  »…
⊏ name(hasAssociations(context, wc = WIMLClass.parseWIML(wiml_code)) ? (wc.getName()+".model") : (wc.getName()+".multipart")) ⊐…
« if (has_associations) { »…
  MIME-Version: 1.0
  MIME-Version: 1.0
  Content-type: multipart/mixed; boundary="mimeboundery"
  Content-type: multipart/mixed; boundary="mimeboundery"
Line 36: Line 28:
  Content-Disposition: attachment; filename=◂‖"Ⓟ/Name"▸.model
  Content-Disposition: attachment; filename=◂‖"Ⓟ/Name"▸.model
   
   
« } »…
  <Class>
  <Class>
   ⋮⊏ ➜ this.Imports(object) ⊐…
   ⋮⊏ ➜ this.Imports(object) ⊐…

Revision as of 18:51, 3 April 2009

Classification
Type Type:org/oogenerator/Template/2.0
Domain Domain:it/development/formatting
Category Type:org/oomodels/wiki/Template
Maturity final
More
Download Code
Namespace (more)

OOEM main package

create new pages

Code[edit]

G-2.0-java_jpp-1.0 -*- coding: utf-8; -*-
▼…
import org.oomodels.wiml.*;
▼…
⊏ signature(String wiml_code) ⊐…
« try { wc = WIMLClass.parseWIML(wiml_code); object = wc; 
  boolean has_associations = false;
  ∀(‖"Ⓟ/Attributes"){
    if (‖"Ⓟ/Association"!=null) { has_associations = true; }
  }/∀
»…
MIME-Version: 1.0
Content-type: multipart/mixed; boundary="mimeboundery"

--mimeboundery
Content-type: text/plain; charset=utf-8
Content-Disposition: attachment; filename=◂‖"Ⓟ/Name"▸.model

<Class>
  ⋮⊏ ➜ this.Imports(object) ⊐…
  <Name>◂‖"Ⓟ/Name"▸</Name>
  ⋮«∀(‖"Ⓟ/ModelTemplateArguments"){»…
  <TemplateArgument Name="◂‖"Ⓟ/Name"▸" GenericLevel="MODEL_TEMPLATE"/>
  ⋮«}/∀»…
  ⋮«∀(‖"Ⓟ/CodeGeneratorTemplateArguments"){»…
  <TemplateArgument Name="◂‖"Ⓟ/Name"▸" GenericLevel="CODE_GENERATOR_TEMPLATE"/>
  ⋮«}/∀»…
  ⋮«∀(‖"Ⓟ/ImplementationLanguageTemplateArguments"){»…
  <TemplateArgument Name="◂‖"Ⓟ/Name"▸" GenericLevel="IMPLEMENTATION_LANGUAGE_TEMPLATE"/>
  ⋮«}/∀»…
  ⋮«∀(‖"Ⓟ/Bases"){»…
  <Base Name="◂‖"Ⓟ/Name"▸"/>
  ⋮«}/∀»…
  ⋮«¬∅(‖"Ⓟ/Stereotypes"){»…
  <Stereotype>«∀(⊙){»◂⊙▸«}/∀»</Stereotype>
  ⋮«}/¬∅»…
  ⋮«∀(‖"Ⓟ/Attributes"){if(‖"Ⓟ/Association" == null){»…
  <Attribute Name="◂‖"Ⓟ/Name"▸" Type="◂((String)(‖"Ⓟ/Type")).replace("/",".")▸"«¬∅(‖"Ⓟ/Stereotypes"){» Stereotype="«∀(⊙){»◂⊙▸«}/∀»"«}/¬∅»…
    ⋮«¬∅(‖"Ⓟ/Extensions"){»…
      ⋮>
      ⋮⊏ ➜ this.Extensions(object) ⊐…
  </Attribute>
    ⋮«}∨{»…
      ⋮/>
    ⋮«}/¬∅»…
  ⋮«}}/∀»…
  ⋮«∀(‖"Ⓟ/Operations"){»…
  <Operation Name="◂‖"Ⓟ/Name"▸" ReturnType="◂‖"Ⓟ/ReturnType"▸"«¬∅(‖"Ⓟ/Stereotypes"){» Stereotype="«∀(⊙){»◂⊙▸«}/∀»"«}/¬∅»…
    ⋮«¬∅(‖"Ⓟ/Extensions"){»…
      ⋮>
      ⋮⊏ ➜ this.Extensions(object) ⊐…
  </Attribute>
    ⋮«}∨{»…
      ⋮/>
    ⋮«}/¬∅»…
  ⋮«}/∀»…
  ⋮«¬∅(‖"Ⓟ/Extensions"){»…
    ⋮⊏ ➜ this.Extensions(object) ⊐…
  ⋮«}/¬∅»…
</Class>
« if (has_associations) { »…
--mimeboundery
Content-type: text/plain; charset=utf-8
Content-Disposition: attachment; filename=◂‖"Ⓟ/Name"▸Association.model

⋮«∀(‖"Ⓟ/Attributes"){if(‖"Ⓟ/Association" != null){»…
<Association>
  ⋮⊏ ➜ this.Imports(object) ⊐…
  ⋮«¬∅(‖"Ⓟ/Stereotypes"){»…
  <Stereotype>«∀(⊙){»◂⊙▸«}/∀»</Stereotype>
  ⋮«}/¬∅»…
  <Ends>
    <End>
      <Type>◂‖[wc]"Ⓟ/Name"▸</Type>
      <Multiplicity>1</Multiplicity>
      <IsNavigable>false</IsNavigable>
      ⋮⊏ ➜ this.Extensions(object) ⊐…
    </End>
    <End>
      <Role>◂‖"Ⓟ/Name"▸</Role>
      <Type>◂((String)(‖"Ⓟ/Type")).replace("/",".")▸</Type>
      <Multiplicity>◂‖"Ⓟ/Association"▸</Multiplicity>
      <IsNavigable>true</IsNavigable>
      ⋮⊏ ➜ this.Extensions(object) ⊐…
    </End>
  </Ends>
  ⋮⊏ ➜ this.Extensions(object) ⊐…
</Association>
⋮«}}/∀»…
« } »…
« } catch (Throwable t) { »…
ERROR: ◂t▸
« } »…
⊏ Ⓣ Extensions(Object object) ⊐…
  ⋮«¬∅(‖"Ⓟ/Extensions"){»…
    <Extensions>
    ⋮«∀(⊙){»…
      <◂‖"Ⓟ/Name"▸>
        ⋮«∀(‖"Ⓟ/Properties"){»…
        <◂‖"Ⓟ/Name"▸>◂‖"Ⓟ/Value"▸</◂‖"Ⓟ/Name"▸>
        ⋮«}/∀»…
      </◂‖"Ⓟ/Name"▸>
    ⋮«}/∀»…
    </Extensions>
  ⋮«}/¬∅»…
⊏ /Ⓣ ⊐…
⊏ Ⓣ Imports(Object object) ⊐…
  <InternalModelImport>org.uml.stereotypes.*</InternalModelImport>
  <ExternalImport>java.lang.String</ExternalImport>
  <ExternalImport>java.lang.Integer</ExternalImport>
  <ExternalImport>java.lang.Object</ExternalImport>
  <ExternalImport>java.lang.Boolean</ExternalImport>
  <PrimitiveImport>int</PrimitiveImport>
⊏ /Ⓣ ⊐…

G-2.0-java_jpp-1.0 -*- coding: utf-8; -*-

import org.oomodels.wiml.*;
▼
⊏ signature(String wiml_code) ⊐
« WIMLClass wc; try { wc = WIMLClass.parseWIML(wiml_code); object = wc; 
  boolean has_associations = false;
  ∀(‖"Ⓟ/Attributes"){
    if (‖"Ⓟ/Association"!=null) { has_associations = true; }
  }/∀
»
« if (has_associations) { »
MIME-Version: 1.0
Content-type: multipart/mixed; boundary="mimeboundery"

--mimeboundery
Content-type: text/plain; charset=utf-8
Content-Disposition: attachment; filename=‖"Ⓟ/Name".model

« } »
<Class>
  ⋮⊏ ➜ this.Imports(object) ⊐
  <Name>‖"Ⓟ/Name"</Name>
  ⋮«∀(‖"Ⓟ/ModelTemplateArguments"){»
  <TemplateArgument Name="‖"Ⓟ/Name"" GenericLevel="MODEL_TEMPLATE"/>
  ⋮«}/∀»«∀(‖"Ⓟ/CodeGeneratorTemplateArguments"){»
  <TemplateArgument Name="‖"Ⓟ/Name"" GenericLevel="CODE_GENERATOR_TEMPLATE"/>
  ⋮«}/∀»«∀(‖"Ⓟ/ImplementationLanguageTemplateArguments"){»
  <TemplateArgument Name="‖"Ⓟ/Name"" GenericLevel="IMPLEMENTATION_LANGUAGE_TEMPLATE"/>
  ⋮«}/∀»«∀(‖"Ⓟ/Bases"){»
  <Base Name="‖"Ⓟ/Name""/>
  ⋮«}/∀»«¬∅(‖"Ⓟ/Stereotypes"){»
  <Stereotype>«∀(⊙){»◂⊙▸«}/∀»</Stereotype>
  ⋮«}/¬∅»«∀(‖"Ⓟ/Attributes"){if(‖"Ⓟ/Association" == null){»
  <Attribute Name="‖"Ⓟ/Name"" Type="◂((String)(‖"Ⓟ/Type")).replace("/",".")▸"«¬∅(‖"Ⓟ/Stereotypes"){» Stereotype="«∀(⊙){»◂⊙▸«}/∀»"«}/¬∅»«¬∅(‖"Ⓟ/Extensions"){»
      ⋮>
      ⋮⊏ ➜ this.Extensions(object) ⊐
  </Attribute>
    ⋮«}∨{»
      ⋮/>
    ⋮«}/¬∅»«}}/∀»«∀(‖"Ⓟ/Operations"){»
  <Operation Name="‖"Ⓟ/Name"" ReturnType="‖"Ⓟ/ReturnType""«¬∅(‖"Ⓟ/Stereotypes"){» Stereotype="«∀(⊙){»◂⊙▸«}/∀»"«}/¬∅»«¬∅(‖"Ⓟ/Extensions"){»
      ⋮>
      ⋮⊏ ➜ this.Extensions(object) ⊐
  </Attribute>
    ⋮«}∨{»
      ⋮/>
    ⋮«}/¬∅»«}/∀»«¬∅(‖"Ⓟ/Extensions"){»⊏ ➜ this.Extensions(object) ⊐«}/¬∅»
</Class>
« if (has_associations) { »
--mimeboundery
Content-type: text/plain; charset=utf-8
Content-Disposition: attachment; filename=‖"Ⓟ/Name"Association.model

⋮«∀(‖"Ⓟ/Attributes"){if(‖"Ⓟ/Association" != null){»
<Association>
  ⋮⊏ ➜ this.Imports(object) ⊐«¬∅(‖"Ⓟ/Stereotypes"){»
  <Stereotype>«∀(⊙){»◂⊙▸«}/∀»</Stereotype>
  ⋮«}/¬∅»
  <Ends>
    <End>
      <Type>‖[wc]"Ⓟ/Name"</Type>
      <Multiplicity>1</Multiplicity>
      <IsNavigable>false</IsNavigable>
      ⋮⊏ ➜ this.Extensions(object) ⊐
    </End>
    <End>
      <Role>‖"Ⓟ/Name"</Role>
      <Type>◂((String)(‖"Ⓟ/Type")).replace("/",".")▸</Type>
      <Multiplicity>‖"Ⓟ/Association"</Multiplicity>
      <IsNavigable>true</IsNavigable>
      ⋮⊏ ➜ this.Extensions(object) ⊐
    </End>
  </Ends>
  ⋮⊏ ➜ this.Extensions(object) ⊐
</Association>
⋮«}}/∀»
« } »
« } catch (Throwable t) { »
ERROR: ◂t▸
« } »
⊏ Ⓣ Extensions(Object object) ⊐«¬∅(‖"Ⓟ/Extensions"){»
    <Extensions>
    ⋮«∀(⊙){»
      <‖"Ⓟ/Name">
        ⋮«∀(‖"Ⓟ/Properties"){»
        <‖"Ⓟ/Name">‖"Ⓟ/Value"</‖"Ⓟ/Name">
        ⋮«}/∀»
      </‖"Ⓟ/Name">
    ⋮«}/∀»
    </Extensions>
  ⋮«}/¬∅»
⊏ /Ⓣ ⊐
⊏ Ⓣ Imports(Object object) ⊐
  <InternalModelImport>org.uml.stereotypes.*</InternalModelImport>
  <ExternalImport>java.lang.String</ExternalImport>
  <ExternalImport>java.lang.Integer</ExternalImport>
  <ExternalImport>java.lang.Object</ExternalImport>
  <ExternalImport>java.lang.Boolean</ExternalImport>
  <PrimitiveImport>int</PrimitiveImport>
⊏ /Ⓣ ⊐