Artefact:Template/org/ooem/templates/wiml-1.0-ooem-multipart-1.0

From OOModels
< Artefact:Template‎ | org‎ | ooem‎ | templates
Revision as of 19:49, 18 January 2010 by AndreasLeue (talk | contribs)
Jump to navigationJump to search
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) ⊐…
« WIMLClass wc; try { wc = WIMLClass.parseWIML(wiml_code); object = wc; 
  boolean has_associations = false;
  if (wc != null) {
»…
MIME-Version: 1.0
Content-type: multipart/mixed; charset=utf-8; boundary="mimeboundery"

«
    ∀(‖"Ⓟ/Attributes"){
      if (‖"Ⓟ/Association"!=null) { has_associations = true; }
    }/∀
»…
--mimeboundery
Content-type: text/plain; charset=utf-8
Content-Disposition: attachment; filename=◂‖"Ⓟ/Name"▸.model

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
« ⇾(⊙,WIMLStateMachine) {»<StateMachine>«}∨{»<Class>« }/⇾ »
  ⋮⊏ ➜ this.Imports(object) ⊐…
  <Name>◂‖"Ⓟ/Name"▸</Name>
  ⋮«∀(‖"Ⓟ/ModelTemplateArguments"){»…
  <TemplateParameter Name="◂‖"Ⓟ/Name"▸" «∃(‖"Ⓟ/DefaultValue"){»DefaultValue="◂((String)(⊙)).replace("/",".")▸" «}/∃»GenericLevel="MODEL_TEMPLATE"/>
  ⋮«}/∀»…
  ⋮«∀(‖"Ⓟ/CodeGeneratorTemplateArguments"){»…
  <TemplateParameter Name="◂‖"Ⓟ/Name"▸" «∃(‖"Ⓟ/DefaultValue"){»DefaultValue="◂((String)(⊙)).replace("/",".")▸" «}/∃»GenericLevel="CODE_GENERATOR_TEMPLATE"/>
  ⋮«}/∀»…
  ⋮«∀(‖"Ⓟ/ImplementationLanguageTemplateArguments"){»…
  <TemplateParameter Name="◂‖"Ⓟ/Name"▸" «∃(‖"Ⓟ/DefaultValue"){»DefaultValue="◂((String)(⊙)).replace("/",".")▸" «}/∃»GenericLevel="IMPLEMENTATION_LANGUAGE_TEMPLATE"/>
  ⋮«}/∀»…
  ⋮«∀(‖"Ⓟ/Bases"){»…
  <Base Parent="◂((String)(⊙)).replace("/",".")▸"/>
  ⋮«}/∀»…
  ⋮«¬∅(‖"Ⓟ/Stereotypes"){»…
  <Stereotype>«∀(⊙){»◂⊙▸«}/∀»</Stereotype>
  ⋮«}/¬∅»…
  ⋮« ⇾(⊙,WIMLStateMachine) {»…
  ⋮«¬∅(‖"Ⓟ/States"){»«∀(⊙){»…
  <State Name="◂‖"Ⓟ/0"▸"«∃(‖"Ⓟ/1"){» StateType="◂⊙▸"«}/∃»/>
  ⋮«}/∀»«}/¬∅»…
  ⋮« }/⇾ »…
  ⋮«∀(‖"Ⓟ/Attributes"){if(‖"Ⓟ/Association" == null){»…
  <Attribute Name="◂‖"Ⓟ/Name"▸" Type="◂((String)(‖"Ⓟ/Type")).replace("/",".")▸"«¬∅(‖"Ⓟ/Stereotypes"){» Stereotype="«∀(⊙){»◂⊙▸«}/∀»"«}/¬∅»…
    ⋮⊏ ➜ this.Extensions(object, "Attribute") ⊐…
  ⋮«}}/∀»…
  ⋮«∀(‖"Ⓟ/Operations"){»…
  ⋮« String op_type; ⇾(⊙,WIMLTransition) { op_type = "Transition"; }∨{ op_type = "Operation"; }/⇾ »…
  <◂op_type▸ Name="◂‖"Ⓟ/Name"▸" ReturnType="◂‖"Ⓟ/ReturnType"▸"«¬∅(‖"Ⓟ/Stereotypes"){» Stereotype="«∀(⊙){»◂⊙▸«}/∀»"«}/¬∅»…
                       ⋮« ⇾(⊙,WIMLTransition) {»«¬∅(‖"Ⓟ/BeforeStates"){»«∀(⊙){» BeforeState-◂Ⓘ+1▸="◂⊙▸"«}/∀»«}/¬∅»« }/⇾ »…
    ⋮⊏ ➜ this.Extensions(object, op_type) ⊐…
  ⋮«}/∀»…
  ⋮⊏ ➜ this.Extensions(object, null) ⊐…
« ⇾(⊙,WIMLStateMachine) {»</StateMachine>«}∨{»</Class>« }/⇾ »
« if (has_associations) { »…
⋮«∀(‖"Ⓟ/Attributes"){if(‖"Ⓟ/Association" != null){»…
--mimeboundery
Content-type: text/plain; charset=utf-8
Content-Disposition: attachment; filename=◂‖[wc]"Ⓟ/Name"▸Association◂‖"Ⓟ/Name"▸.model

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Association>
  ⋮⊏ ➜ this.Imports(object) ⊐…
  ⋮«¬∅(‖"Ⓟ/Stereotypes"){»…
  <Stereotype>«∀(⊙){»◂⊙▸«}/∀»</Stereotype>
  ⋮«}/¬∅»…
  <Ends>
    <End>
      <Type>◂‖[wc]"Ⓟ/Name"▸</Type>
      <Multiplicity>1</Multiplicity>
      <IsNavigable>false</IsNavigable>
      ⋮⊏ ➜ this.Extensions(object, null) ⊐…
    </End>
    <End>
      <Role>◂‖"Ⓟ/Name"▸</Role>
      <Type>◂((String)(‖"Ⓟ/Type")).replace("/",".")▸</Type>
      <Multiplicity>◂‖"Ⓟ/Association"▸</Multiplicity>
      <IsNavigable>true</IsNavigable>
      ⋮⊏ ➜ this.Extensions(object, null) ⊐…
    </End>
  </Ends>
  ⋮⊏ ➜ this.Extensions(object, null) ⊐…
</Association>
⋮«}}/∀»…
« } »…
« } »…
« } catch (Throwable t) { »…
ERROR: ◂t▸
« } »…
⊏ Ⓣ Extensions(Object object, String element) ⊐…
  ⋮«➀:(e)»…
  ⋮«➀:(x)»…
  ⋮«¬∅(‖"Ⓟ/Extensions"){»…
    ⋮«∀(⊙){»…
      ⋮«if(((String)(‖"Ⓟ/Name")).equals("UML")){»…
        ⋮«➀(e){if(element!=null){»>
        ⋮«}}/➀»…
        ⋮«∀(‖"Ⓟ/Properties"){»…
◂((WIMLProperty)(⊙)).dumpToXML("      ",null).toString()▸
        ⋮«}/∀»…
      ⋮«}»…
    ⋮«}/∀»…
  ⋮«}/¬∅»…
  ⋮«¬∅(‖"Ⓟ/Extensions"){»…
    ⋮«∀(⊙){»…
      ⋮«if(((String)(‖"Ⓟ/Name")).equals("UML") == false){»…
        ⋮«➀(e){if(element!=null){»>
        ⋮«}}/➀»…
        ⋮«➀(x){»
    <Extensions>
        ⋮«}/➀»…
        ⋮«if(((String)(‖"Ⓟ/Name")).matches("^org/xmodel/[^/]*")){»…
      <◂((String)(‖"Ⓟ/Name")).replaceFirst("org/xmodel/","")▸>
        ⋮«}else{»…
      <Extension CLASS="◂‖"Ⓟ/Name"▸">
        ⋮«}»…
          ⋮«∀(‖"Ⓟ/Properties"){»…
◂((WIMLProperty)(⊙)).dumpToXML("        ",null).toString()▸
          ⋮«}/∀»…
        ⋮«if(((String)(‖"Ⓟ/Name")).matches("^org/xmodel/[^/]*")){»…
      </◂((String)(‖"Ⓟ/Name")).replaceFirst("org/xmodel/","")▸>
        ⋮«}else{»…
      </Extension>
        ⋮«}»…
      ⋮«}»…
    ⋮«}/∀»…
  ⋮«}/¬∅»…
  ⋮«¬➀(x){»…
    </Extensions>
  ⋮«}/¬➀»…
  ⋮«if(element!=null){»…
    ⋮«¬➀(e){»…
  </◂element▸>
    ⋮«}∨{»/>
    ⋮«}/¬➀»…
  ⋮«}»…
⊏ /Ⓣ ⊐…
⊏ Ⓣ Imports(Object object) ⊐…
  <StereotypeModelImport>org.uml.stereotypes.*</StereotypeModelImport>
  <ExternalImport>java.lang.Boolean</ExternalImport>
  <ExternalImport>java.lang.Byte</ExternalImport>
  <ExternalImport>java.lang.Short</ExternalImport>
  <ExternalImport>java.lang.Integer</ExternalImport>
  <ExternalImport>java.lang.Long</ExternalImport>
  <ExternalImport>java.lang.Float</ExternalImport>
  <ExternalImport>java.lang.Double</ExternalImport>
  <ExternalImport>java.lang.Character</ExternalImport>
  <ExternalImport>java.lang.String</ExternalImport>
  <ExternalImport>java.util.Date</ExternalImport>
  <ExternalImport>java.lang.Object</ExternalImport>
  <PrimitiveImport>boolean</PrimitiveImport>
  <PrimitiveImport>byte</PrimitiveImport>
  <PrimitiveImport>short</PrimitiveImport>
  <PrimitiveImport>int</PrimitiveImport>
  <PrimitiveImport>long</PrimitiveImport>
  <PrimitiveImport>float</PrimitiveImport>
  <PrimitiveImport>double</PrimitiveImport>
  <PrimitiveImport>char</PrimitiveImport>
⊏ /Ⓣ ⊐…