XPandfacade and Check [message #732211] |
Tue, 04 October 2011 09:08  |
st oehm Messages: 79 Registered: October 2009 |
Member |
|
|
hi to all
i have some problemens using check in XPand
for now i have done this:
Resource resource;
//...load resource
OutputImpl output = new OutputImpl();
//...
ProtectedRegionResolverImpl prs = new ProtectedRegionResolverImpl();
//...
UML2MetaModel mm = new UML2MetaModel();
Map<String,Variable> globalVarsMap = new HashMap<String,Variable>();
//...
XpandExecutionContextImpl execCtx = new XpandExecutionContextImpl(output, prs,
globalVarsMap, null, null);
execCtx.registerMetaModel(mm);
//checkcomponents
CheckComponent c = new CheckComponent();
c.addMetaModel(mm);
c.addCheckFile("templateMiddle::javacheck");
WorkflowContextImpl ctx = new WorkflowContextImpl();
ctx.put("", resource.getContents().get(0));
c.invoke(ctx);
//für primtive Types etc...
new Setup().setStandardUML2Setup(true);
XpandFacade facade = XpandFacade.create(execCtx);
facade.evaluate("templateMiddle::Template::main", resource.getContents().get(0));
i have added to the checkcomponent the metamodel and the checkFile. because i found no possibility to set the checkcomponent in the executionContext, i guess i have to use the invoke method of the checkcomponent. but this method expects a WorkFlowContext Object. but i'm not sure what i have put in this workFlowObject. Maybe someone knows it?
greetings
stoehm
|
|
|
|
|
|
Re: XPandfacade and Check [message #734898 is a reply to message #734891] |
Mon, 10 October 2011 10:31   |
|
The toCheck collection is the collection of objects to perform the validation on.
I have added javadocs now.
/**
* Invokes Check validation on a set of objects.
* @param checkFile Qualified name of the check file (qualified with '::')
* @param in The InputStream to use to load checkFile
* @param toCheck A collection of objects to perform the validation on
* @param ctx Execution context to use for evaluating the Check rules
* @param issues Issues instance to collect detected problems in
* @param warnIfNothingChecked When set a warning will be raised if no validation rule was executed
*/
Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01794 seconds