All Downloads are FREE. Search and download functionalities are using the official Maven repository.

extensions.Expression.ext Maven / Gradle / Ivy

There is a newer version: 6.0.2
Show newest version
import guidesign;
import pom;
import dom;
import core;

extension extensions::XMAPage;
extension extensions::Field;
extension extensions::XMAComposite;
extension extensions::XMAStatusFlag;
extension extensions::XMAComponent;
extension extensions::Customization;
extension org::openxma::dsl::common::extensions::LogUtil;
extension org::openxma::xmadsl::Extensions;

extension org::eclipse::xtend::util::stdlib::cloning;

/* ----------------------------------------------------------------------------
 * This file contains functions to create Xma-Expression from a Xmadsl-
 * Expression. 
 *
 * ------------------------------------------------------------------------- */

/*
 * Handle EqualityExpr
 */	
flex::Expression createXMAExpression(EqualityExpr expr, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):

	let xmaLeft = (expr.left != null) ? expr.left.createXMAExpression(comp,currPage,dov):null:
	let xmaOperator = (expr.op != null) ? expr.op.createXMAEqualityOperator():null:	
	let xmaRight = (expr.right != null) ? expr.right.createXMAExpression(comp,currPage,dov):null:
	
	join(xmaOperator,xmaLeft,xmaRight);		
	
/*
 * Handle CondORExpr
 */		
flex::Expression createXMAExpression(CondORExpr expr, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):

	let xmaLeft = (expr.left != null) ? expr.left.createXMAExpression(comp,currPage,dov):null:
	
	(expr.rights.size > 0)
		? expr.rights.createXMAExpressionCondORRights(0,xmaLeft,comp,currPage,dov)
		: xmaLeft;
	
/**
 * Handle CondORRights
 */		
flex::Expression createXMAExpressionCondORRights(List[CondORRights] condOrRights, int nextIndex, flex::Expression xmaLeft, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):

	let rightCondANDExpr = (CondANDExpr)condOrRights.get(nextIndex).right:
	let xmaRight = rightCondANDExpr.createXMAExpression(comp,currPage,dov):
	
	let expr = (xmaRight != null) ? or(xmaLeft,xmaRight) : xmaLeft :
	
	(condOrRights.size>nextIndex+1)
		? condOrRights.createXMAExpressionCondORRights(nextIndex+1,expr,comp,currPage,dov)
		: expr;	
	
/*
 * Handle CondANDExpr
 */			
flex::Expression createXMAExpression(CondANDExpr expr, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):

	let xmaLeft = (expr.left != null) ? ((RelationalExpr)expr.left).createXMAExpression(comp,currPage,dov) : null :
	
	(expr.rights.size > 0)
		? expr.rights.createXMAExpressionCondANDRights(0,xmaLeft,comp,currPage,dov)
		: xmaLeft;
		
/**
 * Handle CondANDRights
 */		
flex::Expression createXMAExpressionCondANDRights(List[CondANDRights] condAndRights, int nextIndex, flex::Expression xmaLeft, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):

	let rightRelationalExpr = (RelationalExpr)condAndRights.get(nextIndex).right:
	let xmaRight = rightRelationalExpr.createXMAExpression(comp,currPage,dov):
	
	let expr = (xmaRight != null) ? and(xmaLeft,xmaRight) : xmaLeft :
	
	(condAndRights.size>nextIndex+1)
		? condAndRights.createXMAExpressionCondANDRights(nextIndex+1,expr,comp,currPage,dov)
		: expr;
		
/*
 * Handle RelationalExpr
 */			
flex::Expression createXMAExpression(RelationalExpr expr, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):

	let xmaLeft = (expr.left != null)?expr.left.createXMAExpression(comp,currPage,dov):null:
	let xmaOperator = (expr.op != null) ? expr.op.createXMARelationalOperator():null:	
	let xmaRight = (expr.right != null) ? expr.right.createXMAExpression(comp,currPage,dov):null:
	
	join(xmaOperator,xmaLeft,xmaRight);			


/*
 * Handle AdditiveExpr
 */		
flex::Expression createXMAExpression(AdditiveExpr expr, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):

let xmaLeft = (expr.left != null)?expr.left.createXMAExpression(comp,currPage,dov):null:
	
	(expr.rights.size > 0)
		? expr.rights.createXMAExpressionAdditiveRights(0,xmaLeft,comp,currPage,dov)
		: xmaLeft;
	
/**
 * Handle AdditiveRights
 */
flex::Expression createXMAExpressionAdditiveRights(List[AdditiveRights] additiveRights, int nextIndex, flex::Expression xmaLeft, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):

	let additiveRight = additiveRights.get(nextIndex):
	let rightMultiplicativeExpr = (MultiplicativeExpr)additiveRight.right:
	let xmaOperator = (additiveRight.op != null) ? additiveRight.op.createXMAAdditiveOperator():null:		
	let xmaRight = rightMultiplicativeExpr.createXMAExpression(comp,currPage,dov):
	
	let expr = join(xmaOperator,xmaLeft,xmaRight):
	
	(additiveRights.size>nextIndex+1)
		? additiveRights.createXMAExpressionAdditiveRights(nextIndex+1,expr,comp,currPage,dov)
		: expr;		

/*
 * Handle MultiplicativeExpr
 */			
flex::Expression createXMAExpression(MultiplicativeExpr expr, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):

let xmaLeft = (expr.left != null)?expr.left.createXMAExpression(comp,currPage,dov):null:
	
	(expr.rights.size > 0)
		? expr.rights.createXMAExpressionMultiplicativeRights(0,xmaLeft,comp,currPage,dov)
		: xmaLeft;

/**
 * Handle MultiplicativeRights
 */
flex::Expression createXMAExpressionMultiplicativeRights(List[MultiplicativeRights] multiplicativeRights, int nextIndex, flex::Expression xmaLeft, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):

	let multiplicativeRight = multiplicativeRights.get(nextIndex):
	let rightAtomicExpr = (AtomicExpr)multiplicativeRight.right:
	let xmaOperator = (multiplicativeRight.op != null) ? multiplicativeRight.op.createXMAMultiplicativeOperator():null:		
	let xmaRight = rightAtomicExpr.createXMAExpression(comp,currPage,dov):
	
	let expr = join(xmaOperator,xmaLeft,xmaRight):
	
	(multiplicativeRights.size>nextIndex+1)
		? multiplicativeRights.createXMAExpressionMultiplicativeRights(nextIndex+1,expr,comp,currPage,dov)
		: expr;		

/*
 * Handle AtomicExpr
 * 
 * Currently just boolean literals are supported.
 */
 	
flex::Expression createXMAExpression(AtomicExpr expr, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):

	// Literals
	(Literal.isInstance(expr))
		? createXMAExpression(((Literal)expr),comp,currPage,dov)
		: null;	
	
	
//	(BoolLiteral.isInstance(expr))
		//? ((BoolLiteral)expr).createBooleanLiteral()
		//: null;
	
/*
 * Handle BoolLiteral
 * 
 * Create a boolean literal.
 */		
flex::Expression createXMAExpression(BoolLiteral boolLiteral, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):
		boolLiteral.createXMALiteral();
		
/*
 * Handle StringLiteral
 * 
 * Create a string literal.
 */		
flex::Expression createXMAExpression(StringLiteral stringLiteral, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):
	stringLiteral.createXMALiteral();
	
/*
 * Handle IntegerLiteral
 * 
 * Create a integer literal.
 */		
flex::Expression createXMAExpression(IntLiteral intLiteral, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):
	intLiteral.createXMALiteral();

/*
 * Handle Variable
 * 
 * Create variable.
 */		
flex::Expression createXMAExpression(Variable variable, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):
    log("Problem using virtual extension for Variable: '"+variable.toString()+"'")->
	null;	
		
/*
 * Handle XmadslVariable
 * 
 * Create variable.
 */		
flex::Expression createXMAExpression(XmadslVariable variable, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):
	(variable.reference	!= null)
		? variable.reference.createXMAVariable(translateAccessType(variable.reference,variable.access),comp,currPage,dov)
		: (log("Variable reference is null for '"+variable.toString()+"', data: "+dov.toString())->
			null);
			
/*
 * Handle FieldVariable
 * 
 * Create variable.
 */		
flex::Expression createXMAExpression(FieldVariable variable, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):
	
	(variable.field	!= null && variable.field.feature != null)
		? ( let dovOfField = variable.field.object:
			let fieldFeature = variable.field.feature:
			let presentableFeature = fieldFeature.feature:
			/* In case a Widget has been created for the Field use it for determining
			 * the access type. */ 
			let existingIExpVariable = findExistingIExpVariable(presentableFeature,currPage,dovOfField):
		 	(existingIExpVariable != null)
				? fieldFeature.createXMAVariable(translateAccessType(existingIExpVariable,variable.access),comp,currPage,dovOfField)
				: fieldFeature.createXMAVariable(translateAccessType(fieldFeature,variable.access),comp,currPage,dovOfField))
		: (log("Variable reference is null for '"+variable.toString()+"', data: "+dov.toString())->
			null);					
			
/*
 * Handle XmaVariable
 * 
 * Create variable.
 */		
flex::Expression createXMAExpression(XmaVariable variable, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):

	(variable.reference	!= null)
		? variable.reference.createXMAVariable(translateAccessType(variable.reference,variable.access),comp,currPage,dov)
		: (log("Variable reference is null for '"+variable.toString()+"', data: "+dov.toString())->
			null);

/*
 *
 */ 			
flex::type::VariableAccess translateAccessType(emf::EObject object, VariableAccess accessType):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.translateAccessType(org.eclipse.emf.ecore.EObject, org.openxma.dsl.core.model.VariableAccess);

/*
 * Handle Call
 * 
 * Create call.
 */		
flex::Expression createXMAExpression(Call call, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):

	call.createXMAFunctionExpression(comp,dov);
	
/*
 * Handle ParentExpr
 * 
 * Create ParenExpr.
 */		
flex::Expression createXMAExpression(ParenExpr parentExpr, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):

	let subExpression = createXMAExpression(parentExpr.expr,comp,currPage,dov):
	bracket(subExpression);	
		
		
flex::LiteralExpression createXMALiteral(Literal literal):
	null;
			
/*
 * Create a xma-boolean literal from xmadsl-boolean literal
 */		
flex::LiteralExpression createXMALiteral(BoolLiteral boolLiteral):

	((TrueLiteral.isInstance(boolLiteral))
		? createBooleanLiteral(true)
		: createBooleanLiteral(false));

/**
 *
 */						
flex::LiteralExpression createXMALiteral(StringLiteral stringLiteral):

	let exp = new flex::LiteralExpression:		
	
	exp.setTypLiteral(types::PropertyType::String)->
	exp.setTxtLiteral(stringLiteral.string)->
	
	exp;
	
/**
 *
 */	
flex::LiteralExpression createXMALiteral(IntLiteral intLiteral):

	let exp = new flex::LiteralExpression:		
	
	exp.setTypLiteral(types::PropertyType::int)->
	exp.setTxtLiteral(intLiteral.number.toString())->
	
	exp;		

/*
 * Create a xma-boolean literal from a boolean
 */		
flex::LiteralExpression createBooleanLiteral(boolean isTrue):
JAVA org.openxma.dsl.generator.helper.ValidatorExtension.createBooleanLiteral(java.lang.Boolean);	
		
flex::type::OperatorType createXMAMultiplicativeOperator(MultiplicativeOp multiplicativeOp):

	switch (multiplicativeOp) {
		case MultiplicativeOp::TIMES: flex::type::OperatorType::mulitply
		case MultiplicativeOp::DIVIDE: flex::type::OperatorType::devide
		default: null
	};
	
flex::type::OperatorType createXMAAdditiveOperator(AdditiveOp additiveOp):

	switch (additiveOp) {
		case AdditiveOp::PLUS: flex::type::OperatorType::plus
		case AdditiveOp::MINUS: flex::type::OperatorType::minus
		default: null
	};
	
flex::type::OperatorType createXMAEqualityOperator(EqualityOp equalityOp):

	switch (equalityOp) {
		case EqualityOp::EQ: flex::type::OperatorType::equals
		case EqualityOp::NE: flex::type::OperatorType::notEquals
		default: null
	};
	
flex::type::OperatorType createXMARelationalOperator(RelationalOp relationalOp):

	switch (relationalOp) {
		case RelationalOp::LT: flex::type::OperatorType::less
		case RelationalOp::LE: flex::type::OperatorType::lessEqual				
		case RelationalOp::GT: flex::type::OperatorType::greater
		case RelationalOp::GE: flex::type::OperatorType::greaterEqual								
		default: null
	};

/**
 * Bracket expression
 */	
flex::Expression bracket(flex::Expression expr):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.bracket(at.spardat.xma.guidesign.flex.Expression);
		
/**
 * Force a bracket expression
 */		
flex::Expression forceBracket(flex::Expression expr):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.forceBracket(at.spardat.xma.guidesign.flex.Expression);
		
/*
 * Not-expression
 */	
flex::Expression not(flex::Expression expr):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.not(at.spardat.xma.guidesign.flex.Expression);

/**
 * Join two XMA-expressions with an operator
 */		
flex::Expression join(flex::type::OperatorType operator, flex::Expression expr1, flex::Expression expr2):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.join(at.spardat.xma.guidesign.flex.type.OperatorType, at.spardat.xma.guidesign.flex.Expression,at.spardat.xma.guidesign.flex.Expression);

/*
 * And-expression
 */		
flex::Expression and(flex::Expression expr1, flex::Expression expr2):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.and(at.spardat.xma.guidesign.flex.Expression,at.spardat.xma.guidesign.flex.Expression);	
		
/*
 * Or-expression
 */		
flex::Expression or(flex::Expression expr1, flex::Expression expr2):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.or(at.spardat.xma.guidesign.flex.Expression,at.spardat.xma.guidesign.flex.Expression);
		
/*
 * Default (EObject) - variable
 */ 
flex::VariableExpression createXMAVariable(emf::EObject object, flex::type::VariableAccess accessType, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):
	(GuiElement.isInstance(object))
		? createXMAVariableForOtherGuiElement((GuiElement)object,accessType,comp,currPage,dov)
		: (log("Variable not supported: '"+object+"'")-> null);			
		
/*
 * Statusflag - variable
 */ 
flex::VariableExpression createXMAVariable(StatusFlag statusFlag, flex::type::VariableAccess accessType, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):

	let stateFlagVariable = new flex::VariableExpression:
	let stateFlagParent = statusFlag.eContainer:
	
	let referencedStateFlag = statusFlag.findXMAStateFlag(comp,currPage,dov):
		
	stateFlagVariable.setTypAccess(flex::type::VariableAccess::value)->	
	stateFlagVariable.setSource(referencedStateFlag)->
	
	stateFlagVariable;
	
flex::VariableExpression createXMAVariableForOtherGuiElement(GuiElement guiElement, flex::type::VariableAccess accessType, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.createXMAVariableForOtherGuiElement(org.openxma.dsl.pom.model.GuiElement,at.spardat.xma.guidesign.flex.type.VariableAccess,at.spardat.xma.guidesign.XMAComponent,at.spardat.xma.guidesign.XMAPage,org.openxma.dsl.pom.model.DataObjectVariable);

/*		 
flex::VariableExpression createXMAVariable(Table table, flex::type::VariableAccess accessType, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.createXMAVariable(org.openxma.dsl.pom.model.Table,at.spardat.xma.guidesign.flex.type.VariableAccess,at.spardat.xma.guidesign.XMAComponent,at.spardat.xma.guidesign.XMAPage,org.openxma.dsl.pom.model.DataObjectVariable);

flex::VariableExpression createXMAVariable(Text text, flex::type::VariableAccess accessType, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.createXMAVariable(org.openxma.dsl.pom.model.Text,at.spardat.xma.guidesign.flex.type.VariableAccess,at.spardat.xma.guidesign.XMAComponent,at.spardat.xma.guidesign.XMAPage,org.openxma.dsl.pom.model.DataObjectVariable);

flex::VariableExpression createXMAVariable(Combo combo, flex::type::VariableAccess accessType, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.createXMAVariable(org.openxma.dsl.pom.model.Combo,at.spardat.xma.guidesign.flex.type.VariableAccess,at.spardat.xma.guidesign.XMAComponent,at.spardat.xma.guidesign.XMAPage,org.openxma.dsl.pom.model.DataObjectVariable);
*/

flex::VariableExpression createXMAVariable(Page page, flex::type::VariableAccess accessType, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.createXMAVariable(org.openxma.dsl.pom.model.Page,at.spardat.xma.guidesign.flex.type.VariableAccess,at.spardat.xma.guidesign.XMAComponent,at.spardat.xma.guidesign.XMAPage,org.openxma.dsl.pom.model.DataObjectVariable);

flex::VariableExpression createXMAVariable(FieldFeature fieldFeature, flex::type::VariableAccess accessType, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):
	
   (fieldFeature.feature != null)
		? fieldFeature.feature.createXMAVariable(accessType,comp,currPage,dov)
		: null
;

flex::IExpVariable findExistingIExpVariable(PresentableFeature feature, XMAPage currPage, DataObjectVariable dov):
	let bdAttribute = findBDAttributeForAttribute(currPage,feature,dov):
	
	let topPageForDov = currPage.findTopXMAPageWhereDovIsAccessible(dov):
	let widgetsWhichAreVariables = getNsIBDAttachable(topPageForDov,currPage):
	let existingIExpVariable = widgetsWhichAreVariables.select(e|e.dataAttribute != null && e.dataAttribute.id()==bdAttribute.id()).typeSelect(flex::IExpVariable).first():

	existingIExpVariable;
	
XMAPage findTopXMAPageWhereDovIsAccessible(XMAPage currPage, DataObjectVariable dov):

	(currPage.businessDataVariables.selectFirst(e|e.namInstance==dov.name)!=null)
		? currPage
		: ((currPage.getContainingXMAPage() != null)
			? currPage.getContainingXMAPage().findTopXMAPageWhereDovIsAccessible(dov)
			: currPage); // Assume dov is defined in Component, therefore topPage is the top-level-page in the component				
	
/*
 * Create a VariableExpression for PresentableFeature. In case a widget has been created from
 * the PresentableFeature a variable for this Widget is created. Otherwise first a 
 * hidden widget is created and then a variable for this new hidden widget.
 */ 
flex::VariableExpression createXMAVariable(PresentableFeature feature, flex::type::VariableAccess accessType, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):	
	let existingIExpVariable = findExistingIExpVariable(feature,currPage,dov):		
	let referencedIExpVariable = (existingIExpVariable!=null) ? existingIExpVariable : currPage.createHiddenIExpVariable(feature,dov): 	
	createXMAVariableForReferencedIExpVariable(referencedIExpVariable,accessType);
	
/*
 * Create a VariableExpression for a IExpVariable. First a reference to the corresponding IExpVariable
 * in the target XMAComponent is determined. This is then used for the creation of the VariableExpression.
 * (This is needed because the may be constellations where the given IExpVariable is not contained 
 * in the target XMAComponent.) 
 */ 
flex::VariableExpression createXMAVariable(flex::IExpVariable xmaExpVariable, flex::type::VariableAccess accessType, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.createXMAVariable(at.spardat.xma.guidesign.flex.IExpVariable,at.spardat.xma.guidesign.flex.type.VariableAccess,at.spardat.xma.guidesign.XMAComponent,at.spardat.xma.guidesign.XMAPage,org.openxma.dsl.pom.model.DataObjectVariable);

/*
 * Simple create an instance of VariableExpression and set the given properties.
 */	
flex::VariableExpression createXMAVariableForReferencedIExpVariable(flex::IExpVariable referencedIExpVariable, flex::type::VariableAccess accessType):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.createXMAVariableForReferencedIExpVariable(at.spardat.xma.guidesign.flex.IExpVariable,at.spardat.xma.guidesign.flex.type.VariableAccess);

/** 
 *
 */ 	
flex::IExpVariable getReferencedIExpVariable(emf::EObject xmaComp, guidesign::flex::IExpVariable xmaExpVariable):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.getReferencedIExpVariable(org.eclipse.emf.ecore.EObject,at.spardat.xma.guidesign.flex.IExpVariable);

/**
 *
 */	
flex::FunctionExpression createXMAFunctionExpression(Call call, XMAComponent comp, DataObjectVariable dov):

	let funcExpr = new flex::FunctionExpression:
	let referencedApplicationFunction = call.findApplicationFunction(comp):
	
	funcExpr.setParameter(call.expr.createXMALiteral())->
	funcExpr.setFunction(referencedApplicationFunction)->
	
	funcExpr;

/**
 *
 */	
flex::ApplicationFunction findApplicationFunction(Call call, XMAComponent xmaComponent):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.findApplicationFunction(org.openxma.dsl.core.model.Call,at.spardat.xma.guidesign.XMAComponent);

/*
 * Statusflag - variable
 */ 
flex::VariableExpression createXMAVariable(Property property, flex::type::VariableAccess accessType, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.createXMAVariable(org.openxma.dsl.dom.model.Property,at.spardat.xma.guidesign.flex.type.VariableAccess,at.spardat.xma.guidesign.XMAComponent,at.spardat.xma.guidesign.XMAPage,org.openxma.dsl.pom.model.DataObjectVariable);

/*
 * Statusflag - variable
 */ 
flex::VariableExpression createXMAVariable(ObjectProperty property, flex::type::VariableAccess accessType, XMAComponent comp, XMAPage currPage, DataObjectVariable dov):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.createXMAVariable(org.openxma.dsl.pom.model.ObjectProperty,at.spardat.xma.guidesign.flex.type.VariableAccess,at.spardat.xma.guidesign.XMAComponent,at.spardat.xma.guidesign.XMAPage,org.openxma.dsl.pom.model.DataObjectVariable);

flex::XMAStateFlag findXMAStateFlag(StatusFlag statusFlag, XMAComponent comp, XMAPage currPage, DataObjectVariable dov ):

	let stateFlagParent = statusFlag.getOwnerOfStatusFlag():

	if (Component.isInstance(stateFlagParent)) 
		then comp.findXMAStateFlagForComponent(statusFlag,dov)
	else if (Page.isInstance(stateFlagParent) || Entity.isInstance(stateFlagParent)) 
		then currPage.findXMAStateFlagForPage(statusFlag,comp,dov)
	else if (ApplicationSession.isInstance(stateFlagParent))
		then comp.findXMAStateFlagForApplication(statusFlag,dov)	
	;
	
/**
 * Get all elements in the nested namespaces between topPage and bottomPage
 */
cached List[IBDAttachable] getNsIBDAttachable(XMAPage topPage, XMAPage bottomPage ):
	let elements = getNsElementsInRange(topPage,bottomPage).typeSelect(IBDAttachable):
	elements;
	
/**
 * Get the elements which are within all nested namespaces from topElement to
 * bottomElement. 
 */	
cached List[emf::EObject] getNsElementsInRange(emf::EObject topElement, emf::EObject bottomElement):
	let nsElements = topElement.eContents.typeSelect(emf::EObject):
	let elementsWithChildrenInNs = nsElements.select(e|isNsRangeBorder(e)==false || containsChildrenInRange(e,bottomElement)):
	
	//log("getNsElementsInRange("+bottomElement.id()+") - topElement.metaType = "+topElement.metaType)->
		
	nsElements.addAll(elementsWithChildrenInNs.getNsElementsInRange(bottomElement))->
	nsElements;

boolean containsChildrenInRange(emf::EObject element, emf::EObject bottomElement):
	
	(bottomElement != null)
		? element == bottomElement || element.eAllContents.contains(bottomElement)
		: false;  		
	

/**
 * Checks whether the Object is the border of a namespace
 */ 	
boolean isNsRangeBorder(emf::EObject obj):
	false;
boolean isNsRangeBorder(Page obj):
	true;
boolean isNsRangeBorder(Component obj):
	true;
boolean isNsRangeBorder(XMAPage obj):
	true;
boolean isNsRangeBorder(XMAComponent obj):
	true;
boolean isNsRangeBorder(Void v):
	error("Can not check nsBorder for null!")->
	false;
	


	
		/**
 * Get all elements in the nested namespaces between topPage and bottomPage
 */
cached List[DataObjectVariable] getNsDataObjectVariable(Component component, Page page ):
	let elements = getNsElementsInRange(component,page).typeSelect(DataObjectVariable):
	elements;	

flex::ApplicationProperty findApplicationProperty(Property property, XMAComponent xmaComponent, DataObjectVariable dov):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.findApplicationProperty(org.openxma.dsl.dom.model.Property,at.spardat.xma.guidesign.XMAComponent,org.openxma.dsl.pom.model.DataObjectVariable);

/**
 * Mapping for supported property-types
 */		
types::PropertyType getXMAPropertyType(Property property):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.getXMAPropertyType(org.openxma.dsl.dom.model.Property);

/**
 * Create application property
 */		
flex::ApplicationProperty createApplicationProperty(flex::XMAApplicationContext application, Property property, XMAComponent xmaComponent):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.createApplicationProperty(at.spardat.xma.guidesign.flex.XMAApplicationContext,org.openxma.dsl.dom.model.Property,at.spardat.xma.guidesign.XMAComponent);	

flex::ApplicationFunction createApplicationFunction(flex::XMAApplicationContext application, Call call, XMAComponent xmaComponent):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.createApplicationFunction(at.spardat.xma.guidesign.flex.XMAApplicationContext,org.openxma.dsl.core.model.Call,at.spardat.xma.guidesign.XMAComponent);	

flex::Expression cloneExpression(flex::Expression exp):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.cloneExpression(at.spardat.xma.guidesign.flex.Expression);			

Void pushOperator(emf::EObject eObject,String operator):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.pushOperator(org.eclipse.emf.ecore.EObject,java.lang.String);			
 
String popOperator(emf::EObject eObject):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.popOperator(org.eclipse.emf.ecore.EObject);			

String nextOperator(emf::EObject eObject):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.getNextOperator(org.eclipse.emf.ecore.EObject);			

Boolean isPrimitiveWrapperType(EqualityExpr equalityExpr):
JAVA org.openxma.dsl.generator.helper.ExpressionExtension.isPrimitiveWrapperType(org.openxma.dsl.core.model.EqualityExpr);			
 
/** 
 * Create a model-object-path starting from the root element of the model.
 */ 
List[emf::EObject] getModelObjectPath(emf::EObject obj):
JAVA org.openxma.xmadsl.LinkerUtil.getModelObjectPath(org.eclipse.emf.ecore.EObject);




© 2015 - 2024 Weber Informatics LLC | Privacy Policy