Home
User Manual - Actifsource
Contents
1. Quick Access E Ge C C Project Explorer 2 q E iO Component 3 0 4 i com actifsource design 3 b gt T asText TemplateFunction a asrc EY com typeOf ch actifsource core selector type FunctionContext EH com actifsource typeRef com actifsource design functionspace selector Component gt EH com actifsource design typeld gt EY com actifsource design decoratingrelation oe EH com actifsource design functionspace typeOf ch actifsource template model spec types TemplateFunction gt EY com actifsource design functionspace abstractfunction name asText gt EH com actifsource design functionspace extend comment gt EH com actifsource design functionspace javafunction param gt EY com actifsource design functionspace selector dakken EY com actifsource design functionspace selector templatefunction gt 3 Client rad b YH Component language b YH Composite gt Y Leaf 4 MyFunctionSpace a functionContext gt O Client 4 Component 4 function gt T asText E Model Inconsistencies 3 o DA x PH Bie gt E TemplateFunction Description Es BH 4 4 Actifsource Generator 4 T 1 item selected In line 1 we write out the component name and its type name In line 2 we iterate over all aggregated compo nents but only if the component is of type Composite type cast In this context we call the template function asText recursively for all aggregated
2. gt L ch actifsource core gt ch actifsource ecore gt 2 ch actifsource environment gt 2 chactifsource generator gt ch actifsource generator compat IS gt 2 chactifsource generator freemarker gt ch actifsource generator graphwiz gt LS ch actifsource qenerator workspacetask The model navigator shows all resources sorted by projects packages and types Use the model navigator to find classes outside your project 2 12 5 Protected Regions Protected Regions 3 index IDI ID ID3 1 Statemachinel Eventl EventCode 2 Statemachinel Ewent EventCode Shows all protected regions from a generated file Click on the entry to navigate to the protected region in the selected file REF 2 12 6 References Ta References 3 2 4 gt EY com actifsource statemachine generic a EW com actifsource statemachine specific 4 amp Statemachinel af Statemachinel typeOf Statemachine Shows all references to a specific resource in the form Subject Predicate Object while object is the referenced resource 3 Resource Editor 3 1 Overview The Actifsource Resource Editor allows you to view and or edit any Actifsource resource Since everything is a resource in Actifsource this is the most important editor The Actifsource Resource Editor shows resources as tree similar to the Windows Explorer Statemachinel 15 E aaa Ea E Stopped State E run Transition typeOf com actifsource statemachine
3. Decorati ngRelation ch actifsource core LinkRelation ch actifsource core selector metaelement Z OwnRelation ch actifsource core T SelectorRelation ch actifsource core j a c UceRelation ch actifsource core definesAspect Defines aspects for instances of this class see also aspectlInitializationAspect as pect ResourceValidationAspect aspect NameAspect which are defined in the aspect property of the class Class allowRoot A Class is a root class if it is not aggregated exclusively that mean owned by an ownRelation with ObjectCardi nality1 1 Set this flag to true or false if you want to overwrite the Actifsource logic Please note that only root classes can be created directly via the New Actifsource Resource Tool see Chapter 2 9 1 New Actifsource Resource classicon Sets an icon for this class and all instances You can select an icon project by using content assist to browse the current project The icon size shall be 16 x 16 pixels lineColor Deprecated fillColor Deprecated shape Deprecated 4 6 2 ch actifsource core Enum The enum is a class with a set of values typeOf ch actifsource core Enum comment aspect InitalizationAspect aspect Resource ValidationAspect aspect NameAspect extends ch actifsource core EnumValue extends mod fier propeny definesAspect aliowRoot classicon value 1 typeOf MyEnum name Valuel 7 value 2 typeOf MyEnum name Value
4. Return type Description String Returns the package of the resource as string simpleName String Returns the Resource s name as defined by its NameAspect If the resource extends NamedResource the NameAspect returns the value of the name attribute If no NameAspect is defined the GUID of the resource is returned 9 4 4 Built in functions on List of Resource Actifsource provides the following built in functions on List of Resource Function Return type Description sortByGuid List of T Sorts the list of resources by their GUIDs sortBySimpleName List of T Sorts the list of resources by their names 9 4 5 Built in functions on Literal Actifsource provides the following built in functions on Literal Function Return type Description quid Gets the identifier of the Literal value This is the Literal itself 9 4 6 Built in functions on IntegerLiteral Actifsource provides the following built in functions on IntegerLiteral Function Return type Description increment Integer Increments an integer number decrement Integer Decrements an integer number notZero Integer Returns the number unless it is zero 9 4 7 Built in functions on IntegerLiteral Actifsource provides the following built in functions on List of IntegerLiteral Function Return type Description sum Integer Calculates the sum of a list of integer numbers minimum Integer Returns the minimum integer in a list maximum Integer Returns the maximum integ
5. C T H S U U A G E Home Actifsource Solutions Tutorials Papers Download Services Forum Contact gt Legal Info Privacy Policy License Community Edition Enterprise Edition CIP Tool Tutorials Community Edition Installing Actifsource Learn how to install the Actifsource Plugin for Eclipse and how to activate e your license more State Machine Develop a fully typed state machine model Learn about decorating relations and range restrictions to ease the use of the specific domain model more Refactoring Writing an aspect for refactoring model instances based on meta model changes more Simple Service Learn to design a generic domain write code templates and generate code more Language Enabling syntax highlighting for any programming language more Built in Models Learn how to create an eclipse plugin containing an Actifsource builtin model more Complex Service Develop complex templates with template interdependencies Use Java Functions from within templates more Literal Aspect Writing Java validation aspects for user defined literal types more Meta Model Documentation Learn how to document your own Meta Model and to generate a browsable HTML documentation more 2014 actifsource GmbH Switzerland all rights reserved 2 Actifsource Environment 2 1 Actifsource Eclipse Plugin Actifsource is
6. FindBugs Java Build Path Java Code Style Add Package gt Java Compiler IN gt Jawa Editor Add Resource lt all resources in project gt E Add BuildConfig Javadoc Location Project References Edit Run Debug Settings f za Task Repository WikiText El ignore whitespaces E execute saveactions Apply 7 4 Output Encoding For every build configuration you may select the output encoding EE StatemachineBuildConfig 2 E com actifsource statemachine generic statemachineBuldContig BuildContig typeor BuildConfig name StatemachineBuildContig descnption o ANN E lineBreak a new ch actifsource generator CharacterEncoding build Task E Cpl252 ch actifsource generator CharacterEncoding H 150 8859 1 ch actifsource generator CharacterEncoding pachine E US ASCII ch actifsource generator CharacterEncoding build Task H UTF 16 ch actifsource generator CharacterEncoding E UTF 8 ch actifsource generator CharacterEncoding If no output encoding has been set the one from the parent build configuration see also Chapter 7 6 2 Nest edBuildConfigGeneratorTask folder parent folder project or workspace is taken in this order Check Properties Resource Text file encoding on folder or project 2014 actifsource GmbH Switzerland all rights reserved gt Resource Run Debug
7. FunctionSpace is the place where you can place any function Template is a code template where you can place functions in the scope of the template Functions are grouped by a FunctionContext By the typeRef the FunctionContext is bound to a Class or an Enum Functions in the function context are applicable on instances of types referenced by typeRef E AbstractType Function Note that Actifsource prohibits more than one function context with the same typeRef in the same function space 9 2 1 Function Parameters A function might define a set of parameters If calling a function from a template Actifsource automatically tries to match with the context path see Chapter 8 3 17 Function parameters are defined in the model of the specific function type see Chapter 9 3 Function types typeOf ch actifsource core selector type FunctionContext com actifsource design template contextpath D 7 function typeOf chactifsource template model spec types TemplateFunction name DCBA ammenti param 1 e selector type Param param ch acti ce core selector type Param paraml3 ch acti e core selector type Param param children Line children language function Using function parameters in a template function see Chapter 9 3 6 TemplateFunction leads to the corre sponding super contexts see Chapter 8 3 5 SuperContext fr FDC BA 52 E 9 2 2 Using function parameters in a java function see C
8. NCTE SOURCE User Manual User Manual 2 Actifsource User Manual To do Information Bold Terms from actifsource or other technologies and tools Bold underlined actifsource Resources Underlined User Resources Underlineditalics Resource Functions 8 FOF e Monospaced User input e Italics Important terms in current situation The authors do not accept any liability arising out of the application or use of any information or equipment described herein The information contained within this document is by its very nature incomplete Therefore the authors accept no responsibility for the precise accuracy of the documentation con tained herein It should be used rather as a guide and starting point Contact actifsource GmbH Tafernstrasse 37 5405 Baden Dattwil Switzerland www actifsource com Trademark actifsource is a registered trademark of actifsource GmbH in Switzerland the EU USA and China Other names appearing on the site may be trademarks of their respective owners 2014 01 14 rc 5 11 0 2014 02 14 rc 5 12 0 2014 02 19 rc 5 13 0 2014 03 28 rc 5 13 1 2014 04 02 rc 5 14 0 Template Editor 2014 04 15 rc 5 14 0 Accessing the model from within Java function 2014 12 23 sw Code Snippet Chapter 2015 03 23 sw Java List Functions 2015 05 01 ms Java API 2014 actifsource GmbH Switzerland all rights reserved Table of Content 1 TI OA PPP Ao e e o tea toneuc
9. Note R ES New Class 1 o E New Enum evente target transition Event K bte Ci New Note User Manual 65 5 3 Domain Diagram Editor The domain diagram editor allows you to create new models based on your meta model 5 3 1 New Domain Diagram You can create a new class diagram via context menu in the project explorer or File New a i com actifsource statemachine a ES asre a EY com actifsource statemachine b H generic t E specific E NewS Prt gt Actifsource gt BA JRE System Lib Copy Actifsource Project gt fe Src of Cut E BuildConfig gt 3 src gen CE Paste f Class Diagram _ Move E Diagram Type Rename Ft Domain Diagram HK Delete dais Freemarker Generator Task Remove from Context Ctrl Alt Shitt Down FunctionSpace tg Import MS 2 Esa Ej Resource Gal Resource Folder 2 Refresh F5 T Template Profiling Tools m5 Template Folder Fix LicencelnfoMarkers via TeamP lugin Tj xPand Generator Task Preselecting a package will directly fill in the resource path and package in the wizard New Domain Diagram Wizard Domain Diagram Create a new domain diagram Resource Path com actifsource statemachines asre Package com actifsource statemachine specific Mame DiagramType SingleRoot Name The name of the domain diagram 2014 actifsource GmbH Switzerland all rights reserved Diagram Type Every domain uses its own diagram styles The Dia
10. io ae 1 Marquee Relation Ej State User Manual 74 5 3 7 Browse Diagram Actifsource automatically detects resources that are also shown on other diagrams Simply click on the diagram symbol to list and browse the other diagrams Pi Statemachinel Overview El y 2014 actifsource GmbH Switzerland all rights reserved User Manual 75 6 Domain Diagram Type 6 1 Overview Domain diagrams are domain specific by definition This means that you can define your own domain specific diagrams 6 2 Shape 6 3 Figure 2014 actifsource GmbH Switzerland all rights reserved 7 Build Config 7 1 Overview The Actifsource BuildConfig acts like a make file It tells Actifsource which build tasks shall be executed The most important build task for code generation is the TemplateGeneratorTask 7 2 New BuildConfig You can create a new build configuration via context menu in the project explorer or File New Project Explorer 3 m BS e dl fe com actifsource statemachine a E asre a EY com actifsource statemachine gt E specifi New FS Project gt EH templa gt Ba Actifsource Copy Actifsource Project gt BA JRE System Lib of Cut Af BuildConfig gt je src Paste Fe Class Diagram i Hoi Move F lt Diagram Type i Rename F lt Domain Diagram 3i Delete dae Freemarker Generator Task Remove from Context Ctrl Alt Shitt Down FunctionSpace tg Import Mi Badkage A eee ES Res
11. Selector Parent child Break Parent nameImpl hpp f C class Parent nameImpl 1 public void identifyChild name 4 hpp amp cpp Add Content between existing Contexts Consider two contexts that follow each other line 4 and 5 in the following example How to insert new con tent between line 4 and line 5 but in the base context T Parent ES E 3 Build 9 Build allParent Parent AENA Selector Parent child Break Parent nameImpl hpp CH class Parent nameImpl i public void identifyChild name al TJ al F Le hpp ES Le cpp Place the cursor on the end of line 4 as shown above and press cursor right The cursor will still remain at the same position but the context selection will change to the parent context Parent El E 3 Build EE aia amp E Parent child Child Selector Build allParent Break Parent namelmpl hpp CH class Parent nameImpl public void identifyChild name 4 F Le hpp ES Le cpp Entering a new line is done in the selected parent context and results in a new line between the existing con texts User Manual 112 T Parent ES E 3 Build gt 5 C Selector Build allParent Break Parent nameImpl hpp gt CH class Parent nameImpl 1 public void identifyChild name 4 F app cpp 8 3 11 Copy Paste Copy Ctrl C and Paste Ctrl V in the Template Edit
12. ry Open QuickAssist Ctrl 1 Switch to Selector Cut Ctrl XA Cop Ctrl C Copy with Context Selected Content 2 Alt PageDown Ctrl C CE Paste CtrHV S c Alt PageDown Ctrl C Ctrl C Please note that it makes no sense to copy the base context see Chapter 8 3 1 Base Context or even the super context see Chapter 8 3 5 SuperContext because they are part of the whole template 8 3 12 Selector The selector allows navigating the meta model and is extremely powerful Please consult Chapter 9 3 2 Selec torFunction for details Use the Switch to Selector tool from the tool bar or Alt Enter to navigate from the code to the selector Use Enter in the selector to jump back to the code Bj Break Flag Consider the following situation element The subsequent template iterates over Container element and prints the name of every element Container 3 E 3 Build Build aliContainerContainer MN Break Container name txt F Text Container name b I ElementA name bas Let s assume that we write template code that shall produce different code depending whether Contain er element is of type ElementA ElementB or ElementC A straightforward solution is introducing a context with a type cast for type in the inheritance hierarchy Container 3 E 3 Build 3 Build aliContoiner Container YH Container elementHementA EEE a Selector Break _ Container name txt a Text Container name
13. volue Iser Manual Value Technically the value is an instance of the enum and therefore fully typed Note that you might define proper ties in your enum which are than accessible in the values typeOf ch actifsource core Enum name MyEnum comment aspect InttializationAspect aspect Resource ValidationAspect aspect NameAspect extends ch actifsource core EnumValue extends modifier 7 typeOt ch actifsource core Attribute name id comment subjectCardinality ch actifsource core Cardinalityl_1 range ch actifsource core IntegerLiteral defaultValue property definesAspect allowRoat classicon 7 value 1 typeOf MyEnum name Valuel i 7 value 2 typeOf MyEnum name Value id 2 value re N Q l 5 Diagram Editor 5 1 Overview Actifsource offers graphical editors to view and edit the meta model and model For editing the model it is possible to define domain specific editors 5 2 Class Diagram Editor The class diagram editor allows you to create new meta models based on Actifsource classes 5 2 1 New Class Diagram You can create a new class diagram via context menu in the project explorer or File New a i com actifsource sta a El arc FS Project E E Meter s i Actifsource Actifsource Project BL JRE System Lik of Cut BuildConfig BaD Pa Fi cg gt 83 src gen Move F lt Diagram Type E test Rename FE Domain Diagram W Delete dae Freemarker Generator Task Remove fr
14. 2014 actifsource GmbH Switzerland all rights reserved matchingTypes Set of Type allowedProperties Property Set Returns the inherited or defined Properties of a Re source s Class allowedPropertiesForRead Property Set Returns the inherited or defined Properties of a Re source s Class including overridden Properties allowedAttributes Attribute Set Returns the inherited or defined Attributes of a Re source s Class allowedAttributesForRead Attribute Set Returns the inherited or defined Attributes of a Re source s Class including overridden Attributes allowedRelations Relation Set Returns the inherited or defined Relations of a Resource s Class allowedRelationsForRead Relation Set Returns the inherited or defined Relations of a Resource s Class including overridden Relations allowedToMeRelations Relation Set Returns the Relations having a Resource s Class as range 11 1 5 Select Functions for Extendable Function Return type Description isAbstractExtendable boolean Checks if an Extendable is abstract isFinalExtendable boolean Checks if an Extendable is final extensions Set of Extendable Returns the extending Resources extendedResource Set of Extendable Returns the extended Resources isExtension boolean Check if a Resource extends another Resource 11 1 6 Select Functions for Resource Property Function Return type Description attributeStatementOrNull Statement allowedPro
15. E run Event typeOf com actifsource statemachine generic Statemachine name Statemachinel 7 typeOf com actifsource statemachine generic Event run i event 2 stop Event j state 1 Stopped State i state 2 Running State state 3 Error State Use the following possibilities to expand collapse resources Device Action Mouse Klick the sign DoubleClick the property Context menu Open Close Folding Keyboard Enter Open Close Folding Backspace Close Folding 3 1 4 The typeOf Statement The typeOf statement of a resource shows the instantiation relation and declares the type of this resource 2014 actifsource GmbH Switzerland all rights reserved User Manual 35 E Statemachinel 3 0 Actifsource only allows a typeOf relation to resources of type Class 3 2 Read Only View ES Resource 32 E El ch actifsource core Resource Class typeOf ch actifsource core Class Resource comment aspect InidialirzationAspect aspect ResourceValidationAspect ResourceValidationAspect 1 JavaAspectimplementation aspect NameAspect extends ch actifsource core Resource mod fier property typeOf UseRelation definesAspect allowKRoot classicon icons Tresource png fillColor shape Deploying Actifsource Models as an Eclipse Plugin see Chapter 13 Plugin Project leads to a read only view of the models Models that are read only are displayed in gray colors Note that the Actifsource C
16. Text eG NameProvider variableNameg TokenToName Selector NameProvider NameProvider okenToName The Code Snippet tutorial available at http www actifsource com tutorials index html show how to imple ment a NameProvider by guiding you step by step through an example Implement a custom NameProvider In general one can implement and use a NameProvider as follows 1 Write a LiteralAspect e g MyNameProviderLiteralAspect in Java which implements ch actifsource core model aspects impl IGenericLiteralAspect lt MyNameProviderLiteralAspect gt import ch actifsource core INode import ch actifsource core Literal import ch actifsource core job IReadJobExecutor import ch actifsource core model aspects impl AbstractStatelessAspectImpl import ch actifsource core scope IResourceScope public class MyNameProviderLiteralAspect extends AbstractStatelessAspectImpl implements ch actifsource core model aspects impl IGenericLiteralAspect lt IMyNameProvider gt Override public boolean allowMultiline return false Override public String isValid IReadJobExecutor executor IResourceScope scope String value return null Override public Literal create IMyNameProvider node return new Literal node toString Override public String getJavaConstructionExpression IReadJobExecutor executor IResourceScope scope INode node return null Override public IMyNameProvider getValue IReadJobExecutor
17. b a ElementC ElementC name ElementB ElementB name ElementA ElementA name ae oh The problem is that a resource type of ElementC is also of type ElementB and ElementA Therefore the above template prints lines 2 3 and 4 for resources of type ElementC But the intention is that only line 2 is printed Use the break flag in the selector for the desired behavior If the break flag is set all subsequent context of the same level are skipped Users familiar with programming language C or C can think of the switch case break statement The following template prints line 2 for resource types of ElementC and then breaks the current iteration to continue with the next resource for Container element User Manual 116 Container EZ E 9 Build 3 Build aliContainer Container Y Container element ElementA ene es Selector ElementA ElementC Container name txt de Text Container name d a ElementC ElementC name A ElementB ElementB name A ElementA ElementA name 4 p btt 5 Please note that a context with a break flag is displayed with a ground beam ES 8 3 13 Line Attributes Use line attributes on a line context to control the output specific positions of a resource in a list Place the cursor on the desired line to apply a line attribute a S i aaa There are five different types of line attributes which might be applied to a line context Context Operation Icon Shortcut Description First ml
18. gt a SubChild subSubChi a Marquee 0 E 0 E _ a a BY com actifsource templateeditor i a Extension a E generic Child Relation gt Ah Design Note gt MyBuildContig Parent F New Class gt s SubChild z New Enum 3 SubSubChild Cy New Note 4 specific b E Parentl E a A b a Actifsource gt EBA JRE System Libre Copy Project Actifsource Project gt EE sre of Cut BuildConfig gt 8 src gen CE Paste Class Diagram Move Diagram Type Y d Rename Domain Diagram EY 1 item selected i Delete Freemarker Generator Task a Remove from Context Ctri Alt Shift Down FunctionSpace Package Resource PMR Eee eae E Resource Folder Template ti p Ti Template Folder Ty xPand Generator Task mi Other I L MA SA1 rif ala rra rn A esa rlar A al ri shte FACAOrFVO 2014 actifsource GmbH Switzerland all rights reserved SEF IVIianUd The New Template Wizard asks for the template name and even allows you to add a base type afterwards using the content assist Ctrl Space Adding a base type leads to a template based on a type see Chapter 8 2 1 Crea te a template based on type G F no Base Type is selected a singleton template will be created Resource Path com actifsource termplateeditor asre Package com actifsource templateeditor template Template Name MyTemplate BuildConfig com actifsource templateeditor genernic MyBuildConti
19. void identifyChild name Param name i f Todo hpp E A cpp 2014 actifsource GmbH Switzerland all rights reserved Navigate Context via Context Bar A context can also be selected by clicking on the context bar Parent El E 3 Build 3 Build ollParentParent HENAO gt E ProtectedContext Selector Parent child Break _ Parent nameImpl hpp C class Parent nameImpl i public void identifyChild name Param name 1 ff Todo Parent child Child hpp e cpp Add Context A new context is always added after the actually selected context Navigate to a certain context before insert ing a new context as shown above Let s assume that we want create a function identifyChild name for every child in the parent context For that reason we insert a new context using the Insert LineContext tool from the toolbar E Darent e A 3 Build gt Build ollParent Parent gt E Parent nameImpl hpp CH class Parent nameImpl i public o M al del hpp cpp As a second step you have to declare a selector see Chapter 8 3 12 Selector to define the context Since our base context is Parent we have to traverse the relation Parent child to reach all children from parent 1 Ls gt SS SubChild e FubSubehld _ ca sSubSubChild Choose the relation Parent child for the selector using content assist Ctrl Space Parent El E 3 Build 9 Buil
20. 1 6 Customize View Hierarchical ae Src b E sre gen Link with Editor Package Presentation Flat Focus on Active Task Flat Package Presentation H com ES com actifsource ES com actifsource statemachine H com actifsource statemachine generic ES com actifsource statemachine specific H com actifsource statemachine template Using the flat package presentation all packages are shown as a flat list Hierarchical Package Presentation 4 E com actifsource statemachine ES generic H specific ES template 2014 actifsource GmbH Switzerland all rights reserved Using the hierarchical package presentation the hierarchy is preserved Note that folders which do not contain files are shown flat anyhow This might lead to problems if you like to add new files or folders in a collapsed package Just switch to the flat package presentation to solve this problem 2 10 4 Drag and Drop Use drag and drop to move resources between packages All references to the resource are kept automatically j Project Explorer 2 E BS e gt a i com actifsource statemachine a E arc 4 EW com actifsource statemachine a E generic Pi Design A Event gt State gt Statemachine ine Pi Statemachinel E Statemachinel template statemachine gt BA Actifsource E JRE System Library JavaSE 1 6 src 2 src gen test 2 11 Project Explorer Context Menu The
21. AOR F t 9 5 2 Model backward access Using the selector syntax accessing the model backwards is quite easy see chapter 9 3 2 SelectorFunction by the minus sign Accessing the model backwards is also possible in the Java code For the model backward access use the static function selectToMeProperty on the class which defines the relation Since we want to access the relation Parent child backwards we have to choose the static method Par ent selectToMeChild providing the actual child as parameter As a result we get the parent of the given child MOverride public com actifsource design function modelaccess javamodel IParent getParent final com actifsource design Tunction modelaccess javamodel IChild child Begin Protected Regio 5623a133 c49a 11e3 a312 9d8ca9dd1829 End Protected Region 5623a133 c49a 11e3 a312 9d8ca9dd1829 h 9 5 3 Function access Use the extension mechanism to access any of your functions from within Java Code Note that the extension mechanism also supports polymorphic calls see chapter Fehler Verweisquelle konnte nicht gefunden wer den Fehler Verweisquelle konnte nicht gefunden werden Let s assume that we have a function filterChild as shown in chapter 9 5 1 Model forward access Let s write a Java function filterChildReverse which returns a reverse list of the filtered children based on filterChild For the function access use the extension function on the give
22. BRA Selector Build ollPorent F Parent namelmpl hpp C pre Farent name j class Parent nameImpl 1 public q Le hpp Da Le cpp void identifyChild name E The type name is inserted just as given The advantage of using type names in the template is the automatic renaming if the name of the type is changed La Parentllmpl hpp El pe Parent Parenti y gt class ParentlImpl public void identifyChildi void identifyChild void identifyChild3 4 1 mM User Manual 101 8 3 8 Open Link You can always open a resource link in the template editor AS ere Life l l g ommno Open Link with Default Editor Use one of the following methods to open a link in the default editor see Chapter 2 11 2 Open with Action Opens Description Ctrl Click Default Editor Press Ctrl Click on the link to open the resource F3 Default Editor Press F3 on the current cursor position to open the resource Default Editor Click Open Link in ResourceEditor from the toolbar on the current cursor position to open the resource To open a function link in the function editor use the default editor To open the function model use the re source editor see below Open Link with Resource Editor Use one of the following methods to open a link in the resource editor see Chapter 2 11 2 Open with Action Opens Description Ctri Alt Click Resource Editor Press Ctrl Click o
23. Dosa COMEX MEDUn adsa oa E e E EO oca 71 39 0 BROWSE RESOURCE sisas elias 73 Sn Browse Diadre E anes ntaenianoutyasatetaaeuameatiasasadeush auuattanassdeaenmesiateratedtacimancin 74 DOMAIN Diagram TY DC a A tus A A Aa 75 6 1 ONEVIEW aaua an n a a a a aa a 75 6 2 SOT IO N E E I A E N A E N E E E EEA A EE eee ot 75 6 3 FEU E aera RO 75 A me te ten eee PR O PEO A N 76 7 1 A a T tacanst gateea a uit emu aes naan s oacete tea nic eauneenu aoe Losaaejaeteoumethaeatnaecnaee 76 7 2 NEW BUNGE OND Setra ica 76 7 3 BUNOCONTIC and TareetEOl e 77 7 4 OUTDO UT ENCON ss aa 78 7 5 A A r teenensutcieuamancnal 79 7 6 Bulla Tas Ktm cra raoba 80 7 6 1 Template Generator Task da erpicadas 81 7 6 2 NestedBuldContigGeneratorTaS Kiara a 82 OO COPY T E E O 82 FOA DEC ripio 83 PO ExecuterrocessBulldTask ida di 84 ES GTIP AVB UI A A ecaaten 85 7 7 EIN SO aU NG AAA eo uo a NO 85 8 o O erec et cert 87 8 1 OV SVN dialectal 87 8 2 nn 87 8 2 1 Create a template based ON tyPe occcccccccncccccnnonoconnnnnnonnnononnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnanannnnnos 87 8 2 2 Create a BULU ONCE Template ia a 90 8 3 WRITING TEM e a db 92 SaL A O 92 A O e o A 92 So Tacita 94 SIA Fe iio 95 Sn DUNE COMO anar 96 O NA oie 98 8 3 7 Using type names in the template COJE cccooccccccoconcconcnnnnnnnnnnnanonononnnnononnnnnnanononnnnnnnnnnnnnnnaninonns 100 B S OPEL aida 101 8 3 9 Line Context Column Context Protected Context ooc
24. MyFunctionS pace extends metaModel g functionContext typeOt ch actifsource core selector type FunctionContext typeRef com actifsource design functionspace selector 5ubChild typeld function typeOf ch actifsource core selector typeSelectorFunction name getParent comment poram SubChild subChild child 7 return Type typeOf ch actifsource core selector type Class Type classRef com actifsource design functionspace selector Parent classid function functionContext List operators Actifsource provides you with the following operators which are defined on lists where the lists are given by Selector expressions Operator Description A union B The result is the concatenation of the two lists A and B For example a1 a2 union a3 a1 is equal to a1 a2 a3 a1 A intersect B Only elements found in A and in B where duplicates are preserved and the resulting order is given by A For example a1 a1 a2 a2 intersect a2 a1 a1 is equal to a1 a1 a2 A except B For all elements b in B the first occurrence of b in A is removed from A For example a2 a1 a3 a2 a1 except a1 a2 a1 is equal to a3 a2 All elements in A if a is not empty otherwise all elements in B For example a1 a2 else b1 b2 is equal to a1 a2 and else b1 b2 is equal to b1 b2 Note that you can use brackets to control precedence i e 4 x union A y intersect A z The result type of the union intersect and else operator is
25. New Enum Inserts a new enum on the diagram and in the model For other properties see also Chapter 4 6 2 ch actifsource core Enum New Note Inserts a new note on the diagram Click on the first text line of the note to enter the edit mode 3 Statemachine This is a note evente target transition Event k state 0 0 9 7 5 2 3 Drag and Drop Use the drag and drop feature from the project explorer to add an existing class to your diagram User Manual 62 File Edit View Navigate Search Project Run Window Help E Bri OO Pris vie B gn hao fo af 001 Quick Access J Magi E pl 29 Project Explorer 32 za e g Pi Design ES dl com actifsource statemachine j f asre a EY com actifsource statemachine 4 generic gt Pi Design gt E Event gt E State Statemachine Statemachine E Tension b specific gt template gt Ha Actifsource b JRE System Library JavaSE 1 6 b 2 src gt 3 src gen gt test 1 item selected 5 2 4 Context Menu Description Use the context menu on the diagram background 3 Statemachine O Palette li Select igi Marquee a Extension Relation Note E New Class New Enum i New Note Resource ch actifsource core ch actifsource core selector ch actifsource core selector element ch actifsource core selector metaelement ch actifsource co
26. O TO 155 10 3 NADU LAN WAS Sila 156 10 3 1 O AE ie dag eee 156 10 3 2 CMMUSCONAI OM at atone T A 156 10 3 3 TOKT PE i a a A 157 LOA COE SHIP DEL O de db 157 10 4 1 CONTENT ASSIS cineca eset ata aca ua eta ne niece bis 158 10 4 2 Vandation and ago tesco asss tad o nn A AE 160 10 5 Code Genera ON rara dira 161 10 5 1 Built Template FUNCION Sa Sas 161 10 5 2 Display Code SNIDPEES INDIA SLAMS uste 165 TE AW el Weeraciastecn hestacacenueencacnieee E ara iateeay alee E E E ENE E 166 LA Select Fassade e A E E iia 166 11 1 1 Select FUNCHONS TOF Propecia 166 11 1 2 Select FUNCTIONS TOF StATCMON din wai siedar ann easucadios ous deuvnedoue bas beveveenete 166 11 1 3 Selec FUNCTIONS TOR Clas S eatea vad eccttnsonsTetesoocantenqnsdauusdevaneyrpusticduneessutessyuceuamadunaluurensteeuagcnnuuosens 166 11 1 4 Select FUNCTIONS TOF RES OUNCE cosirer AR 167 11 1 5 Select Functions for Extendable ccccccccccccsssssseecccccsseeseeecccesseeeeeeeceeessaeeuseseceeessuagaeseseeeeeas 168 11 1 6 Select Functions for Resource Property ssssscccccsssssssescecccsscessseescccssccesssessccsssecesseessccses 168 11 1 7 select FUMCHONS TOF PACKE ici 169 11 1 8 Select Functions Tor Resource SOON 170 11 1 9 Additional Select FUNCION Sisa iia 170 T2 Code Generated a a cusco 171 U2 OVEN aee a EE EE E ER EA T 171 13 IP Pro eii do 172 13 1 OVERVICW ile acia 172 1 Overview 1 1 Working with models Actifsource is a comprehensive design and code
27. Object and Predicate given ment by Resource and Relation toMeStatements Set of State Returns the first Statement with given Object ment treeSelectObjects Set of Object Calculates the closure for given Resource and Relation topoSelectObjects Set of Object treeSelectSubjects Set of Object decoratableNodes Set of Re source 11 1 7 Select Functions for Package Function Return type Description allReferencedPackages Package allStatements Set of Statement Returns all the Statements in a Package allRequiredScopes Set of Statement allAvailableRequiredScopes Set of Resource Scope resourceByNameOrNull Resource Returns the Resource in the Package having a given simple Name User Manual 175 11 1 8 Select Functions for Resource Scope getScope Resource Scope Returns the Scope isRequired Set of Resource Scope E allResourcesInScope Unordered Set of Resource Returns all Resources reachable from a given Resource Scope allReferencedResourcesinScope Unordered Set of Resource classByName Java class Loads a Java class of given name classByNameOrNull Java class Loads a Java class of given name packagesInScope Set of Package unreferencedResource Set of Resource with Pack F ai Class Returns the direct and indirect Types of a Resource 11 1 9 Additional Select Functions Function Return type Description getScope Resource Scope Returns the Scope o o _getRequiredScopes _ SetofResourceSco
28. Property Returns the inherited or defined Properties of a Class allowedPropertiesOfTypeForRead Set of Property Returns the inherited or defined Properties of a Class including the overridden Properties allowedAttributesOfType Set of Attribute Returns the inherited or defined Attributes of a 2014 actifsource GmbH Switzerland all rights reserved User Manual 172 Class allowedAttributesOfTypeForRead Set of Attribute Returns the inherited or defined Attributes of a allowedRelationsOfType allowedRelationsOfTypeForRead isAbstractClass isFinalClass isSubclass subclasses superclasses matchingInstances isMatchingObjectFilter matchingSuperTypes matchingSubTypes isMatchingSuperType rangeToType Set of Attribute boolean boolean Set of Type Set of Resource with Package Set of Resource with Package Set of Type Set of Attribute Class including the overridden Attributes Returns the inherited or defined Relations of a Class Returns the inherited or defined Relations of a Class including overridden Relations Checks if a Class is abstract Checks if a Class is final Checks if a Class extends another Class Returns the Sub Classes of a given Class Returns the Super Classes of a given Class Filter on Resource Set of Type Set of Type boolean Set of Type 11 1 4 Select Functions for Resource Function exists packages mainPackage asPackagedResource asPackagedR
29. Python Ruby Scala Sql StructuredText Svg Text Description Microsoft C Sharp Cascading Style Sheet http www graphviz or Hyper Text Markup Language www omg org gettinestarted omg idl htm Structured Query Language for RDBMS http en wikipedia org wiki Structured text Scalable Vector Graphics Plain text 2014 actifsource GmbH Switzerland all rights reserved File Name Extension ada c h CS cpp hpp cob CSS erl hrl ot groovy hs html xtml java mod VisualBasic Microsoft Visual Basic Xml Extensible Markup Language 8 4 2 TemplateLanguage Model vb vba To create your own template language model just instantiate the class TemplateLanguage typeOt name fileNameExtension 1 TileNameExtension 2 hpp fueMomelxtension j keyword5tyle 1 KeywordStyle keyword5tyle 2 KeywordStyle keyword Style i stringStyle 1 StringStyle stringStyle 2 StringStyle stringStyle singleLineComment SingleLineComment singleLineComment multilineComment MultiLineComment file NameExtension The file name extension of the template language is used to automatically select the language line see Chapter 8 3 3 Language Line from the file extension in the file line see Chapter 8 3 2 File Line keywordStyle A list of keywords including the syntax style color font modifier KeywordStyle typeOt SyntaxStyle color RoyalBlue fontModifier Bold Fo
30. Settings com actifsource statemachine asre Proje kspace_usermanual com actifsource statemachine asre 9 Januar 2014 15 08 09 Attributes Read only Fl Archive E Derived Text file encoding Inherited from container Cp1252 Other Cp1252 Restore Defaults type filter text Workspace General See Startup and Shutdown for workspace startup and shutdown preferences gt Appearance Capabilities Compare Patch Build automatically Content Types Refresh using native hooks or polling Editors Refresh on access Keys Save automatically before build i MEOE GONE F Always close unrelated projects without prompt Perspectives Search gt Security Workspace save interval in minutes 4 gt Startup and Shutdov Tracing Workspace name shown in window title Web Browser a Open referenced projects when a project amp opened O Always Never Prompt C C Text file encoding New text file line delimiter ChangeLog Default Cp1252 Default Windows FreeMarker Editor DSL Other Cp1252 A Other Windows b Help p Install Updat A Restore Defaults Apply 7 5 Line Break For every build configuration you may select the line break style User Manual 80 EE StatemachineBuildConfig 2 E com actifsource statemachine generic StatemachineBuildConfig BuikdContfig typeof BuildConfig name StatemachineBuildContig description outputE
31. Target Folder Generated code is written to target folders You might specify any existing or new folder in your project as a target folder Project Settings Setup your project GE Resource Paths amp Target Folders L Template Folders 13 Project Dependencies i Built in Dependencies a amp fs o 62 Add TametFolder lt all templates and all resources in project gt Add BuilldContig Add Package E ignore whitespaces F execute saveactions Add Target Folder Adds a new target folder to your project Add Build Config Adds a new build configuration to your target folder A build configuration is kind of a make file that tells actifsource which templates to build If no build configura tion is defined Actifsource automatically generates code for all templates from the current project combined with all matching resources from the current project see Chapter 7 Build Config see Chapter 8 Template Edi tor Add Package Adds a new package to your build configuration Code is only generated for matching resources found in the specified packages e com actifsource statemachine specific all resources in the package e com actifsource statemachine specific all resources in the package and its subpackages If no package is defined Actifsource generates code for all matching resources found in all packages of the current project Note that you need to reference packages from
32. The comment text literal let you comment your classes and literals Comments are shown in tooltips when hovering the mouse pointer over class and property names Note that the comment property is inherited by extending from Commentable Extending from Commentable allows writing comment for any resource and activates the tooltip functionality aspect InitializationAspect The initialization aspect initializes a resource during creation To be provided as Java class aspect ResourceValidationAspect The resource validation aspect defines specific validation rules for a resource To be provided as Java class aspect NameAspect The name aspect defines the name of a resource To be provided as Java class or in the simple selector syntax Note that you might define a selector aspect pointing to a TemplateFunction see Chapter 9 3 6 TemplateFunc tion or a TemplateLineFunction see Chapter 9 3 7 TemplateLineFunction extends Defines the base class and inherits all properties when instantiating modifier The modifier defines if a class can be instantiated or sub classed Modifier Description Abstract No instance allowed of this class Final No subclass allowed of this class property Defines the property of this class Properties carry the data when instantiating the class Choose the property type you need see also Chapter O Property a Type Selection Choose the type of the new object Ea Attribute ch actifsource core
33. built in templates or writing them from scratch The behavior of the built in tem plate functions can be customized by overwriting the way names of variables and functions are created see Section Overwrite Variable and Function Names Name Provider below 10 5 1 Built in Template Functions Actifsource provides the following built in template functions which are defined on resources of type ch actifsource codesnippet metamodel element CodeSnippet e codeSnippetToST generates Structured Text from a CodeSnippet with input language CMinus or CMi nusCondition e codeSnippetToC generates C code from a CodeSnippet with input language CMinus or CMinusCondi tion e codeSnippetToText generates code from a CodeSnippet with input language Text unvalidated code e codeSnippetToFormattedC generates formatted C code HTML from a CodeSnippet with input lan guage CMinus or CMinusCondition the actual code is the p e codeSnippetToVHDL generates VHDL code from a generates C code from a CodeSnippet with input language CMinus or CMinusCondition For all the above template functions the names of variables and functions in the output code are generated by calling the function simpleName BuiltIn on the corresponding resource Note that the above template functions which are written for input languages CMinus and CMinusCondition can also be applied to Text The output is the same as when calling the function codeSnippetToText in this case Overwrite
34. can sort according to any literal attribute i e name 74 Project Explorer 53 E BS e 7 d Te com actifsource statemachine a d O ASTE a amp com actifsource statemachine b EH generic a EY specific 4 H Statemachinel New gt mm state Open With H template E Cut Paste Move Rename Delete Show JavaClassMame for Selection DEV Sort Property Note that you have to switch on Group Aggregation By Relation see Chapter 2 10 2 Actifsource Presentation to see the relations 2 12 Actifsource Views 2 12 1 AQL Query 3 AOL Query E a A execute The Actifsource Query Language let you query the model TODO FAN MA YN nf _ A E pu L 1 o Cc yf arritenirra FC maL Curas 2014 actitsource GMDH 2 12 2 Hierarchy Ta Hierarchy a 9 NamedResource ch actifsource core gt amp Resource ch actifsource core Shows the hierarchy between resources 2 12 3 Model Inconsistencies Model Inconsistencies 3 Z E Description Resource Statement Attribute name must be defined at least once 9510ca01 79df 11e3 b637 113462b2fd40 9510ca01 79df 11e3 b637 113462b2fd40 name 4 m P Shows all model inconsistencies calculated by the validator Make sure that this view is always visible to check whether your model is valid or not Note that the code generator could throw an exception if your model is invalid 2 12 4 Model Navigator E Model Navigator EZ
35. component Note the indention of two spaces on line 2 Actifsource takes care of the indentions so that the whole content of the template function is indented T asText ES E iT this Component Gita Break Text Component name Component t b Component asText We can now call our template function from a template If there is a call to a function from another function space the function space is explicitly stated using the notation myFunction MyFunctionSpace 2014 actifsource GmbH Switzerland all rights reserved T Client 23 E 2g Build 5 Bulld aliCient Client 2g Client component Component Selector Client comp Break El bd ES Next we create an instance of type Client containing composites and leaves The output from the above tem plate might look as follows Note that the indention is applied recursively Clientl bd El E Compositel Composite Compositel 1 Composite Leafl 1 a Leaf A Leafl 1 b Leaf F Compositel 2 Composite Leaf1 7 a Leaf Leafl 2 b Leaf d t 9 3 7 TemplateLineFunction The template line function behaves like a template but without the possibility to set contexts see Chapter 8 3 9 Line Context Column Context Protected Context The template line allows you to create simple single line texts as for name aspects see Chapter 4 6 1 ch actifsource core Class Consider a resource Person with two string literals firstName and LastNam
36. defined on types with an abstract modifier see Chapter 4 6 1 ch actifsource core Class For an abstract function there must be non abstract function for any non abstract subclass in the same func tion space or in a function space that extends it typeOf ch actifsource core selector type FunctionSpace name MyFunctionSpace extends metaMode m functionContext 1 type ch actifsource core selector type FunctionContext com actifsource design functionspace abstractfunction MyClass a functionContext 2 typeOf ch actifsource core selector type FunctionContext typeRef com actifsource design functionspace abstractfunction MySubClass identity TemplateFunction function Context 9 3 2 SelectorFunction Selector functions allow you to navigate the model by using the selector syntax Starting from a Class defined by FunctionContext typeRef you may navigate via the resource properties Selectors might be used in Templates to select a context But selectors might also be called from within selec tors even recursively User Manual 137 Forward navigation Consider the following meta model 1 We like to define a selector function named getSubChild on Parent which returns all sub children in all children of the parent The return type when navigating along a property is given by the range of the property i e in our example the expected return type is a list of elements of type SubChild To navigate from Parent via chi
37. extending from Resource Relation Inserts a relation from a class to another Select one of the relation types or a base relation Selecting a base relation automatically selects the relation type needed see Chapter O Property Create New Relation Creates a New Relation Marne Base Relation opt DecoratingRelation ch actifsource core Relation Type OwnRelation ch actifsource core UseRelation ch actifsource core Subject Cardinality ch actifsource core Cardinality0_N Object Cardinality ch actifsource core Cardinality0_N Cancel Note Connects class to any note See also New Note New Class Inserts a new class on the diagram and in the model Note that the preselected namespace package and or containing resource is the same as the package of the class diagram Note that you can directly select the super class in this dialog While NamedResource is the default you may select Resource to create an unnamed resource or any other Class For other properties see also Chapter 4 6 1 ch actifsource core Class a New Resource Wizard Actifsource Resource Creates a new actifsource resource of some type in the specified location Resource Path com actifsource statemachine asrc Namespace com actifsource statemachine generic ch actifsource core Class Mame Modifiers Abstract Final SuperClass ch actifsource core NamedResource Finish Cancel
38. generator tool covering all aspects of domain driven software development from domain analysis through to the design models code generating testing refactoring and maintenance Actifsource allows you to define your domain specific software specification Let s Build Your Domain Specific Modeling Tool That Turns Your Software Specification Into Running Code This software specification is also called domain model or specific model The domain model shall be inde pendent from any used technology i e programming language operating system etc Domain Model Software Specification As the domain model is domain specific by definition we need to specify the structure for every domain This task is done in the so called meta model Meta Model Domain Model Software Specification The meta model is built upon concepts of the Actifsource core model aka Meta Meta Model Note that the core model is self describing i e it is the meta model of itself Core Model Meta Meta Model Meta Model To find an adequate meta model you need to analyze your business domain If you like to create a Service Oriented Architecture SAO your meta model might will contain services If you like to model state machines your meta model will define states event and transitions Note that the Meta Model is an abstraction of your business domain and defines the business classes and their relationships As we do
39. generic Statemachine i typeOf i event 1 run Event i event 2 stop Event y mE 1 typeOf com actifsource statemachine generic State name Stopped A nee typeOf com actifsource statemachine generic Transition event com actifsource statemachine specitic statemachinel run transition stop j state 2 Running State state 3 Error State Property Aggregated Resource Referenced Resource 3 1 1 Aggregated vs Referenced Resource Actifsource distinguish between aggregated and referenced resources An aggregated resource lives in the context of the parent resource Deleting the parent resource will delete all aggregated resources Referenced resource may live anywhere in the model and are just referenced Delete the referencing class will not affect the lifetime of the referenced resource 3 1 2 Property All information is grouped by properties see also Chapter O Property Actifsource distinguish the following property types User Manual 34 Class Meaning Property Base class for all properties Relation Base class for all relations OwnRelation Leads to aggregated resources UML Aggregation Composition UseRelation Leads to referenced resources UML Association Attribute Primitive literals String Boolean Integer etc 3 1 3 Open Close Folding To work with large resources efficiently Actifsource can expand or collapse aggregated resources Statemachinel 2 E E E Maa Aa aba
40. is the concatenation of the two lists A and B For example a1 a2 union a3 a1 is equal to a1 a2 a3 a1 A intersect B Only elements found in A and in B where duplicates are preserved and the resulting order is given by A For example a1 a1 a2 a2 intersect a2 a1 a1 is equal to a1 a1 a2 A except B For all elements b in B the first occurrence of b in A is removed from A For example a2 a1 a3 a2 a1 except a1 a2 a1 is equal to a3 a2 All elements in A if a is not empty otherwise all elements in B For example a1 a2 else b1 b2 is equal to a1 a2 and else b1 b2 is equal to b1 b2 Note that you can use brackets to control precedence i e 4 x union A y intersect A z The result type of the union intersect and else operator is the most concrete supertype of the type of the two operands e g if A is of type NamedResource and B is of type Resource then A intersect B A union B and A else B are all of type Re source Down Cast Consider the following meta model 0 yaw gt if ala esa C2 mh A nae ImArinr A al ri shte FOCOAVK IO 2014 actifsource GmbH Switzerland all rights reserved If you only like to get Leaf components from the Client just use the type cast operator colon typeOt ch actifsource core selector type FunctionContext typeRef com actifsource design functionspace selector Client typeld p function typeOt ch actifsource core selector type SelectorFunction name allleaf co
41. on all views Plug in Development t Remote Systems t Run Debug Spectile Editor Team Terminal Tracing Make sure to enable Show Max Heap to track the maximum memory usage by using the context menu on the heap status display S actifsource Eclipse SDK File Edit View Navigate Search Project Debug Run Window Help m E 3 E E ey Owe eo eel q o gt ds ee heh od or E OO v Quick Access 1 Ej A actifsource fy Project Explorer 2 m E Statemachinel E Statemachinel Statemachinel EZ 4 E 5 e 7 gt a i com actifsource statemachi h EA a E asc 7 a EH com actifsource stat WL Edit b EH generic oi Marquee b EH specific ee gt EH template gt Be Actifsource E State b A JRE System Library Java T A Search gt ge sre 2 gt sre gen E test Relation we Rew Description 4 uu 0 items selected Set Mark Clear Mark 2014 actifsource GmbH Switzerland all rights reserved 2 3 Perspectives Since Eclipse is a general software development tool you must be able to select different perspectives Make sure that the Actifsource Perspective is selected when working with Actifsource actifsource Eclipse File Edit Navigate Search Project Run Window Help Ti TI Bei Re Orie eo ese A Quick Access Ey Project Explo 22 O ESS 7 Model Inconsistencies 13 Description Resource 2 4 Actifsource Preferences The preferences dialog Window P
42. on the left side which indicates that there is a Quick Assist available Click on the light bulb or press Ctrl 1 to open the Quick Assist User Manual 121 T Parent El E 3 Buik BEA Selector Build allParent Break _ el Parent nameImpl hpp CH d g class EE i a Extract JavaFunction public void identifyChi fe Extract TemplateLineFunction ff Extract TemplateFunction al b el hpp E cpp 8 3 17 Context Path The path from the outermost to the innermost context is called Context Path Actifsource uses the Context Path to determine the parameters of a function see Chapter 9 2 1 Function Parameters Consider the following meta model The subsequent template shows nested contexts based on the above meta model Please note that the bread crumb displays the context path for the actual cursor position ContextPath 2 E r 3 Build 5 Build ollA A SAB HB cc gt SN Selector C d Break _ The template shows the following context paths Line Context Path Line 2 A B Line 3 A B C Line 4 A B C D 2014 actifsource GmbH Switzerland all rights reserved Calling a function with parameters is only allowed if the context path is matching The following function f D C B A is based on Class D and declaring the parameters c of type C b of type B and a of type A typeOt chactifsource core selector type FunctionContext com actifsource design template contextpat
43. resources of type Template 2 11 3 Rename Resources and Packages Renae Accor Reso O OOOO Mew Name Statemachine Mew name must be different from old name Cancel You may rename any resource or package via the context menu rename or by pressing F2 Windows 2 11 4 Generic Refactoring If you change your meta model any depending domain model might become invalid Actifsource lets you regis ter a piece of Java code which transforms all existing domain models to fit the new meta model REF Actifsource also uses this feature intensely if there are changes in the core model meta meta model Please make sure to check the release notes to see if you need to run a Generic Refactoring after updating to a new Actifsource Version Actifsource Refactoring Select a Refactorer 09 09 2015 Update Cip Process extensions from 5 8 5 to 5 8 6 17 09 2015 Set language of FileContext TemplateFunction explicitly in Model 19 09 2013 Remove commentstart lagcommentEndTag from BuildConfig 11 10 2013 Update Cip Diagram Style 07 11 2013 Convert SubRelations to normal Qwn Use Relations 13 12 2015 Remove relationMode from all relations 2 11 5 Compare With eo Compare 23f4ddef 793e 11 e3 9694 211 d197 b4cb0 asr Current and Local Revi ES 0 E Actifsource Resource Compare Y lt a El Ad A typeOf Statemachine typeOf Statemachine name Statemachinel name Statemachinel event l Eventl E
44. selector type FunctionContext typeRef com actifsource design functionspace MyClass typeld function identify TemplateFunction function functionContext 2 typeOf ch actifsource core selector type FunctionContext typeRef com actifsource design functionspace MySubClass typeld function identify TemplateFunction function functionContest 9 2 4 Non Polymorphic calls There are situations where polymorphic calls are not desired You have to disable polymorphic calls on every caller Use the context menu Change to non virtual call on the function typeOt name extends metaModel functionContext 1 functionContext 2 functionContext chactifsource core selector type FunctionSpace MyFunctionS pace typeOf typeRet typeld function 1 function 2 function typeOf typeRef typeld function function ch actifsource core selector typ com actifsource design function ch actifsource core selector type FunctionContext com actifsource design functionspace abstractfunction MyClass typeOf SelectorFunction comment param _ yclassidentifyo return Type StringLiterz z 3 Open link in ResourceEditor identity AbstractFunction Open ContentAssist Ctrl Space Open QuickAssist Ctrl 1 Ctrl X Ctrl C identify TemplateFunction Ctrl V Copy GUID as Constant Copy GUID Change to Non Virtual Call A small arrow indicates the non polymorphic call typeOt name comment param selector r
45. shipped as Eclipse Plugin Please make sure to install Eclipse first Choose Help Install new Soft ware to install Actifsource from one of the following Eclipse Update Sites e http www actifsource com updates Community Edition e http www actifsource com updates enterprise Enterprise Edition password protected If you are not familiar with the Eclipse environment please consult the Actifsource Tutorial Installing Actifsource 2 2 Memory Usage The Actifsource technology allows you to track any keystroke in real time As a result of this feature the memory consumption might be quite high for larger models Make sure to adopt the memory given to Eclipse if necessary in the eclipse ini file in the Eclipse directory We suggest at least 4 GB of ram a eclipse ini Editor Datei Bearbeiten Format Ansicht openFi le launcher appendvmargs vmar gs Dosgqi requiredjJavaversion 1 6 XX MaxPerms1ze 256m UseconcMarksweepGc XxX CM5INncrementalMode To observe the memory while working with Actifsource enable Window Preferences General Show heap sta tus User Manual 13 General L Always run in background source Ant C C ChangeLog Workbench save interval in minutes 5 FreeMarker Editor DSL Help Install Update Open mode Double click b Java Single click b Library Hover Select on hover Model Validation _ Open when using arrow keys Mylyn Note This preference may not take effect
46. snippet are temporary resources they are only visible for the code generator To use the content of code snippets in diagrams Actifsource provides template functions which allow you to display the code in diagrams e displayCodeSnippet e displayCodeSnippetSingleLine These TemplateFunctions show the unprocessed code as it is entered by the user in the code snippet editor Both functions are defined on resources of type ch actifsource codesnippet metamodel element CodeSnippet An example application of these functions can be found in the Actifsource Tutorial Code Snippets at http www actifsource com tutorials index html User Manual 171 11 Java API 11 1 Select Fassade 11 1 1 Select Functions for Property Function Return type Description rangeOrNull Class Returns a Property s range gt ownerOrNull Class Returns a Property s domain isOwnRelation boolean Check if a Property is an OwnRelation isDecoratingRelation boolean Check if a Property is a DecoratingRelation isSubRelation boolean Checks if a Relation extends another Relation isComposition boolean Checks if a Relation is a Composition superRelations Set of Relation Returns the Relations a Relation extends subRelations Set of Relation Returns the Relations that extend a given Relation rootProperty Relation Returns the first Properties of the Set of Properties a Proper ty extends including itself rootRelation Relation Returns the first Relations of
47. the most concrete supertype of the type of the two operands e g if A is of type NamedResource and B is of type Resource then A intersect B A union B and A else B are all of type Re source Down Cast Consider the following meta model 0 yaw gt if ala esa C2 mh A nae ImArinr A al ri shte FOCOAVK IO 2014 actifsource GmbH Switzerland all rights reserved If you only like to get Leaf components from the Client just use the type cast operator colon typeOt ch actifsource core selector type FunctionContext typeRef com actifsource design functionspace selector Client typeld p function typeOt ch actifsource core selector type SelectorFunction name allleaf comment param Client component Leaf lt FeturnType typeOf ch actifsource core selector type ListType innerTypeRef com actifsource design functionspace selector Leat innerTypeld function Up Cast It is always possible to use an upcast to a base class i e Resource or NamedResource if needed Self Cast If your selector has to return the typeRef instance itself use the self cast Consider the following selector func tion for Component returning the component instance itself typeOt chactifsource core selector type FunctionContext typeRef com actifsource design functionspace selector Component typeld 7 function typeOf chactifsource core selector type SelectorFunction name self comment param selector Component Composit 7 feturnType typeOf cha
48. with GCC 2014 actifsource GmbH Switzerland all rights reserved User Manual 177 13 Plugin Project 13 1 Overview 2014 actifsource GmbH Switzerland all rights reserved
49. writing meta code based on the class Parent To create a template based on the class Parent simply choose New Template from the context menu of the class Parent 0 n1 arrife m esa lC mnh L A nae ImArinr A al ri shte FOCOAVK IO 2014 actifsource GmbH Switzerland all rights reserved User Manual 88 4 3 tifsource com acti File Edit View Navigate Search Project Debug Run Window Help EA AAA v mo 075 Be hi Di one Iii Quick Access l E ZA actifsource Project Explorer 53 m Pi Design 5 E Parentl El 5 gt 2 Palette gt gt es com actifsource statemachine N Select d r com actifsource templateeditor a EE asre a BY com actifsource templateeditor a E generic E Child gt Pi Design Note Eq MyBuildConfig Parent E New Class a hil gt hi i hile gt SubChi 1 ubSubChild EH Marquee a Extension Relation gt ES Al New IES Prec pa 5 VERAZ Jew Note 4 spe Open Actifsource Project b E Open With Class Diagram it te b Bm Actifsourc Copy Diagram Type Domain Diagrarn amp rs rs rs File cs d Di t gt JRE Syster of Cut eg g src Faste El gt 3 sre gen FE Folder Freemarker Generator Task Rename a 4 m X Delete Folder l Remove from Context Ctrl Alt Shitt Down Peebles bret a 1 item selected xPand Generator Task g Import ih e The New Template Wizard he
50. 12 which defines a list of resources Additionally it allows you to choose a tokenType which is either e ch actifsource codesnippet metamodel TokenType Variable for variables or e ch actifsource codesnippet metamodel TokenType Function for functions a token 1 typeOf ch actifsource codesnippet metamodel RelationTokenProvider selector Transition transition state variable tokenType ch actifsource codesnippet metamodel TokenType Variable subtoken For variables you can define sub tokens The definition of sub tokens instructs the Content Assist to propose all resources defined by the selector of the sub token when you insert a after a token This means that sub tokens can be used to insert resources as identifiers of fields in structs where the token corresponds to the struct and the sub token to the field for details see Section O below 10 3 Input Languages At the moment the following languages are available C CMinusCondition and Text 10 3 1 C The language C is a proper subset of the language ANSI C It has the following restrictions C supports no declarations of variables functions or types C does not support the use of pointers and addresses C does not support type casts a a a C does not support conditional statements Expression Expression Expression However they can easily be replaced by equivalent if statements 5 The comma operators is not supported i e expressions such as a X 2 2 4
51. 2 b Foo x y 2 y are not valid 6 Postfix and prefix increment and decrement operators are not supported C supports access to fields of structs As identifiers for fields either variables or arbitrary identifiers are valid The Content Assist provides proposals for fields of structs if the variable definitions are created accordingly see Section 10 4 1 C knows the following list of keywords break else switch return continue for default do if while until case Furthermore the language knows the following operators Infix Operators amp amp amp lt gt lt gt lt lt gt gt Prefix Operators Assignment Operators t lt lt gt gt amp 10 3 2 CminusCondition A code snippet with CMinusCondition allows the user to input a conditional expression as in ANSI C e g a rela tional or equality expression while the same restrictions apply as for C details see Section 10 3 1 Such an expression can then be used for example as the condition in an if statement 10 3 3 Text Text allows the user to insert arbitrary text with resources added as either variables or functions This language should only be used if C is too restrictive and validation of the input code is not required The input code is syntactically not validated and the resulting parse tree is very simple 3 CompilationUnit A Te
52. 4 actifsource GmbH Switzerland all rights reserved Note that you can open the resource for any GUID in an Eclipse text editor or in the Eclipse console by Ctrl Click on the GUID h Statemachinel hpp 2 2 class Statemachinel a public enum State Stopped Running Error mstate void run void stop te Actifsource 10A 7b973890 79e0 113462b2fd40 J23f4ddef 793e 11e3 9694 211d197b4cbe G dl rr p 7 6 2 NestedBuildConfigGeneratorTask The nested build configurator task let you reference and execute existing build configurations typeOf BuildContig name StatemachineBuildContig desenption outputincoding lineBreak buildTask typeOf NestedBuildConfigGeneratorTask buildConfig 1 CIP Staternachine buildConfig 2 CIP_C TestSuite_Console buddConfig targetSubPath cip src build Task Build Config References any existing build configuration Target Sub Path Defines a sub path to the target folder see also Chapter 2 5 3 Target Folder 7 6 3 CopyTask Copies a file or a folder to a specified target path Please note that this tasks needs a built in dependency to WORKSPACE see Chapter 2 5 6 Built in Dependencies User Manual 83 typeOf BuildContfig name StatemachineBuildContig descnpiion outputincoding line Break buildTask 11 typeOf Fesource recursive mergeDuplicateFolders target build Task Resource The file or folder to copy There ar
53. 8cTed4 7 1 Toda End Protected Region a 4e8786 a85e 11e3 8e23 57T188cTed4 i a void identifyChild3 Begin Protected Region 20963fla a85e 11e3 8e23 65 f188cfed4 11 Todo End Protected Region 28 963fla a55e 11e3 8e23 65 f188cfed4 a I a AAA idi actiTtsource GMDA y IWILLZE iu d PIS tls reserved The protected context consists of one or more lines in a file The text in the protected context is repeated for any resource reached by the selector see Chapter 8 3 10 Working with Context and generated To insert a protected context use the Insert ProtectedContext tool from the toolbar Parent El E Build gt Build allParent Parent Y Parent child Child gt FEAS Id Contexts Parent w Child Name e Parent nameImpl hpp a C class Parent nameImpl public void identifyChild name Param name hpp Le cpp Note that you can control the GUIDs that identify the protected regions by checking the resources in the con text path Just make sure that the resulting set of GUIDs is unique in your generated file You might also define a name for the Protected Region Parent El E Build Build allParent Parent Y Parent child Child PEA Parent nameImpl hpp gt CH class Parent nameImpl i public void identifyChild name Param name 1 Todo hpp Le cpp Please note that changing the name of the Protected Re
54. Alt 1 The first element of the iteration Not First E Alt 2 All elements of the iteration except the first Not Last m Alt 3 All elements of the iteration except the last Last uo Alt 4 The last element of the iteration Empty Alt 5 For empty iterations The following template prints the comment on line 7 only for the first element of the iteration over the list Parent child Please note that line 7 is not printed if Parent child is empty ra 2014 actifsource SMbH Switzerland all rights reserved T Parent 3 E 3 Build gt 9 Build allPorent Parent E E Selector Parent child Break _ Farent nameImpl hpp fa C per a r class Parent nameImpl Parent Parent name W public lc hpp 2 Le cpp The following example prints a comment on line 8 if Parent child is empty Parent 3 ae 3 Build 9 Build aliParent Parent E PAE Selector Parent child Break F Parent nameImpl hpp a CH PRE a class Parent nameImpl i public Identify methods j No identify methods Parent Parent name m void identifyChild name Le hpp Es Le Cpp 8 3 14 Column Attributes Use column attributes on a column context to control the output specific positions of a resource in a list Select the desired characters to apply a line attribute A lif 2 f0 mm0 O0 There are five different types of column attr
55. INSErE ON TNE EMPEY IN A Ai 37 S522 Insert before OF aner Properties milano 38 3 6 Rererence Tesouro 39 3 7 New reterenccd TESQUICE tiraron a 40 3 8 MOVe esquiar acosa 40 3 9 SOTELO DEV oe dlsics 41 310 QUICK ASSIS ano a cee lot ncese daa cee oes aca duende enue eae 41 Core Model Meta Meta Model usada add 43 4 1 VET VIC Wenna dd 43 4 2 Rescue di a acid 43 4 3 aii 44 4 4 A stats E E EE E E E E E E 44 AAL O O 45 4A 2 A A A teens tmenew ede tuleancies 46 BAS TEO oa 46 AAA UPRO e e lee LES 47 O ere O teas cae uacaoniaddacuaassincnay daaeeangsecatvelt A coats tnaenaususeartucensaane 48 AAG DecoratingRela Ona 49 All CCOO dd do 52 AS ARDU a a a eect diaum Wea taiedaduaedceaeat iat meee eleadodutetaaiens 53 4 5 AOStra c Pa a aa r nO en ee a a eet eee ee nee 54 4 6 Sol a Serrin iieiea a bons ae Meats waned ene dameneeseaeidsaceaaneees 54 A Od CA CHISOUNCE core CLASS oic ene hetaarsasteacanatatannsavenad ana tadaa nauauadine ue E 54 410 2 Macin ource CONE Uni iii 56 MA O aia aaa easionae ues wa adauanean esabia sie edumeaes at aaatecaieertia 58 5 1 A aden ost E S a A A A 58 5 2 Glass DIaeram Edito E E O E A O 58 iz NEW CSS Di 58 SPA A A 58 zea DRAE ahd DIO iii 61 Dstt COMA MICA iia 62 5 29 Class Context Mena ai 62 LO BROWSE RESQUICO ardido dd 64 5 3 DOM li DIAS rath Ei as 65 SL NEW DO Malia Didera ee a a aca 65 53 2 NeW DOMAIN Diagram tor RESOURCE satan 68 O ma meanonececea tease 69 534 Drag and DROP oda 70
56. Note that the TemplateFunctions presented in Section 10 5 1 generate the names by internally calling the name functions variableName and functionName on ch actifsource codesnippet metamodel parsetree template NameProvider the default NameProvider Thus overwriting these functions in a FunctionSpace that extends TokenToName for the type NameProvider see example below also changes the behavior of this TemplateFunctions without NameProvider e g toC CodeSnippetToCode This can in particular change the behavior of already existing templates and tem plate functions Therefore this approach should normally be avoided and a customized NameProvider imple mented instead typeOf ch actifsource core selector type FunctionSpace name NameFunctions extends TokenToMame extends metaModel a functionContext 1 typeOf ch actifsource core selector type FunctionContext typeRet ch actifsource codesnippet metamodel parsetree template MameProvider typeld y function 1 typeOf TemplateLineFunction name variableName comment H param resource Param param text warPrefix_ResourcesimpleName Buutin function 2 TemplateLineFunction functionName resource Param funPrefix_Resource simpleName builtin Figure 1 FunctionSpace that extends TokenToName with functions overwriting the name functions on the built in default NameProvider 10 5 2 Display Code Snippets in Diagrams Since the parse trees created from the input code of a code
57. Region e52flebe 8a64 11e3 af9e fd317997ec11 Actifsource ID 5349246f db37 11de 82b8 17be2e034a3b dfc79b23 8a64 11e3 af9e fd317997ec11 B 57yazs0KpdkZOd20J307dU9LMw As function arguments an instance of type FunctionContext typeRef and all parameters are passed Use the Java content assist Ctrl Space to display available functions To access properties choose my Class selectMyProperty For more information on how to access the Javamodel see Chapter 9 5 Return Types e returnType l 1 3 TypeOrTypeReference eS TypeReference i 5 GenericContextType GenericContextListType 5 SimpleType 3 ListType A Java function has a return type which is either a Type or a TypeReference A Type is either a SimpleType or a ListType A SimpleType can in particular be a ClassType which references any Class or a LiteralType which references any Literal For a LiteralType the return type of the generated Java function is the Java class given by the return value of the method getValueType of the ILiteralAspect e g in the example above the LiteralAspect of StringLiterals ch actifsource core model aspects impl String StringLiteralAspect defines that java lang String represents StringLiterals and therefore the the return type of identify is java lang String A ListType references either a Class or a Literal more precisely it actually references an AbstractType The return type of the generated Java function is th
58. Single Line TextContent Generator Empty Line StyleConfiguration Line 1 Line 1 Text AE Line 2 Line 2 Text ae ae Closed Aggregation 1 instancel Typel ChangeLog Closed Aggregation 2 instance Type FreeMarker Editor DSL gt Expanded Aggregation 1 gt Help A gt Install Update Expanded Aggregation 2 line in resource gt Java gt Library Hover gt Model Validation gt Mylyn gt Remote Systems gt Run Debug b Specfile Editor Profile Terminal t Tracing O Profile Shows all built in and user defined profiles Edit Edit user defined profiles Note that you cannot edit built in profiles Copy Copy built in or user defined profiles Use copy on a built in profile to create a user defined profile Remove Removes user defined profiles Note that you cannot remove built in profiles 2 4 4 Validator Preferences type filter text Validator gt General E Set actifsource validator preferences a Actifsource a Revalidation Delay ms 300 StyleConfiguration Validator Revalidation Delay ms Actifsource validates every keystroke The validation might lead to a high CPU load for large models For this reason you can configure the delay between validations 2 5 Project Wizard The project wizard allows you to create a new Actifsource project from scratch Select File new Actifsource Project 2 5 1 Project Name and Location Project Cre
59. Space myFunction MyFunctionSpace the function myFunction is only called once on the list of all Children reachable from ParentContainer 9 3 5 JavaAspectFunction TBD 9 3 6 TemplateFunction A template function behaves in the same way as a template but there are no files generated from a template function Just think of a template function as a sub template which can be expanded in a template or in anoth er template function also recursively Consider the following meta model 3 Client y component Component component gt Let us now write a template function for a component which writes the name and type of the component and ifthe given component is a composite also does the same recursively for all subcomponents 0 1 First of all we have to define the template function in the model typeOt chactifsource core selector type FunctionContext typeRet com actifsource design functionspace selector Component typeld gt function typeOt ch actifsource template modeLspec types emplateFunction comment param children children language function To open the template function with the template editor just double click in the Project Explorer Use the Link with Editor tool see Chapter 2 10 1 Link with Editor to easily locate the template function in the project ex plorer User Manual 148 File Edit Navigate Search Project Debug Refactor Run Window Help Ty teen he MES a al T a
60. URETIONS OM RE SOUC ese E E 147 9 4 4 Built in functions on List Of RESOUFCe sssssssseeesssssssrrrrssssereresssssreresssssserereesssserrreesssserereeessses 147 9 4 5 BUIN TUN CONS OM LITO dad 147 9 4 6 Built in functions on IntegerLiteral sii ditara 147 9 4 7 Built in functions on IntegerLiteral oocccnccoooncnnnnonnonnnnnnncnnnnnonononnnononnnnnnnnnnronnnnnnnnnnnnnnnninnnos 147 9 4 8 Built in functions ON BooleanLiteral ooooonccnnnncnnonnonnnnnnnnnonnnacnnnnnnnnnnnnnnnnnnnnnnnnnnnrnnnnnnnnonnnnnnss 147 9 49 Built in TUNCtIONS ON st Of Ena caia 147 9 4 10 Bult FUNCTIONS on LISP OF Letter idos 148 9 4 11 Bultaintunctions on TEXN Eral aaa ias 148 9 4 12 Built in functions on SEENELItera lisa orseRinida 148 9 4 13 UA A O A 149 9 4 14 BUIN TUNCUONS OW GUIA ii A 149 9 4 15 Bont FUNCTIONS OM BUN a aia 149 9 4 16 Built in functions on LinkSelector oocccccccccconooccnnnnnnnonnnononnnnnnonnnnncnnnnnnnnonnnonnnnnnnnnnnanirnnnnnnnnnnns 149 9 4 17 B ultantuncions on la io 149 9 5 Accessing the model from within Java FUNCTION oocccccccocccnnnnnnncnnnnnnnnonnnnonononnnnnnnnnnnnnonononnnnnnnancnnos 149 SL Model forward arce Sita 149 952 ModelDackWward acces aii tdi 151 Ores FUNCION CCE SS olaaa aaa Ai 151 9A Built in TUNCTON ACCESS A ARA 151 TOS Code SID Pe Sa 153 10 1 DIVI RA Wisin obio 153 10 2 Defining Code Snippet Rel tON Sissi 153 10 2 1 WANS WAC e E E A AA EET 155 10 2 2 TOKENS oea ON
61. Variable and Function Names Name Provider Generating the names of variables and functions by calling simpleNameOBuiltIn is in practice not always suffi cient to generate code that meets all the requirements the requirements on the naming could depend on naming conventions of the target language or names of variables could depend on the context in which the corresponding resource is used For these cases Actifsource provides more flexible template functions which takes a Literal of type ch actifsource codesnippet metamodel parsetree template NameProvider as an addi tional parameter e codeSnippetToSTwithNameProvider e codeSnippetToCwithNameProvider e codeSnippetToText e codeSnippetToFormattedC e codeSnippetToVHDL Apart from the generation of function and variable names these templates have exactly the same behavior as the corresponding template functions from the section above The additional parameter to this functions can be used to store additional context information necessary to generate the names and to overwrite the functions used to generate the names namely variable Name TokenToName and functionName TokenToName These two functions take a parameter of type Re source the resource corresponding to the variable resp function and generate the name by calling NamePro vider variableName TokenToName resp NameProvider functionName TokenToName SF etree A E b T this Resource gt NameProvider NameProvider NameProvider
62. all available resources to insert as functions and variables The set of available resources is defined by the property token on the corresponding StructuredCodeSnippetRelation see Section10 2 Inserted resources are underlined with blue color Structures The StructuredCodeSnippetRelation supports the definition of complex and nested data types such as structs by defining a set of subtokens for a token After inserting an instance of a token into the code snippet editor followed by a struct field access in C the Content Assist will propose the list of all resources defined by the selectors of its sub tokens Consider for example the following meta model Furthermore we consider a StructuredCodeSnippetRelation on class A with the following definition of tokens token typeOf ch actifsource codesnippet metamodel RelationTokenProvider selector A b tokenType ch actifsource codesnippet metamodel Token Type Variable 1 subtoken 1 typeOf ch actifsource codesnippet metamodel SelectorSublokenProvider selector Buc token Type ch actifsource codesnippet metamodel TokenType Variable subtoken typeOf ch actifsource codesnippet metamodel SelectorsubTokenProvider selector Cd tokenType ch actifsource codesnippet metamodel Token Type Variable subtoken subtoken T Ma btoken 2 typeOf ch actifsource codesnippet metamodel SelectorSublokenProvider selector B d tokenType ch actifsource codesnippet metamodel TokenType Variabl
63. ansitionfEvent targetState To add code snippets to resources of type MyClass you have to edit MyClass in the resource editor add a new property and choose the type StructuredCodeSnippetRelation for the relation in the Type Selection dialog a Type Selection Choose the type of the new object a Attribute ch actifsource core Deco ratingRelation ch actifsource core t DomainDiagramRelation ch actifsource ui diagram relation LinkRelation ch actifsource core selector metaelement OwnRelation ch actifsource core PropertyBasedCodeSnippetRelation ch actifsource codesnippet metamodel SelectorRelation ch actifsource core EsStructuredCodeSnippetRelation ch actifsource codesnippet metamodel s UseRelation ch actifsource core 2014 actifsource GmbH Switzerland all rights reserved In the resulting property you have to create the following statements subjectObjectCardinality objectCardi nality and name as for Own or UseRelations see Section 4 3 Additionally we define the CodeSnippetRelationAspect as shown below with the class ch actifsource codesnippet metamodel aspect impl StructuredCodeSnippetRelationAspect typeof name comment extends modifier aspect OwnRangeResinctionAspect aspect CodeSnippetRelationAspect typeOf JavaAspectimplementation implements CodeSnippetRelationAspect className ch actifsource codesnippet metamodel aspect impl Structured C
64. ate a new project resource Use default location Cc Projects workspace_usermanual com actifsource statemachine Browse default Working sets 7 Add project to working sets Project name This is the name of the new project We suggest that the project name is given in the eclipse like manner com company project subproject Note that the dotted name automatically leads to a corresponding package structure a r2 com actifsource statemachine a E arc 44 com H com actifsource ES com actifsource statemachine Location This is the location of the project The default location is in the workspace Working Set You might add the project to an existing working set A working set is a dedicated view to the projects of the workspace 2 5 2 Resource Paths Project Settings Setup your project G5 Resource Paths E Target Folders et Template Folders L3 Project Dependencies i Built in Dependencies L Add Resource Path generate javamodel Finish All Actifsource resources are saved in Resource Files with the ending asr in an xml format The resource path defines where to find the model resources Add Resource Path Adds a new resource path to the project Edit Edits an existing resource path Remove Removes an existing resource path Generate javamodel Actifsource builds internal Java classes to handle your model Do not switch off this option unless you know exactly what you do 2 5 3
65. atemachinel ES 4 Palette i Select E Edit 01 a 4 Marquee gt Relation Ej State 0 n1 arrife m esa lC mnh L A nae ImArinr A al ri shte FOCOAVK IO 2014 actifsource GmbH Switzerland all rights reserved SingleRoot If there is a single root defined every resource is created in the context of the single root If no single root is defined resources are created in the same package as the domain diagram Note that defining a rootClass in the DiagramType demands for a singleRoot in the domain diagram 5 3 2 New Domain Diagram for Resource al i com actifsource statemachine a ES asic a EH com actifsource statemachi a EH generic b 3 Design E Event E State Statemachine b 2 Statemachine gt E Transition gt EH template Project b Be Actifsource Actifsource Project gt BBA JRE System Library JavaS ds gt z3 src Open With Ft Class Diagram gt 5 src gen Copy Diagram Type test E pl Domain Diagram File Folder Paste Move Freemarker Generator Task Rename Resource Folder Delete Template Remove from Context Ctrl Alt Shift Down xPand Generator Task a Tener You can create a new domain diagram for a single root directly by calling New Domain Diagram on a resource Domain Diagram Create a new domain diagram Resource Path com actifsource statemachine asre Package com actifsou
66. bH Switzerland all rights reserved 4 Core Model Meta Meta Model 4 1 Overview Every meta model is based on the Actifsource Core Model Make sure that you understand the concepts of Resource Class and Property before you start creating your own meta model Core Model Meta Meta Model Meta Model Domain Model Software Specification 4 2 Resource In Actifsource everything is a Resource That means that every Resource you create extends the Resource Even Resource extends Resource so that the core model can describe itself If the Resource shall has a name you can extend from NamedResource e Resource 4 3 Class Creating your own meta model you have to specify a set of classes and their relationships The Core Model therefore provides you a NamedResource called Class Class is the only Resource in Actifsource that can be instantiated where in this context we mean by instantiate that there is a typeOf relation For that reason Resource is of type Class and Class extends NamedResource This recursive definition becomes necessary as the Actifsource core model has to describe itself You can say that the Actifsource core model is meta model of itself typeof MamedResource i 4 4 Property Any information is modelled by a property Specifying your own class therefore also means specifying all prop erties of this class property There are different types of properties 4 4 1 P
67. ce jawafunction import ch actifsource util Assert import java util List import ch actifsource co namic amic import ch actifsource core dynamic IDynamicResourceExtension import import Begin Protected Region dfc79b23 8a64 11le3 af9e Td317997ec11 imports End Protected Region dfc 9b23 8a64 11e3 af9e fd317997ec11 imports public class MyFunctionSpace Begin Protected Region dfc79b23 8a64 11e3 af9e fd317997ec11 End Protected Region dfc79b23 82964 11e3 af9e d317997ec11 public static interface IMyClassFunctions extends IDynamicResourceExtension IDynamicResourceExtension MethodId e52Tlebe 8a64 11e3 aT9e fd317997ec11 public java lang String identify ip public static interface IMyClassFunctionsImpl extends IDynamicResourceExtensionJavalmpl IDynamicResourceExtension MethodId e52Tlebe 8a64 1lle3 aTt9e Td317997ec11 public java lang String identify final com actifsource design functionspace extend javamodel IMyClass myClass y public static class MyClassFunctionsImpl implements IMyClassFunctionsImpl public static final IMyClassFunctionsImpl INSTANCE new MyClassFunctionsImpl private MyClassFunctionsImpl Override public java lang String identify final com actifsource design functionspace extend javamodel IMyClass myClass Begin Protected Region e52flebe 8a64 11e3 af9e fd31 7997ec11 return myClass selectName MyClass End Protected
68. ce offers a quick assist to fix common issues Hoover the mouse pointer over the light bulb symbol z to get a tooltip with a short description of the problem 2014 actifsource GmbH Switzerland all rights reserved User Manual 42 gt transition 2 H A com actifsource statemachine generic StateClass a aA E E typeOf DecoratingRelation name transition comment subjectCardinality Cardinality0_1 aspect OwnRangeResinctionAspect aspect DecoratingRelationAspect DecoratingRelationAspect 1 ResourceSelectorAspectimplementation mod fier objectCardinality Cardinalityl_1 defaultValue ownership Type extends A com actifsource statemachine qeneric Transition he class used as range of a DecoratingRelation must extend ch actifsource core Decorator kAssist available Ctrl 1 Click on the bulb symbol to get the possible solutions ge transition 23 S com actifsource statemachine generic StateClass A EA A typeOf DecoratingRelation name transition comment subjectCardinality Cardinality0_1 aspect OwnRangeRestnctionAspect aspect DecoratingRelationAspect DecoratingRelationAspect 1 ResourceSelectorAspectImplementation mood fier objectCardinality Cardinality1_1 defaultValue ownership Type extends com actifsource statemachine qeneric Transition Sl fz Let Transition extend Decorator Device Action Mouse Click on the bulb symbol Keyboard Ctrl 1 2014 actifsource Gm
69. ch returns the component itself and also all parent components which are reachable by going backwards via the component relation User Manual typeOt typeRet typeld function function NO ch actifsource core selector type FunctionContext com actifsource design functionspace selector Component typeOf name comment param selector return Type ch actifsource core selector type SelectorFunction allComponent ComponentComponent union Component component aliCon typeOf ch actifsource core selector type Listlype innerTypeRef com actifsource design functionspace selector Component innerTypeld To get the Client which is parent of all component just collect all component first by using the above selector functions From all this components in the collected set there is only one instance aggregated by Client Let s write a selector function for that Please take extra care because there are two relations named component One is Composite component the other one is Client component Make sure to use Composite component in allComponent and Cli ent component in getClient typeOt typeRef typeld function 1 function 2 function ch actifsource core selector type FunctionContext com actifsource design functionspace selector Component typeOf name comment param selector return Type selector return Type ch actifsource core selector type SelectorFunction allComponent Component Com
70. coccocccnccnoccnccnncnnaconccnnccnaroncnnaronaconccnaranacaninnns 101 8 3 10 WORKING WIN CONTEXTS Sansen n ona e E a 105 8 3 11 COPY PISE a a E E id 112 8 3 12 DGS COM a E RL 114 8 3 13 A a A bteekeaouieenne tr auensaseeetuebaanianeee 116 8 3 14 COM ACEO UN OS ut Macusesenaaanees anger eencsiendsaccidsencaneeesvecsensus 117 8 3 15 FUNCTIONS PACO acia 119 8 3 16 EX aci FUNCION a le do 120 8 3 17 CONEX PAN erana da soe 121 8 4 Declaring a Programming Language nesrecna a a S 123 8 4 1 Supported Programming Languages ooccccccccnnccnnnnnnnnnnnnnnnnnnnnnnnnnnnononnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnanininns 123 342 lemplatelLanguage Mod io 124 843 HN Extension PriOnty RUES od 125 9 EONA NOLA E E E gon PE A AEE A ease santas T T eu tans cau T A T A T N E T 126 9 1 OVCIMISW aa 126 9 2 FUNCION SPICE AS 126 9 21 sEUNETIOM ParameterSunesorr la ltda 126 DA HPO AON OG CANS a aaa E nee soceo cea acute ceat on te mec causes oe enced A 128 FAS JNOMSPOIVIMOLDIIC Calc 128 J2 o A RR OA 129 9 3 FUNCUON YDE ea a E E E T 130 J3 Abstract FUNCION tai 131 Date SSCIECVOr PUMICE OM ii does 131 Diss DaVal UNCON A e E o e O E PE O 137 SE AV ALISE UNC OMY bd 141 To JAVARSDCEUPUMCTION vecanccctcrcaccacken an a eater ach eclanasi au cwdsst a a a 141 913 6 Template FUNCTION aens ac en eas tedouaes a E E Ni 142 137 Templateline FUNCT ON A O 144 9 4 BUIN UNC Sta A iia 146 9AL Built in TURCUOMS ON AN Valsa 146 gA Built TUAcUOns ORAR 146 543 BUNEIN T
71. context menu of the project explorer supports several important operations on packages and resources 2 11 1 New Dialog The new Actifsource dialog creates different types of actifsource files For some types of resources you can create new resources based on existing resources New Actifsource Project Creates a new Actifsource project in the current workspace with the project wizard as shown in Chapter 2 5 Project Wizard New BuildConfig Creates a new BuildConfig which can be referenced in target folders see Chapter 2 5 3 Target Folder and Chap ter 7 Build Config New Class Diagram Creates a new class diagram for UML like Meta Model design The class diagram is the easiest way to create Meta Models New Diagram Type Creates a new diagram type which defines a user specific domain diagram Creating a new diagram type on an existing class preselects this class as the RootClass New Domain Diagram Creates a new domain diagram Domain diagrams are based on diagram types Creating a domain diagram on an existing resource preselects this resource as the singleRoot The diagram type is automatically selected by the type of the singleRoot If no singleRoot is defined it is created automatically with the type defined by the diagram type New FunctionSpace Creates a new function space see Chapter 9 2 Function Space New Package Creates a new package New Resource Creates a new resource of any type New Resource Folder Creat
72. ctifsource core selector type ClassType classRef com actifsource design functionspace selector Component classid function Recursive navigation The diagram below shows a composite pattern as presented in the book Design Patterns from Erich Gamma et al The composite pattern allows you to recursively instantiate Composite instances which might aggregate other components of type Leaf or again of type Composite 0 1 gt 9 Component There is an easy way to find the Client of this recursive model using selectors First we collect all components including the own component and all parent components For that reason we write a selector function for Component which returns the component itself and also all parent components which are reachable by going backwards via the component relation typeOf ch actifsource core selector type FunctionContext typeRet com actifsource design functionspace selector Component typeld A function typeOt ch actifsource core selector type SelectorFunction name allComponent comment param Component Component union Component component aliCon 7 returnType typeOf ch actifsource core selector type Listlype innerTypeRef com actifsource design functionspace selector Component innerTypeld function To get the Client which is parent of all component just collect all component first by using the above selector functions From all this components in the collected set there is only one i
73. ctifsource shows an empty line for all properties which might have another instance depends on the subject cardinality see Chapter 4 4 1 Property 2014 actifsource GmbH Switzerland all rights reserved User Manual 38 Statemachinel 3 2 E com actifsource statemachine specific Statemachinel Statemachine typeOf com actifsource statemachine generic Statemachine name Statemachinel j ewent 1 run Event event stop Event event state 1 Stopped State i state 2 Running State state 3 Error State To insert a resources on the empty line use the following possibilities Device Action Mouse Ctrl DoubleLeftClick on the property Context menu Insert here Keyboard Enter 3 5 2 Insert before or after properties Actifsource allows inserting resources before or after existing properties Statemachinel 2 E e Ma tee A ABBA AER E Runninc typeOf com actifsource statemachi name Statemachinel event 1 run Event event 2 stop Event event state 1 Stopped State state 2 Error State To insert an aggregated resource before or after an existing resource use the following possibilities Device Action Mouse Ctrl DoubleLeftClick to insert after the current resource Ctrl Shift DoubleLeftClick to before after the current resource Context menu Insert after to insert after the current resource Insert before to insert before the current re
74. ctionContext typeRet com actifsource statemachine generic MyNameProvider typeld function 1 typeOf A 3 name variableName comment ds typeOf ch actifsource core selector type Param name resource type Resource ClassType param mod fier ownership inlineJavaCode returnType TextLiteral Literallype cached true function 2 typeOf JawaFunction name functionName comment aia typeOf ch actifsource core selector type Param name resource type Resource ClassType param mod fier ownership inlineJoveaCode returnType TextLiteral LiteralType cached true 5 Write a JavaFunctions e g createMyNameProvider that generates an instance of the newly created Java interface e g IMyNameProvider public com actifsource statemachine IMyNameProvider MieateMyNameProviders final com actifsource statemachine generic javamodel IStatemachine statemachine Begin Protected Region 0571debc 86ec 11e4 a718 85e3dd915202 return new IMyNameProvider TODO implement interface IMyNameProvider 3 End Protected Region 571debc 86ec 11e4 a718 85e3dd915202 6 In the template where the function to lt Language gt withNameProvider is used call the newly created Java Function createMyNameProvider and call to lt Language gt withNameProvider with the output of the Java Function Selector Statemachine createMyNameProvideriNameFuncilons NameProvider Statemachine nameImpl cpp C E CodeSni
75. d gt A Selector Build allParent Break dl F Le hpp Es 8 3 3 Language Line The language line defines the programming language for e Syntax Highlighting e Comment Style e String Style including escape rules Actifsource defines the most common languages If you are using a language which is not defined by default see Chapter 8 4 1 Supported Programming Languages do not hesitate to create one by your own see Chap ter 8 4 Declaring a Programming Language You may change the language at any time by using the content assist Ctrl Space on the language line Parent ES a Build e Build allPorent Parent Selector Build allPoarent Break C ch actifsource template language specific Language C ch actifsource template language specific Language Cobol ch actifsource template language specific Language Css ch actifsource template language specific Language hi t Lc hpp Selecting or changing a file extension in the file line see Chapter 8 3 2 File Line automatically selects the corre sponding language 1 p 1 N yy nti fec ALIrFCO T g ry h LJ Cyasitza yl aa A gt ri amntc racarv a A 2U14 actitsource GmbH y IWILLE diid d MISAS eserved Parent 3 E 3 Build gt A Selector Build allParent hl E Parent name headers Parent nameImpl a c lt lt lt _ lt __ a Le hpp fa 4 Use Ctrl Click on the language to show the underlying lan
76. d ollParentParent AENA y Parent namelmpl hpp C class Parent nameImpl 1 public al Le hpp 3 cpp Using content assist in the new context you are now able to use links on resources of type Child Parent 3 E 3 Build Y Build allPorent Parent SEP Selector Parent child Break Parent nameImpl hpp CH class Parent nameImpl 1 public child com actifsource templateeditor generic ES Parent com actifsource templateeditor generic 4 J Build ch actifsource template Le hpp ES Le c eo Model ch actifsource core selector Press Ctrl Space to show Insert Type Name Proposals To complete the task from above insert a function named identifyChild name T Parent ES 0 3 Build 9 Build ollPorentParent SEP Selector Parent child Break Parent namelmpl hpp CH class Parent nameImpl i public void identifyChild name gt ll hpp E3 Le cpp Line 4 is now repeated for any resource of type Child reached by the relation Parent child Parentllmpl hpp 2 E Parent2lmpl hpp 3 pl hpp plonpp gt class Parentlimpl a gt class Parent2Impl a i i public void identifychild1 identifyChildi void identifyChild2 identifyChild2 gt void identifyChild3 IdentifyChild3 LE LE Actifsource ID b18241da as5tf Actifsource ID b18241da a85f 1 4 lala t A lis Mio Add Context via Quick Assist Using the q
77. d true function 2 typeOf name myGenericListFunction comment param mod ifter ownership inlineJavaCode return Type typeOt GenericContextListType cached true public lt T extends ch actifsource core javamodel IResource gt T myGenericFunction final T resource E ake re m E Fa at M I a oh 3 Build 9 Build olIMyCloss MyClass 3 MyClass myGenericl istFunction MyFunctionSpace MyClass Selector MyClass myGenericFun myFunct ion F lass name txt Text r E public lt T extends ch actifsource core javamodel IResource gt List lt T gt myGenericListFunction final T resource ES Build 3 Build aliMyCloss MyClass 9 MyClass myGenericFunction MyFunctionSpace MyClass Selector MyC lass name txt Text 9 3 4 JavaListFunction Java list functions can be applied to a list of elements defined by a Selector expression e g in the Selector ex pression Parent child myFunction ChildFunctionSpace the function myFunction is called on the list of all Chil dren reachable from Parent via the relation child see example in Section 9 3 2 The this parameter of the generated Java function is then of type java util List lt C gt where C is the Java class corresponding to the typeRef of the FunctionContext respectively java util List lt T extends C gt if the returnType of the Java list function is GenericContext List Type Consider the following example that is based o
78. e 3 Person firstName StringLiteral lastName StringLiteral Write a template function for person which prints out the person s last name and first name User Manual 150 typeOf ch actifsource core selector type FunctionContext typeRef com actifsource design functionspace selector templateline Person typeld a function typed ch actifsource core selector type TemplateLineFunction PersonJastWame Person firstName function Simply use the template line function as name aspect in the class Person typeOf ch actifsource core Class name Person comment aspect IntializationAspect aspect Resource ValidationAspect A EP typeOf TextSelectorAspectimplementation implements NameAspect extends ch actifsource core Resource extends modifier property 1 firstName Attribute Please not that it is also possible that the selector of the name aspect can be used directly as template line 2014 actifsource GmbH Switzerland all rights reserved User Manual 151 type f ch actifsource core Class name Person comment aspect InitializationAspect aspect Resource ValidationAspect gt aspect NarneAspect typeOf TextSelectorAspectimplementation implements NameAspect Person lastName Person firstName extends ch actifsource core Resource extends modifier property 1 firstName Attribute Note that Person is only a Resource but not a NamedResource The attributes firstName and lastName are th
79. e subtoken subtoken We can now create a resource al of type A and insert code into the code snippet editor When calling the Con tent Assist after inserting b1 it proposes the list c1 c2 available through the Selector B c and d1 available through the Selector B d See first screenshot below Note that it is also syntactically correct to insert arbitrary strings as identifiers for fields of structs After inserting one or more such identifiers followed by a the Con tent Assist will again propose the list of root elements tokens independently of possible resources before the string see second screenshot below It is not possible to define structures recursively Thus you have to explicitly define the whole structure to the desired finite depth if it is self referential User Manual 165 b typeOf com actifsource statemachine generic B name bl ell typeOt com actifsource statemachine generic C name cl d ci typeOf com actifsource statemachine generic C name cl dll typeOf com actifsource statemachine generic D name dl dfi typeOf com actifsource statemachine generic D name d2 dla typeOt com actifsource statemachine generic D name d3 d d di b ES B snippet bl a ae ee ere eau eo et 10 4 2 Validation and Errors The syntax of the input code in the code snippet editor is continuously validated Syntax errors are shown by underlining the errors in the code and adding an error descriptio
80. e different resource types Resource Type Description BundleResource File or folders found in a bundle plugin project OutputScopeResourc File or folders found in the target folder e i TemplateScopeResource File or folders found in the template folder WorkspaceResource File or folders found in the workspace Recursive All subfolders are copied if set to true Merge Duplicate Folders When enabled the generator allows merging content from different folders into one folder Otherwise an error will occur Target The target to copy the files or folders There are different target types Target Type Description ResourcePathTarget Target path relative to copied resources ZipTarget File and folders are copied into a zip file 7 6 4 DeleteFolderTask Deletes the specified folders relative to the target folder Please note that this tasks needs a built in dependen cy to WORKSPACE see Chapter 2 5 6 Built in Dependencies 2014 actifsource GmbH Switzerland all rights reserved BuildContfig StatemachineBuildContig buildTask typeOf DeleteFolderTask path 1 src path 2 doc path buid Task Path A path relative to the target folder 7 6 5 ExecuteProcessBuildTask Executes any process on your operating system Please note that this tasks needs a built in dependency to WORKSPACE see also Chapter 2 5 6 Built in Dependencies To execute a shell command on windows choose cmd as shell command c as first ar
81. ease make sure that Build Automatically is switched on Please make yourself familiar with the Eclipse Builder concept See Project Properties Builders to see the active builders for your project and their execution order see Chapter 7 7 Eclipse Builder Properties for com actifsource statemachine type filter text Builders gt Resource Configure the builders for the project di FA Java Builder Coverage lad Actifsource Builder actifsource FindBugs Java Build Path gt Java Code Style Java Compiler EN Cancel Generate Automatically If Generate Automatically is switched on Actifsource will generate code after saving changed files If Generate Automically is not switched on you have to trigger code generation manually Right click on the Eclipse project and select Generate Code Actifsource also generates Java classes for internal use Generating these internal classes is not switched off by Generate Automatically Enable External Builder This feature is for beta users and developers only Since Actifsource is developed by Actifsource we must be able to build ourselves with the current version The external builder is compiled at development time and ensures that every change in the Actifsource workspace affects the next code generation run 2 9 Toolbar The Actifsource toolbar provides you with two important tools 2 9 1 New Actifsource Resource Ey The n
82. eates a new actifsource template and adds it to a BuildConfig Resource Path com actifsource templateeditor asrc Package cat i H com actifsource templateeditor generic com actifsource templateeditor asrc Template Name Pare H com actifsource templateeditor specific com actifsource templateeditor asrc BuildConfig co er com actifsource templateeditor template com actifsource templateeditor asrc MetaModel Base Type com actifsource templateeditor generic Parent Creating a template based on a type i e class Parent opens an editor with a predefined selector Build allParent This means that this template is executed for all resources of type Parent 2014 actifsource GmbH Switzerland all rights reserved User Manual 90 fF Parent EZ E J Build gt A Selector gt a a dl F TETE 0 8 2 2 Create a Build once Template To create a Build once template simply choose New Template from the context menu of a package Please note that the template is created in the chosen package Remitancat karein ars A a Seep ene a eee ee Serene a Ae ao 05 TE hb op Ee E ut Quick Access E Project Explorer 53 Pi Design 2 4 5 p k Palette gt gt i com actifsource statemachine Pe select d e com actitsource templateeditor 1 1 o ras all PL ase gt subChild
83. en a java util List lt Class gt where Class is the Java class that corresponds to the Literal or the Class Note that in the latter case the Java class is the wrapper Java class that corresponds to the Actifsource Class and is provided by the Javamodel see also Chapter 2 and Section 9 5 A TypeReference is either a GenericContextType or a GenericContextListType In the first case the return type of the generated Java function is lt T extends C gt T where C is the Java class corresponding to the type of the element the function is called on the this instance In the second case the return type of the generated Java function is a lt T extends C gt java util List lt T gt where T is defined as before see examples below Note that function with a return type of GenericContextType or a GenericContextListType can be applied to elements of any sub type of the type given by typeRef of the FunctionContext i e the this parameter of the generated Java function is lt T extends Class gt T where Class is the Java wrapper class corresponding to the typeRef of the FunctionContext typeOf ch actifsource core selector type FunctionSpace name MyFunctionSpace extends metaModel 7 functionContext typeOf ch actifsource core selector type FunctionContext typeRef ch actifsource core Resource function 1 typeOf ocn name myGenericFunction comment param modifier ownership inlinelavaCode returnType T extends Resource GenericContextType cache
84. er in a list 9 4 8 Built in functions on BooleanLiteral Actifsource provides the following built in functions on BooleanLiteral Function Return type Description isFalse Boolean Returns true if the Boolean value is false 9 4 9 Built in functions on List of Character Actifsource provides the following built in functions on List of Character Return type Description Boolean Builds a string from characters 2014 actifsource GmbH Switzerland all rights reserved User Manual 153 9 4 10 Built in functions on List of Letter Actifsource provides the following built in functions on List of Letter Return type Description Word Builds a word from letters 9 4 11 Built in functions on TextLiteral Actifsource provides the following built in functions on TextLiteral Function Return type Description suppressindent Text Sets the current intent mode to suppress indent All lines after the first line start at the very beginning of the line If applied in a template function the setting of the outer template is not affected The return value is the text itself indent Sets the indent mode to indent default All lines will start at the same position as the first line The preceding characters in the first line are copied non whitespace characters replaced by whitespaces If applied in a template function the setting of the outer template is not affected The return value is the text itself Sets the indent m
85. ere is a call to Parent className where className is the function T Parent ES E 3 Buik BEA Selector Build allParent F 1 E public void identifyChild name E a F Le hpp es Le Cpp To see the model of a function within a template just open the folding on the template dl Le com actifsource templateeditor a ES arc a EY com actifsource templateeditor EY generic 8 specific a EY template 4 Parent dl Parent L className E Actifsource gt E JRE System Library JavaSE 1 6 8 sre 2 erc gen 3 sre g If a function is placed in a function space other than the own template the function call is displayed with the name of the function space after the sign Parent className MyFunctionSpace indicates a function call where the function className is located in the function space MyFunctionSpace T Parent El A 3 Buik BEA Selector Bulld allParent Break T F i public void identifyChild name a hpp 23 8 cpp 8 3 16 Extract Function The Actifsource Template Editor allows you to extract selected expressions as functions Please consider ex tracting complex expression if you use them more than once T Parent El E 3 Build eo Build aliPorent Parent Selector Build allParent Break Parent nameImpl hpp C class ieee ean i Selecting an expression which might also contain links leads to a light bulb
86. erefore just normal properties com actifsource design functionspace selector templateline Person firstName Bohr Defining the name aspect as seen above synthesizes the name a EY com actifsource design functionspace selector templateline person E Bohr Niels E Curie Marie E Einstein Albert E Planck Max 9 4 Built in functions Actifsource provides lots of useful built in functions 9 4 1 Built in functions on Any Actifsource provides the following built in functions on Any Function Return type Description Literal Gets the unique identifier of any Resource or Literal For Resources it is a GUID for Literals it is the Literal itself 9 4 2 Built in functions on Any List Actifsource provides the following built in functions on List of Any count IntegerLiteral Counts the number of elements in the list isEmpty BooleanLiteral Returns true if and only if the list is empty isSet BooleanLiteral Returns true if and only if the list contains no duplicates first T Returns the first element in the list last T Returns the last element in the list 2014 actifsource GmbH Switzerland all rights reserved User Manual 152 count IntegerLiteral Counts the number of elements in the list reverse List of T Reverses the elements in the list distinct List of T Remove duplicates from a list first to last 9 4 3 Built in functions on Resource Actifsource provides the following built in functions on Resource
87. es a new resource folder see Chapter 2 5 2 Resource Paths New Template Creates a new code template see Chapter Template Editor Creating a new template on an existing class preselects this class as the base type 2 11 2 Open with The Open with dialog forces eclipse to open files with a specific editor The first element in the Open With list is the default editor Once opened with another than the default editor Eclipse reminds this setting when double clicking the file to open Just select Open With Default Editor to restore the settings j Project Explorer 3 E ES dl fe com actifsource statemachine a asc a amp com actifsource statemachine a EHH gener Resource Editor a EE a pee Text Editor gt E State of Cut Fi State Paste System Editor a W templat Move In Place Editor T State BA Actifsource Rename Default Editor E JRE System Lib Delete Other gt STC Remove from Context Ctri Alt Shitt Down gt 3 src gen tg Import 4 il ey Export 2 Refresh FS Actifsource supports the following editor types Resource Editor The Actifsource Resource Editor is the standard editor which opens all types of Actifsource resources Class Diagram Editor The Actifsource Class Diagram Editor opens resources of type ClassDiagram Domain Diagram Editor The Actifsource Domain Diagram Editor opens resources of type DomainDiagram Template Editor The Actifsource Template Editor opens
88. esource namespace simpleName hasName hasModifiableName fullName isOwned isRootResource isAllowedPredicate rootResource rootStatements directlyOwnedResources ownStatementOrNull decoratedNode shallowType isTypeOf toMeRelationsForType toMeTypes isMatching Return type boolean Relation Set Relation Set Resource Package Set of Resource with Package string with string boolean boolean boolean boolean boolean boolean Resource Statement Set of Resource Statement Resource Type boolean Relation Set of Type boolean m AAC Decorate a Resource by its main Package Decorate a Set of Resources by their main Packages Returns the name of the Packages and owning Resources concatenated with dot Returns the Name of a Resource defined by the NameAspect or else the GUID Checks if a Resource has a Name that is it has a NameAspect defined ERROR Returns the Name predeeded by Package Names and Name of the owner Resources Checks if a Resource is directly or indirectly owned by an other Resource or it is the same Resource checks if a Resource is not owned by any other Resource Returns the owner Resource that directly resides in a Pack Returns the Statement stating that a given Resource is owned by another Resource Returns the Resource being decorated by this Decorator Returns the direct Type of a Resource check if a Resource is instance of a given Class
89. esource which fits the requirements Actifsource comes up with a quick assist see also Chapter 3 10 Quick Assist g gt b2 ES Z E e com actifsource design decoratingrelation 42 Class cored iter its sity typeOf ch actifsource core DecoratingRelation comment subjectCardinality ch actifsource core Cardinality0_1 aspect OwnRangeResinctionAspect r aspect DecoratingRelationAspect typeOf ResourceSelectorAspectimplementation implements DecoratingRelationAspect selector A2 a1 b1 mod fier objectCardinality ch actifsource core Cardinalityl_1 defaultValue ownership Type extends uE range com actifsource design decoratingrelation B2 gt he class used as range of a DecoratingRelation must extend ch actifsource core Decorator ist available Ctrl 1 The quick assist extends the range of the decorating relation from Decorator and adds a sub relation to Deco rator target with type of the target of your decorating aspect 4 4 7 SelectorRelation TBD 4 4 8 Attribute The Attribute allows creating simple literals There are some predefined literal instances that you might use Please note that the range of an attribute is Literal where Literal is also an AbstractType as already seen for Class see Chapter 4 4 1 Property BooelanLiteral The Boolean literal allows the values true or false only DoubleLiteral The double literal is a 64 bit floating point value IntegerLiteral The integer literal is a 32 bit inte
90. et of code is essential ly a list of statements written in C where C is a subset of the programming language ANSI C A more precise definition of C will be given below Actifsource then provides the possibility to generate code in an arbitrary target language from these code snippets This is achieved by parsing the input code according to the grammar of C and applying either built in or user provided templates to the resulting parse tree This parse tree is actu ally a model composed of temporary i e non persistent resources The following example shows a code snippet where the underlined identifiers are resources used as variables and functions A EA mi Sniper pe multi line comment 10 2 Defining Code Snippet Relations First we will show how to add a code snippet relation to a class and define all the necessary properties of this relation Such a relation enables the code snippet editor on instances of this class and allows a user to add code written in the chosen input language to the resource Most of the examples and screenshots in the following are taken from the Code Snippet tutorial available at http www actifsource com tutorials index html This tutorial is based on the following meta model for statemachines and shows how to add code snippets for conditions on transitions and for actions taken when a condition is executed User Manual 159 3g Statemachine event State eventetarget _tr
91. eturn Type 9 2 5 Extends StringLiteral LiteralType Polymorphic calls are supported in the same function space by default Extending another function space ena bles polymorphic calls over functions spaces MA JNIA a ctitc mirra Am h L Cra nitzarian A m rio ht c racarvan 2014 actifsource Gmbl l Switzerland all IgNtS reserved User Manual 135 MyFunctionSpace 3 El com actifsource design functionspace MyFunctionSpace FunctionSpace E Y p pa typeOf ch actifsource core selector type FunctionSpace extends metaModel functionContext typeOt chactifsource core selector type FunctionContext typeRef com actifsource design functionspace MWyClass typeld function identify TemplateFunction function E MySubFunctionSpace 3 com actifsource design functionspace MySubFunctionSpace FunctionSpace typeOf ch actifsource core selector type FunctionSpace 7 functionContext typeOt chactifsource core selector type FunctionContext typeRet com actifsource design functionspace MySubClass typeld function identify TemplateFunction function functionContext 9 3 Function types Actifsource supports different types of functions 2014 actifsource GmbH Switzerland all rights reserved D functionContext Sl AbstractlavaFunction 7 JavaAspectFunction Bl JavaFunction 9 3 1 Abstract Function Abstract functions shall only be
92. event 1 run Event j event 2 stop Event a state 1 typeOf com actifsource statemachine generic State name Stopped a a com actifsource statemachine generic Transition o transition stop Running com actifsource statemachine specific statemachinel State j state Running State state 3 Error State 2014 actifsource GmbH Switzerland all rights reserved User Manual 40 3 7 New referenced resource You are able to create new referenced resources just by typing the named and select new from the content assist E Statemachinel 3 o ES E ja aaa aba E Stopped State E run Transition typeOf com actifsource statemachine generic Statemachine name Statemachinel event 1 run Event event 2 stop Event 7 statell typeOf com actifsource statemachine generic State name Stopped a transition run typeOt com actifsource statemachine qeneric Transition event com actifsource statemachine specific Statemachinel run E transition stop state 2 Running State The place where the resource is created depends on the UseRangeRestrictionAspect see Chapter 4 4 4 UseRe lation If there is no UseRangeRestrictionAspect defined the new resource is created in the same package as the referencing resource 3 8 Move resource If you need to change the order you can simple move resources up and down within the same property Statemachinel 2 E E 8 com actifsource statemachine specific State
93. ew resource tool lets you create a new Actifsource resource in the selected package The new resource tool only allows creating so called root classes REF 2 9 2 Open Actifsource Resource al This tool shows all resources and allows filtering by name Please note that this operation might be slow for a large amount of resources 2 10 Project Explorer The project explorer let you access your resource files Resources are stored as xml files and named by the GUID Globally Unique Identifier of the resource Since this format is incomprehensible for humans the Pro ject Explorer shows the name for named resources User Manual 24 2 10 1 Link with Editor Ef Project Explorer s o 720 com actifsource statemachine a EP asic com com actifsource com actifsource statemachine com actifsource statemachine generic com actifsource statemachine specific E EE EB E EE EE com actifsource statemachine template t Actifsource gt HA JRE System Library JavaSE 1 6 E src b E3 src gen Switch on the option Link with Editor to synchronize the project explorer with the currently active editor 2 10 2 Actifsource Presentation Actifsource allows you to show aggregated resources sorted by relation or just by their occurrence in the con taining class Group Aggregation By Relation switched on iy Project Explorer 5 E ES r Te com actifsource statemachine a El asre Top Level Elements a EH com actifsource sta
94. executor IResourceScope scope INode node return null Override public Class lt IMyNameProvider gt getValueType return IMyNameProvider class 2 Create your own resource of type Literal e g MyNameProvider which extends 3 ch actifsource codesnippet metamodel parsetree template NameProvider typeOf ch actifsource core Literal pi MyNameProvider comment aspect Literal spect type0f JavaAspectimplementation Implements LiteralAspect className com actifsource statemachine MyNameProviderLiteralAspect aspect LiteralAspect extends 1 AbstractLiteral extends ch actifsource codesnippet metamodel parsetree template NameProvider extends mod fier Create a Java interface e g IMyNameProvider which provides the members needed to manage and store the context information needed by the NameProvider import ch actifsource codesnippet metamodel template INameProvider public interface IMyNameProvider extends INameProvider FF TODO add methods to provide context information Create a FunctionSpace e g MyNameFunctions which extends TokenToName with a FunctionContext for the newly created Literal type e g MyNameProvider Create the two functions variableName and func tionName with exactly the same signature as corresponding functions in the TokenToName ch actifsource core selector type FunctionSpace NameFunctions TokenToName 7 functionContext 1 typeOf ch actifsource core selector type Fun
95. g MetaModel Actifsource Creating a Build once template opens an editor with a predefined selector Build once Builtin That means that this template is executed only once T MyTemplate ES E g Build b gt MA a Selector Build oncefBuiltIn Break F j P F B Undefined 0 S Y ANN yeti feniirra Gm h H Giuitzarlan AN fm riontc racarva A ZU14 act itsource GMD IWILZE diid d rignts reserved 8 3 Writing template code Writing template code is nearly as easy as writing common code thanks to the Actifsource Template Editor 8 3 1 Base Context The Actifsource Template Editor lets you write code in the context of the meta model Fi Parent 25 E 3 Build 3 Build allPorent Parent Selector Build allParent ak F Base Context Build oliPorent Parent 4 te Undefined O The orange bar on the left is the context you are in Creating a template for the class Parent lets you work in the context of this class The context derived from the base type see Chapter 8 2 1 Create a template based on type is called base context 8 3 2 File Line First of all you have to specify a proper name Since we want to generate a file for any instance of the class Parent we have to specify a file name that is unique for every Parent instance dd Parent El E eo Build 9 Build allPorent Parent Selector Build allParent Break cify unique filename Use Ctrl Space t
96. g MetaModel Actifsource Since Child is owned by Parent child Actifsource automatically provides you with a super context of type Par ent E Child 2 50 3 Build gt FS lee eee est amp E Parent child Child Selector Bulld allParent Break F Parent name Child name hpp gt C Bulld ollPorent Parent 4 H Le hpp EZ Please note that the base context i e Child in this example is the widest bar 1 MI 2014 actifsource GmbH Switzerland all rights reserved User Manual 98 Child 2 E 3 Build gt 3 Build allPorentParent HANA Selector Parent child Break _ F Parent name Child name hpp gt C gt 4 b Le App e 8 3 6 Writing Code Let s start writing code First we write a C class named Parent namelmpl while Parent name is replaced by the name of the specific instance of class Parent Note that the keyword class is bold and has a special color as defined in the language C see Chapter 8 4 Declaring a Programming Language To insert a reference to the meta model just use content assist Ctrl Space at any time Parent 3 E 3 Build BR Selector Build allParent Break e Parent namelmpl hpp r C ame ch actifsource core NamedResource d came ExportPackageTemplate ch actifsource template dataclass c Df new Function Press Ctri 5psce to show Insert New Variable Proposals 4 F Le bpp El Le cpp Underlined words are s
97. gion or the involved resources leads to new Protected Regions while the old once are moved to the end of the file User Manual 105 8 3 10 Working with Contexts Adding and removing a context is one of the most important operations when working with the Template Edi tor Use the Template Editor Toolbar to add remove or navigate contexts gt Prada EE m m o a Context Operation Icon Shortcut Description Select TopContext m AlttHome Selects the top context Select ParentContext Ae Alt PgUp Selects the parent context from the actual context Select ChildContext i Alt PgDown Selects the child context from the actual context Select BottomContext 1 Alt End Selects the bottom context Insert LineContext Jf Alt Insert Inserts a line context in the actual context Insert ColumnContext Ed Alt Shift Insert Inserts a column context in the actual context Insert ProtectedContext 014 Inserts a protected context in the actual context Delete Context ES Alt Delete Delete the actual context Navigate Context via Select Tools Using the Context Select Tools in the Toolbar you might change the selection of the context from parent to child and vice versa a kK Rolo i 2 omm oo Navigate Context via Breadcrumb A context can be selected by clicking on the Breadcrumb Parent El E A Parent child Child ProtectedContext Selector Build allParent Break Parent nameImpl hpp gt CH class Parent nameImpl i public
98. gral value LongLiteral The long literal is a 64 bit integral value StringLiteral The string literal is a single line string value TextLiteral The text literal is a multi line string value ScopePathLiteral The scope literal allows referencing any file in the current project JavaTypeLiteral The Java type literal allows referencing a Java class or interface JavaClassLiteral The Java type literal allows referencing a Java class JavalnterfaceLiteral The Java type literal allows referencing a Java interface 4 5 AbstractType ioe T extends extends As we have seen before Class and Literal both extend AbstractType Furthermore AbstractLiteral is of type Literal and Resource is of type Class To complete this picture we can add Any which is of type AbstractType 4 6 Core Resources The Actifsource Core provides a set of resources that allows you to build your own meta model The most im portant resources are Class with its Properties and Enum 4 6 1 ch actifsource core Class typeOt chactifsource core Class comment aspect Intro lirzation specd aspect Resource ValidationAspect aspect Name spect extends chactifsource core MamedResource extends modifier property definesAspect allowRoot classicon line Color filiC olor shape typeOf To act as a class a resource has to be of type Class To be type something of means to be an instance of some thing comment
99. gramType lets you define your domain specific domain dia grams see Chapter 6 Domain Diagram Type If there is no diagram type defined the diagram editor has a default behavior and shows resources and their relationships use and own relation dependencies Ei Statemachinel Statemachinel 2 lt e Palette b gt h Select 1 J Edit 0 rr 4 Marquee i i A r 5 Relation Pi Ej Resource As a very simple example let us define a diagram type for a state machine meta model 5 Staternachine 11 event target transition Event As the root class see also Single Root we choose Statemachine This means that we can only edit elements that are part of the state machine The allowed class is State since we like to edit states Between states there are transitions A Transition is an indirect relation from State via Transition to State User Manual O typeOt ch actifsource uLdiagram diagramtype Diagram Type name Statemachine com actifsource statemachine genertc Statemachine r allowedClass typeOf AllowedClass com actifsource statemachine generic State m PR typeOf ShowPaletteEntry style typeOt AllowedIndirectRelation selector State transition state createAllowed true Inverse visible openEditor allowedRelation highlightPath searchPath tooltip ollowedClass The minimal diagram type shown above leads to a domain specific state event diagram Pi Statemachinel St
100. guage model see Chapter 8 4 Declaring a Program ming Language Parent 3 E e Build 2g Build ol Paorent Parent Selector Build allParent E F Parent name headers Parent nameImpl hpp CH i y a Le pp es 8 3 4 File Tab There are always situations where two or more files belong to each other i e hpp cpp in C Actifsource therefore supports file tabs Just press the button right next to the file tabs to add a new file tab Note that files tabs are always auto matically named the same as the file extension Parent 2 5 J Build gt BA Selector Build allParent r le Parent nameImpl C 4 2 wooo T Press the X button to delete the active file tab T Parent ES 3 Build eS Build allPorent Parent Selector Build allPoarent Parent nameImpl cpp CH F Le hpp Lel cpp Press Ctrl Tab to select next tab from within the code section 8 3 5 SuperContext Let s assume that we want to generate a file for every Child instance 1 1 es H amp S Chil SSSubChild le SUbSubChild cS cubSubChild For that reason we create a template with Child as base type User Manual 97 Template This wizard creates a new actifsource template and adds it to a BuildConfig Resource Path com actifsource ternplateeditor asre Package com actifsource templateeditor generic Template Name Child BuildConfig com actifsource templateeditor genernic MyBuildConti
101. gument and your shell command and parameters as subsequent arguments BuildConfi StatemachineBuildContig buildTask typeOf ExecuteProcessBuildTask directory Src command cmd argument 1 fe argument 2 copy argument 3 Statemachinel hpp argument 4 c Temp argument build Task Directory Directory to execute the process relative to the target project Command The command without arguments to execute Argument The arguments of the command 7 6 6 GraphvizBuiltTask Runs the graphviz dot command on all dot files in the target folder Please note that this tasks needs a built in dependency to GRAPHVIZ see also Chapter 2 5 6 Built in Dependencies Make sure that you have graphviz installed see http www graphviz org and reachable in your path typeOt BuildContig name StatemachineBuildContig descnption outputEncoding linebreak build Task GraphvizBuild Task stylesheet adapt ize false buildTask Styleheet A css stylesheet if needed Adapt Size If set to true the generated diagram s width is set to 100 7 7 Eclipse Builder Eclipse supports so called Builders to build anything In C C there is the CDT Builder to build executables and libraries from header and source files In Java there is the Java Builder to build class files from java files In Actifsource there is the Actifsource Builder to generate code from the model asr files Make sure that the builders are arranged in t
102. h D typeld 7 function typeOf chactifsource template model spec types TemplateFunction name DCBA comment paramll ch actifsource core selector type Param c C OlassType param 2 ch actifsource core selector type Param b B ClassType paraml3 ch actifsource core selector type Param a A ClassType param children Line children language Function Calling fD C B Ais only allowed if the context path contains at least A B C and D in the given order ContedPath i E Build Build all4 A BADE HB cc gt See Selector C d Break al A name txt gt Text F b bar 25 Consider a function fD_A which is based on Class D and declaring a parameter a of type A It is allowed to call this function on the context path A B C and D because it contains A and D in the correct order User Manual ContextPath 3 Selector gt Ea a le C d 8 4 Declaring a Programming Language The Actifsource Template editor does syntax highlighting for keywords comments and strings The actual selected language is determined by the Language Line see Chapter 8 3 3 Language Line 8 4 1 Supported Programming Languages 123 Currently Actifsource supports syntax highlighting for the following programming script markup or domain languages Programming Language Ada CH C Cobol Css Delphi Erlang GraphViz Groovy Haskell Html Java JavaScript Modula2 Oberon Omgldl Pascal Php
103. hapter 9 3 3 SelectorFunction Selector functions allow you to navigate the model by using the selector syntax Starting from a Class defined by FunctionContext typeRef you may navigate via the resource properties Selectors might be used in Templates to select a context But selectors might also be called from within selec tors even recursively User Manual 128 Forward navigation Consider the following meta model 1 We like to define a selector function named getSubChild on Parent which returns all sub children in all children of the parent The return type when navigating along a property is given by the range of the property i e in our example the expected return type is a list of elements of type SubChild To navigate from Parent via child to subChild just assemble a selector Parent child subChild Make sure to use content assist Ctrl Space when writing selector functions typeOf name comment param ch actifsource core selector typeSelectorFunction getSubChild selector Parent c return Type createUniqueResource CompactFigureUtil Press Ctri Space to show Insert New Variable Proposals This is what a selector function could look like typeOt name extends metaModel functionContext functionContext ch actifsource core selector type FunctionS pace MyFunctionSpace typeOt ch actifsource core selector type FunctionContext typeRef com ac
104. he correct order You will find the settings in Pro ject Properties Builder User Manual Coverage FindBugs Java Build Path Java Code Style Java Compiler Java Editor Javadoc Location Project References Refactoring History 2014 actifsource GmbH Switzerland all rights reserved Edit Remove 86 User Manual 87 8 Template Editor 8 1 Overview As already seen in Chapter 1 1 Working with models the Actifsource Template Editor allows you to write meta code based on the meta model Writing meta code means to write code along the structures which are given by the meta model without knowing the specific domain model Meta Model Code Template Domain Model Software Specification Generated Code 8 2 New Template A template is either based on a type Class Enum or not Template Type Description Based on types Based on a type means that the Template is applied for every instance of that type The result is one file per instance Build once Build once means that the Template is applied exactly once The result is one file 8 2 1 Create a template based on type Creating a template based on a specific type Class is the normal case Consider a nested Parent Child struc ture with the following meta model For every specific parent child structure there is at least a resource of type Parent to start with So let s start
105. hich templates have to be built typeOt BuildContig name StatemachineBuildContig descnption 7 build Task typeOf TemplateGeneratorTask template com actifsource statemachine template Statemachine omitFileld false build Task Template References the template Omit File Id Actifsource normally inserts an id at the end of every generated file This file id helps identify and track gener ated code in Statemachinel hpp 3 Zo gt blass Statemachinel public enum State Stopped Running Error mState void run void stop t Actifsource ID 7b973890 79e0 11e3 b637 113462b2fd40 23f4ddef 793e 11e3 9694 211d197b4cb0 Ijp827V0uEyp70h4vGgo6kuqHtw The Actifsource ID is assembled as follows Actifsource ID TemplateGUID SuperContextGUID BaseContextGUID MD5Hash Element Descriptiom Comment Tags The comment tags i e are given by the language Actifsource ID Static identifier TemplateGUID GUID of the template which created this file SuperContextGUID GUID of the resources which contains the base resource BaseContextGUID GUID of the base resources of this file MD5Hash A hash code over the generated code but not including protected regions to detect if the generated code has been changed manually To ignore white spaces when building the MD5 hash check Chapter 2 5 3 Target Folder CY ola rif ela rra rn LJ A ImArinr A al ri Jh tc raAacariso 201
106. his class from the diagram only but not from the model Use Delete on the keyboard to delete select ed classes from the diagram Delete from Model Deletes this class from the diagram and from the model Use Shift Delete on the keyboard to delete selected classes from the diagram and from the model Show Attributes Shows attributes literals in an UML like style p Design 24 ff 2 Palette gt ie Select 5 Statemachine ig a Marquee event State A Extension 0 Relation p A Note y E New Class 7 o 1 i New Enum evente target aran Ci New Note iy a Hide Attributes Hides shown attribute see also Show Attributes Instances Inserts instances of a specific class on the diagram Fi Design EZ E a Palette gt ES Statemachine lt Statemachinel Is Select oi Marquee 1 A event state T Extension Relation L F Note E mn ES New Class ROS 1 E New Enum evente target transition Event state Ci New Note 0 gt _ S Transition Types Shows the types Class typeOf statement of a specific class Super Class Shows the superclass Class extend statement of a specific class You this feature repeatedly to show the in heritance hierarchy 5 2 6 Browse Resource Open any class in the resource editor by Ctrl Click on the class name Fi Design 23 Hu 2 Palette bs ES Statemachine ls Select o Marquee A Extension gt Relation
107. i public i Todo le hpp ES Le cpp Protected Context The protected context allows inserting so called protected regions into the generated files User Manual 103 n Parentlimpl hpp El E class ParentlImpl publ ic e void identifychild1 f Begin Protected Region 787bfb38 a85e 11e3 8e23 057f188cfed4 i Toda End Protected Region 78 7bTb38 a85e 11e3 8e23 057T188cTed4 a void identifyChild2 Begin Protected Region a 4e8786 a85e 11e3 8e23 0577188cTed4 1 Toda End Protected Region a64e8786 asB5e 11e3 8e23 657f188cfed4 a void identifyChild3 Begin Protected Region a 963f1la a85e 11e3 8e23 057f188cfed4 i Toda End Protected Region a6963fla a85e 11e3 5e23 85 f188cfed4 3 4 t The content of the Protected Regions is saved before regenerating and inserted in the newly generated file Use Protected Regions to insert handwritten code into generated files Note that Protected Regions are identified by the GUID of the resource of the current context Use Ctrl Click on the GUID to navigate to the corresponding resource n Parentlimpl hpp El gt class Parentl1Impl l public a void identifyChild1 i Begin Protected Region 787bfb38 a85e 11e3 8e23 057f188cfed4 Todo End Protected Region 787bfb38 a85e 11e3 8e23 657f188cfed4 j a void identifyChild Begin Protected Region a 4e8786 a85e 1lle3 8e23 57T18
108. ibutes which might be applied to a column context User Manual 118 Context Operation Icon Shortcut Description First D Alt 1 The first element of the iteration Not First A Alt 2 All elements of the iteration except the first Not Last a Alt 3 All elements of the iteration except the last Last O Alt 4 The last element of the iteration Empty o Alt 5 For empty iterations The following example prints the comma after Param name for all elements of the iteration except the last T Parent ES A 3 Build 3 Build allParent Parent Parent child Child Sj e E Selector Child param Break nl Parent nameImpl hpp CH f a ske Parent Parent name y class Parent nameImpl i public void identifyChild name 4 le hpp E L cpp The next example prints void on line 7 if Parent child is empty T Parent ES A 3 Build 3 Build allParentParent Y Parent child Child E MAA selector Child param Break ee he Parent namelmpl hpp C f k Parent Parent name class Parent nameImpl i public j void identifyChild name void 2014 actifsource GmbH Switzerland all rights reserved 8 3 15 FunctionSpace As shown in Chapter 9 2 Function Space the Template acts as a Functions Space Therefore functions might be placed directly in the template see Chapter 9 Functions for details Function calls are displayed in italic In the subsequent example th
109. jectCardinality The Relation defines the object cardinality which determines how many resources of type A can reference a resource of type B via relation b 4 4 4 UseRelation The UseRelation UML Association references another resource without affecting the lifetime of this re source Deleting the referencing resource will not delete the referenced resource e Abstractlype UseRangeRestrictionAspect You may want to restrict resources that can be referenced by a UseRelation depending on their context Con sider a state machine where only target states of the own state machine shall be selected zg Statemachine fi event State A Transition Let s define a UseRangeRestriction aspect for Transition state that allows only states of the own state machine Select the ResourceSelectorAspectimplementation for the easy to use Selector Syntax see Chapter 9 3 2 Sel ectorFunction or the JavaAspectimplementation for a powerful Java implementation typeOf name comment subjectCardinality Cardinalityl_1 r aspect UseRangeRestrictionAspect typeOf ResourceSelectorAspectImplementation Implements UseRangeRestrictionAspect selector Transition transition state state modifier objectCardinality Cardinality0_N defaultValue displayStrategy subpackage range com actifsource statemachine generic state extends Starting from Transition navigating backwards via transition and state note the minus sign for backwa
110. ld to subChild just assemble a selector Parent child subChild Make sure to use content assist Ctrl Space when writing selector functions typeOf name comment param ch actifsource core selector typeSelectorFunction getSubChild selector Parent c return Type createUniqueResource CompactFigureUtil Press Ctri Space to show Insert New Variable Proposals This is what a selector function could look like typeOt name extends metaModel functionContext functionContext ch actifsource core selector type FunctionS pace MyFunctionSpace typeOt ch actifsource core selector type FunctionContext typeRef com actifsource design functionspace selector Parent typeld function typeOf ch actifsource core selector type SelectorFunction name getSubChild comment param Parent child subChild return Type typeOf ch actifsource core selector type Listl ype innerTypeRef com actifsource design functionspace selector SubChild innerTypeld Backward navigation Consider the following meta model 2014 actifsource GmbH Switzerland all rights reserved User Manual 13 UJ 00 1 am To get the Parent instance for a SubChild instance we have to navigate backwards via the subChild and child relation The selector allows backward navigation via the minus relation typeOf ch actifsource core selector type FunctionSpace name
111. lps to configure the template settings Template This wizard creates a new actifsource template and adds it to a BuildConfig Resource Path com actifsource templateeditor asre Browse Package com actifsource templateeditor generic Browse Template Name Parent BuildContig com actifsource templateeditor genernic MyBuildContig MetaModel Actifsource Base Type com actifsource templateeditor generic Parent Set the options as needed 2014 actifsource GmbH Switzerland all rights reserved User Manual 89 Option Description Resource Path The resource path where the template is located see Chapter 17 Resource Paths This option is automatically filled in Package The package where the template is located The package is derived from the location where the context menu was Called Template Name The name of the template The template name is automatically derived from the Base Type BuildConfig The build configuration where this template is referenced see Chapter 7 Build Config MetaModel Make sure to choose Actifsource unless you know exactly what you do Base Type The base type is derived from the location where the context menu was called Please note that there is a short way for choosing the package Just type the first few letters of a package fol lowed by a dot Using content assist Ctrl Space shows the matching packages Template This wizard cr
112. machinel Statemachinel_ E run Event typeOt com actifsource statemachine generic Statemachine name Statemachinel event 1 Browse Into ewent F3 event 2 state 1 Open Content Assist Ctrl Space state 2 state 3 Ctrl X Ctrl C Ctrl V Close Aggregated Resource Backspace Open Folding Enter Insert Before Ctrl Shift Enter Insert After Ctrl Enter Copy GUID as Constant Copy GUID Sort Property 2014 actifsource GmbH Switzerland all rights reserved User Manual 41 To move resources up and down use the following possibilities Device Action Context menu Move Down Keyboard Alt CursorDown Alt CursorUp 3 9 Sort property Actifsource lets you sort all resources of the same property by any literal i e name property Note that the sort algorithm is just applied once Just call sort any time if needed E Statemachinel 2 Sj Event E E Mae Aa EA BA Ea E run Event typeOf com actifsource statemachine name Statemachinel ewent 1 run Event i event 2 Browse Into event state 1 Fa Open Content Assist Ctri 5pace f statel2 state 3 of Cut Ctrl X Copy Ctrl E Paste Ctrl V Close Aggregated Resource Backspace Open Folding Enter Insert Before Ctrl Shift Enter Insert After Ctrl Enter Move Up Alt Up Move Down Alt Down Copy GUID as Constant Copy GUID Sort Property Create Instance 3 10 Quick Assist Sometimes Actifsour
113. mment param Client component Leaf lt FeturnType typeOf ch actifsource core selector type ListType innerTypeRef com actifsource design functionspace selector Leat innerTypeld function Up Cast It is always possible to use an upcast to a base class i e Resource or NamedResource if needed Self Cast If your selector has to return the typeRef instance itself use the self cast Consider the following selector func tion for Component returning the component instance itself typeOt chactifsource core selector type FunctionContext typeRef com actifsource design functionspace selector Component typeld 7 function typeOf chactifsource core selector type SelectorFunction name self comment param selector Component Composit 7 feturnType typeOf chactifsource core selector type ClassType classRef com actifsource design functionspace selector Component classid function Recursive navigation The diagram below shows a composite pattern as presented in the book Design Patterns from Erich Gamma et al The composite pattern allows you to recursively instantiate Composite instances which might aggregate other components of type Leaf or again of type Composite 0 1 gt 9 Component There is an easy way to find the Client of this recursive model using selectors First we collect all components including the own component and all parent components For that reason we write a selector function for Component whi
114. n allowed Relation highlightPath searchPath tooltip ollowedClass Search Searches allowed classes with a defined search path REF 5 3 4 Drag and Drop Use the drag and drop feature from the project explorer to add an existing resource to your diagram 2014 actifsource GmbH Switzerland all rights reserved User Manual 71 EE OPA e q da i 5 pi of Dji opi Seg 0 Quick Access E a actifsource 4 Project Explorer 3 pza ss Ta Pi Statemachinel Statemachinel EZ a i com actifsource statemachine gt a E asrc 4 EY com actifsource statemachine ls d generic i 1 Edit b Pi Design Ei Marquee gt g Event T gt S State x Relation Statemachine Noy EY State p Fi Statemachine Fi ni Sj Transition 4 EY specific a H Statemachinel ii Bn Je A E stop f Ek BE ef E r gt B Stopped Actifsource Generator l ou a Generate for scope com actifsource sta gt 4 Mi I H 1 item selected 5 3 5 Context Menu Pi Statemachinel Statemachinel EZ E gt Palette gt ls Select 1 Edit Loi Marquee gt Relation x Delete from Model Shift Delete Hide Resource Delete Show Resource Show Hide Resource Parts Router Delete from Model Deletes this resource from the diagram and from the model Use Shift Delete on the keyboard to delete se lected resources from the diagram and from the model Hide Resource Deletes this resource from
115. n resource with Func tionSpace TypeRefFunctions class as parameter FunctionSpace is the function space where your function is defined TypeRef is FunctionContext typeRef The static property class is given from Java and represents a class as an object Override public java util List lt com actifsource design function modelaccess javamodel IChild gt filterChildReverse final com actifsource se a nodelaccess a parent 4 Begin Protected Region 7 List lt IChild gt childList ArrayList lt IChild gt endef ole java util collections oler elo dieser return modifiableChildList End Protected Region 58c9e575 c49e 11e3 a312 9d8ca9dd1829 9 5 4 Built in function access 9 5 5 Use the extension mechanism to access built in functions on resources see chapter 9 4 1 Built in functions on Any Actifsource provides the following built in functions on Any Function Return type Description Literal Gets the unique identifier of any Resource or Literal For Resources it is a GUID for Literals it is the Literal itself 9 5 6 Built in functions on Any List Actifsource provides the following built in functions on List of Any IntegerLiteral Counts the number of elements in the list BooleanLiteral Returns true if and only if the list is empty BooleanLiteral Returns true if and only if the list contains no duplicates 2014 actifsource GmbH Switzerland all rights reserved first T Returns the first element in
116. n the link to open the resource Alt F3 Resource Editor Press F3 on the current cursor position to open the resource ine Resource Editor Click Open Link in ResourceEditor from the toolbar on the current cursor position to open the resource 8 3 9 Line Context Column Context Protected Context Actifsource knows three different types of contexts Line Context The line context consists of one or more lines in a file The text in the line context is repeated for any resource reached by the selector see chapter 8 3 10 Working with Context To insert a ine context use the nsert Line Context tool from the toolbar or press Alt Insert 2014 actifsource GmbH Switzerland all rights reserved Parent EZ E 3 Build 3 Build ollPorentParent AENA Selector Parent child Break _ Parent nameImpl hpp CH class Parent nameImpl 1 public g void identifyChild name Param name 1 Todo a b Le hpp 3 Le cpp Column Context The column context consists of one or more columns of a line The text in the column context is repeated for any resource reached by the selector see Chapter 8 3 10 Working with Context To insert a column context ME use the Insert ColumnContext tool from the toolbar or press Alt Shift Insert Parent EZ E 3 Build 3 Build allParentParent Sj Parent child Childd IEA Selector Child param Look l Parent nameImpl hpp a class Parent nameImpl
117. n the meta model from Section 9 3 5 functionContext 2 typeOt ch actifsource core selector type FunctionContext typeRet com actifsource listtunction Child e NN typeOf JavaListFunction name myChildrenListFunction comment param mod fer ownership inlineJave Code returnType T extends Child GenericContextType cached true function public lt T extends com actifsource listfunction javamodel IChild gt T myChildrenListFunction final List lt T gt childList The return types of JavaListFunctions are determined in the same way as for JavaFunctions see Section 9 3 3 A list of built in Java list functions is presented in Section Fehler Verweisquelle konnte nicht gefunden wer den Consider an extended meta model where Parent can be referenced by a ParentContainer via a relation parent 1 1 a Child subChild SubChild In this case the selector ParentContainer parent child myFunction MyFunctionSpace constructs for each Parent the list of Children reachable from this Parent and then applies the function myFunction to each of these lists If the function should be applied to the list of Children reachable indirectly via parent gt child we can write a Selector Function that returns a list of all these Children e g ParentContain er getAllChildren MyFunctionSpace where getAllChildren is a SelectorFunction with the selector ParentCon tainer parent child In the selector ParentContain er getAllChildren MyFunction
118. n to the Model Inconsistencies view 3 startCounter lt foo action Model Inconsistencies El Properties i Problems oS ie Description Resource Statemen missing at lt EOF gt 3159c2a8 847a lled 9bsd Stbl4s0sf4ed ic unknown 2014 actifsource GmbH Switzerland all rights reserved 10 5 Code Generation In this section we will show how to generate code in an arbitrary target language from code snippets As ex plained in the introduction of this chapter the input code of a code snippet is parsed by a parser that depends on the chosen input language e g C or Text From the resulting parse tree Actifsource generates a model that is composed of temporary resources The meta model for parse trees of the language C is available at http www actifsource com manuals index html The parse tree for unvalidated input Text can be found in Section 10 3 3 To generate output files from these temporary models we can apply code templates or template functions to these temporary resources i e the temporary resources behave in exactly the same way as persistent re sources except that they are not shown in the resource browser Project Explorer and are deleted when the session ends e g the project or the workspace is closed To use the content of code snippets in templates you can either use the built in TemplateFunctions see Section 10 5 1 or write your own templates or template functions by modifying the
119. ncoding a E EN a buildTask Mac E Unix E Windows ch actifsource generator LineBreak LineBreak build Task If no line break has been set the one from the parent build configuration see also Chapter 7 6 2 NestedBuild ConfigGeneratorTask project or workspace is taken type filter text General See Startup and Shutdown for workspace startup and shutdown preferences gt Appearance Capabilities Compare Patch Build automatically Content Types Refresh using native hooks or polling Editors Refresh on access Keys E Save automatically before build i a En Always close unrelated projects without prompt Perspectives Search gt Security Workspace save interval in minutes 43 gt Startup and Shutdov Tracing Workspace name shown in window title Web Browser Open referenced projects when a project is opened O Always Never Prompt Text file encoding New text file line delimiter ChangeLog a Default Cp1252 Default Windows FreeMarker Editor DSL 5 Other Cp1252 5 Other Windows gt Help gt Install Update 7 6 BuildTask The build configuration lists all build tasks Build tasks are executed in the order as listed There are different types of build tasks The most important one is the TemplateGeneratorTask 2014 actifsource GmbH Switzerland all rights reserved User Manual 7 6 1 Template Generator Task The template generator task defines w
120. ndiveonsd ddceanusssuincadaaaiian die 24 2 10 3 Package Presentation cccccccsssccccssscccasscccceecccseuseccsuseeessscesseueeesaaeeesaaecesseuseessausessseeessaeeess 25 2 10 4 DP ana DOD eae E een E EE E E eee ee ee eee 26 2 11 Project Explorer Context MENU rr 26 2 11 1 INAV a ei T 26 2 11 2 OPEN nos 27 2 11 3 Rename Resources and Packages ansia ied 28 2 11 4 GENEE RCT AC CONS ind tod 28 2 11 5 COMPITE Witir eE aed taeenecbamoeeusuaanas 29 2 11 6 Show Resource Dependenci8eS ccccsseccccsscccesceccenscccceuceccauesecsauseceseuseessaeeeseueeessauseessueseesaases 29 2 11 7 SOME PLONE Moa 30 A IN O O 30 2 12 1 AQUI iS 30 2 12 2 aa A lt A eater Ee one ot nee tr Mie a eee ene en ne ee ee eee eee eee 31 2 12 3 Model nconsisten cies iia seticsnaaeenoees 31 2 12 4 MOTE NA A e o eo 31 2 12 5 Protected Ree Sia 31 2 12 6 FRETTING EA 32 Resource A saa on aaeanace van a mata yausad 33 31 OVER VICW cua dad 33 S11 Aggregated vs Referenced RESOUPCE vcidedoscctssesseuctasgavsaseaborsendonaeatesenawen ede a taster eee eaaeee 33 F2 A A tame uecewreauutes 33 Sd Open ClOSE FOIGING arta atada 34 Sd MMC type Statement id 34 3 2 Read ONIY VIEW ee ei 35 3 3 Brescia 35 3L Navigate POSOUCS So is at 36 3 3 2 Focusing aggregated resources occcooccccococcnnononnnonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnannnnnnnss 36 3 4 BLOW SEAS squid dla coins 37 3 5 o A dacesancwasenancdaces tuseasabetmaceeiauinep a 37 SL
121. ng package structure 2014 actifsource GmbH Switzerland all rights reserved dl T2 com actifsource statemachine a E asre fA com H com actifsource fA com actifsource statemachine H com actifsource statemachine generic H com actifsource statemachine specific fA com actifsource statemachine template Generic The generic package contains the meta model Specific The specific package contains the domain model Template The template package contains the code templates 2 8 Project Menu Use the project menu to control the build system of Eclipse and Actifsource File Edit Mavigate Search Project Run Window Help i Open Project Close Project Ces E Build All Ctrl B Enable External Builder y Project Explorer 3 4 Generate Automatically E G5 asrc Build Project gt BA Actifsource Build Working Set gt BA JRE System Library Clean E sre Build Automatically gt 3 src gen Generate Javadoc ES Console Es Ex BB of E ciy Properties Actifsource Generator 4 LA Jl processed 2 files 1 1 es com actifsource statemachine Build Automatically If Build Automatically is switched on Eclipse will build the project automatically after changed files have been saved Actifsource also generates Java classes for internal use Generating these internal classes is also switched off by Build Automatically and you can t expect Actifsource to work correctly Therefore pl
122. nning Running State Error State 3 3 2 Focusing aggregated resources Clicking on a resource in the breadcrumb allows you to focus only on this aggregated resource Use this feature to work with large resource files 2014 actifsource GmbH Switzerland all rights reserved User Manual 37 E Stopped w E E com actifsource staternachine specific Statemachinel Statemachine EEE 0 E runTransition typeOf com actifsource statemachine generic State name Stopped 7 com actifsource statemachine generic Transition com actifsource statemachine specific Statemachinel run Running 3 4 Browse resource Actifsource allows you to browse any resource in any editor Statemachinel El E E B MAA AAA Aa OA aa E Stopped State typeOt com actifsource statemachine generic Statemachine name Statemachinel event 1 run Event event 2 stop Event 7 typeOf com actifsource statemachine generic State name Stopped a transition run typeOf com actifsource statemachine generic Transition event com actifsource statemachine specific Statemachinel run state hy transition stop s T com actitsource statemachine specific statemachinel Running state Running State state 3 Error State To browse any resources in actifsource use the following possibilities Device Action Mouse Ctrl LeftClick Context menu Browse Into Keyboard F3 3 5 Insert resource 3 5 1 Insert on the empty line A
123. not know your meta model in advance we cannot generate any suitable code for you This means that you have to define your own code templates according to the meta model Defining code templates is as easy as writing normal code Meta Model Code Template Since everything depends on the meta model you have to start by analyzing your business domain Once the meta model is defined you are able to enter you domain specific software specification accordingly Also tem plate code is written along the meta model From this three models meta model domain model code tem plate your code is generated by the Actifsource code generator User Manual Core Model Meta Meta Model Meta Model I Domain Model Software Specification 1 2 Resource La Ld a al me a a y na is a om nn m me ay __ 11 Code Template a Generated Code Every model consists of so called resources A resource is like an object and the most abstract entity from the Actifsource core model In fact every model element is a resource Every resource is identified by a globally unique identifier GUID which is automatically assigned if you create a new resource Therefore changing resource names never affects any relation between resources 1 3 Getting started To get started with Actifsource we suggest our tutorials on the Actifsource web site Please visit http www actifsource com tutorials
124. nstance aggregated by Client Let s write a selector function for that Please take extra care because there are two relations named component One is Composite component the other one is Client component Make sure to use Composite component in allComponent and Cli ent component in getClient typeOf ch actifsource core selector type FunctionContext typeRef com actifsource design functionspace selector Component typeld function 1 typeOf ch actifsource core selector type SelectorFunction name allComponent comment param selector Component Component union Component component aliConmy returnType typeOt ch actifsource core selector type Listlype innerTypeRef com actifsource design functionspace selector Component innerTypeld a function 2 typeOf ch actifsource core selector type SelectorFunction name getClient comment param Component aliCom return Type ch actifsource core selector type Class Type com actifsource design functionspace selector Client function Calling selectors with parameters TBD CC DAI Asa ctitc niimra G m h hH Cra i itsarlan A in J rio ht C racarv a A 2014 actifsource Gmbl l Switzerland all Isnts reserved 9 3 3 JavaFunction Actifsource supports user implemented Java functions that make use of the very powerful Javamodel to access the Actifsource models from Java code see also Section 9 5 typeOf name extends metaModel functionContext functionContest ch ac
125. ntMod ter keyword 1 Fdefine keyword 2 Ferror import stringStyle A declaration of start and end tag for strings including the syntax style color font modifier typeOt StringStyle style typeOf SyntaxStyle color Blue FontM od ter startTag endTag escapeSign escapesign singleLineComment A declaration of the start tag for single line comments including the syntax style color font modifier typeOt SingleLineComment oa typeOf SyntaxStyle color Green fontModiier tay if mutliLineComment A declaration of start and end tag for multi line comments including the syntax style color font modifier typeOt MultiLineComment style typeOf SyntaxStyle color Green fontModifier startlag p endTag I 8 4 3 File Extension Priority Rules You might define your own template language defining the same file name extension as a built in language Actifsource will handle user defined template languages with higher priority so that you can overwrite the standard 9 Functions 9 1 Overview Actifsource functions might be called from templates see Chapter 8 Template Editor from other functions or from selector relations see Chapter 4 4 7 SelectorRelation There are different supported types of functions see Chapter 9 3 Function types 9 2 Function Space The function space is the resource where functions are living We know two different types of functions spaces both derived from AbstractFunctionSpace
126. o called inks which are directly linked with your model Note that renaming resources in the meta model automatically renames all links in the template synchronously 2014 actifsource GmbH Switzerland all rights reserved User Manual 99 Parent ES E 3 Build BR Selector Build allParent Break L F Parent namelmpl hpp r class Parent nameImpl bp Le hpp 2 Le cpp You can always navigate to the corresponding resource in the model by using Ctrl Click on the links as shown below or the 8 tool from the toolbar Parent 3 E 3 Build gt 5 C E Selector Build allParent Break F Parent namelmpl hpp A 2g com actifsource templateeditor generic Parent ContextPath Build hal b lc hpp ES L cpp Saving the above template leads to one file for every resource of type Parent in your project 2014 actifsource GmbH Switzerland all rights reserved E Actifsource 10 b18241da a85 Al Mio j gt class Parent2Impl a 3 Actifsource ID b18241da a85f 1 Alis Mio I A build config is needed to work with resources from other projects see Chapter 7 Build Config 8 3 7 Using type names in the template code Please note that you might insert type names directly in the template code by using the content assist Ctrl Space If the desired type name is not available press Ctrl Space again to get all available type names Parent 25 3 Buil
127. o insert variable 4 I El Undefined O E User Manual 93 The name of the generated files is derived from the specific resource instance for which code is generated Use content assist Ctrl Space to access the properties of the class which is bound to the base context by the Selec tor dd Parent El E 3 Build ea Build allPorent Parent Selector Build allParent Break E e child com actifsource te ch actifsource co e typedt ch actifsource cor ee connector ch actifsource ul ce data ch actifsource ul defaultValue ch actifsource cor 4 ene 52 ce defaultValue ch actifsource cor EE ce functionRef ch actifsource cor The following file name will create files named Parent namelmpl hpp while Parent name is replaced by the name of the specific instance of class Parent Text elements referring to the model are called links and dis played underlined Please note that the file extension hpp automatically selects the Language C see Chapter 8 3 3 Language Line and Chapter 8 4 Declaring a Programming Language Parent 3 E 3 Build AR Selector Build allParent Break _ F Parent namelmpl hpp C Le hpp es Le cpp It is also possible to define a folder structure in the file line The generated files will be placed in the defined folders 2014 actifsource GmbH Switzerland all rights reserved Jser Manual 94 Parent El E J Buil
128. ode to prefix All lines will repeat the preceding characters in of the first line If applied in a template function the setting of the outer template is not affected The return value is the text itself List lt String gt Splits text into a list of strings of maximum 80 characters Words are considered atomic if possible List lt String gt Splits text into a list of strings of maximum 100 characters Words are considered atomic if possible escapedString String Escapes the text such that it can be embedded into C C or Java source code Escaping for C C only works for ASCII characters notEmpty Text Returns the text unless it is empty 9 4 12 Built in functions on StringLiteral Actifsource provides the following built in functions on StringLiteral Function Return type Description character List of Character Gets the characters in the string length Integer Gets the number of characters in the string toFirstUpper String Gets the same string with capital first letter toFirstLower String Gets the same string with small first letter toAllUpper String Gets the string in all capital letters toAllLower String Gets the string in all small letters camelcapToUnderscore String Inserts an underscore before every uppercase letter unless it is the first letter in the string whitespaceToCamelcap String Replaces letters behind one or many whitespace characters by their uppercase counterparts replacing those whitespace cha
129. odeSnippetRelationAspect aspect CodeSnippethelationAspect subjectCardinality Cardinality0_1 range ch actifsource codesnippet metamodel element Codesnippet objectCardinalrty Cardinalityl_1 style ownership Type defaultValue language CMinusCondition token typeOf ch actifsource codesnippet metamodel RelationTokenProvider selector Transition transition state variable tokenType ch actifsource codesnippet metamodel TokenType Variable subtoken token 10 2 1 Language Next we choose an input language for the code snippet MEU nC token ch actifsource codesnippet metamodel language CodeSnippetLanguage CMinus ch actifsource codesnippet lanquage CodeSnippetLanquage CMinusCondition ch actifsource codesnippet language CodeSnippetLanguage Text ch actifsource codesnippet lanquage CodeSnippetLanguage token The input language is used to check the input code syntactically and to highlight keywords of the language Furthermore the input language defines which parser will be applied to the input code when generating out put code from the code snippet See Section 10 3 for a description of the available input languages 10 2 2 Tokens Finally we need to define which resources will be available as functions and variables in the code snippet edi tor This is done by creating one or more token statements referring to a RelationTokenProvider The Rela tionTokenProvider allows the user to define a selector cf Section 8 3
130. om Context Ctrl Alt Shitt Down FunctionSpace Ey Import ES Package a E Resource je Resource Folder AS E lt Template Profiling Tools t Gi Template Folder Fix LicencelnfoMarkers via TeamPlugin Ti xPand Generator Task Preselecting a package will directly fill in the resource path and package in the wizard New Class Diagram Wizard Class Diagram Create a new empty class diagram Resource Path com actifsource statemachine asrc Finish Cancel 5 2 2 Palette Use the palette to edit your diagram Pi Design 2 E lt e Palette gt ls Select AA 2 Marquee 1 event state ji Extension Relation Note Astate E New Class e 1 Ej New Enum event target transition Event 0 5 state Ci New Note Select Selects one or many classes from the diagram Use Ctrl Click for multi select Marquee Selects classes from the diagram within a rectangle Extension Derives a class from another class by adding a Class extend statement in the sub class Note that are special rules for your convenience Consider creating two new Classes MyClass and MySubClass Both are extending NamedResource by default Inserting an extends relation from MySubClass to MyClass would add an extends relation from MySubClass to MyClass as expected At the same time the extends relation from MySubSubClass to NamedResource is re moved because MyClass already extends NamedResource The same rule also applies when
131. on for a Resource in the Relation s range objectMinCard int Returns the minimum allowed count of Statement of a given Relation for a Resource in the Relation s range attributeMinCard int Returns the minimum allowed count of Statement of a given Attribute for a Resource in the Attribute s domain attributeMaxCard int Returns the minimum allowed count of Statement of a given Attribute for a Resource in the Attribute s domain CC 2341 artiftenirra GmhH Cwitzarland all rishte racarvan 20 14 act fsource Gm bl l IWILZeMNana al Igi its reserved subjectMinCard int Returns the minimum allowed count of Statement of a given Relation for a Resource in the Property s domain subjectiMaxCard int Returns the minimum allowed count of Statement of a given Relation for a Resource in the Property s domain objectForAttributeOrNull List of Literal Returns the first Objects as result of the Evaluation of a given Attribute on a given Resource valueForAttributeOrNull string Returns the string value of the first Object as result of the Evaluation of a given Attribute on a given Resource valueForBooleanAttribute boolean Returns the string value of the first Object as result of the Evaluation of a given Attribute on a given Resource or a default value objectForRelationOrNull List of Re Returns the first Objects as result of the Evaluation of a source given Relation on a given Resource objectsForRelation List of Re Return
132. or has some special features to work with links and con texts Copy Paste with Link Links can be easily copied like text T CopyPaste El E 8 Sula gt S ERE Selector Build allA Break _ F P EXT B name om C name D name ABC D 7 El tet 3 Copy Paste with Context The Copy action takes care on all nested contexts in the current context The following situation won t copy the selected line context C on line 2 but the nested column context D p 2014 actifsource GmbH Switzerland all rights reserved T CopyPaste El E 3 Build 3 Build ollA A HA b B SEE Selector B c Break B name s Fli ss ABC D 7 El bar BS If you have to copy the line context C on line 2 just navigate to the base context see Chapter 8 3 10 Working with Contexts what makes the line context a nested context T CopyPaste i E 3 Build 3 Build alA A SE gt YH Bec Selector A b Break _ e A name txt Text B name gt 9 El ABC D r bar 25 There is also a command Copy with Context in the context menu which allows to specify the position from which context are copied The following situation shows a selection on line 2 where the copy operation allows to copy with context C or B T CopyPaste 3 E 3 Build 3 Build ollA A YH A b B HER Selector B c Break dl A name txt gt Text B name oO Uae AE ABC D ha Open ContentAssist Ctrl Space ja 19
133. ore Model is read only for you 3 3 Breadcrumb The breadcrumb helps you navigating large resources 2014 actifsource GmbH Switzerland all rights reserved User Manual E Statemachinel 2 36 event 1 event state 1 LU state state 3 com actifsource statemachine generic Statemachine Statemachinel run Event stop Event typeOf com actifsource statemachine generic State name Stopped 7 com actifsource statemachine generic Transition com actifsource statemachine specific Statemachinel run Running transition stop Running State Error State 3 3 1 Navigating resources Clicking on the arrow in the breadcrumb allows you navigating all resources from the same property E Statemachinel E 2 4 E com actifsource statemachine specific Statemachinel Statemachine H Stopped State amp run Transition typeOt name event L event 2 state 1 state state 3 com actifsource statemachine generic State E Stopped com actifsource statemachine specific Statemachinel Statemachinel E Running com actifsource statemachine specific Statermachinel Aa E Error com actifsource statemachine specific Statemachinel stop Event typeOf com actifsource statemachine generic State name Stopped transition run typeOf com actifsource statemachine generic Transition event com actifsource statemachine specific Statemachinel run state Ru
134. other projects explicitly Set the project dependencies first accordingly Add Resource Adds a single resource to your build configuration If no resource is defined Actifsource generates code for all matching resources found in all packages of the current project Note that you need to reference resources from other project explicitly Set the project dependencies first see Chapter 2 5 5 Project Dependencies Edit Edits the current entry Remove Removes the current entry Ignore Whitespaces Actifsource calculates a checksum MD5 hash for every generated file If this option is checked Actifsource will ignore whitespaces when calculating the checksum Execute Save Actions Eclipse supports so called Save Actions after a file has been saved i e code formatting If this option is checked save actions are executed after generating the files 2 5 4 Template Folders Project Settings Setup your project CE Resource Paths 5 Target Folders Project Dependencies L gt Built in Dependencies EI Add Template Folder Edit Remove This feature is for beta users and developers only and might be used to reference folders for templates of third party products User Manual 20 2 5 5 Project Dependencies Setup your project 2E Resource Paths 22 Target Folders lt b Template Folders Project Dependencies Remove Use the project dependencies if you like to split your model in different Actifsource
135. ource g Resource Folder 2 Refresh F5 T Template Profiling Tools t T3 Template Folder Fix LicencelnfoMarkers via TeamPlugin Tj xPand Generator Task Delete LicencelntoMarkers A AA Actifsource suggests adding templates to the build configuration which are not assigned to any other build configuration yet User Manual 77 Create BuildConfig Creates a new BuildConfig in the specified package Resource Path com actifsource staternachine asrc Package com actifsource statemachine generic Mame Statemachi neBuildConfig Templates T Statemachine com actifsource statemachine template For every selected template Actifsource creates a so called a TemplateGeneratorTask as shown below StatemachineBuildConfig 3 E En ET Statemachine TemplateGeneratorTask typeor BuildConfig name StatemachineBuildContig description lineBreak 7 buildTask typeOf TemplateGeneratorTask template com actifsource statemachine template Statemachine omiutFileld false buuld Task 7 3 BuildConfig and TargetFolder Build configurations have to be registered with target folders to take any effect see also Chapter 2 5 3 Target Folder and Chapter 2 6 Project Properties 2014 actifsource GmbH Switzerland all rights reserved User Manual 78 type filter text t Resource lactifsource Builders Coverage di com actifsource statemachine generic StatemachineBuildContig
136. pe____ _ _aliRequiredScopes ____ SetofResourceScope____ _ o _allAvailableRequiredScopes Set of Resource Scope 2 o isRequired Set of Resource Scope S _allResources Unordered Set of Resource Returns all Resources in Scope allResourcesinPackage Unordered Set of Resource Unordered Set of Resource allResourcesinPackage2 Unordered Set of Resource Returns all Resources in a Package with Package allResourcesInPackages2 Unordered Set of Resource Returns all Resources in a List of Packages with Package allRootResourcesinPackage Unordered Set of Resource Returns all Resources residing directly in a Package allStatements Set of Statement Returns all Statements resourceBySimpleNameOrNull Resource with Package Returns the Resource having a given simple Name resourcesBySimpleName Set of Resource with Pack Returns the Resource having a given simple age Name resourceByFullNameOrNull Resource with Package Returns the Resource having a given full Name resourcesByFullName Set of Resource with Pack Returns the Resource having a given full Name packagesByName a a Package Returns the Packages having a given Name subPackagesByName Set of Package Returns the Packages having a given Name including the Sub Packages packagesByExpressions Iterable of Package Es allPackages Iterable of Package E 2014 actifsource GmbH Switzerland all rights reserved User Manual 176 12 Code Generator 12 1 Overview Click on GUID Eclipse Builder Working
137. pertiesForRead Property Set Returns the inherited or defined Properties of a Re source s Class including overridden Properties allowedAttributes Attribute Set Returns the inherited or defined Attributes of a Re source s Class allowedAttributesForRead Attribute Set Returns the inherited or defined Attributes of a Re source s Class including overridden Attributes allowedRelations Relation Set Returns the inherited or defined Relations of a Re source s Class allowedRelationsForRead Relation Set Returns the inherited or defined Relations of a Re source s Class including overridden Relations _allowedToMeRelations Relation Set Returns the Relations having a Resource s Class as range objectsForAttribute List of Any Returns the Objects as result of the Evaluation of a given Attribute on a given Resource objectForAttribute List of Any Returns the first Objects as result of the Evaluation of a given Attribute on a given Resource or else a default objectForAttributeOrNull List of Any Returns the first Objects as result of the Evaluation of a given Attribute on a given Resource statementForAttributeOrNull List of State Returns the first Statement on a given Resource for a ments given Attribute objectForPropertyOrNull List of State Returns the first Objects as result of the Evaluation of a ments given Property on a given Resource objectiMaxCard int Returns the maximum allowed count of Statement of a given Relati
138. ponent union Component component cliComponent MyFunctionSpace typeOf ch actifsource core selector type Listlype innerTypeRef com actifsource design functionspace selector Component innerTypeld ch actifsource core selector type SelectorFunction Component aliCom typeOt ch actifsource core selector type Class Type classRef com actifsource design functionspace selector Client classid Calling selectors with parameters TBD JavaFunction leads to the corresponding java function arguments J LULA al actiTtsouUrce GMD 1 IWILZE dild d IST ECS reserved Override public java lang String gD C B Affinal com actifsource design template contextpath javamodel IC c final com actifsource design template contextpath javamodel IB b final final com actifsource design mplate con path javamodel ID di 4 Begin Protected Region c767a862 b9a5 11e3 ae55 fF7dd183ca236 return End Protected Region c767ae62 b925 11e3 ae55 f7dd183ca236 t 9 2 3 Polymorphic calls Function calls are polymorphic if a function has the same name the same parameters and a typeRef to a sub class 3 MySubClass In the following example the function identify is defined for MyClass and MySubClass There will be a poly morphic call to MyClass identify dependent on the type of the instance typeOt ch actifsource core selector type FunctionSpace extends metaModel functiontontext 1 typeOf ch actifsource core
139. projects Note that you have to set the project dependencies before you might reference packages and resources from other projects in the target folder Add Project Adds a new project dependency Edit Edits the current project dependency Remove Removes the current project dependency 2 5 6 Built in Dependencies Project Settings Setup your project DIAGRAM CORE CIP 2014 actifsource GmbH Switzerland all rights reserved User Manual 21 Use the built in dependencies to reference any Actifsource built in models Built In Description CORE The Actifsource core model do not remove DIAGRAM Domain Diagram C Embedded real time state engine IP UM UML state engine and code generator Add Builtin Adds a new built in project dependency Edit Edits the current built in project dependency Remove Removes the current built in project dependency 2 6 Project Properties All settings shown in Chapter 2 5 Project Wizard can be found in Project Properties Actifsource Properties for com actifsource statemachine type filter text t Resource E Resource Paths GL Template Folders Builders EE fasre Coverage FindBugs Jawa Build Path gt Java Code Style ae gt Java Compiler AA gt Java Editor Javadoc Location generate javamodel Project References Refactoring History Run Debug Settings gt Task Repository WikiText 2 7 Standard Package Structure We suggest the followi
140. racters whitespaceToUnderscore String Replaces all whitespace characters by underscore characters split80 List of String Splits the string into a list of strings of maximally 80 characters split100 List of String Splits the string into a list of strings of maximally 100 charac ters packageToDirectory String Replaces by isNotEmpty Boolean Returns true if and only if the string is not an empty string escapedString String Escapes the string such that it can be embedded into C C or Java source code Escaping for C C only works for ASCII 2014 actifsource GmbH Switzerland all rights reserved User Manual 154 characters part List of Literal Parses the string into words natural numbers and special characters removing whitespaces 9 4 13 Built in functions on Word Actifsource provides the following built in functions on Build Function Return type Description character Letter Gets the letters in the word 9 4 14 Built in functions on Guid Actifsource provides the following built in functions on Build Function Return type Description timestamp Long Returns the GUID s timestamp in 100 nanoseconds starting from Oct 15 1582 time Time Returns the GUID s time identify Resource Returns the Resource identified by the GUID 9 4 15 Built in functions on Build Actifsource provides the following built in functions on Build Function Return type Description once Build Used in the selector of the
141. rce statemachine specific Mame Diagrarmlype com actifsource statemachine generic Statemachine SingleRoot com actifsource statemachine specific Sstatemachinel Finish Cancel Note that the single root is preselected in the wizard and the diagram type is automatically detected if there is a diagram type which has a root class of the same type as the chosen single root 5 3 3 Palette Use the palette to edit the domain diagram g Statemachinel Statemachinel 3 4 lt e Palette tS ls select _J Edit on Marquee stpp gt Relation N Ej State H Running Search Select Selects one or many classes from the diagram Use Ctrl Click for multi select Edit Edits figures with a FigureEditableLabelSelector REF Note that you can also enter the edit mode with the Select tool Click on the text to alter wait for one second until the cursor changes to text mode and click again Marquee Selects classes from the diagram within a rectangle Relation Inserts a relation from a resource to another Resources Inserts a new resource on the diagram and in the model Note that you control the palette by Al lowedClass paletteEntry in your diagram type User Manual typeOf ch actifsource uLdiagram diagramtype Diagram Type name Statemachine rootClass com actifsource statemachine genertc Statemachine style 7 allowedClass Allowed las com actifsource statemachine generic State allowedRelatio
142. rd navi gation to Statemachine where navigating forward to all States 4 4 5 OwnRelation The OwnRelation UML Aggregation Composition aggregates another resource Deleting the aggregating resource of type A will delete the referenced resources of type B 0L range range 4 4 6 DecoratingRelation Combining two existing models together is a very important task Sometimes this is done by so called model transformation Actifsource chooses another way because model transformation often only works in one di rection Actifsource allows decorating existing resources with other ones That means that we can add any auxiliary information to already existing information You will find out that this is a very powerful concept The DecoratingRelation allows building a homomorphism A homomorphism is a structure preserving map between two structures The word homomorphism comes from the ancient Greek language u homos meaning same and opp morphe meaning shape Consider a resource A1 with a list b1 of resources of type B1 Consider a second List A2 that has a reference a1 to a resource of type Al The decorating relation A2 b2 shall have 0 1 resources of type B2 for any resources reached via A2 a1 b1 The decorating relation A2 b2 needs a decorating aspect which defines where to find the resources that shall be decorated typeOt name comment subjectCardinality aspect OwnRangeRestnctionAspect aspect Decora
143. re selector token t ch actifsource core selector type ch actifsource environment ch actifsource generator i 1 ch actifsource generator graphviz event state ch actifsource generator workspacetask gt 5 O Show JavaClassName for Selection DEV a eeun j ch actifsource solution cip generic cipimport model b i E id pl ara ch actifsource solution cip generic core meta Profile As ch actifsource solution cip generic core meta cluster event tra Debug As ch actifsource solution cip generic core meta extension 0 4 a ch actifsource solution cip generic core meta mode 0 Profile As ch actifsource solution cip generic core meta process er Coverage As ch actifsource solution cip generic core meta system gt Profiling Tools ch actifsource solution cip generic core meta system codeOptions gt Show Shows any existing resource in the scope of your project Use this feature to insert resources from third party or Actifsource models to your diagram i e Actifsource Core Model 5 2 5 Class Context Menu Use the content menu on any class 2014 actifsource GmbH Switzerland all rights reserved E Design e E ae Palette gt l ES Statemachine Sel I i ie select A Hi Delete from Diagram Delete a a state 3 Delete from Model shift Delete g Show Attributes a 6 instances i E 1 E types i superclass i event trar Ci New Note Delete from Diagram Deletes t
144. references Actifsource provides the following configuration options 2 4 1 Statistics Selecting the Actifsource menu shows a statistic of the resources type filter text Actifsource gt General a Actifsource Expand the tree to edit preferences for a specific content type Generator StyleConfiguration Statistics Validator gt Ant gt C Project FResources RootResources Statements Total 43 142 com actifsource statemachine 43 142 ChangeLog FreeMarker Editor DSL gt Help gt Install Update gt Java gt Library Hover Model Validation Restore Defaults Apply O Resources The number of resources in the project RootResources The number of root resources in the project A root resource is a non aggregated resource Statements The number of statements in the project The statement declares three resources as follows Subject Predicate Object 2 4 2 Generator type filter text Generator t General Set actifsource generator preferences a Actifsource Generator StyleConfiguration Validator Always clear generator console before generate Actifsource cleans the console output before generating code This makes it easier to scroll to the top of the output to find error messages 2 4 3 Style Configuration The style configuration let you define your own colors type filter text StyleConfiguration t General 4 Actifsource
145. roperty The property acts as an abstract base class Please note that properties are fully typed In Actifsource the type of a property is named range ES AbstractType Every resource that can be referenced by a range has to be of type AbstractType One abstract type you al ready know by now is Class SubjectCardinality The Property defines the subject cardinality which determines how many resources of type B can be referenced by a resource of type A via relation b You may choose one of the following predefined cardinality instances subjectCardinalit typeUf minCardinality 2 maxCardinality 3 4 4 2 Relation The relation acts as an abstract base class for any relation property between classes 4 4 3 Extends The relation extends allows you to define sub properties of existing properties in a super class ASub bSub extends A b in the following example That means that instances of ASub can have only references to resources of type BSub while it is still possible to access the ASub bSub resources via A b as type of B It is also possible to have more than one sub property that extends the same super property as long as the sum of cardinalities of the sub properties complies with the cardinality of the super property e bSubl ab A bSub2 b A AS Please note that is it only allowed to extend a property of the same type i e UseRelation extends UseRelation OwnRelation extends OwnRelation Ob
146. s the Objects as result of the Evaluation of a given source Relation on a given Resource objectsForRelationOfType List of Re Returns the Objects as result of the Evaluation of a given source Relation on a given Resource having a given Type ownerOrNull Resource Returns a Resource s owner Resource relationStatementOrNull Statement OOOO statementOrNull Statement Returns the Statement with given Subject Predicate and Object statement Set of State Returns the Statements with given Subject ment statementsForAttribute Set of State Returns the Statements with Subject and Predicate given ment by Resource and Attribute statementsForRelation Set of State Returns the Statements with Subject and Predicate given ment by Resource and Relation statementForRelationOrNull Set of State Returns the first Statement with Subject and Predicate ment given by Resource and Relation subjectForRelationOrNull Set of State Returns the first Subject with Object and Predicate given ment by Resource and Relation subjectsForRelation Set of State Returns the Subjects with Object and Predicate given by ment Resource and Relation toMeStatementForRelationOrNull Set of State Returns the first Statement with Object and Predicate ment given by Resource and Relation toMeStatementsForAttribute Set of State Returns the Statements with Object and Predicate given ment by Resource and Attribute toMeStatementsForRelation Set of State Returns the Statements with
147. source Keyboard Ctrl Enter to insert after the current resource 2014 actifsource GmbH Switzerland all rights reserved User Manual 39 Ctrl Shift Enter to insert before the current resource 3 6 Reference resource E Statemachinel 13 E 8 eee eee aa ae aa E Stopped State E run Transition typeOf com actifsource statemachine generic Statemachine name Statemachinel i event 1 run Event i event stop Event a state 1 typeOf com actifsource statemachine generic State name Stopped 3 p transition run typeOf com actifsource statemachine generic Transition event com actifsource statemachine specific Statemachinel run a a transition stop Error com actifsource statemachine specific statemachinel State l state 2 Running State E Running com actifsource statemachine specific Statemachinel State state 3 Bice Bite E Stopped com actifsource statemachine specific Statemachinel State To reference any resource use the content assist Note that Actifsource supports content assist in many differ ent situations Just try Ctrl Space to activate content assist via keyboard Device Action Context menu Open Content Assist Keyboard Ctrl Space You may also type some letters to filter the resources E Statemachinel 33 om E MAA AA aa ae a E Stopped State E run Transition typeOf com actifsource statemachine generic Statemachine name Statemachinel
148. teacnenadantslask asec 9 1 1 WOKE W OOE Suecia 9 1 2 PO OUE ar e E ce 11 1 3 Clea dig AE S atada 11 ACi ource ENVION CIM ar E E S OO 12 2 1 Actifsource Eclipse PlUBIN ccsscccccsssseccccccseecccsenseesccseaseesccseaseesceseuseesecseaseesecsenseesecseassetsessageereess 12 2 2 Memo A EE E A o e E a 12 2 3 POr PEC A E E AEEA EE EE E EA AE A EEE EAA 14 2 4 Achour ce Pre re rentes maria 14 PE e Se SU CS A ecntecanenetects andtseacccauiaunanstsreceuseseteanctsaccoesee 14 A OP ENE O eee Pe A 15 243 Style Contarini ad 15 Ae Ls A E e Pe UE en o e A 16 2 5 Pro ec WTO 16 2 5 1 Project Name and Location oocccccoccnccnocnnccnnnnnnnnnnnnnnnnonnnnnnnnnrnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnananinns 16 254 ReSourCe GIS cats cacti atest re een pees serosa ap ice teen ENE EEE co vce ROA uate RENNA 17 Po fa Tarreo role io na 18 2 5 4 Template Folder Saravia deidades 19 Pos Project De nen den anar 20 ASO B lt DEDENGENCIOS moscada 20 2 6 Project PO SS ena dt caca 21 2 7 Standard Package Structure ccccccssssccccssscccensccccenecccsenseeseueceesseecsseecessueseesauecesseeeessaesessaaesesseneeess 21 2 8 PrO CERITO acid coopera 22 2 9 O E 23 291 NEW ACTITISOUICE RESOUMEC escroto 23 29 2 OpenAct source RESOUTCE rc ea 23 210 POE CERO rones 23 2 10 1 MNBA PP E E E e E eaetiamadecamanenee 24 2 10 2 Actifsource Presentation siscasascissscnciiassasesiiccasinandyensnacdacnnasadseisaauibanndiens ecadna
149. temachine b 8 generic a 8 specific a Statemachinel a event E Eventl E Event a state a E Statel 4 E transition E Eventl gt E State p E States Actifsource Presentation Group Aggregations By Relations Select Working Set Deselect Working Set Edit Active Working Set Package Presentation Customize View Link with Editor Focus on Active Task 2014 actifsource GmbH Switzerland all rights reserved User Manual 25 Group Aggregation By Relation switched off ERY Project Explorer 53 E S amp a 13 com actifsource statemachine Top Level Elements a E asic a EH comactifsource statemachine Actifsource Presentation Group Aggregations By Relations gt EH generic Select Working Set Deselect Working Set Edit Active Working Set a EY specific Statemachinel Package Presentation Customize View Link with Editor EH template b Ha Actifsource Focus on Active Task gt HA JRE System Library JavaSE 1 6 2 10 3 Package Presentation Project Explorer 3 5 gt d Ve com actifsource statemachine Top Level Elements sE asrci eee ee ee ee ee EY com Actifsource Presentation ES com actifsource Select Working Set fA com actifsource statemachi a ee Deselect Working Set H com actifsource statemachi EY com actifsource statemachi Edit Actrve Working Set fA com actifsource statemac gt Actifsource b ma JRE System Library Jawa5E
150. template Build once means a template is not based on a resource but only built once 9 4 16 Built in functions on LinkSelector Actifsource provides the following built in functions on LinkSelector Function Return type Description selectorText String Converts a selector to simple text string selectorResultType AbstractType Calculates a selectors result type 9 4 17 Built in functions on File Actifsource provides the following built in functions on File Function Return type Description contents Text Returns a file s contents 9 5 Accessing the model from within Java function It is possible to access the model other functions see chapter 9 3 Function types or even built in functions see chapter Fehler Verweisquelle konnte nicht gefunden werden Fehler Verweisquelle konnte nicht ge funden werden from within Java functions Consider the following meta model for the subsequent examples 9 5 1 Model forward access Let s write a Java Function for Parent which returns only instances of type Child with names beginning with A Start by declaring a Java Function named filterChild as seen in Chapter 9 3 3 O 2014 actifsource GmbH Switzerland all rights reserved typeOf ch actifsource core selector type FunctionContext typeRef com actifsource design functionspace selector Parent typeld a function typeOf ch actifsource core selector type Javabunction Ce comment param mod fier ownership 7 return T
151. the Set of Relations a Relation extends including itself possibleDecoratingTypes Map E 11 1 2 Select Functions for Statement Function Return type Description existsStatement boolean findNext Property Set Returns the successor Statement of a given Statement nameO Attribute Set Returns the composed simpleName in the form Subject Predicate Object statementPath List of Statement decoratedNode Resource Returns the Resource that is decorated via this decorating Statement 11 1 3 Select Functions for Class Function Return type Description instances Set of Resource Returns the direct or indirect instances of a Class directinstances Set of Resource Returns the direct instances of a Class instancesWithPackage Set of Resource Returns the direct or indirect instances of a Class in all Packages instancesWithMainPackage Set of Resource Returns the direct or indirect instances of a Class with their main Package isTypeOfFilter Filter on Resource Returns a Filter which includes Resources of a given Class resourceBySimpleNameOrNull Resource with Pack Returns the Instance having a given simple Name age resourcesBySimpleName Set of Resource with Returns the Instances having a given simple Name Package resourceByFullNameOrNull Resource with Pack Returns the Instance having a given simple Name age resourcesByFullName Set of Resource with Returns the Instances having a given simple Name Package allowedPropertiesOfType Set of
152. the diagram but not from the model Use Delete on the keyboard to hide selected resources from the diagram 2014 actifsource GmbH Switzerland all rights reserved AA Y N User M anual 72 Show Resource Shows any hidden resource in the scope of the selected resource If this action is called on the background of the diagram the scope is your single root Show Hide Resource Parts Shows or hides aggregated parts see Chapter 4 4 5 OwnRelation Pi Statemachinel Overview 22 y 2 Palette gt ie e i Edit oi Marquee Fs Relation E Resource H H Statemachinel g Delete from Model Shift Delete i Hide Resource Delete Show Resource Show Hide Resource Parts y atatemachinel Overview 3 A Sa Palette i Select i Edit id oe 2 Marquee Statemachinel Relation E Stopped Ej Resource Router Selects between different routing algorithms Router Description Image CC N1 Asa ctitc mMiircra G m h h Cra J itsarlan A in J rio ht C racarv a A 2014 actifsource Gmbl l Switzerland all Isnts reserved Default Manual routing by dragging the line on the drag points Manhatten Lines are routed with 90 angles Nolntersection As few intersections as possible 5 3 6 Browse Resource Open any class in the resource editor by Ctrl Click on the class name Pi Statemachinel Statemachinel EZ T E Stopped Palette b Select 1 JEdit
153. the list last T Returns the last element in the list count IntegerLiteral Counts the number of elements in the list reverse List of T Reverses the elements in the list distinct List of T Remove duplicates from a list first to last Built in functions on Resource from within Java Code Accessing built in functions is done the same way as seen in the above chapter 9 5 3 Function access To write a function which returns the package and the simpleName of a child we can reuse the built in func tions package and simpleName For the built in function access use the extension function on the given resource with Built in IResourceFunctions class as parameter Override public java lang String simpleNameWithPackage final com actifsource design function modelaccess javamodel IChild child Begin Protected Region 73d260T c4a2 11e3 a312 9d8ca9dd1829 return child extension ch actifsource template BuiltIn IResourceFunctions class package child extension ch actifsource template BuiltiIn ResourceFunctions class simpleName End Protected Region 73d266f8 c4a2 11e3 a312 9d8ca9dd1829 hi Note that you cannot access built in functions for literals via the extension mechanism 10 Code Snippets 10 1 Overview Actifsource supports a special editor the so called Code Snippet editor which allows the user to insert Actifsource resources as variables or functions into snippets of source code Such a snipp
154. tifsource core selector type FunctionSpace MyFunctionSpace typeOf ch actifsource core selector type FunctionContext typeRet com actifsource design functionspace extend MyClass typeld function typeOf ch actifsource core selector typeJavaFunction comment param mod fier ownership return Type typeOf ch actifsource core selector type Literall ype literalRet ch actifsource core StringLiteral iteralld cached true Function When you declare a Java function Actifsource automatically generates a function skeleton in a file with the same name as your function space found in the folder src gen a 2 src gen gt 8 com actifsource design gt gA com actifsource design decoratingrelation gt 8 com actifsource design decoratingrelation javamodel gt gA com actifsource design functionspace gt FS com actifsource design functionspace abstractfunction gt 8 com actifsource design functionspace abstractfunction javamodel gt 8 com actifsource design functionspace extend gt 8 com actifsource design functionspace extend javarnodel a 6 com actifsource design functionspace javafunction J JavafunctionPackage java J MyFunctionSpace jz You should only modify generated files within protected regions see Chapter 2 12 5 Protected Regions Take extra care that import statements are placed within the protected regions especially if inserted automatically by the Java content assist package com actifsource design functionspa
155. tifsource design functionspace selector Parent typeld function typeOf ch actifsource core selector type SelectorFunction name getSubChild comment param Parent child subChild return Type typeOf ch actifsource core selector type Listl ype innerTypeRef com actifsource design functionspace selector SubChild innerTypeld Backward navigation Consider the following meta model 2014 actifsource GmbH Switzerland all rights reserved User Manual 129 1 am To get the Parent instance for a SubChild instance we have to navigate backwards via the subChild and child relation The selector allows backward navigation via the minus relation typeOf ch actifsource core selector type FunctionSpace name MyFunctionS pace extends metaModel g functionContext typeOt ch actifsource core selector type FunctionContext typeRef com actifsource design functionspace selector 5ubChild typeld function typeOf ch actifsource core selector typeSelectorFunction name getParent comment poram SubChild subChild child 7 return Type typeOf ch actifsource core selector type Class Type classRef com actifsource design functionspace selector Parent classid function functionContext List operators Actifsource provides you with the following operators which are defined on lists where the lists are given by Selector expressions Operator Description A union B The result
156. tingRelationAspect mod fer objectCardinality style defaultValue ownership Type extends range chactifsource core DecoratingRelation b2 ch actifsource core Cardinality0_1 typeOt ResourceSelectorAspectImplementation Implements DecoratingRelationAspect selector A al bl ch actifsource core Cardinalityl_1 com actifsource design decoratingrelation B2 Let us create a resource TestA1 of type Al first typeOf bt ft b1 2 b1 3 com actifsource design decoratingrelation Al TestAl typeOt com actifsource design decoratingrelation B 1 name Bil typeOt com actifsource design decoratingrelation B1 name Bl typeOt com actifsource design decoratingrelation B 1 name B1_3 Now let us create a resource TestA2 of type A2 with a reference to TestA1 Please note that A2 b2 is now deco rating A2 a1 b1 what is indicated by the brackets i e b1 B1_1 typeOt com actifsource desiqn decoratingrelation A2 name TestA2 name al TestAl b2 B1 1 b2 81 2 b2 B13 Creating a decorated resource will automatically fill in the target property b1 typeOt com actifsource desiqn decoratingrelation A2 al TestAl 7 be B1_1 typeOf com actifsource design decoratingrelation B 2 bl com actifsource design decoratingrelation estAl B1_1 b2 B1_2 62 B1_3 Please note that the decorating relation needs a subclass of type Decorator If your decorating relation does not point to a r
157. uick assist is the most efficient way to add a new context To create a new context with the selector Parent child just insert the link Parent child using context assist Ctrl Space A light bulb g indicates that there is a quick assist available Click on the light bulb or press Ctrl 1 to open the quick assist User Manual 109 Parent 3 0 3 Build gt 5 C Selector Build allParent Break T r Parent nameImpl hpp e C class Parent nameImpl 1 public HE i A a el app l cpp You are now allowed to create a line context or a column context directly with Parent child as the selector T Parent EZ y 3 Buil BEA Selector Build all Parent Break Parent nameImpl hpp gt class Parent nameImpl 1 public e Parent child t Create Line Context amp Create Column Context il 1 h hpp e cpp A new context is inserted with the desired selector Parent child is automatically replaced by Child which is the result of the selector 2014 actifsource GmbH Switzerland all rights reserved Parent 3 0 3 Build 9 Build ollParent Parent EE Selector Break _ Parent namelmpl hpp C class Parent nameImpl i public Pa esa dl I Le hpp ES Le cpp Automatic Context growth Adding new lines pressing return automatically lets the context grow T Parent ES E 3 Build 5 Build allParent Parent EE
158. vent event 1 Eventl Event event 2 Ewent Event event 2 Event Event state 1 Statel State Statel State state 2 State State state State State state 3 states State Working together in a team you might have collisions when checking Actifsource resource files asr into your version control system i e CVS SVN GIT etc Actifsource lets you compare resources and resolve conflicts in the compare view of the Resource Editor 2 11 6 Show Resource Dependencies In the context menu of the selected resource you will find the following commands to show specific dependen cies Show Instances Shows all instances of the selected resource Note that a resource must be of type Class to have instances See also Chapter 2 12 2 Show Types S Shows all types of the selected resource typeof statement See also Chapter 2 12 2 Show Subclasses La Shows all sub classes of the selected resource extend statement Note that a resource must be of type Class to have sub classes See also Chapter 2 12 2 Show Superclasses i Shows all super classes of the selected resource extend statement Note that a resource must be of type Class to have super classes See also Chapter 2 12 2 Show References al Shows all resources that are referencing the selected resource See also Chapter 2 12 6 User Manual 2 11 7 Sort Property a Sorts resources referenced by a relation Note that you
159. xt E VariableReference A FunctionReference 10 4 Code Snippet Editor The code snippet editor is available in the resource editor for any property of type StructuredCodeSnippetRela tion The editor supports multi line input It highlights keywords and comments according to the language property of the StructureCodeSnippetRelation You can inspect the definition of the input language by CTRL Left Click on the chosen language defauitVaiue H token 1 Variable Relation TokenProwide ch actifsource codesnippet language CMinus token 2 FUN Cero oe re re token This opens the chosen language in the resource editor and allows you to browse the properties such as key words and style of comments of the language 1 Actually it is validated but it has a very simple and non restrictive grammar typeOt CodeSnippetLanguage keywordatyle typeOf KeywordStyle style SyntaxStyle keyword 1 break keyword 2 case keyword 3 continue keyword 4 default keyword 5 do keyword 6 else keyword 7 for keyword 8 if keyword 9 return keyword 10 switch keyword 11 until keyword 1 2 while keyword reywordStyle E o stringStyle StringStyle H singleLineComment Single LineComment singleLineComment F multiLineComment MultilineComment parser CminusParser 10 4 1 Content Assist By using CTRL Space in the code snippet editor you can as usual call the Content Assist The Content Assist will show you
160. ype typeOf ch actifsource core selector type ListType inner TypeRet com actifsource design function javafunction modelaccess Child innerlypeld cached true function o For the model forward access use the selectProperty function on the given resource where property is the property to select The subsequent filter function iterates over the relation Parent child in the for Statement via par ent selectChild Then we check if Child name starts with A via child selectName If the condition is fulfilled we add the filtered child to the child list At the end we return the child list with the filtered children Override public java util List lt com actifsource design function modelaccess javamodel Ichild gt filterchild final com actifsource design function modelaccess javamodel IParent parent Begin Protected Region ab2f9f4a c496 11e3 a312 9d8ca9dd1829 ArrayList lt IChild gt childList new ArrayList lt Ichild gt for IChild child parent selectChild i if khild selectName startswith ar 3 childList add child return childList End Protected Region ab2f9f4a c496 11e3 a312 9d8ca9dd1829 You might use the filter function in the selector of a template or in any other function The following template only prints children with names starting with A T ModelAccess El ae _ 3 Buik 3 Build allParentParent ERAN aa Selector Break Parent name txt a Text D
Download Pdf Manuals
Related Search
Related Contents
Samsung 730MP Manual de Usuario Samsung HT-XQ100T Manual de Usuario Actividades Concorrente Issue Tracker User Manual Linear Gage LGK series User manual Benutzerhandbuch Manuel d`utilisation Aton CL103 User guide PSC E1 - Comune di Casal di Principe Eglo 200094A Installation Guide Voice Mail e Operatore Automatico a Stato Solido Copyright © All rights reserved.
Failed to retrieve file