ecoreJavascriptDelegatesTest
Company
name
employees
size
Employee
reportsTo
manager
checkNameLength
diagnostics
context
name
manager
company
directReports
allReports
reportingChain
CompanySizeKind
small
small
medium
medium
large
large
NameType
java.lang.String
java.lang.String
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
    xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="ecoreJavascriptDelegatesTest"
    nsURI="http://www.eclipse.org/emf/js4emf/tests/ecoreJavascriptDelegatesTest.ecore"
    nsPrefix="st">
  <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
    <details key="settingDelegates" value="http://www.eclipse.org/emf/2002/Ecore/Javascript"/>
    <details key="invocationDelegates" value="http://www.eclipse.org/emf/2002/Ecore/Javascript"/>
    <details key="validationDelegates" value="http://www.eclipse.org/emf/2002/Ecore/Javascript"/>
  </eAnnotations>
  <eClassifiers xsi:type="ecore:EClass" name="Company">
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
    <eStructuralFeatures xsi:type="ecore:EReference" name="employees" upperBound="-1"
        eType="#//Employee" containment="true" eOpposite="#//Employee/company"/>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="size" lowerBound="1" eType="#//CompanySizeKind"
        changeable="false" volatile="true" transient="true" derived="true">
      <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/Javascript">
        <details key="Javascript" value="var sizeKind = $ecoreJavascriptDelegatesTest.$CompanySizeKind;&#xA;var size = this.employees.size();&#xA;if (size &lt; 50) return sizeKind.$small;&#xA;else if (size &lt; 1000) return sizeKind.$medium;&#xA;else return sizeKind.$large;"/>
      </eAnnotations>
    </eStructuralFeatures>
  </eClassifiers>
  <eClassifiers xsi:type="ecore:EClass" name="Employee">
    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
      <details key="constraints" value="nonNullName"/>
    </eAnnotations>
    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/Javascript">
      <details key="nonNullName" value="return this.name != null;"/>
    </eAnnotations>
    <eOperations name="reportsTo" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
      <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/Javascript">
        <details key="Javascript" value="return this.reportingChain.contains(manager)"/>
      </eAnnotations>
      <eParameters name="manager" eType="#//Employee"/>
    </eOperations>
    <eOperations name="checkNameLength" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
      <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/Javascript">
        <details key="body" value="// excludes Sally&#xA;var name = this.name;&#xA;return name != null &amp;&amp; name.length != 5;"/>
      </eAnnotations>
      <eParameters name="diagnostics" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDiagnosticChain"/>
      <eParameters name="context" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EMap"/>
    </eOperations>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="#//NameType"/>
    <eStructuralFeatures xsi:type="ecore:EReference" name="manager" eType="#//Employee"/>
    <eStructuralFeatures xsi:type="ecore:EReference" name="company" lowerBound="1"
        eType="#//Company" eOpposite="#//Company/employees"/>
    <eStructuralFeatures xsi:type="ecore:EReference" name="directReports" upperBound="-1"
        eType="#//Employee" changeable="false" volatile="true" transient="true" derived="true">
      <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/Javascript">
        <details key="Javascript" value="var thisEmp = this;&#xA;return this.company.employees.select(function (emp) { return (emp.manager == thisEmp);});"/>
      </eAnnotations>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EReference" name="allReports" ordered="false"
        upperBound="-1" eType="#//Employee" changeable="false" volatile="true" transient="true"
        derived="true">
      <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/Javascript">
        <details key="Javascript" value="var thisEmp = this;&#xA;return this.company.employees.select(function (emp) { return emp.reportsTo(thisEmp);});"/>
      </eAnnotations>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EReference" name="reportingChain" upperBound="-1"
        eType="#//Employee" changeable="false" volatile="true" transient="true" derived="true">
      <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/Javascript">
        <details key="Javascript" value="var linkedList = null;&#xA;if (this.manager == null)&#xD;&#x9;linkedList = new java.util.LinkedList();&#xD;else {&#xA;&#x9;linkedList = this.manager.reportingChain;&#xA;&#x9;linkedList.addFirst(this.manager);&#xA;}&#xA;return linkedList;&#xA;"/>
      </eAnnotations>
    </eStructuralFeatures>
  </eClassifiers>
  <eClassifiers xsi:type="ecore:EEnum" name="CompanySizeKind">
    <eLiterals name="small"/>
    <eLiterals name="medium" value="1"/>
    <eLiterals name="large" value="2"/>
  </eClassifiers>
  <eClassifiers xsi:type="ecore:EDataType" name="NameType" instanceClassName="java.lang.String">
    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
      <details key="constraints" value="nonEmptyName capitalizedName"/>
    </eAnnotations>
    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/Javascript">
      <details key="nonEmptyName" value="return NameType != null &amp;&amp; NameType.length > 0;"/>
      <details key="capitalizedName" value="return NameType != null &amp;&amp; NameType.length > 0 &amp;&amp; java.lang.Character.isUpperCase(NameType.charAt(0));"/>
    </eAnnotations>
  </eClassifiers>
</ecore:EPackage>

{"directed":true,"nodes":[{"nsPrefix":"st","nsURI":"http://www.eclipse.org/emf/js4emf/tests/ecoreJavascriptDelegatesTest.ecore","name":"ecoreJavascriptDelegatesTest","id":0,"eClass":"EPackage"},{"instanceTypeName":null,"defaultValue":null,"instanceClassName":null,"name":"Company","instanceClass":null,"abstract":false,"id":1,"interface":false,"eClass":"EClass"},{"instanceTypeName":null,"defaultValue":null,"instanceClassName":null,"name":"Employee","instanceClass":null,"abstract":false,"id":2,"interface":false,"eClass":"EClass"},{"instanceTypeName":null,"instanceClassName":null,"name":"CompanySizeKind","instanceClass":null,"id":3,"serializable":true,"eClass":"EEnum"},{"instanceTypeName":"java.lang.String","defaultValue":null,"instanceClassName":"java.lang.String","name":"NameType","instanceClass":"java.lang.String","id":4,"serializable":true,"eClass":"EDataType"},{"ordered":true,"upperBound":1,"defaultValue":null,"volatile":false,"many":false,"required":true,"eClass":"EAttribute","defaultValueLiteral":null,"unsettable":false,"transient":false,"unique":true,"name":"name","changeable":true,"lowerBound":1,"iD":false,"id":5,"derived":false},{"container":false,"ordered":true,"upperBound":-1,"defaultValue":null,"volatile":false,"many":true,"required":false,"eClass":"EReference","defaultValueLiteral":null,"containment":true,"unsettable":false,"transient":false,"unique":true,"name":"employees","changeable":true,"resolveProxies":true,"lowerBound":0,"id":6,"derived":false},{"ordered":true,"upperBound":1,"volatile":true,"many":false,"required":true,"eClass":"EAttribute","defaultValueLiteral":null,"unsettable":false,"transient":true,"unique":true,"name":"size","changeable":false,"lowerBound":1,"iD":false,"id":7,"derived":true},{"id":8,"eClass":"EGenericType"},{"id":9,"eClass":"EGenericType"},{"container":true,"ordered":true,"upperBound":1,"defaultValue":null,"volatile":false,"many":false,"required":true,"eClass":"EReference","defaultValueLiteral":null,"containment":false,"unsettable":false,"transient":false,"unique":true,"name":"company","changeable":true,"resolveProxies":true,"lowerBound":1,"id":10,"derived":false},{"id":11,"eClass":"EGenericType"},{"ordered":true,"upperBound":1,"unique":true,"name":"reportsTo","lowerBound":1,"id":12,"many":false,"required":true,"eClass":"EOperation"},{"ordered":true,"upperBound":1,"unique":true,"name":"checkNameLength","lowerBound":0,"id":13,"many":false,"required":false,"eClass":"EOperation"},{"ordered":true,"upperBound":1,"defaultValue":null,"volatile":false,"many":false,"required":false,"eClass":"EAttribute","defaultValueLiteral":null,"unsettable":false,"transient":false,"unique":true,"name":"name","changeable":true,"lowerBound":0,"iD":false,"id":14,"derived":false},{"container":false,"ordered":true,"upperBound":1,"defaultValue":null,"volatile":false,"many":false,"required":false,"eClass":"EReference","defaultValueLiteral":null,"containment":false,"unsettable":false,"transient":false,"unique":true,"name":"manager","changeable":true,"resolveProxies":true,"lowerBound":0,"id":15,"derived":false},{"container":false,"ordered":true,"upperBound":-1,"defaultValue":null,"volatile":true,"many":true,"required":false,"eClass":"EReference","defaultValueLiteral":null,"containment":false,"unsettable":false,"transient":true,"unique":true,"name":"directReports","changeable":false,"resolveProxies":true,"lowerBound":0,"id":16,"derived":true},{"container":false,"ordered":false,"upperBound":-1,"defaultValue":null,"volatile":true,"many":true,"required":false,"eClass":"EReference","defaultValueLiteral":null,"containment":false,"unsettable":false,"transient":true,"unique":true,"name":"allReports","changeable":false,"resolveProxies":true,"lowerBound":0,"id":17,"derived":true},{"container":false,"ordered":true,"upperBound":-1,"defaultValue":null,"volatile":true,"many":true,"required":false,"eClass":"EReference","defaultValueLiteral":null,"containment":false,"unsettable":false,"transient":true,"unique":true,"name":"reportingChain","changeable":false,"resolveProxies":true,"lowerBound":0,"id":18,"derived":true},{"id":19,"eClass":"EGenericType"},{"ordered":true,"upperBound":1,"unique":true,"name":"manager","lowerBound":0,"id":20,"many":false,"required":false,"eClass":"EParameter"},{"id":21,"eClass":"EGenericType"},{"id":22,"eClass":"EGenericType"},{"ordered":true,"upperBound":1,"unique":true,"name":"diagnostics","lowerBound":0,"id":23,"many":false,"required":false,"eClass":"EParameter"},{"ordered":true,"upperBound":1,"unique":true,"name":"context","lowerBound":0,"id":24,"many":false,"required":false,"eClass":"EParameter"},{"id":25,"eClass":"EGenericType"},{"id":26,"eClass":"EGenericType"},{"id":27,"eClass":"EGenericType"},{"id":28,"eClass":"EGenericType"},{"id":29,"eClass":"EGenericType"},{"id":30,"eClass":"EGenericType"},{"id":31,"eClass":"EGenericType"},{"id":32,"eClass":"EGenericType"},{"name":"small","id":33,"value":0,"literal":"small","eClass":"EEnumLiteral"},{"name":"medium","id":34,"value":1,"literal":"medium","eClass":"EEnumLiteral"},{"name":"large","id":35,"value":2,"literal":"large","eClass":"EEnumLiteral"}],"links":[{"source":0,"target":1},{"source":0,"target":2},{"source":0,"target":3},{"source":0,"target":4},{"source":1,"target":0},{"source":1,"target":5},{"source":1,"target":6},{"source":1,"target":7},{"source":5,"target":8},{"source":5,"target":1},{"source":6,"target":2},{"source":6,"target":9},{"source":6,"target":1},{"source":6,"target":10},{"source":9,"target":2},{"source":7,"target":3},{"source":7,"target":11},{"source":7,"target":1},{"source":11,"target":3},{"source":2,"target":0},{"source":2,"target":12},{"source":2,"target":13},{"source":2,"target":14},{"source":2,"target":15},{"source":2,"target":10},{"source":2,"target":16},{"source":2,"target":17},{"source":2,"target":18},{"source":12,"target":19},{"source":12,"target":2},{"source":12,"target":20},{"source":20,"target":2},{"source":20,"target":21},{"source":20,"target":12},{"source":21,"target":2},{"source":13,"target":22},{"source":13,"target":2},{"source":13,"target":23},{"source":13,"target":24},{"source":23,"target":25},{"source":23,"target":13},{"source":24,"target":26},{"source":24,"target":13},{"source":14,"target":4},{"source":14,"target":27},{"source":14,"target":2},{"source":27,"target":4},{"source":15,"target":2},{"source":15,"target":28},{"source":15,"target":2},{"source":28,"target":2},{"source":10,"target":1},{"source":10,"target":29},{"source":10,"target":2},{"source":10,"target":6},{"source":29,"target":1},{"source":16,"target":2},{"source":16,"target":30},{"source":16,"target":2},{"source":30,"target":2},{"source":17,"target":2},{"source":17,"target":31},{"source":17,"target":2},{"source":31,"target":2},{"source":18,"target":2},{"source":18,"target":32},{"source":18,"target":2},{"source":32,"target":2},{"source":3,"target":0},{"source":3,"target":33},{"source":3,"target":34},{"source":3,"target":35},{"source":33,"target":3},{"source":34,"target":3},{"source":35,"target":3},{"source":4,"target":0}],"multigraph":true}