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 2018/07/21 14:00:24 UTC
[isis] 01/03: ISIS-1810: improvements for generating archetypes
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch release-2.0.0-M1-RC1
in repository https://gitbox.apache.org/repos/asf/isis.git
commit 52f69b02e731e7b23ff8ecc9404e0473b1c2b70f
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sat Jul 21 14:38:27 2018 +0100
ISIS-1810: improvements for generating archetypes
for example aps
- adds gpg.plugin for generated archetype
- use title() rather than @Title as workaround for
updates scripts for generating archetypes:
- use project.version to declare submodules (in the simpleapp top-level pom)
- fix dependencyManagement.dependencies.dependency.version for submodules
- Update submodule's parent.version
- Update all module's version, unable to use
---
.../application/helloworld/nb-configuration.xml | 19 ---
example/application/helloworld/nbactions.xml | 50 --------
.../java/domainapp/dom/impl/HelloWorldObject.java | 32 +++--
.../src/main/java/domainapp/dom/types/Name.java | 24 ++++
.../src/main/java/domainapp/dom/types/Notes.java | 25 ++++
.../modules/simple/dom/impl/SimpleObject.java | 29 ++---
.../domainapp/modules/simple/dom/types/Name.java | 3 +-
.../domainapp/modules/simple/dom/types/Notes.java | 25 ++++
example/application/simpleapp/pom.xml | 8 +-
example/archetype/simpleapp/pom.xml | 43 ++++++-
.../appended-resources/supplemental-models.xml | 26 -----
.../META-INF/maven/archetype-metadata.xml | 38 ++----
.../modules/simple/dom/impl/SimpleObject.java | 29 ++---
.../domainapp/modules/simple/dom/types/Name.java | 3 +-
.../domainapp/modules/simple/dom/types/Notes.java | 28 +++++
.../src/main/resources/archetype-resources/pom.xml | 10 +-
.../resources/projects/basic/archetype.properties | 2 +-
scripts/updateGeneratedArchetypeSources.groovy | 129 ++++++++++++++-------
18 files changed, 284 insertions(+), 239 deletions(-)
diff --git a/example/application/helloworld/nb-configuration.xml b/example/application/helloworld/nb-configuration.xml
deleted file mode 100644
index 307db53..0000000
--- a/example/application/helloworld/nb-configuration.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project-shared-configuration>
- <!--
-This file contains additional configuration written by modules in the NetBeans IDE.
-The configuration is intended to be shared among all the users of project and
-therefore it is assumed to be part of version control checkout.
-Without this configuration present, some functionality in the IDE may be limited or fail altogether.
--->
- <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
- <!--
-Properties that influence various parts of the IDE, especially code formatting and the like.
-You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
-That way multiple projects can share the same settings (useful for formatting rules for example).
-Any value defined here will override the pom.xml file value but is only applicable to the current project.
--->
- <org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>Tomcat</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
- <org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>1.7-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
- </properties>
-</project-shared-configuration>
diff --git a/example/application/helloworld/nbactions.xml b/example/application/helloworld/nbactions.xml
deleted file mode 100644
index 363ba34..0000000
--- a/example/application/helloworld/nbactions.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<actions>
- <action>
- <actionName>run</actionName>
- <packagings>
- <packaging>war</packaging>
- <packaging>ear</packaging>
- <packaging>ejb</packaging>
- </packagings>
- <goals>
- <goal>package</goal>
- </goals>
- <properties>
- <netbeans.deploy>true</netbeans.deploy>
- <netbeans.deploy.clientUrlPart>localhost</netbeans.deploy.clientUrlPart>
- </properties>
- </action>
- <action>
- <actionName>debug</actionName>
- <packagings>
- <packaging>war</packaging>
- <packaging>ear</packaging>
- <packaging>ejb</packaging>
- </packagings>
- <goals>
- <goal>package</goal>
- </goals>
- <properties>
- <netbeans.deploy.debugmode>true</netbeans.deploy.debugmode>
- <netbeans.deploy>true</netbeans.deploy>
- <netbeans.deploy.clientUrlPart>localhost</netbeans.deploy.clientUrlPart>
- </properties>
- </action>
- <action>
- <actionName>profile</actionName>
- <packagings>
- <packaging>ejb</packaging>
- <packaging>ear</packaging>
- <packaging>war</packaging>
- </packagings>
- <goals>
- <goal>package</goal>
- </goals>
- <properties>
- <netbeans.deploy>true</netbeans.deploy>
- <netbeans.deploy.profilemode>true</netbeans.deploy.profilemode>
- <netbeans.deploy.clientUrlPart>localhost</netbeans.deploy.clientUrlPart>
- </properties>
- </action>
- </actions>
diff --git a/example/application/helloworld/src/main/java/domainapp/dom/impl/HelloWorldObject.java b/example/application/helloworld/src/main/java/domainapp/dom/impl/HelloWorldObject.java
index 54a1a35..02f57e4 100644
--- a/example/application/helloworld/src/main/java/domainapp/dom/impl/HelloWorldObject.java
+++ b/example/application/helloworld/src/main/java/domainapp/dom/impl/HelloWorldObject.java
@@ -29,17 +29,15 @@ import org.apache.isis.applib.annotation.Auditing;
import org.apache.isis.applib.annotation.CommandReification;
import org.apache.isis.applib.annotation.DomainObject;
import org.apache.isis.applib.annotation.DomainObjectLayout;
-import org.apache.isis.applib.annotation.Editing;
-import org.apache.isis.applib.annotation.Parameter;
-import org.apache.isis.applib.annotation.ParameterLayout;
-import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.Publishing;
import org.apache.isis.applib.annotation.SemanticsOf;
-import org.apache.isis.applib.annotation.Title;
import org.apache.isis.applib.services.message.MessageService;
import org.apache.isis.applib.services.repository.RepositoryService;
import org.apache.isis.applib.services.title.TitleService;
+import domainapp.dom.types.Name;
+import domainapp.dom.types.Notes;
+
@javax.jdo.annotations.PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "helloworld" )
@javax.jdo.annotations.DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@javax.jdo.annotations.Version(strategy= VersionStrategy.DATE_TIME, column ="version")
@@ -52,25 +50,22 @@ public class HelloWorldObject implements Comparable<HelloWorldObject> {
this.name = name;
}
- @javax.jdo.annotations.Column(allowsNull = "false", length = 40)
- @Property(editing = Editing.DISABLED)
- @Title(prepend = "Object: ")
- private String name;
+ public String title() {
+ return "Object: " + getName();
+ }
+
+ @Name private String name;
public String getName() { return name; }
public void setName(final String name) { this.name = name; }
- @javax.jdo.annotations.Column(allowsNull = "true", length = 4000)
- @Property(editing = Editing.ENABLED)
- private String notes;
+ @Notes private String notes;
public String getNotes() { return notes; }
public void setNotes(final String notes) { this.notes = notes; }
@Action(semantics = SemanticsOf.IDEMPOTENT, command = CommandReification.ENABLED, publishing = Publishing.ENABLED)
public HelloWorldObject updateName(
- @Parameter(maxLength = 40)
- @ParameterLayout(named = "Name")
- final String name) {
+ @Name final String name) {
setName(name);
return this;
}
@@ -99,17 +94,16 @@ public class HelloWorldObject implements Comparable<HelloWorldObject> {
}
- @javax.jdo.annotations.NotPersistent
@javax.inject.Inject
+ @javax.jdo.annotations.NotPersistent
RepositoryService repositoryService;
- @javax.jdo.annotations.NotPersistent
@javax.inject.Inject
+ @javax.jdo.annotations.NotPersistent
TitleService titleService;
- @javax.jdo.annotations.NotPersistent
@javax.inject.Inject
+ @javax.jdo.annotations.NotPersistent
MessageService messageService;
-
}
\ No newline at end of file
diff --git a/example/application/helloworld/src/main/java/domainapp/dom/types/Name.java b/example/application/helloworld/src/main/java/domainapp/dom/types/Name.java
new file mode 100644
index 0000000..021ce11
--- /dev/null
+++ b/example/application/helloworld/src/main/java/domainapp/dom/types/Name.java
@@ -0,0 +1,24 @@
+package domainapp.dom.types;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.jdo.annotations.Column;
+
+import org.apache.isis.applib.annotation.Editing;
+import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
+import org.apache.isis.applib.annotation.Property;
+
+@Column(length = Name.MAX_LEN, allowsNull = "false")
+@Property(editing = Editing.DISABLED, maxLength = Name.MAX_LEN)
+@Parameter(maxLength = Name.MAX_LEN)
+@ParameterLayout(named = "Name")
+@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Name {
+
+ int MAX_LEN = 40;
+}
diff --git a/example/application/helloworld/src/main/java/domainapp/dom/types/Notes.java b/example/application/helloworld/src/main/java/domainapp/dom/types/Notes.java
new file mode 100644
index 0000000..0ba48e2
--- /dev/null
+++ b/example/application/helloworld/src/main/java/domainapp/dom/types/Notes.java
@@ -0,0 +1,25 @@
+package domainapp.dom.types;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.jdo.annotations.Column;
+
+import org.apache.isis.applib.annotation.Editing;
+import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
+import org.apache.isis.applib.annotation.Property;
+
+@Column(length = Notes.MAX_LEN, allowsNull = "true")
+@Property(editing = Editing.ENABLED, maxLength = Notes.MAX_LEN)
+@Parameter(maxLength = Notes.MAX_LEN)
+@ParameterLayout(named = "Notes")
+@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Notes {
+
+ int MAX_LEN = 4000;
+
+}
diff --git a/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.java b/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.java
index 80acf29..9d7ecf9 100644
--- a/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.java
+++ b/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.java
@@ -18,6 +18,7 @@
*/
package domainapp.modules.simple.dom.impl;
+import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.VersionStrategy;
@@ -28,20 +29,17 @@ import org.apache.isis.applib.annotation.Auditing;
import org.apache.isis.applib.annotation.CommandReification;
import org.apache.isis.applib.annotation.DomainObject;
import org.apache.isis.applib.annotation.DomainObjectLayout;
-import org.apache.isis.applib.annotation.Editing;
-import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.Publishing;
import org.apache.isis.applib.annotation.SemanticsOf;
-import org.apache.isis.applib.annotation.Title;
-import org.apache.isis.applib.services.i18n.TranslatableString;
import org.apache.isis.applib.services.message.MessageService;
import org.apache.isis.applib.services.repository.RepositoryService;
import org.apache.isis.applib.services.title.TitleService;
import domainapp.modules.simple.dom.types.Name;
+import domainapp.modules.simple.dom.types.Notes;
@javax.jdo.annotations.PersistenceCapable(identityType=IdentityType.DATASTORE, schema = "simple")
-@javax.jdo.annotations.DatastoreIdentity(strategy=javax.jdo.annotations.IdGeneratorStrategy.IDENTITY, column="id")
+@javax.jdo.annotations.DatastoreIdentity(strategy=IdGeneratorStrategy.IDENTITY, column="id")
@javax.jdo.annotations.Version(strategy= VersionStrategy.DATE_TIME, column="version")
@javax.jdo.annotations.Unique(name="SimpleObject_name_UNQ", members = {"name"})
@DomainObject(auditing = Auditing.ENABLED)
@@ -49,15 +47,15 @@ import domainapp.modules.simple.dom.types.Name;
@lombok.RequiredArgsConstructor
public class SimpleObject implements Comparable<SimpleObject> {
+ public String title() {
+ return "Object: " + getName();
+ }
@lombok.Getter @lombok.Setter @lombok.NonNull
- @Title(prepend = "Object: ")
@Name private String name;
- @javax.jdo.annotations.Column(allowsNull = "true", length = 4000)
@lombok.Getter @lombok.Setter
- @Property(editing = Editing.ENABLED)
- private String notes;
+ @Notes private String notes;
@Action(semantics = SemanticsOf.IDEMPOTENT, command = CommandReification.ENABLED, publishing = Publishing.ENABLED, associateWith = "name")
@@ -70,35 +68,27 @@ public class SimpleObject implements Comparable<SimpleObject> {
return getName();
}
- public TranslatableString validate0UpdateName(final String name) {
- return name != null && name.contains("!") ? TranslatableString.tr("Exclamation mark is not allowed") : null;
- }
-
@Action(semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE)
public void delete() {
final String title = titleService.titleOf(this);
messageService.informUser(String.format("'%s' deleted", title));
- repositoryService.remove(this);
+ repositoryService.removeAndFlush(this);
}
-
-
- // -- toString, compareTo
@Override
public String toString() {
return getName();
}
+ @Override
public int compareTo(final SimpleObject other) {
return ComparisonChain.start()
.compare(this.getName(), other.getName())
.result();
}
- //endregion
- // -- injected services
@javax.inject.Inject
@javax.jdo.annotations.NotPersistent
RepositoryService repositoryService;
@@ -110,6 +100,5 @@ public class SimpleObject implements Comparable<SimpleObject> {
@javax.inject.Inject
@javax.jdo.annotations.NotPersistent
MessageService messageService;
- //endregion
}
\ No newline at end of file
diff --git a/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/types/Name.java b/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/types/Name.java
index e381dbe..5acb880 100644
--- a/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/types/Name.java
+++ b/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/types/Name.java
@@ -7,6 +7,7 @@ import java.lang.annotation.Target;
import javax.jdo.annotations.Column;
+import org.apache.isis.applib.annotation.Editing;
import org.apache.isis.applib.annotation.Parameter;
import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Property;
@@ -14,7 +15,7 @@ import org.apache.isis.applib.services.i18n.TranslatableString;
import org.apache.isis.applib.spec.AbstractSpecification2;
@Column(length = Name.MAX_LEN, allowsNull = "false")
-@Property(mustSatisfy = Name.NoExclamationMarks.class, maxLength = Name.MAX_LEN)
+@Property(editing = Editing.DISABLED, mustSatisfy = Name.NoExclamationMarks.class, maxLength = Name.MAX_LEN)
@Parameter(mustSatisfy = Name.NoExclamationMarks.class, maxLength = Name.MAX_LEN)
@ParameterLayout(named = "Name")
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
diff --git a/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/types/Notes.java b/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/types/Notes.java
new file mode 100644
index 0000000..bb35237
--- /dev/null
+++ b/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/types/Notes.java
@@ -0,0 +1,25 @@
+package domainapp.modules.simple.dom.types;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.jdo.annotations.Column;
+
+import org.apache.isis.applib.annotation.Editing;
+import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
+import org.apache.isis.applib.annotation.Property;
+
+@Column(length = Notes.MAX_LEN, allowsNull = "true")
+@Property(editing = Editing.ENABLED, maxLength = Notes.MAX_LEN)
+@Parameter(maxLength = Notes.MAX_LEN)
+@ParameterLayout(named = "Notes")
+@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Notes {
+
+ int MAX_LEN = 4000;
+
+}
diff --git a/example/application/simpleapp/pom.xml b/example/application/simpleapp/pom.xml
index bcca60b..af88d4f 100644
--- a/example/application/simpleapp/pom.xml
+++ b/example/application/simpleapp/pom.xml
@@ -116,23 +116,23 @@
<dependency>
<groupId>org.apache.isis.example.application</groupId>
<artifactId>simpleapp-module-simple</artifactId>
- <version>${revision}</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.isis.example.application</groupId>
<artifactId>simpleapp-module-simple</artifactId>
- <version>${revision}</version>
+ <version>${project.version}</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.apache.isis.example.application</groupId>
<artifactId>simpleapp-application</artifactId>
- <version>${revision}</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.isis.example.application</groupId>
<artifactId>simpleapp-webapp</artifactId>
- <version>${revision}</version>
+ <version>${project.version}</version>
</dependency>
<!-- lombok -->
diff --git a/example/archetype/simpleapp/pom.xml b/example/archetype/simpleapp/pom.xml
index eb6a4e3..8436675 100644
--- a/example/archetype/simpleapp/pom.xml
+++ b/example/archetype/simpleapp/pom.xml
@@ -67,12 +67,47 @@
<url>git@github.com:incodehq/incode-build.git/simpleapp</url>
</scm>
<parent>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis</artifactId>
- <version>2.0.0-M1</version>
- <relativePath>../../../core/pom.xml</relativePath>
+ <groupId>org.apache</groupId>
+ <artifactId>apache</artifactId>
+ <version>18</version>
+ <relativePath/>
</parent>
<properties>
<archetype.test.skip>true</archetype.test.skip>
</properties>
+ <profiles>
+ <profile>
+ <id>gpg</id>
+ <activation>
+ <property>
+ <name>gpg.passphrase</name>
+ </property>
+ </activation>
+ <properties>
+ <gpg.useagent>false</gpg.useagent>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>sign-release-artifacts</id>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ <configuration>
+ <gpgArguments>
+ <arg>--pinentry-mode</arg>
+ <arg>loopback</arg>
+ </gpgArguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
diff --git a/example/archetype/simpleapp/src/main/appended-resources/supplemental-models.xml b/example/archetype/simpleapp/src/main/appended-resources/supplemental-models.xml
deleted file mode 100644
index 01c58d8..0000000
--- a/example/archetype/simpleapp/src/main/appended-resources/supplemental-models.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<supplementalDataModels
- xmlns="http://maven.apache.org/supplemental-model/1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/supplemental-model/1.0.0
- http://maven.apache.org/xsd/supplemental-model-1.0.0.xsd">
-
-</supplementalDataModels>
diff --git a/example/archetype/simpleapp/src/main/resources/META-INF/maven/archetype-metadata.xml b/example/archetype/simpleapp/src/main/resources/META-INF/maven/archetype-metadata.xml
index 37b7cec..dd6eceb 100644
--- a/example/archetype/simpleapp/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/example/archetype/simpleapp/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -1,23 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<archetype-descriptor xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="simpleapp" xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd">
+<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="simpleapp"
+ xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<fileSets>
<fileSet filtered="true" encoding="UTF-8">
<directory>_checks</directory>
@@ -32,7 +16,7 @@
</includes>
</fileSet>
<fileSet encoding="UTF-8">
- <directory/>
+ <directory></directory>
<includes>
<include>.gitattributes</include>
<include>.gitignore</include>
@@ -43,7 +27,7 @@
</fileSet>
</fileSets>
<modules>
- <module name="${rootArtifactId}-module-simple" id="${rootArtifactId}-module-simple" dir="module-simple">
+ <module id="${rootArtifactId}-module-simple" dir="module-simple" name="${rootArtifactId}-module-simple">
<fileSets>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/java</directory>
@@ -65,14 +49,14 @@
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
- <directory/>
+ <directory></directory>
<includes>
<include>logging-dn-enhance.properties</include>
<include>logging-integtest.properties</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
- <directory/>
+ <directory></directory>
<includes>
<include>.gitignore</include>
<include>build.gradle</include>
@@ -85,7 +69,7 @@
</fileSet>
</fileSets>
</module>
- <module name="${rootArtifactId}-application" id="${rootArtifactId}-application" dir="application">
+ <module id="${rootArtifactId}-application" dir="application" name="${rootArtifactId}-application">
<fileSets>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/java</directory>
@@ -125,13 +109,13 @@
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
- <directory/>
+ <directory></directory>
<includes>
<include>logging-integtest.properties</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
- <directory/>
+ <directory></directory>
<includes>
<include>.gitignore</include>
<include>translations.pot</include>
@@ -139,7 +123,7 @@
</fileSet>
</fileSets>
</module>
- <module name="${rootArtifactId}-webapp" id="${rootArtifactId}-webapp" dir="webapp">
+ <module id="${rootArtifactId}-webapp" dir="webapp" name="${rootArtifactId}-webapp">
<fileSets>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/java</directory>
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.java
index 3bbdbac..ceea058 100644
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.java
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.java
@@ -21,6 +21,7 @@
*/
package domainapp.modules.simple.dom.impl;
+import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.VersionStrategy;
@@ -31,20 +32,17 @@ import org.apache.isis.applib.annotation.Auditing;
import org.apache.isis.applib.annotation.CommandReification;
import org.apache.isis.applib.annotation.DomainObject;
import org.apache.isis.applib.annotation.DomainObjectLayout;
-import org.apache.isis.applib.annotation.Editing;
-import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.Publishing;
import org.apache.isis.applib.annotation.SemanticsOf;
-import org.apache.isis.applib.annotation.Title;
-import org.apache.isis.applib.services.i18n.TranslatableString;
import org.apache.isis.applib.services.message.MessageService;
import org.apache.isis.applib.services.repository.RepositoryService;
import org.apache.isis.applib.services.title.TitleService;
import domainapp.modules.simple.dom.types.Name;
+import domainapp.modules.simple.dom.types.Notes;
@javax.jdo.annotations.PersistenceCapable(identityType=IdentityType.DATASTORE, schema = "simple")
-@javax.jdo.annotations.DatastoreIdentity(strategy=javax.jdo.annotations.IdGeneratorStrategy.IDENTITY, column="id")
+@javax.jdo.annotations.DatastoreIdentity(strategy=IdGeneratorStrategy.IDENTITY, column="id")
@javax.jdo.annotations.Version(strategy= VersionStrategy.DATE_TIME, column="version")
@javax.jdo.annotations.Unique(name="SimpleObject_name_UNQ", members = {"name"})
@DomainObject(auditing = Auditing.ENABLED)
@@ -52,15 +50,15 @@ import domainapp.modules.simple.dom.types.Name;
@lombok.RequiredArgsConstructor
public class SimpleObject implements Comparable<SimpleObject> {
+ public String title() {
+ return "Object: " + getName();
+ }
@lombok.Getter @lombok.Setter @lombok.NonNull
- @Title(prepend = "Object: ")
@Name private String name;
- @javax.jdo.annotations.Column(allowsNull = "true", length = 4000)
@lombok.Getter @lombok.Setter
- @Property(editing = Editing.ENABLED)
- private String notes;
+ @Notes private String notes;
@Action(semantics = SemanticsOf.IDEMPOTENT, command = CommandReification.ENABLED, publishing = Publishing.ENABLED, associateWith = "name")
@@ -73,35 +71,27 @@ public class SimpleObject implements Comparable<SimpleObject> {
return getName();
}
- public TranslatableString validate0UpdateName(final String name) {
- return name != null && name.contains("!") ? TranslatableString.tr("Exclamation mark is not allowed") : null;
- }
-
@Action(semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE)
public void delete() {
final String title = titleService.titleOf(this);
messageService.informUser(String.format("'%s' deleted", title));
- repositoryService.remove(this);
+ repositoryService.removeAndFlush(this);
}
-
-
- // -- toString, compareTo
@Override
public String toString() {
return getName();
}
+ @Override
public int compareTo(final SimpleObject other) {
return ComparisonChain.start()
.compare(this.getName(), other.getName())
.result();
}
- //endregion
- // -- injected services
@javax.inject.Inject
@javax.jdo.annotations.NotPersistent
RepositoryService repositoryService;
@@ -113,6 +103,5 @@ public class SimpleObject implements Comparable<SimpleObject> {
@javax.inject.Inject
@javax.jdo.annotations.NotPersistent
MessageService messageService;
- //endregion
}
\ No newline at end of file
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/types/Name.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/types/Name.java
index ad40574..d7a1115 100644
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/types/Name.java
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/types/Name.java
@@ -10,6 +10,7 @@ import java.lang.annotation.Target;
import javax.jdo.annotations.Column;
+import org.apache.isis.applib.annotation.Editing;
import org.apache.isis.applib.annotation.Parameter;
import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Property;
@@ -17,7 +18,7 @@ import org.apache.isis.applib.services.i18n.TranslatableString;
import org.apache.isis.applib.spec.AbstractSpecification2;
@Column(length = Name.MAX_LEN, allowsNull = "false")
-@Property(mustSatisfy = Name.NoExclamationMarks.class, maxLength = Name.MAX_LEN)
+@Property(editing = Editing.DISABLED, mustSatisfy = Name.NoExclamationMarks.class, maxLength = Name.MAX_LEN)
@Parameter(mustSatisfy = Name.NoExclamationMarks.class, maxLength = Name.MAX_LEN)
@ParameterLayout(named = "Name")
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/types/Notes.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/types/Notes.java
new file mode 100644
index 0000000..40e7874
--- /dev/null
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/types/Notes.java
@@ -0,0 +1,28 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package domainapp.modules.simple.dom.types;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.jdo.annotations.Column;
+
+import org.apache.isis.applib.annotation.Editing;
+import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
+import org.apache.isis.applib.annotation.Property;
+
+@Column(length = Notes.MAX_LEN, allowsNull = "true")
+@Property(editing = Editing.ENABLED, maxLength = Notes.MAX_LEN)
+@Parameter(maxLength = Notes.MAX_LEN)
+@ParameterLayout(named = "Notes")
+@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Notes {
+
+ int MAX_LEN = 4000;
+
+}
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/pom.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/pom.xml
index 2404a4b..67683b9 100644
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/pom.xml
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/pom.xml
@@ -26,7 +26,7 @@
</parent>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
- <version>${revision}</version>
+ <version>${version}</version>
<name>Apache Isis App - SimpleApp Parent</name>
<packaging>pom</packaging>
<properties>
@@ -99,23 +99,23 @@
<dependency>
<groupId>${groupId}</groupId>
<artifactId>${rootArtifactId}-module-simple</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>${groupId}</groupId>
<artifactId>${rootArtifactId}-module-simple</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>${groupId}</groupId>
<artifactId>${rootArtifactId}-application</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>${groupId}</groupId>
<artifactId>${rootArtifactId}-webapp</artifactId>
- <version>${version}</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
diff --git a/example/archetype/simpleapp/src/test/resources/projects/basic/archetype.properties b/example/archetype/simpleapp/src/test/resources/projects/basic/archetype.properties
index 1ec5147..cedcc41 100644
--- a/example/archetype/simpleapp/src/test/resources/projects/basic/archetype.properties
+++ b/example/archetype/simpleapp/src/test/resources/projects/basic/archetype.properties
@@ -1,4 +1,4 @@
-#Thu Jul 19 00:48:43 CEST 2018
+#Thu Jul 19 21:25:40 CEST 2018
package=it.pkg
version=0.1-SNAPSHOT
groupId=archetype.it
diff --git a/scripts/updateGeneratedArchetypeSources.groovy b/scripts/updateGeneratedArchetypeSources.groovy
index b4018dc..0be6252 100644
--- a/scripts/updateGeneratedArchetypeSources.groovy
+++ b/scripts/updateGeneratedArchetypeSources.groovy
@@ -89,21 +89,69 @@ println "updating ${pomFile.path}"
def pomXml = new XmlSlurper(false,false).parseText(pomFile.text)
-pomXml.appendNode {
- parent {
- groupId("org.apache.isis.core")
- artifactId("isis")
- version(isis_version)
- relativePath("../../../core/pom.xml")
- }
-}
pomXml.groupId='org.apache.isis.archetype'
-def fragmentToAdd = new XmlSlurper( false, false ).parseText( '''<properties>
+pomXml.appendNode(new XmlSlurper( false, false ).parseText( '''
+ <parent>
+ <groupId>org.apache</groupId>
+ <artifactId>apache</artifactId>
+ <version>18</version>
+ <relativePath />
+ </parent>
+''' )
+)
+
+pomXml.appendNode(new XmlSlurper( false, false ).parseText( '''
+<properties>
<archetype.test.skip>true</archetype.test.skip>
-</properties>''' )
-pomXml.appendNode(fragmentToAdd)
-
+</properties>
+''' )
+)
+
+pomXml.appendNode(new XmlSlurper( false, false ).parseText( '''
+ <profiles>
+ <profile>
+ <!--
+ as per https://stackoverflow.com/a/28860520/56880
+ allows -Dgpg.passphrase= to be used rather than gpg.useagent
+ inherited from parent.
+ Note that this requires gpg v2.1+
+ -->
+ <id>gpg</id>
+ <activation>
+ <property>
+ <name>gpg.passphrase</name>
+ </property>
+ </activation>
+ <properties>
+ <gpg.useagent>false</gpg.useagent>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>sign-release-artifacts</id>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ <configuration>
+ <gpgArguments>
+ <arg>--pinentry-mode</arg>
+ <arg>loopback</arg>
+ </gpgArguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+''' )
+)
pomFile.text = withLicense(pomXml)
@@ -123,70 +171,67 @@ println "updating ${resourcePomXmlFile.path}"
def resourcePomXml = new XmlSlurper(false,false).parseText(resourcePomXmlFile.text)
-// this looks weird, but trust me, it's correct
-
-// version is set to the (in-effect) hard-coded string '${revision}'. This is resolved when the app generated
-// from the archetype is built, eg with mvn -Drevision=...; it will fall back to the properties/revision.
-resourcePomXml.version='${revision}'
// the properties.revision, meanwhile, is set to the version that is prompted for when the
// app is first generated from the archetype
resourcePomXml.properties.revision='${version}'
resourcePomXml.properties['isis.version']=isis_version
+resourcePomXml.dependencyManagement.dependencies.dependency.each { dependency ->
+ if(dependency.groupId=='${groupId}') {
+ dependency.version='${project.version}'
+ }
+}
+
+
resourcePomXmlFile.text = withLicense(resourcePomXml)
/////////////////////////////////////////////////////
//
-// update archetype-metadata.xml
+// update the .launch files
//
/////////////////////////////////////////////////////
+new File(ROOT+"BASE+\"src/main/resources/archetype-resources/").eachDirRecurse() { dir ->
-def metaDataFile=new File(ROOT+"META-INF/maven/archetype-metadata.xml")
+ dir.eachFileMatch(~/pom[.].xml/) { eachPomXmlFile ->
-println "updating ${metaDataFile.path}"
+ println "updating ${eachPomXmlFile.path}"
-def metaDataXml = new XmlSlurper(false,false).parseText(metaDataFile.text)
+ def eachPomXml = new XmlSlurper(false,false).parseText(eachPomXmlFile.text)
+ if(eachPomXml.parent.groupId=='${groupId}') {
+ eachPomXml.parent.version='${revision}'
+ }
-metaDataXml.modules.module.fileSets.fileSet.each { fileSet ->
- if(fileSet.directory=='ide/eclipse') {
- fileSet.@filtered='true'
+ eachPomXmlFile.text = withLicense(eachPomXml)
}
}
-metaDataFile.text = withLicense(metaDataXml)
-
-
/////////////////////////////////////////////////////
//
-// update the .launch files
+// update archetype-metadata.xml
//
/////////////////////////////////////////////////////
-new File(ROOT+"archetype-resources/").eachDirRecurse() { dir ->
- dir.eachFileMatch(~/.*[.]launch/) { launchFile ->
+def metaDataFile=new File(ROOT+"META-INF/maven/archetype-metadata.xml")
- println "updating ${launchFile.path}"
+println "updating ${metaDataFile.path}"
- def launchXml = new XmlSlurper(false,false).parseText(launchFile.text)
- def projectAttr = launchXml.stringAttribute.find { it.@key=="org.eclipse.jdt.launching.PROJECT_ATTR" }
- String oldValue=projectAttr.@value
- def newValue = oldValue.replaceAll("${application_name}[^-]*-","\\\${rootArtifactId}-")
- projectAttr.@value=newValue
+def metaDataXml = new XmlSlurper(false,false).parseText(metaDataFile.text)
- launchFile.text = """#set( \$symbol_pound = '#' )
-#set( \$symbol_dollar = '\$' )
-#set( \$symbol_escape = '\\' )
-"""
- launchFile.append(XmlUtil.serialize(launchXml))
- }
+metaDataXml.modules.module.fileSets.fileSet.each { fileSet ->
+ if(fileSet.directory=='ide/eclipse') {
+ fileSet.@filtered='true'
+ }
}
+metaDataFile.text = withLicense(metaDataXml)
+
+
///////////////////////////////////////////////////
//
// add empty supplemental-models.xml