| /* |
| * Copyright (c) 2007, 2008 Borland Software Corporation |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Artem Tikhomirov (Borland) - initial API and implementation |
| */ |
| «IMPORT "http://www.eclipse.org/gmf/2008/GenModel"» |
| «IMPORT "http://www.eclipse.org/emf/2002/Ecore"» |
| «EXTENSION xpt::GenAuditRoot» |
| |
| «DEFINE extensions FOR gmfgen::GenEditorGenerator-» |
| «IF hasAudits()»«EXPAND extensions FOR audits»«ENDIF-» |
| «ENDDEFINE» |
| |
| «DEFINE extensions FOR gmfgen::GenAuditRoot-» |
| «EXPAND extensions_emfv_constraintProviders» |
| «EXPAND extensions_emfv_constraintBindings» |
| «EXPAND extensions_emfv_uiContexts» |
| «ENDDEFINE» |
| |
| // |
| // Extension point: org.eclipse.emf.validation.constraintProviders |
| // |
| «DEFINE extensions_emfv_constraintProviders FOR GenAuditRoot-» |
| <extension point="org.eclipse.emf.validation.constraintProviders"> |
| «EXPAND xpt::Common::xmlGeneratedTag» |
| «EXPAND declareCategory FOREACH categories-» |
| <constraintProvider cache="true"> |
| «FOREACH getAllTargetedModelPackages() AS p-» |
| <package namespaceUri="«p.ecorePackage.nsURI»"/> |
| «ENDFOREACH-» |
| «EXPAND defineCategory FOREACH categories-» |
| </constraintProvider> |
| </extension> |
| «ENDDEFINE» |
| |
| // |
| // Extension point: org.eclipse.emf.validation.constraintBindings |
| // |
| «DEFINE extensions_emfv_constraintBindings FOR GenAuditRoot-» |
| <extension point="org.eclipse.emf.validation.constraintBindings"> |
| «EXPAND xpt::Common::xmlGeneratedTag» |
| «FOREACH clientContexts AS ctx-» |
| <clientContext default="false" id="«getQualifiedIdentity(ctx)»"> |
| <selector class="«ctx.getQualifiedClassName()»"/> |
| </clientContext> |
| <binding context="«getQualifiedIdentity(ctx)»"> |
| «FOREACH rules.select(r | r.target != null && r.target.contextSelector == ctx) /*alternative: ctx.ruleTargets.contains(r.target)*/ AS rule-» |
| <constraint ref="«editorGen.plugin.iD».«escapeXML(rule.id)»"/> |
| «ENDFOREACH-» |
| </binding> |
| |
| «ENDFOREACH-» |
| </extension> |
| «ENDDEFINE» |
| |
| // |
| // Extension point: org.eclipse.emf.validation.ui.UIRegisteredClientContext |
| // |
| «DEFINE extensions_emfv_uiContexts FOR GenAuditRoot-» |
| «IF editorGen.diagram.liveValidationUIFeedback» |
| <extension point="org.eclipse.emf.validation.ui.UIRegisteredClientContext"> |
| «EXPAND xpt::Common::xmlGeneratedTag» |
| «FOREACH clientContexts AS ctx-» |
| <clientContext id="«getQualifiedIdentity(ctx)»"/> |
| «ENDFOREACH-» |
| </extension> |
| «ENDIF-» |
| «ENDDEFINE» |
| |
| «DEFINE declareCategory FOR gmfgen::GenAuditContainer-» |
| <category id="«EXPAND _pathMap»" mandatory="false" name="«IF name != null»«escapeXML(name)»«ELSE»«EXPAND _pathMap»«ENDIF»"> |
| <![CDATA[«description != null ? description : ""»]]> |
| </category> |
| «ENDDEFINE» |
| |
| «DEFINE defineCategory FOR gmfgen::GenAuditContainer-» |
| <constraints categories="«EXPAND _pathMap»"> |
| «FOREACH audits.select(a | a.target != null && a.target.getTargetClass() != null) AS audit-» |
| <constraint id="«escapeXML(audit.id)»" |
| «IF audit.requiresConstraintAdapter»lang="Java" class="«audit.getConstraintAdapterQualifiedClassName()»"«ELSE»lang="OCL"«ENDIF» |
| name="«escapeXML(audit.name != null ? audit.name : audit.id)»" |
| mode="«IF audit.useInLiveMode»Live«ELSE»Batch«ENDIF»" |
| severity="«audit.severity.name»" statusCode="200"> |
| «IF !audit.requiresConstraintAdapter»<![CDATA[«audit.rule != null ? audit.rule.body : ""»]]>«ENDIF» |
| <description><![CDATA[«audit.description != null ? audit.description : ""»]]></description> |
| <message><![CDATA[«IF audit.message != null»«audit.message»«ELSE»«audit.name != null ? audit.name : audit.id» audit violated«ENDIF»]]></message> |
| <target class="«audit.target.getTargetClassModelQualifiedName()»"/> |
| </constraint> |
| «ENDFOREACH-» |
| </constraints> |
| «ENDDEFINE» |
| |
| «DEFINE _pathMap FOR gmfgen::GenAuditContainer»«FOREACH path AS p SEPARATOR "/" »«escapeXML(p.id)»«ENDFOREACH»«ENDDEFINE» |