Usage

    Xion is an action language that describes behavior and queries in the business model and the navigation model. It is necessary to distinguish instructions and expressions which represent atomic Xion constructions. Expressions provide results while instructions extends expressions with  affectations, blocs, conditional instructions (if, for, while, do), return, write ,writeRaw, and variable declarations.


    In the business model

    The business model defines classes of objects that the generated web application will use. Each of them has a behavior. This behavior is described by methods and constructors, described with a Xion sequence of instructions.
 

Method definition

    A method describes what an operation realizes. This method is qualified by a return type and typed parameters, defined by the operation specifying the method.

    Each of these formal parameters is seen as a variable in the Xion code.

    Describing a method is done by a Xion instruction sequence.

    The value returned by a method is done by a return preceding an expression whom evaluation represents the value returned by the method. If the return type is Void, that is the no type type, return does not proceed an expression, and is not necessary. return ends the method execution.

    Accessing the object on which the operation is called is made by pseudo variables this or self.

    An operation may be marked as isQuery. A method that instanciate an object, modify an attribute or a link, or call an operation non isQuery cannot realize an isQuery operation.

Constructor definition

    A constructor is a method that is automatically called during an object instanciation. It usually initializes attributes and links. Defining a constructor is not mandatory. In that it describes an object instanciation, it cannot be isQuery. The name of a constructor is the name of the class, and its return type must be Void. For instance, in the class named MyClass, create an operation (popup Add/Operation) named MyClass and set the return type to Void. A constructor can have any number of parameters. If no parameter is defined, the constructor is a  "default constructor". To instanciate an object, use the new operator, followed by the name of the type and the parameters of the wanted constructor (empty if it is the default one).

    In case of inheritance, it may be necessary to define which constructor to use with which parameters. This comes from the fact the new object is both of an instance of its class, and its ancestor class:

    The direct ancestor has no constructor, or just one constructor with no parameters: it is not necessary to defined the called constructor: it will be the default one.

    The ancestor defines several constructor, or a parameterized one: the called constructor is defined by the  super instruction. For instance, if MyClass defines a constructor with parameters Integer, Boolean, the first instruction in the constructor must be super(1, true) (with correct parameters). Parameters are given by expressions. If they need a heavy computing, one may define a static operation that does this computing.

 

        Example

Method public Writer(String message): "this.message = message;"

Method public String write(): "return this.message;"

Method public HelloWriter(): "super("Hello World");"

To write "Hello World", ask an object of type HelloWriter to do write(), for instance new HelloWriter().write();

 


    In the navigation model

    A decision center offers some decisions, each of them referencing the page to show. The chosen decision depends on choice criteria. It also may be necessary to write enter actions . A page sends a context (incoming the center), for decision center or next page computation. Moreover, before activating a new page, it is necessary to send a context (outgoing the center) , that must be initialized. The incoming context is the one of the calling page, or a subset of variables with same names and equivalent types if the center is referenced by several pages. There is also session context.
 

Defining choice criteria

    A choice criteria allows a decision center to choose the showed page. A decision center is made of some decisions, each of them linked to a page. These decisions are ordered, and defines a criteria, expressed in a Xion Boolean expression. If the first criteria is true, then its linked page is showed, elsewhere, the next is tested, etc... If no criteria is fired, a default page may be called.

Entry action

     When entering a page or a decision center, it may be necessary to do some specific action. For instance, actions to validate a form, to initialize special values like private values in the context (of the file or the decision center). This is possible thanks to the Entry Action, that is described in Xion.

Incoming context

    A context incoming a decision center (sent by the calling page) is a set of variable with their names, types and values. These variables may be accessed in the entry action, choice criteria or defining outgoing context. A context incoming a page may be used in its entry action.

Outgoing context

    When a decision is chosen, it is necessary to initialize public variables defined in the called page context. This is possible thanks to Xion affecting an expression to each variable. Defining variables that have a default value (a Xion expression in the context of the called page) is not mandatory.
 

Previous     Summary    Next