Difference between revisions of "Artefact:Template/org/ooem/templates/wiml-1.0-ooem-class-2.0"
From OOModels
< Artefact:Template | org | ooem | templates
Jump to navigationJump to search
AndreasLeue (talk | contribs) (end fixes) |
AndreasLeue (talk | contribs) (enabled extensions) |
||
Line 132: | Line 132: | ||
⋮«}}/➀»… | ⋮«}}/➀»… | ||
⋮«➀(x){» | ⋮«➀(x){» | ||
<Extensions> | <Extensions> | ||
⋮«}/➀»… | ⋮«}/➀»… | ||
⋮«if(((String)(‖"Ⓟ/Name")).matches("^org/xmodel/[^/]*")){»… | <Extension CLASS="OOEMExtension_OCP_XML"> | ||
<XOCP CLASS="String" CONTENT="XML/Text"> | |||
⋮«if(((String)(‖"Ⓟ/Name")).matches("^org/xmodel/[^/]*")){»… | |||
<◂((String)(‖"Ⓟ/Name")).replaceFirst("org/xmodel/","")▸> | |||
⋮«}else{»… | |||
<◂‖"Ⓟ/Name"▸> | |||
◂((WIMLProperty)(⊙)).dumpToXML(" | ⋮«}»… | ||
⋮«∀(‖"Ⓟ/Properties"){»… | |||
◂((WIMLProperty)(⊙)).dumpToXML(" ",null).toString()▸ | |||
⋮«}/∀»… | |||
⋮«if(((String)(‖"Ⓟ/Name")).matches("^org/xmodel/[^/]*")){»… | |||
</◂((String)(‖"Ⓟ/Name")).replaceFirst("org/xmodel/","")▸> | |||
⋮«}else{»… | |||
</◂‖"Ⓟ/Name"▸> | |||
⋮«}»… | |||
</XOCP> | |||
</Extension> | </Extension> | ||
⋮«}»… | ⋮«}»… | ||
⋮«}/∀»… | ⋮«}/∀»… | ||
Line 153: | Line 156: | ||
⋮«¬➀(x){»… | ⋮«¬➀(x){»… | ||
</Extensions> | </Extensions> | ||
⋮«}/¬➀»… | ⋮«}/¬➀»… | ||
⋮«if(element!=null){»… | ⋮«if(element!=null){»… |
Revision as of 16:18, 16 April 2012
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_jppi-1.0 -*- coding: utf-8; -*- ▼… import org.oomodels.wiml.*; import java.util.Map; ▼… ⊏ signature(String wiml_code, Map<String,String> predefined_arguments, Map<String,String> conversion_arguments, Map<String,String> request_arguments) ⊐… « WIMLClass wc; try { wc = WIMLClass.parseWIML(wiml_code); object = wc; boolean has_associations = false; if (wc == null) { throw new org.oomodels.OOMStatusCode(204); } else { boolean complete_xml = "true".equals(predefined_arguments.get("CompleteXMLDocument")); String xmlns = complete_xml ? " xmlns=\"http://xmlns.sphenon.com/org/ooem\"" : ""; String indent = complete_xml ? "" : " "; »… «if(complete_xml) {»… ⋮<?xml version="1.0" encoding="UTF-8" standalone="yes"?> «}»… «¶(indent)»… « ⇾(⊙,WIMLStateMachine) {»<StateMachine◂xmlns▸>«}∨{»<Class◂xmlns▸>« }/⇾ » <Name>◂conversion_arguments.get("page").replaceFirst("Artefact:Model/","").replace("/",".")▸</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"▸" Variable="◂‖"Ⓟ/1"▸"«∃(‖"Ⓟ/2"){» StateType="◂⊙▸"«}/∃»/> ⋮«}/∀»«}/¬∅»… ⋮« }/⇾ »… ⋮«∀(‖"Ⓟ/Attributes"){if(‖"Ⓟ/Association" == null){»… <Attribute Name="◂‖"Ⓟ/Name"▸" PASS="2" TypeName="◂((String)(‖"Ⓟ/Type")).replace("/",".")▸"«∀(‖"Ⓟ/Stereotypes"){» Stereotype-◂Ⓘ▸="◂⊙▸"«}/∀»… ⋮⊏ ➜ this.Extensions(object, "Attribute") ⊐… ⋮«}else{»… <AssociationEnd PASS="2"> ⋮«¬∅(‖"Ⓟ/Stereotypes"){»«∀(⊙){»… <!-- <Stereotype>◂⊙▸</Stereotype> --> ⋮«}/∀»«}/¬∅»… ⋮«∃(‖"Ⓟ/OtherName"){»… <Role>◂⊙▸</Role> ⋮«}/∃»… <!-- <TypeName>◂‖[wc]"Ⓟ/Name"▸</TypeName> --> ⋮«∃(‖"Ⓟ/OtherMultiplicity"){»… <Multiplicity>◂⊙▸</Multiplicity> <IsNavigable>true</IsNavigable> ⋮«}∨{»… <Multiplicity>1</Multiplicity> <Navigability>false</Navigability> ⋮«}/∃»… ⋮«●(‖"Ⓟ/Ends/1"){»⊏ ➜ this.Extensions(object, null) ⊐«}/●»… <OtherRole>◂‖"Ⓟ/Name"▸</OtherRole> <OtherTypeName>◂((String)(‖"Ⓟ/Type")).replace("/",".")▸</OtherTypeName> <OtherMultiplicity>◂‖"Ⓟ/Multiplicity"▸</OtherMultiplicity> <OtherNavigability>true</OtherNavigability> ⋮«●(‖"Ⓟ/Ends/0"){»⊏ ➜ this.Extensions(object, null) ⊐«}/●»… ⋮⊏ ➜ this.Extensions(object, null) ⊐… </AssociationEnd> ⋮«}}/∀»… ⋮«∀(‖"Ⓟ/Operations"){»… ⋮« String op_type; ⇾(⊙,WIMLTransition) { op_type = "Transition"; }∨{ op_type = "Operation"; }/⇾ »… <◂op_type▸ Name="◂‖"Ⓟ/Name"▸" ReturnType="◂‖"Ⓟ/ReturnType"▸"«∀(‖"Ⓟ/Stereotypes"){» Stereotype-◂Ⓘ▸="◂⊙▸"«}/∀»… ⋮« ⇾(⊙,WIMLTransition) {»«¬∅(‖"Ⓟ/BeforeStateExpression"){» BeforeStates="◂⊙▸"«}/¬∅»« }/⇾ »… ⋮⊏ ➜ this.Extensions(object, op_type) ⊐… ⋮«}/∀»… ⋮«∀(‖"Ⓟ/Views"){»… <View Name="◂‖"Ⓟ/Name"▸" «¬∅(‖"Ⓟ/Stereotypes"){» Stereotype="«∀(⊙){»◂⊙▸«}/∀»"«}/¬∅» CLASS="UMLView_SlotSpecification"> <ClassOfView>◂‖[wc]"Ⓟ/Name"▸</ClassOfView> ⋮⊏ ➜ this.Extensions(object, null) ⊐… ⋮«∀(‖"Ⓟ/SlotSpecifications"){»… <SlotSpecification Name="◂‖"Ⓟ/Name"▸" Visibility="◂‖"Ⓟ/Visibility"▸" Attributes="◂‖"Ⓟ/Attributes"▸" Associations="◂‖"Ⓟ/Associations"▸" Operations="◂‖"Ⓟ/Operations"▸" Expand="◂‖"Ⓟ/Expand"▸"> <EntryIncludeRegExp>◂‖"Ⓟ/EntryIncludeRegExp"▸</EntryIncludeRegExp> <EntryExcludeRegExp>◂‖"Ⓟ/EntryExcludeRegExp"▸</EntryExcludeRegExp> <FeatureIncludeRegExp>◂‖"Ⓟ/FeatureIncludeRegExp"▸</FeatureIncludeRegExp> <FeatureExcludeRegExp>◂‖"Ⓟ/FeatureExcludeRegExp"▸</FeatureExcludeRegExp> </SlotSpecification> ⋮«}/∀»… </View> ⋮«}/∀»… ⋮⊏ ➜ this.Extensions(object, null) ⊐… « ⇾(⊙,WIMLStateMachine) {»</StateMachine>«}∨{»</Class>« }/⇾ » «/¶»… « } »… « } catch (org.oomodels.OOMStatusCode osc) { throw osc; } catch (Throwable t) { org.oomodels.OOMStatusCode osc = new org.oomodels.OOMStatusCode(204); //osc.setCause(t); throw osc; } »… ⊏ Ⓣ 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> ⋮«}/➀»… <Extension CLASS="OOEMExtension_OCP_XML"> <XOCP CLASS="String" CONTENT="XML/Text"> ⋮«if(((String)(‖"Ⓟ/Name")).matches("^org/xmodel/[^/]*")){»… <◂((String)(‖"Ⓟ/Name")).replaceFirst("org/xmodel/","")▸> ⋮«}else{»… <◂‖"Ⓟ/Name"▸> ⋮«}»… ⋮«∀(‖"Ⓟ/Properties"){»… ◂((WIMLProperty)(⊙)).dumpToXML(" ",null).toString()▸ ⋮«}/∀»… ⋮«if(((String)(‖"Ⓟ/Name")).matches("^org/xmodel/[^/]*")){»… </◂((String)(‖"Ⓟ/Name")).replaceFirst("org/xmodel/","")▸> ⋮«}else{»… </◂‖"Ⓟ/Name"▸> ⋮«}»… </XOCP> </Extension> ⋮«}»… ⋮«}/∀»… ⋮«}/¬∅»… ⋮«¬➀(x){»… </Extensions> ⋮«}/¬➀»… ⋮«if(element!=null){»… ⋮«¬➀(e){»… </◂element▸> ⋮«}∨{»/> ⋮«}/¬➀»… ⋮«}»… ⊏ /Ⓣ ⊐…