You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2013/06/13 18:55:53 UTC

svn commit: r1492758 - /isis/site/trunk/content/getting-started/resources/isis-templates.xml

Author: danhaywood
Date: Thu Jun 13 16:55:52 2013
New Revision: 1492758

URL: http://svn.apache.org/r1492758
Log:
new templates

Modified:
    isis/site/trunk/content/getting-started/resources/isis-templates.xml

Modified: isis/site/trunk/content/getting-started/resources/isis-templates.xml
URL: http://svn.apache.org/viewvc/isis/site/trunk/content/getting-started/resources/isis-templates.xml?rev=1492758&r1=1492757&r2=1492758&view=diff
==============================================================================
--- isis/site/trunk/content/getting-started/resources/isis-templates.xml (original)
+++ isis/site/trunk/content/getting-started/resources/isis-templates.xml Thu Jun 13 16:55:52 2013
@@ -128,6 +128,48 @@ public void removeFrom${CollectionName}(
 protected void onAddTo${CollectionName}(final ${ElementType} ${elementName}) {
 }
 protected void onRemoveFrom${CollectionName}(final ${ElementType} ${elementName}) {
+}</template><template autoinsert="true" context="java-members" deleted="false" description="Collection modify (with actions)" enabled="true" name="iscmoda">${:import(org.apache.isis.applib.annotation.MemberOrder)}// Action.&#13;
+@MemberOrder(name="${collectionName}", sequence="1")&#13;
+public ${enclosing_type} insertInto${CollectionName}(final ${ElementType} ${elementName}) {&#13;
+    addTo${CollectionName}(${elementName});&#13;
+    return this;&#13;
+}&#13;
+&#13;
+// Programming model.&#13;
+public void addTo${CollectionName}(final ${ElementType} ${elementName}) {&#13;
+    // check for no-op&#13;
+    if (${elementName} == null ||&#13;
+            get${CollectionName}().contains(${elementName})) {&#13;
+            return;&#13;
+    }&#13;
+    // associate new&#13;
+    get${CollectionName}().add(${elementName});&#13;
+    // additional business logic&#13;
+    onAddTo${CollectionName}(${elementName});&#13;
+}&#13;
+&#13;
+// Action.&#13;
+@MemberOrder(name="${collectionName}", sequence="2")&#13;
+public ${enclosing_type} deleteFrom${CollectionName}(final ${ElementType} ${elementName}) {&#13;
+    removeFrom${CollectionName}(${elementName});&#13;
+    return this;&#13;
+}&#13;
+&#13;
+// Programming model.&#13;
+public void removeFrom${CollectionName}(final ${ElementType} ${elementName}) {&#13;
+    // check for no-op&#13;
+    if (${elementName} == null ||&#13;
+            !get${CollectionName}().contains(${elementName})) {&#13;
+            return;&#13;
+    }&#13;
+    // dissociate existing&#13;
+    get${CollectionName}().remove(${elementName});&#13;
+    // additional business logic&#13;
+    onRemoveFrom${CollectionName}(${elementName});&#13;
+}&#13;
+protected void onAddTo${CollectionName}(final ${ElementType} ${elementName}) {&#13;
+}&#13;
+protected void onRemoveFrom${CollectionName}(final ${ElementType} ${elementName}) {&#13;
 }</template><template autoinsert="true" context="java-members" deleted="false" description="Collection (set)" enabled="true" name="iscs">// {{ ${CollectionName} (Collection)&#13;
 ${:import(java.util.Set,java.util.LinkedHashSet,org.apache.isis.applib.annotation.MemberOrder)}private Set&lt;${ElementType}&gt; ${collectionName} = new LinkedHashSet&lt;${ElementType}&gt;();&#13;
 @MemberOrder(sequence="1")&#13;
@@ -143,10 +185,62 @@ public void set${CollectionName}(final S
 ${:import(java.util.SortedSet,java.util.TreeSet,org.apache.isis.applib.annotation.MemberOrder)}private SortedSet&lt;${ElementType}&gt; ${collectionName} = new TreeSet&lt;${ElementType}&gt;();&#13;
 @MemberOrder(sequence="1")&#13;
 public SortedSet&lt;${ElementType}&gt; get${CollectionName}() {&#13;
-        return ${collectionName};&#13;
+    return ${collectionName};&#13;
+}&#13;
+public void set${CollectionName}(final SortedSet&lt;${ElementType}&gt; ${collectionName}) {&#13;
+    this.${collectionName} = ${collectionName};&#13;
+}&#13;
+// }}</template><template autoinsert="true" context="java-members" deleted="false" description="Collection (set-sorted-with actions)" enabled="true" name="iscssa">// {{ ${CollectionName} (Collection)&#13;
+${:import(java.util.SortedSet,java.util.TreeSet,org.apache.isis.applib.annotation.MemberOrder)}private SortedSet&lt;${ElementType}&gt; ${collectionName} = new TreeSet&lt;${ElementType}&gt;();&#13;
+@MemberOrder(sequence="1")&#13;
+public SortedSet&lt;${ElementType}&gt; get${CollectionName}() {&#13;
+    return ${collectionName};&#13;
 }&#13;
 public void set${CollectionName}(final SortedSet&lt;${ElementType}&gt; ${collectionName}) {&#13;
-        this.${collectionName} = ${collectionName};&#13;
+    this.${collectionName} = ${collectionName};&#13;
+}&#13;
+&#13;
+@MemberOrder(name="${collectionName}", sequence="1")&#13;
+public ${enclosing_type} insertInto${CollectionName}(final ${ElementType} ${elementName}) {&#13;
+    addTo${CollectionName}(${elementName});&#13;
+    return this;&#13;
+}&#13;
+&#13;
+// Programming model.&#13;
+public void addTo${CollectionName}(final ${ElementType} ${elementName}) {&#13;
+    // check for no-op&#13;
+    if (${elementName} == null ||&#13;
+            get${CollectionName}().contains(${elementName})) {&#13;
+            return;&#13;
+    }&#13;
+    // associate new&#13;
+    get${CollectionName}().add(${elementName});&#13;
+    // additional business logic&#13;
+    onAddTo${CollectionName}(${elementName});&#13;
+}&#13;
+&#13;
+// Action.&#13;
+@MemberOrder(name="${collectionName}", sequence="2")&#13;
+public ${enclosing_type} deleteFrom${CollectionName}(final ${ElementType} ${elementName}) {&#13;
+    removeFrom${CollectionName}(${elementName});&#13;
+    return this;&#13;
+}&#13;
+&#13;
+// Programming model.&#13;
+public void removeFrom${CollectionName}(final ${ElementType} ${elementName}) {&#13;
+    // check for no-op&#13;
+    if (${elementName} == null ||&#13;
+        !get${CollectionName}().contains(${elementName})) {&#13;
+        return;&#13;
+    }&#13;
+    // dissociate existing&#13;
+    get${CollectionName}().remove(${elementName});&#13;
+    // additional business logic&#13;
+    onRemoveFrom${CollectionName}(${elementName});&#13;
+}&#13;
+protected void onAddTo${CollectionName}(final ${ElementType} ${elementName}) {&#13;
+}&#13;
+protected void onRemoveFrom${CollectionName}(final ${ElementType} ${elementName}) {&#13;
 }&#13;
 // }}</template><template autoinsert="true" context="java-members" deleted="false" description="Collection validation" enabled="true" name="iscval">public String validateAddTo${CollectionName}(final ${ElementType} ${elementName}) {&#13;
 	return ${cursor}null; // TODO: return reason why argument cannot be added, null if ok to add&#13;