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 2014/09/25 11:52:20 UTC
[1/7] ISIS-887: mothballed the core/module* modules,
moved to mothballed/core/module*
Repository: isis
Updated Branches:
refs/heads/master fa1876c02 -> 790e70df1
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/applib/src/test/java/org/apache/isis/applib/services/settings/SettingAbstractTest.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/applib/src/test/java/org/apache/isis/applib/services/settings/SettingAbstractTest.java b/mothballed/core/module-settings/applib/src/test/java/org/apache/isis/applib/services/settings/SettingAbstractTest.java
new file mode 100644
index 0000000..bc3693d
--- /dev/null
+++ b/mothballed/core/module-settings/applib/src/test/java/org/apache/isis/applib/services/settings/SettingAbstractTest.java
@@ -0,0 +1,103 @@
+/**
+ * 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.
+ */
+package org.apache.isis.applib.services.settings;
+
+import org.joda.time.LocalDate;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class SettingAbstractTest {
+
+ @Rule
+ public ExpectedException expectedExceptions = ExpectedException.none();
+
+ private static final class SettingAbstractForTesting extends SettingAbstract {
+ private final String key;
+ private final String valueRaw;
+ private final SettingType type;
+
+ public SettingAbstractForTesting(String key, String valueRaw, SettingType type) {
+ this.key = key;
+ this.valueRaw = valueRaw;
+ this.type = type;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public String getValueRaw() {
+ return valueRaw;
+ }
+
+ public SettingType getType() {
+ return type;
+ }
+
+ public String getDescription() {
+ return null;
+ }
+ }
+
+ private SettingAbstract strSetting;
+ private SettingAbstract intSetting;
+ private SettingAbstract localDateSetting;
+ private SettingAbstract longSetting;
+ private SettingAbstract boolSetting;
+
+ private LocalDate someLocalDate;
+
+ @Before
+ public void setUp() throws Exception {
+ someLocalDate = new LocalDate(2012,4,1);
+
+ strSetting = new SettingAbstractForTesting("strSetting", "ABC", SettingType.STRING);
+ intSetting = new SettingAbstractForTesting("intSetting", "" + Integer.MAX_VALUE, SettingType.INT);
+ localDateSetting = new SettingAbstractForTesting("localDateSetting", someLocalDate.toString(SettingAbstract.DATE_FORMATTER), SettingType.LOCAL_DATE);
+ longSetting = new SettingAbstractForTesting("longSetting", ""+Long.MAX_VALUE, SettingType.LONG);
+ boolSetting = new SettingAbstractForTesting("boolSetting", Boolean.TRUE.toString(), SettingType.BOOLEAN);
+ }
+
+ @Test
+ public void happyCases() {
+ assertThat(strSetting.valueAsString(), is("ABC"));
+ assertThat(intSetting.valueAsInt(), is(Integer.MAX_VALUE));
+ assertThat(localDateSetting.valueAsLocalDate(), is(someLocalDate));
+ assertThat(longSetting.valueAsLong(), is(Long.MAX_VALUE));
+ assertThat(boolSetting.valueAsBoolean(), is(true));
+ }
+
+ @Test
+ public void sadCases() {
+ expectedExceptions.expectMessage("Setting 'strSetting' is of type STRING, not of type INT");
+ strSetting.valueAsInt();
+ expectedExceptions.expectMessage("Setting 'strSetting' is of type STRING, not of type LONG");
+ strSetting.valueAsLong();
+ expectedExceptions.expectMessage("Setting 'strSetting' is of type STRING, not of type LOCAL_DATE");
+ strSetting.valueAsLocalDate();
+ expectedExceptions.expectMessage("Setting 'strSetting' is of type STRING, not of type BOOLEAN");
+ strSetting.valueAsBoolean();
+ expectedExceptions.expectMessage("Setting 'intSetting' is of type INT, not of type STRING");
+ intSetting.valueAsString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/impl-jdo/.gitignore
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/impl-jdo/.gitignore b/mothballed/core/module-settings/impl-jdo/.gitignore
new file mode 100644
index 0000000..a48e45b
--- /dev/null
+++ b/mothballed/core/module-settings/impl-jdo/.gitignore
@@ -0,0 +1 @@
+/target-ide
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/impl-jdo/pom.xml
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/impl-jdo/pom.xml b/mothballed/core/module-settings/impl-jdo/pom.xml
new file mode 100644
index 0000000..fbbb12a
--- /dev/null
+++ b/mothballed/core/module-settings/impl-jdo/pom.xml
@@ -0,0 +1,146 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-settings</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>isis-module-settings-impl-jdo</artifactId>
+
+ <name>Isis Module: App and User Settings (JDO impl)</name>
+ <description>
+ Implementation of the application and user settings module, persisting
+ to database (using JDO Objectstore)
+ </description>
+
+ <properties>
+ <siteBaseDir>../..</siteBaseDir>
+ <relativeUrl>module-settings/impl/</relativeUrl>
+ </properties>
+
+ <url>http://isis.apache.org/${relativeUrl}</url>
+
+ <build>
+ <resources>
+ <resource>
+ <filtering>false</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ <resource>
+ <filtering>false</filtering>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-maven-plugin</artifactId>
+ <version>${datanucleus-maven-plugin.version}</version>
+ <configuration>
+ <fork>false</fork>
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>enhance</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ org.datanucleus
+ </groupId>
+ <artifactId>
+ datanucleus-maven-plugin
+ </artifactId>
+ <versionRange>
+ [3.2.0-release,)
+ </versionRange>
+ <goals>
+ <goal>enhance</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-settings-applib</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-unittestsupport</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+
+ <!-- DataNucleus (jdo-api, and for enhancer) -->
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-accessplatform-jdo-rdbms</artifactId>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-jodatime</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/impl-jdo/src/main/java/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/impl-jdo/src/main/java/META-INF/persistence.xml b/mothballed/core/module-settings/impl-jdo/src/main/java/META-INF/persistence.xml
new file mode 100644
index 0000000..1b83835
--- /dev/null
+++ b/mothballed/core/module-settings/impl-jdo/src/main/java/META-INF/persistence.xml
@@ -0,0 +1,26 @@
+<?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.
+-->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
+
+ <persistence-unit name="isis-module-settings-impl-jdo">
+ </persistence-unit>
+</persistence>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingJdo.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingJdo.java b/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingJdo.java
new file mode 100644
index 0000000..22d5e77
--- /dev/null
+++ b/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingJdo.java
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+
+package org.apache.isis.objectstore.jdo.applib.service.settings;
+
+import javax.jdo.annotations.IdentityType;
+
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.services.settings.ApplicationSetting;
+import org.apache.isis.applib.services.settings.SettingType;
+import org.apache.isis.objectstore.jdo.applib.service.JdoColumnLength;
+
+@javax.jdo.annotations.PersistenceCapable(
+ identityType = IdentityType.APPLICATION,
+ table="IsisApplicationSetting")
+@javax.jdo.annotations.Queries({
+ @javax.jdo.annotations.Query(
+ name = "findByKey", language = "JDOQL",
+ value = "SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.settings.ApplicationSettingJdo "
+ + "WHERE key == :key"),
+ @javax.jdo.annotations.Query(
+ name = "findAll", language = "JDOQL",
+ value = "SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.settings.ApplicationSettingJdo "
+ + "ORDER BY key")
+})
+@Named("Application Setting")
+public class ApplicationSettingJdo extends SettingAbstractJdo implements ApplicationSetting {
+
+
+ @javax.jdo.annotations.Column(length=JdoColumnLength.SettingAbstract.SETTING_KEY)
+ @javax.jdo.annotations.PrimaryKey
+ public String getKey() {
+ return super.getKey();
+ }
+ @Override
+ public void setKey(String key) {
+ super.setKey(key);
+ }
+
+ // //////////////////////////////////////
+
+ @javax.jdo.annotations.Column(length=JdoColumnLength.DESCRIPTION)
+ @javax.jdo.annotations.Persistent
+ @Override
+ public String getDescription() {
+ return super.getDescription();
+ }
+ @Override
+ public void setDescription(String description) {
+ super.setDescription(description);
+ }
+
+ // //////////////////////////////////////
+
+ @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.SettingAbstract.VALUE_RAW)
+ @javax.jdo.annotations.Persistent
+ @Override
+ public String getValueRaw() {
+ return super.getValueRaw();
+ }
+ @Override
+ public void setValueRaw(String valueAsRaw) {
+ super.setValueRaw(valueAsRaw);
+ }
+
+ // //////////////////////////////////////
+
+ @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.SettingAbstract.SETTING_TYPE)
+ @javax.jdo.annotations.Persistent
+ @Override
+ public SettingType getType() {
+ return super.getType();
+ }
+ @Override
+ public void setType(SettingType type) {
+ super.setType(type);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingsServiceJdo.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingsServiceJdo.java b/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingsServiceJdo.java
new file mode 100644
index 0000000..014455a
--- /dev/null
+++ b/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingsServiceJdo.java
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+
+package org.apache.isis.objectstore.jdo.applib.service.settings;
+
+import java.util.List;
+
+import org.joda.time.LocalDate;
+
+import org.apache.isis.applib.AbstractService;
+import org.apache.isis.applib.annotation.ActionSemantics;
+import org.apache.isis.applib.annotation.ActionSemantics.Of;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.annotation.Optional;
+import org.apache.isis.applib.query.QueryDefault;
+import org.apache.isis.applib.services.settings.ApplicationSetting;
+import org.apache.isis.applib.services.settings.ApplicationSettingsService;
+import org.apache.isis.applib.services.settings.ApplicationSettingsServiceRW;
+import org.apache.isis.applib.services.settings.SettingAbstract;
+import org.apache.isis.applib.services.settings.SettingType;
+
+/**
+ * An implementation of {@link ApplicationSettingsService} that persists settings
+ * as entities into a JDO-backed database.
+ */
+@Named("Application Settings")
+public class ApplicationSettingsServiceJdo extends AbstractService implements ApplicationSettingsServiceRW {
+
+ @ActionSemantics(Of.SAFE)
+ @Override
+ public ApplicationSetting find(@Named("Key") String key) {
+ return firstMatch(
+ new QueryDefault<ApplicationSettingJdo>(ApplicationSettingJdo.class,
+ "findByKey",
+ "key", key));
+ }
+
+ // //////////////////////////////////////
+
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(sequence="1")
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public List<ApplicationSetting> listAll() {
+ return (List)allMatches(
+ new QueryDefault<ApplicationSettingJdo>(ApplicationSettingJdo.class,
+ "findAll"));
+ }
+
+ // //////////////////////////////////////
+
+ @MemberOrder(sequence="10")
+ @Override
+ public ApplicationSetting newString(
+ @Named("Key") String key,
+ @Named("Description") @Optional String description,
+ @Named("Value") String value) {
+ return newSetting(key, description, SettingType.STRING, value);
+ }
+ @MemberOrder(sequence="11")
+ @Override
+ public ApplicationSettingJdo newInt(
+ @Named("Key") String key,
+ @Named("Description") @Optional String description,
+ @Named("Value") Integer value) {
+ return newSetting(key, description, SettingType.INT, value.toString());
+ }
+ @MemberOrder(sequence="12")
+ @Override
+ public ApplicationSettingJdo newLong(
+ @Named("Key") String key,
+ @Named("Description") @Optional String description,
+ @Named("Value") Long value) {
+ return newSetting(key, description, SettingType.LONG, value.toString());
+ }
+ @MemberOrder(sequence="13")
+ @Override
+ public ApplicationSettingJdo newLocalDate(
+ @Named("Key") String key,
+ @Named("Description") @Optional String description,
+ @Named("Value") LocalDate value) {
+ return newSetting(key, description, SettingType.LOCAL_DATE, value.toString(SettingAbstract.DATE_FORMATTER));
+ }
+ @MemberOrder(sequence="14")
+ @Override
+ public ApplicationSettingJdo newBoolean(
+ @Named("Key") String key,
+ @Named("Description") @Optional String description,
+ @Named("Value") @Optional Boolean value) {
+ return newSetting(key, description, SettingType.BOOLEAN, new Boolean(value != null && value).toString());
+ }
+
+ private ApplicationSettingJdo newSetting(
+ String key, String description, SettingType settingType, final String valueRaw) {
+ final ApplicationSettingJdo setting = newTransientInstance(ApplicationSettingJdo.class);
+ setting.setKey(key);
+ setting.setDescription(description);
+ setting.setValueRaw(valueRaw);
+ setting.setType(settingType);
+ persist(setting);
+ return setting;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingsServiceJdoHidden.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingsServiceJdoHidden.java b/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingsServiceJdoHidden.java
new file mode 100644
index 0000000..95512c0
--- /dev/null
+++ b/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingsServiceJdoHidden.java
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+package org.apache.isis.objectstore.jdo.applib.service.settings;
+
+import java.util.List;
+
+import org.joda.time.LocalDate;
+
+import org.apache.isis.applib.annotation.Hidden;
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.services.settings.ApplicationSetting;
+
+/**
+ * An implementation intended to be hidden in the UI, and delegated to by other services.
+ */
+public class ApplicationSettingsServiceJdoHidden extends ApplicationSettingsServiceJdo {
+
+ @Hidden
+ @Override
+ public ApplicationSetting find(@Named("Key") String key) {
+ return super.find(key);
+ }
+
+ // //////////////////////////////////////
+
+ @Hidden
+ @Override
+ public List<ApplicationSetting> listAll() {
+ return super.listAll();
+ }
+
+ // //////////////////////////////////////
+
+ @Hidden
+ @Override
+ public ApplicationSetting newString(String key, String description, String value) {
+ return super.newString(key, description, value);
+ }
+
+ @Hidden
+ @Override
+ public ApplicationSettingJdo newInt(String key, String description, Integer value) {
+ return super.newInt(key, description, value);
+ }
+
+ @Hidden
+ @Override
+ public ApplicationSettingJdo newLong(String key, String description, Long value) {
+ return super.newLong(key, description, value);
+ }
+
+ @Hidden
+ @Override
+ public ApplicationSettingJdo newLocalDate(String key, String description, LocalDate value) {
+ return super.newLocalDate(key, description, value);
+ }
+
+ @Hidden
+ @Override
+ public ApplicationSettingJdo newBoolean(String key, String description, Boolean value) {
+ return super.newBoolean(key, description, value);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/SettingAbstractJdo.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/SettingAbstractJdo.java b/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/SettingAbstractJdo.java
new file mode 100644
index 0000000..8e6f8da
--- /dev/null
+++ b/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/SettingAbstractJdo.java
@@ -0,0 +1,190 @@
+/*
+ * 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.
+ */
+
+package org.apache.isis.objectstore.jdo.applib.service.settings;
+
+import javax.jdo.annotations.PersistenceCapable;
+
+import org.joda.time.LocalDate;
+
+import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.annotation.Optional;
+import org.apache.isis.applib.services.settings.SettingType;
+
+/**
+ * Factors out common implementation; however this is annotated with {@link PersistenceCapable},
+ * so that each subclass is its own root entity.
+ */
+public abstract class SettingAbstractJdo extends org.apache.isis.applib.services.settings.SettingAbstract implements org.apache.isis.applib.services.settings.ApplicationSetting {
+
+ private String key;
+
+ @javax.jdo.annotations.Column(allowsNull="false")
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(final String key) {
+ this.key = key;
+ }
+
+ // //////////////////////////////////////
+
+ private String description;
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(final String description) {
+ this.description = description;
+ }
+
+ @MemberOrder(name="Description", sequence="1")
+ @Named("Update")
+ public SettingAbstractJdo updateDescription(@Named("Description") @Optional String description) {
+ setDescription(description);
+ return this;
+ }
+ public String default0UpdateDescription() {
+ return getDescription();
+ }
+
+ // //////////////////////////////////////
+
+ private SettingType type;
+
+ @javax.jdo.annotations.Column(allowsNull="false")
+ public SettingType getType() {
+ return type;
+ }
+
+ public void setType(final SettingType type) {
+ this.type = type;
+ }
+
+ // //////////////////////////////////////
+
+ private String valueRaw;
+
+ @javax.jdo.annotations.Column(allowsNull="false")
+ public String getValueRaw() {
+ return valueRaw;
+ }
+
+ public void setValueRaw(final String valueAsRaw) {
+ this.valueRaw = valueAsRaw;
+ }
+
+ // //////////////////////////////////////
+
+ @MemberOrder(name="ValueAsString", sequence="1")
+ @Named("Update")
+ public SettingAbstractJdo updateAsString(@Named("Value") String value) {
+ setValueRaw(value);
+ return this;
+ }
+ public String default0UpdateAsString() {
+ return getValueAsString();
+ }
+ public boolean hideUpdateAsString() {
+ return typeIsNot(SettingType.STRING);
+ }
+
+ @MemberOrder(name="ValueAsInt", sequence="1")
+ @Named("Update")
+ public SettingAbstractJdo updateAsInt(@Named("Value") Integer value) {
+ setValueRaw(value.toString());
+ return this;
+ }
+ public Integer default0UpdateAsInt() {
+ return getValueAsInt();
+ }
+ public boolean hideUpdateAsInt() {
+ return typeIsNot(SettingType.INT);
+ }
+
+ @MemberOrder(name="ValueAsLong", sequence="1")
+ @Named("Update")
+ public SettingAbstractJdo updateAsLong(@Named("Value") Long value) {
+ setValueRaw(value.toString());
+ return this;
+ }
+ public Long default0UpdateAsLong() {
+ return getValueAsLong();
+ }
+ public boolean hideUpdateAsLong() {
+ return typeIsNot(SettingType.LONG);
+ }
+
+ @MemberOrder(name="ValueAsLocalDate", sequence="1")
+ @Named("Update")
+ public SettingAbstractJdo updateAsLocalDate(@Named("Value") LocalDate value) {
+ setValueRaw(value.toString(DATE_FORMATTER));
+ return this;
+ }
+ public LocalDate default0UpdateAsLocalDate() {
+ return getValueAsLocalDate();
+ }
+ public boolean hideUpdateAsLocalDate() {
+ return typeIsNot(SettingType.LOCAL_DATE);
+ }
+
+ @MemberOrder(name="ValueAsBoolean", sequence="1")
+ @Named("Update")
+ public SettingAbstractJdo updateAsBoolean(@Named("Value") Boolean value) {
+ setValueRaw(value.toString());
+ return this;
+ }
+ public Boolean default0UpdateAsBoolean() {
+ return getValueAsBoolean();
+ }
+ public boolean hideUpdateAsBoolean() {
+ return typeIsNot(SettingType.BOOLEAN);
+ }
+
+ // //////////////////////////////////////
+
+
+ public SettingAbstractJdo delete(
+ @Named("Are you sure?") @Optional Boolean confirm) {
+ if(confirm == null || !confirm) {
+ container.informUser("Setting NOT deleted");
+ return this;
+ }
+ container.remove(this);
+ container.informUser("Setting deleted");
+ return null;
+ }
+
+
+
+
+ // //////////////////////////////////////
+
+ private DomainObjectContainer container;
+
+ public void setDomainObjectContainer(final DomainObjectContainer container) {
+ this.container = container;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingJdo.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingJdo.java b/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingJdo.java
new file mode 100644
index 0000000..f1ff4b2
--- /dev/null
+++ b/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingJdo.java
@@ -0,0 +1,129 @@
+/*
+ * 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.
+ */
+
+package org.apache.isis.objectstore.jdo.applib.service.settings;
+
+
+import javax.jdo.annotations.IdentityType;
+
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.annotation.Title;
+import org.apache.isis.applib.services.settings.SettingType;
+import org.apache.isis.applib.services.settings.UserSetting;
+import org.apache.isis.objectstore.jdo.applib.service.JdoColumnLength;
+
+@javax.jdo.annotations.PersistenceCapable(
+ identityType = IdentityType.APPLICATION,
+ objectIdClass=UserSettingJdoPK.class,
+ table="IsisUserSetting")
+@javax.jdo.annotations.Queries({
+ @javax.jdo.annotations.Query(
+ name = "findByUserAndKey", language = "JDOQL",
+ value = "SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.settings.UserSettingJdo "
+ + "WHERE user == :user "
+ + "&& key == :key ")
+ ,@javax.jdo.annotations.Query(
+ name = "findByUser", language = "JDOQL",
+ value = "SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.settings.UserSettingJdo "
+ + "WHERE user == :user "
+ + "ORDER BY key")
+ ,@javax.jdo.annotations.Query(
+ name = "findAll", language = "JDOQL",
+ value = "SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.settings.UserSettingJdo "
+ + "ORDER BY user, key")
+})
+// can't see how to specify this order in the primary key; however HSQLDB objects :-(
+//@javax.jdo.annotations.Unique(name="USER_KEY_IDX", members={"user","key"})
+@Named("User Setting")
+public class UserSettingJdo extends SettingAbstractJdo implements UserSetting {
+
+
+ private String user;
+
+ @javax.jdo.annotations.Column(length=JdoColumnLength.USER_NAME)
+ @javax.jdo.annotations.PrimaryKey
+ @Title(sequence="5", append=": ")
+ @MemberOrder(sequence = "5")
+ public String getUser() {
+ return user;
+ }
+
+ public void setUser(final String user) {
+ this.user = user;
+ }
+
+ // //////////////////////////////////////
+
+ @javax.jdo.annotations.Column(length=JdoColumnLength.SettingAbstract.SETTING_KEY)
+ @javax.jdo.annotations.PrimaryKey
+ @Title(sequence="10")
+ @Override
+ public String getKey() {
+ return super.getKey();
+ }
+ @Override
+ public void setKey(String key) {
+ super.setKey(key);
+ }
+
+ // //////////////////////////////////////
+
+ @javax.jdo.annotations.Column(length=JdoColumnLength.DESCRIPTION)
+ @javax.jdo.annotations.Persistent
+ @Override
+ public String getDescription() {
+ return super.getDescription();
+ }
+ @Override
+ public void setDescription(String description) {
+ super.setDescription(description);
+ }
+
+ // //////////////////////////////////////
+
+ @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.SettingAbstract.VALUE_RAW)
+ @javax.jdo.annotations.Persistent
+ @Title(prepend=" = ", sequence="30")
+ @Override
+ public String getValueRaw() {
+ return super.getValueRaw();
+ }
+ @Override
+ public void setValueRaw(String valueAsRaw) {
+ super.setValueRaw(valueAsRaw);
+ }
+
+ // //////////////////////////////////////
+
+ @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.SettingAbstract.SETTING_TYPE)
+ @javax.jdo.annotations.Persistent
+ @Override
+ public SettingType getType() {
+ return super.getType();
+ }
+ @Override
+ public void setType(SettingType type) {
+ super.setType(type);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingJdoPK.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingJdoPK.java b/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingJdoPK.java
new file mode 100644
index 0000000..13a20ed
--- /dev/null
+++ b/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingJdoPK.java
@@ -0,0 +1,90 @@
+/**
+ * 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.
+ */
+package org.apache.isis.objectstore.jdo.applib.service.settings;
+
+import java.io.Serializable;
+import java.util.StringTokenizer;
+
+/**
+ * @see http://www.datanucleus.org/products/datanucleus/jdo/primary_key.html
+ */
+public class UserSettingJdoPK implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+
+ public String user;
+ public String key;
+
+ public UserSettingJdoPK ()
+ {
+ }
+
+ public String getUser() {
+ return user;
+ }
+
+ public void setUser(String user) {
+ this.user = user;
+ }
+
+ public String getKey() {
+ return key;
+ }
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+
+ /**
+ * Constructor accepting same input as generated by toString().
+ */
+ public UserSettingJdoPK(String value)
+ {
+ StringTokenizer token = new StringTokenizer (value, ";;");
+ token.nextToken(); // className
+ this.setUser(token.nextToken()); // user
+ this.setKey(token.nextToken()); // key
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (!(obj instanceof UserSettingJdoPK))
+ {
+ return false;
+ }
+ UserSettingJdoPK c = (UserSettingJdoPK)obj;
+
+ return getUser().equals(c.getUser()) && getKey().equals(c.getKey());
+ }
+
+ public int hashCode ()
+ {
+ return this.getUser().hashCode() ^ this.getKey().hashCode();
+ }
+
+ public String toString ()
+ {
+ // Give output expected by String constructor
+ return this.getClass().getName() + ";;" + this.getUser() + ";;" + this.getKey();
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingsServiceJdo.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingsServiceJdo.java b/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingsServiceJdo.java
new file mode 100644
index 0000000..21ba8b9
--- /dev/null
+++ b/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingsServiceJdo.java
@@ -0,0 +1,170 @@
+/*
+ * 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.
+ */
+
+package org.apache.isis.objectstore.jdo.applib.service.settings;
+
+import java.util.List;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+import org.joda.time.LocalDate;
+
+import org.apache.isis.applib.AbstractService;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.annotation.Optional;
+import org.apache.isis.applib.query.QueryDefault;
+import org.apache.isis.applib.services.settings.SettingAbstract;
+import org.apache.isis.applib.services.settings.SettingType;
+import org.apache.isis.applib.services.settings.UserSetting;
+import org.apache.isis.applib.services.settings.UserSettingsService;
+import org.apache.isis.applib.services.settings.UserSettingsServiceRW;
+
+/**
+ * An implementation of {@link UserSettingsService} that persists settings
+ * as entities into a JDO-backed database.
+ */
+@Named("User Settings")
+public class UserSettingsServiceJdo extends AbstractService implements UserSettingsServiceRW {
+
+ @Override
+ public UserSetting find(
+ @Named("User") String user,
+ @Named("Key") String key) {
+ return firstMatch(
+ new QueryDefault<UserSettingJdo>(UserSettingJdo.class,
+ "findByUserAndKey",
+ "user",user,
+ "key", key));
+ }
+
+
+ // //////////////////////////////////////
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public List<UserSetting> listAllFor(String user) {
+ return (List)allMatches(
+ new QueryDefault<UserSettingJdo>(UserSettingJdo.class,
+ "findByUser",
+ "user", user));
+ }
+ public List<String> choices0ListAllFor() {
+ return existingUsers();
+ }
+
+ private List<String> existingUsers() {
+ final List<UserSetting> listAll = listAll();
+ return Lists.newArrayList(Sets.newTreeSet(Iterables.transform(listAll, GET_USER)));
+ }
+
+ private final static Function<UserSetting, String> GET_USER = new Function<UserSetting, String>() {
+ public String apply(UserSetting input) {
+ return input.getUser();
+ }
+ };
+
+ // //////////////////////////////////////
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public List<UserSetting> listAll() {
+ return (List)allMatches(
+ new QueryDefault<UserSettingJdo>(UserSettingJdo.class,
+ "findAll"));
+ }
+
+
+ // //////////////////////////////////////
+
+ @MemberOrder(sequence="10")
+ public UserSettingJdo newString(
+ @Named("User") String user,
+ @Named("Key") String key,
+ @Named("Description") @Optional String description,
+ @Named("Value") String value) {
+ return newSetting(user, key, description, SettingType.STRING, value);
+ }
+ public String default0NewString() {
+ return getContainer().getUser().getName();
+ }
+
+ @MemberOrder(sequence="11")
+ public UserSettingJdo newInt(
+ @Named("User") String user,
+ @Named("Key") String key,
+ @Named("Description") @Optional String description,
+ @Named("Value") Integer value) {
+ return newSetting(user, key, description, SettingType.INT, value.toString());
+ }
+ public String default0NewInt() {
+ return getContainer().getUser().getName();
+ }
+
+ @MemberOrder(sequence="12")
+ public UserSettingJdo newLong(
+ @Named("User") String user,
+ @Named("Key") String key,
+ @Named("Description") @Optional String description,
+ @Named("Value") Long value) {
+ return newSetting(user, key, description, SettingType.LONG, value.toString());
+ }
+ public String default0NewLong() {
+ return getContainer().getUser().getName();
+ }
+
+ @MemberOrder(sequence="13")
+ public UserSettingJdo newLocalDate(
+ @Named("User") String user,
+ @Named("Key") String key,
+ @Named("Description") @Optional String description,
+ @Named("Value") LocalDate value) {
+ return newSetting(user, key, description, SettingType.LOCAL_DATE, value.toString(SettingAbstract.DATE_FORMATTER));
+ }
+ public String default0NewLocalDate() {
+ return getContainer().getUser().getName();
+ }
+
+ @MemberOrder(sequence="14")
+ public UserSettingJdo newBoolean(
+ @Named("User") String user,
+ @Named("Key") String key,
+ @Named("Description") @Optional String description,
+ @Named("Value") @Optional Boolean value) {
+ return newSetting(user, key, description, SettingType.BOOLEAN, new Boolean(value != null && value).toString());
+ }
+ public String default0NewBoolean() {
+ return getContainer().getUser().getName();
+ }
+
+ private UserSettingJdo newSetting(
+ String user, String key, String description, SettingType settingType, final String valueRaw) {
+ final UserSettingJdo setting = newTransientInstance(UserSettingJdo.class);
+ setting.setUser(user);
+ setting.setKey(key);
+ setting.setType(settingType);
+ setting.setDescription(description);
+ setting.setValueRaw(valueRaw);
+ persist(setting);
+ return setting;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingsServiceJdoHidden.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingsServiceJdoHidden.java b/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingsServiceJdoHidden.java
new file mode 100644
index 0000000..a1f2595
--- /dev/null
+++ b/mothballed/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingsServiceJdoHidden.java
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+package org.apache.isis.objectstore.jdo.applib.service.settings;
+
+import java.util.List;
+
+import org.joda.time.LocalDate;
+
+import org.apache.isis.applib.annotation.Hidden;
+import org.apache.isis.applib.services.settings.UserSetting;
+
+/**
+ * An implementation intended to be hidden in the UI, and delegated to by other services.
+ */
+public class UserSettingsServiceJdoHidden extends UserSettingsServiceJdo {
+
+ @Hidden
+ @Override
+ public UserSetting find(String user, String key) {
+ return super.find(user, key);
+ }
+
+ // //////////////////////////////////////
+
+ @Hidden
+ @Override
+ public List<UserSetting> listAll() {
+ return super.listAll();
+ }
+
+ @Hidden
+ @Override
+ public List<UserSetting> listAllFor(String user) {
+ return super.listAllFor(user);
+ }
+
+ // //////////////////////////////////////
+
+ @Hidden
+ @Override
+ public UserSettingJdo newString(String user, String key, String description, String value) {
+ return super.newString(user, key, description, value);
+ }
+
+ @Hidden
+ @Override
+ public UserSettingJdo newInt(String user, String key, String description, Integer value) {
+ return super.newInt(user, key, description, value);
+ }
+
+ @Hidden
+ @Override
+ public UserSettingJdo newLong(String user, String key, String description, Long value) {
+ return super.newLong(user, key, description, value);
+ }
+
+ @Hidden
+ @Override
+ public UserSettingJdo newLocalDate(String user, String key, String description, LocalDate value) {
+ return super.newLocalDate(user, key, description, value);
+ }
+
+ @Hidden
+ @Override
+ public UserSettingJdo newBoolean(String user, String key, String description, Boolean value) {
+ return super.newBoolean(user, key, description, value);
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/pom.xml
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/pom.xml b/mothballed/core/module-settings/pom.xml
new file mode 100644
index 0000000..677f227
--- /dev/null
+++ b/mothballed/core/module-settings/pom.xml
@@ -0,0 +1,94 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-settings</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Isis Module: App and User Settings</name>
+ <description>
+ Application and user settings
+ </description>
+
+ <properties>
+ <siteBaseDir>..</siteBaseDir>
+ <relativeUrl>module-settings/</relativeUrl>
+ </properties>
+
+ <url>http://isis.apache.org/${relativeUrl}</url>
+
+ <dependencyManagement>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-settings-applib</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-settings-applib</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ <scope>test</scope>
+ <type>test-jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-settings-impl-jdo</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-settings-impl-jdo</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ <scope>test</scope>
+ <type>test-jar</type>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-applib</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-unittestsupport</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <modules>
+ <module>applib</module>
+ <module>impl-jdo</module>
+ </modules>
+
+</project>
[7/7] git commit: ISIS-887: mothballed the core/module* modules,
moved to mothballed/core/module*
Posted by da...@apache.org.
ISIS-887: mothballed the core/module* modules, moved to mothballed/core/module*
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/790e70df
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/790e70df
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/790e70df
Branch: refs/heads/master
Commit: 790e70df12920ddc52b08ceea3ebab3a190e3db1
Parents: fa1876c
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Sep 25 10:35:31 2014 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Sep 25 10:35:31 2014 +0100
----------------------------------------------------------------------
core/module-audit-jdo/.gitignore | 1 -
core/module-audit-jdo/pom.xml | 149 ----
.../src/main/java/META-INF/persistence.xml | 26 -
.../jdo/applib/service/audit/AuditEntryJdo.java | 359 ---------
.../service/audit/AuditingServiceJdo.java | 56 --
.../audit/AuditingServiceJdoContributions.java | 55 --
.../audit/AuditingServiceJdoRepository.java | 129 ----
.../src/main/resources/images/AuditEntryJdo.png | Bin 477 -> 0 bytes
core/module-command-jdo/.gitignore | 1 -
core/module-command-jdo/pom.xml | 162 ----
.../src/main/java/META-INF/persistence.xml | 26 -
.../background/BackgroundCommandServiceJdo.java | 89 ---
...ackgroundCommandServiceJdoContributions.java | 73 --
.../BackgroundCommandServiceJdoRepository.java | 70 --
.../jdo/applib/service/command/CommandJdo.java | 740 -------------------
.../service/command/CommandServiceJdo.java | 119 ---
.../command/CommandServiceJdoContributions.java | 70 --
.../command/CommandServiceJdoRepository.java | 169 -----
...xecutionFromBackgroundCommandServiceJdo.java | 49 --
.../src/main/resources/images/CommandJdo.png | Bin 582 -> 0 bytes
.../service/command/CommandJdoTest_next.java | 43 --
core/module-devutils/.gitignore | 1 -
core/module-devutils/applib/.gitignore | 1 -
core/module-devutils/applib/pom.xml | 55 --
.../devutils/DeveloperUtilitiesService.java | 75 --
core/module-devutils/impl/.gitignore | 1 -
core/module-devutils/impl/pom.xml | 61 --
.../DeveloperUtilitiesServiceDefault.java | 223 ------
.../services/devutils/MetaModelRow.java | 234 ------
core/module-devutils/pom.xml | 94 ---
core/module-publishing-jdo/.gitignore | 1 -
core/module-publishing-jdo/pom.xml | 147 ----
.../src/main/java/META-INF/persistence.xml | 26 -
.../jdo/applib/service/publish/IoUtils.java | 126 ----
.../service/publish/PublishedEventJdo.java | 490 ------------
.../service/publish/PublishedEventJdoPK.java | 102 ---
.../service/publish/PublishingServiceJdo.java | 124 ----
.../PublishingServiceJdoContributions.java | 47 --
.../publish/PublishingServiceJdoRepository.java | 156 ----
.../main/resources/images/PublishedEventJdo.png | Bin 541 -> 0 bytes
.../jdo/applib/service/publish/IoUtilsTest.java | 36 -
.../module-publishingeventserializer-ro/pom.xml | 89 ---
.../EventSerializerRendererContext.java | 95 ---
.../RestfulObjectsSpecEventSerializer.java | 126 ----
.../main/resources/images/PublishedEventJdo.png | Bin 541 -> 0 bytes
core/module-settings/.gitignore | 1 -
core/module-settings/applib/.gitignore | 1 -
core/module-settings/applib/pom.xml | 55 --
.../services/settings/ApplicationSetting.java | 25 -
.../settings/ApplicationSettingsService.java | 34 -
.../settings/ApplicationSettingsServiceRW.java | 38 -
.../isis/applib/services/settings/Setting.java | 53 --
.../services/settings/SettingAbstract.java | 192 -----
.../applib/services/settings/SettingType.java | 28 -
.../applib/services/settings/UserSetting.java | 34 -
.../services/settings/UserSettingsService.java | 36 -
.../settings/UserSettingsServiceRW.java | 38 -
.../services/settings/SettingAbstractTest.java | 103 ---
core/module-settings/impl-jdo/.gitignore | 1 -
core/module-settings/impl-jdo/pom.xml | 146 ----
.../src/main/java/META-INF/persistence.xml | 26 -
.../service/settings/ApplicationSettingJdo.java | 96 ---
.../settings/ApplicationSettingsServiceJdo.java | 120 ---
.../ApplicationSettingsServiceJdoHidden.java | 81 --
.../service/settings/SettingAbstractJdo.java | 190 -----
.../applib/service/settings/UserSettingJdo.java | 129 ----
.../service/settings/UserSettingJdoPK.java | 90 ---
.../settings/UserSettingsServiceJdo.java | 170 -----
.../settings/UserSettingsServiceJdoHidden.java | 88 ---
core/module-settings/pom.xml | 94 ---
mothballed/core/module-audit-jdo/.gitignore | 1 +
mothballed/core/module-audit-jdo/pom.xml | 149 ++++
.../src/main/java/META-INF/persistence.xml | 26 +
.../jdo/applib/service/audit/AuditEntryJdo.java | 359 +++++++++
.../service/audit/AuditingServiceJdo.java | 56 ++
.../audit/AuditingServiceJdoContributions.java | 55 ++
.../audit/AuditingServiceJdoRepository.java | 129 ++++
.../src/main/resources/images/AuditEntryJdo.png | Bin 0 -> 477 bytes
mothballed/core/module-command-jdo/.gitignore | 1 +
mothballed/core/module-command-jdo/pom.xml | 162 ++++
.../src/main/java/META-INF/persistence.xml | 26 +
.../background/BackgroundCommandServiceJdo.java | 89 +++
...ackgroundCommandServiceJdoContributions.java | 73 ++
.../BackgroundCommandServiceJdoRepository.java | 70 ++
.../jdo/applib/service/command/CommandJdo.java | 740 +++++++++++++++++++
.../service/command/CommandServiceJdo.java | 119 +++
.../command/CommandServiceJdoContributions.java | 70 ++
.../command/CommandServiceJdoRepository.java | 169 +++++
...xecutionFromBackgroundCommandServiceJdo.java | 49 ++
.../src/main/resources/images/CommandJdo.png | Bin 0 -> 582 bytes
.../service/command/CommandJdoTest_next.java | 43 ++
mothballed/core/module-devutils/.gitignore | 1 +
.../core/module-devutils/applib/.gitignore | 1 +
mothballed/core/module-devutils/applib/pom.xml | 55 ++
.../devutils/DeveloperUtilitiesService.java | 75 ++
mothballed/core/module-devutils/impl/.gitignore | 1 +
mothballed/core/module-devutils/impl/pom.xml | 61 ++
.../DeveloperUtilitiesServiceDefault.java | 223 ++++++
.../services/devutils/MetaModelRow.java | 234 ++++++
mothballed/core/module-devutils/pom.xml | 94 +++
.../core/module-publishing-jdo/.gitignore | 1 +
mothballed/core/module-publishing-jdo/pom.xml | 147 ++++
.../src/main/java/META-INF/persistence.xml | 26 +
.../jdo/applib/service/publish/IoUtils.java | 126 ++++
.../service/publish/PublishedEventJdo.java | 490 ++++++++++++
.../service/publish/PublishedEventJdoPK.java | 102 +++
.../service/publish/PublishingServiceJdo.java | 124 ++++
.../PublishingServiceJdoContributions.java | 47 ++
.../publish/PublishingServiceJdoRepository.java | 156 ++++
.../main/resources/images/PublishedEventJdo.png | Bin 0 -> 541 bytes
.../jdo/applib/service/publish/IoUtilsTest.java | 36 +
.../module-publishingeventserializer-ro/pom.xml | 89 +++
.../EventSerializerRendererContext.java | 95 +++
.../RestfulObjectsSpecEventSerializer.java | 126 ++++
.../main/resources/images/PublishedEventJdo.png | Bin 0 -> 541 bytes
mothballed/core/module-settings/.gitignore | 1 +
.../core/module-settings/applib/.gitignore | 1 +
mothballed/core/module-settings/applib/pom.xml | 55 ++
.../services/settings/ApplicationSetting.java | 25 +
.../settings/ApplicationSettingsService.java | 34 +
.../settings/ApplicationSettingsServiceRW.java | 38 +
.../isis/applib/services/settings/Setting.java | 53 ++
.../services/settings/SettingAbstract.java | 192 +++++
.../applib/services/settings/SettingType.java | 28 +
.../applib/services/settings/UserSetting.java | 34 +
.../services/settings/UserSettingsService.java | 36 +
.../settings/UserSettingsServiceRW.java | 38 +
.../services/settings/SettingAbstractTest.java | 103 +++
.../core/module-settings/impl-jdo/.gitignore | 1 +
.../core/module-settings/impl-jdo/pom.xml | 146 ++++
.../src/main/java/META-INF/persistence.xml | 26 +
.../service/settings/ApplicationSettingJdo.java | 96 +++
.../settings/ApplicationSettingsServiceJdo.java | 120 +++
.../ApplicationSettingsServiceJdoHidden.java | 81 ++
.../service/settings/SettingAbstractJdo.java | 190 +++++
.../applib/service/settings/UserSettingJdo.java | 129 ++++
.../service/settings/UserSettingJdoPK.java | 90 +++
.../settings/UserSettingsServiceJdo.java | 170 +++++
.../settings/UserSettingsServiceJdoHidden.java | 88 +++
mothballed/core/module-settings/pom.xml | 94 +++
140 files changed, 6565 insertions(+), 6565 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-audit-jdo/.gitignore
----------------------------------------------------------------------
diff --git a/core/module-audit-jdo/.gitignore b/core/module-audit-jdo/.gitignore
deleted file mode 100644
index a48e45b..0000000
--- a/core/module-audit-jdo/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/target-ide
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-audit-jdo/pom.xml
----------------------------------------------------------------------
diff --git a/core/module-audit-jdo/pom.xml b/core/module-audit-jdo/pom.xml
deleted file mode 100644
index cebf10c..0000000
--- a/core/module-audit-jdo/pom.xml
+++ /dev/null
@@ -1,149 +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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-audit-jdo</artifactId>
-
- <name>Isis Module: Audit (JDO Implementation)</name>
- <description>
- AuditingService implementation that persists audit entries to
- database (via JDO objectstore).
- </description>
-
- <properties>
- <siteBaseDir>..</siteBaseDir>
- <relativeUrl>module-audit/</relativeUrl>
- </properties>
-
- <url>http://isis.apache.org/${relativeUrl}</url>
-
- <build>
- <resources>
- <resource>
- <filtering>false</filtering>
- <directory>src/main/resources</directory>
- </resource>
- <resource>
- <filtering>false</filtering>
- <directory>src/main/java</directory>
- <includes>
- <include>**</include>
- </includes>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.datanucleus</groupId>
- <artifactId>datanucleus-maven-plugin</artifactId>
- <version>${datanucleus-maven-plugin.version}</version>
- <configuration>
- <fork>false</fork>
- <verbose>true</verbose>
- </configuration>
- <executions>
- <execution>
- <phase>compile</phase>
- <goals>
- <goal>enhance</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- <pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>
- org.datanucleus
- </groupId>
- <artifactId>
- datanucleus-maven-plugin
- </artifactId>
- <versionRange>
- [3.2.0-release,)
- </versionRange>
- <goals>
- <goal>enhance</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore />
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-applib</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-unittestsupport</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <!-- DataNucleus (jdo-api, and for enhancer) -->
- <dependency>
- <groupId>org.datanucleus</groupId>
- <artifactId>datanucleus-accessplatform-jdo-rdbms</artifactId>
- <type>pom</type>
- </dependency>
- <dependency>
- <groupId>org.datanucleus</groupId>
- <artifactId>datanucleus-jodatime</artifactId>
- </dependency>
-
- </dependencies>
-
-
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-audit-jdo/src/main/java/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/core/module-audit-jdo/src/main/java/META-INF/persistence.xml b/core/module-audit-jdo/src/main/java/META-INF/persistence.xml
deleted file mode 100644
index ded7c39..0000000
--- a/core/module-audit-jdo/src/main/java/META-INF/persistence.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.
--->
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
-
- <persistence-unit name="isis-module-audit-jdo">
- </persistence-unit>
-</persistence>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditEntryJdo.java
----------------------------------------------------------------------
diff --git a/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditEntryJdo.java b/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditEntryJdo.java
deleted file mode 100644
index 05592db..0000000
--- a/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditEntryJdo.java
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- * 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.
- */
-package org.apache.isis.objectstore.jdo.applib.service.audit;
-
-import java.sql.Timestamp;
-import java.text.SimpleDateFormat;
-import java.util.UUID;
-
-import javax.jdo.annotations.IdentityType;
-import javax.jdo.annotations.Index;
-import javax.jdo.annotations.Indices;
-
-import org.apache.isis.applib.DomainObjectContainer;
-import org.apache.isis.applib.Identifier;
-import org.apache.isis.applib.annotation.ActionSemantics;
-import org.apache.isis.applib.annotation.ActionSemantics.Of;
-import org.apache.isis.applib.annotation.Disabled;
-import org.apache.isis.applib.annotation.Hidden;
-import org.apache.isis.applib.annotation.Immutable;
-import org.apache.isis.applib.annotation.MemberGroupLayout;
-import org.apache.isis.applib.annotation.MemberOrder;
-import org.apache.isis.applib.annotation.Named;
-import org.apache.isis.applib.annotation.ObjectType;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.annotation.TypicalLength;
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.services.HasTransactionId;
-import org.apache.isis.applib.services.bookmark.Bookmark;
-import org.apache.isis.applib.services.bookmark.BookmarkService;
-import org.apache.isis.applib.util.ObjectContracts;
-import org.apache.isis.applib.util.TitleBuffer;
-import org.apache.isis.objectstore.jdo.applib.service.DomainChangeJdoAbstract;
-import org.apache.isis.objectstore.jdo.applib.service.JdoColumnLength;
-import org.apache.isis.objectstore.jdo.applib.service.Util;
-
-@javax.jdo.annotations.PersistenceCapable(
- identityType=IdentityType.DATASTORE,
- table="IsisAuditEntry")
-@javax.jdo.annotations.DatastoreIdentity(
- strategy=javax.jdo.annotations.IdGeneratorStrategy.IDENTITY,
- column="id")
-@javax.jdo.annotations.Queries( {
- @javax.jdo.annotations.Query(
- name="findByTransactionId", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
- + "WHERE transactionId == :transactionId"),
- @javax.jdo.annotations.Query(
- name="findByTargetAndTimestampBetween", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
- + "WHERE targetStr == :targetStr "
- + "&& timestamp >= :from "
- + "&& timestamp <= :to "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findByTargetAndTimestampAfter", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
- + "WHERE targetStr == :targetStr "
- + "&& timestamp >= :from "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findByTargetAndTimestampBefore", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
- + "WHERE targetStr == :targetStr "
- + "&& timestamp <= :to "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findByTarget", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
- + "WHERE targetStr == :targetStr "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findByTimestampBetween", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
- + "WHERE timestamp >= :from "
- + "&& timestamp <= :to "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findByTimestampAfter", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
- + "WHERE timestamp >= :from "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findByTimestampBefore", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
- + "WHERE timestamp <= :to "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="find", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
- + "ORDER BY timestamp DESC")
-})
-@Indices({
- @Index(name="IsisAuditEntry_ak", unique="true",
- columns={
- @javax.jdo.annotations.Column(name="transactionId"),
- @javax.jdo.annotations.Column(name="target"),
- @javax.jdo.annotations.Column(name="propertyId")
- })
-})
-@Immutable
-@Named("Audit Entry")
-@ObjectType("IsisAuditEntry")
-@MemberGroupLayout(
- columnSpans={6,0,6},
- left={"Identifiers","Target"},
- right={"Detail"})
-public class AuditEntryJdo extends DomainChangeJdoAbstract implements HasTransactionId {
-
- public AuditEntryJdo() {
- super(ChangeType.AUDIT_ENTRY);
- }
-
- // //////////////////////////////////////
- // Identification
- // //////////////////////////////////////
-
- public String title() {
- final TitleBuffer buf = new TitleBuffer();
- buf.append(
- new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(getTimestamp()));
- buf.append(",", getUser());
- buf.append(":", getTargetStr());
- buf.append(" ", getMemberIdentifier());
- return buf.toString();
- }
-
-
- // //////////////////////////////////////
- // user (property)
- // //////////////////////////////////////
-
- private String user;
-
- @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.USER_NAME)
- @Hidden(where=Where.PARENTED_TABLES)
- @MemberOrder(name="Identifiers",sequence = "10")
- public String getUser() {
- return user;
- }
-
- public void setUser(final String user) {
- this.user = user;
- }
-
-
- // //////////////////////////////////////
- // timestamp (property)
- // //////////////////////////////////////
-
- private Timestamp timestamp;
-
- @javax.jdo.annotations.Column(allowsNull="false")
- @Hidden(where=Where.PARENTED_TABLES)
- @MemberOrder(name="Identifiers",sequence = "20")
- public Timestamp getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(final Timestamp timestamp) {
- this.timestamp = timestamp;
- }
-
-
-
-
- // //////////////////////////////////////
- // transactionId (property)
- // //////////////////////////////////////
-
- private UUID transactionId;
-
- /**
- * The unique identifier (a GUID) of the transaction in which this audit entry was persisted.
- *
- * <p>
- * The combination of ({@link #getTransactionId() transactionId}, {@link #getTargetStr() target}, {@link #getPropertyId() propertyId} ) makes up the
- * (non-enforced) alternative key.
- */
- @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.TRANSACTION_ID)
- @TypicalLength(36)
- @MemberOrder(name="Identifiers",sequence = "30")
- @Hidden(where=Where.PARENTED_TABLES)
- @Disabled
- @Override
- public UUID getTransactionId() {
- return transactionId;
- }
-
- @Override
- public void setTransactionId(final UUID transactionId) {
- this.transactionId = transactionId;
- }
-
-
- // //////////////////////////////////////
- // targetClass (property)
- // //////////////////////////////////////
-
- private String targetClass;
-
- @javax.jdo.annotations.Column(allowsNull="true", length=JdoColumnLength.TARGET_CLASS)
- @TypicalLength(30)
- @MemberOrder(name="Target", sequence = "10")
- @Named("Class")
- public String getTargetClass() {
- return targetClass;
- }
-
- public void setTargetClass(final String targetClass) {
- this.targetClass = Util.abbreviated(targetClass, JdoColumnLength.TARGET_CLASS);
- }
-
-
- // //////////////////////////////////////
- // target (property)
- // openTargetObject (action)
- // //////////////////////////////////////
-
- private String targetStr;
-
- @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.BOOKMARK, name="target")
- @Named("Object")
- @MemberOrder(name="Target", sequence="30")
- public String getTargetStr() {
- return targetStr;
- }
-
- public void setTargetStr(final String targetStr) {
- this.targetStr = targetStr;
- }
-
-
- // //////////////////////////////////////
- // memberIdentifier (property)
- // //////////////////////////////////////
-
- private String memberIdentifier;
-
- /**
- * This is the fully-qualified class and property Id, as per
- * {@link Identifier#toClassAndNameIdentityString()}.
- */
- @javax.jdo.annotations.Column(allowsNull="true", length=JdoColumnLength.MEMBER_IDENTIFIER)
- @TypicalLength(60)
- @Hidden(where=Where.ALL_TABLES)
- @MemberOrder(name="Detail",sequence = "1")
- public String getMemberIdentifier() {
- return memberIdentifier;
- }
-
- public void setMemberIdentifier(final String memberIdentifier) {
- this.memberIdentifier = Util.abbreviated(memberIdentifier, JdoColumnLength.MEMBER_IDENTIFIER);
- }
-
-
- // //////////////////////////////////////
- // propertyId (property)
- // //////////////////////////////////////
-
- private String propertyId;
-
- /**
- * This is the property name (without the class).
- */
- @javax.jdo.annotations.Column(allowsNull="true", length=JdoColumnLength.AuditEntry.PROPERTY_ID)
- @Hidden(where=Where.NOWHERE)
- @MemberOrder(name="Target",sequence = "20")
- public String getPropertyId() {
- return propertyId;
- }
-
- public void setPropertyId(final String propertyId) {
- this.propertyId = Util.abbreviated(propertyId, JdoColumnLength.AuditEntry.PROPERTY_ID);
- }
-
-
- // //////////////////////////////////////
- // preValue (property)
- // //////////////////////////////////////
-
- private String preValue;
-
- @javax.jdo.annotations.Column(allowsNull="true", length=JdoColumnLength.AuditEntry.PROPERTY_VALUE)
- @Hidden(where=Where.NOWHERE)
- @MemberOrder(name="Detail",sequence = "6")
- public String getPreValue() {
- return preValue;
- }
-
- public void setPreValue(final String preValue) {
- this.preValue = Util.abbreviated(preValue, JdoColumnLength.AuditEntry.PROPERTY_VALUE);
- }
-
-
- // //////////////////////////////////////
- // postValue (property)
- // //////////////////////////////////////
-
- private String postValue;
-
- @javax.jdo.annotations.Column(allowsNull="true", length=JdoColumnLength.AuditEntry.PROPERTY_VALUE)
- @Hidden(where=Where.NOWHERE)
- @MemberOrder(name="Detail",sequence = "7")
- public String getPostValue() {
- return postValue;
- }
-
- public void setPostValue(final String postValue) {
- this.postValue = Util.abbreviated(postValue, JdoColumnLength.AuditEntry.PROPERTY_VALUE);
- }
-
-
-
- // //////////////////////////////////////
- // toString
- // //////////////////////////////////////
-
- @Override
- public String toString() {
- return ObjectContracts.toString(this, "timestamp,user,targetStr,memberIdentifier");
- }
-
-
- // //////////////////////////////////////
- // Injected services
- // //////////////////////////////////////
-
-
- @javax.inject.Inject
- private BookmarkService bookmarkService;
-
- @javax.inject.Inject
- private DomainObjectContainer container;
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdo.java
----------------------------------------------------------------------
diff --git a/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdo.java b/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdo.java
deleted file mode 100644
index 54a0211..0000000
--- a/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdo.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.
- */
-package org.apache.isis.objectstore.jdo.applib.service.audit;
-
-import java.util.UUID;
-import org.apache.isis.applib.AbstractService;
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.services.audit.AuditingService3;
-import org.apache.isis.applib.services.bookmark.Bookmark;
-
-@DomainService
-public class AuditingServiceJdo extends AbstractService implements AuditingService3 {
-
- @Programmatic
- public void audit(
- final UUID transactionId, String targetClass, final Bookmark target,
- String memberIdentifier, final String propertyId,
- final String preValue, final String postValue,
- final String user, final java.sql.Timestamp timestamp) {
-
- final AuditEntryJdo auditEntry = newTransientInstance(AuditEntryJdo.class);
-
- auditEntry.setTimestamp(timestamp);
- auditEntry.setUser(user);
- auditEntry.setTransactionId(transactionId);
-
- auditEntry.setTargetClass(targetClass);
- auditEntry.setTarget(target);
-
- auditEntry.setMemberIdentifier(memberIdentifier);
- auditEntry.setPropertyId(propertyId);
-
- auditEntry.setPreValue(preValue);
- auditEntry.setPostValue(postValue);
-
- persistIfNotAlready(auditEntry);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdoContributions.java
----------------------------------------------------------------------
diff --git a/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdoContributions.java b/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdoContributions.java
deleted file mode 100644
index 9fca7d7..0000000
--- a/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdoContributions.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.objectstore.jdo.applib.service.audit;
-
-import java.util.List;
-
-import org.apache.isis.applib.AbstractService;
-import org.apache.isis.applib.annotation.ActionSemantics;
-import org.apache.isis.applib.annotation.ActionSemantics.Of;
-import org.apache.isis.applib.annotation.NotContributed;
-import org.apache.isis.applib.annotation.NotContributed.As;
-import org.apache.isis.applib.annotation.NotInServiceMenu;
-import org.apache.isis.applib.annotation.Render;
-import org.apache.isis.applib.annotation.Render.Type;
-import org.apache.isis.applib.services.HasTransactionId;
-
-/**
- * This service contributes an <tt>auditEntries</tt> collection to any implementation of
- * {@link org.apache.isis.applib.services.HasTransactionId}, in other words commands, audit entries and published
- * events. This allows the user to navigate to other audited effects of the given command.
- *
- * <p>
- * Because this service influences the UI, it must be explicitly registered as a service
- * (eg using <tt>isis.properties</tt>).
- */
-public class AuditingServiceJdoContributions extends AbstractService {
-
- @ActionSemantics(Of.SAFE)
- @NotInServiceMenu
- @NotContributed(As.ACTION) // ie contribute as collection
- @Render(Type.EAGERLY)
- public List<AuditEntryJdo> auditEntries(final HasTransactionId hasTransactionId) {
- return auditEntryRepository.findByTransactionId(hasTransactionId.getTransactionId());
- }
-
- // //////////////////////////////////////
-
- @javax.inject.Inject
- private AuditingServiceJdoRepository auditEntryRepository;
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdoRepository.java
----------------------------------------------------------------------
diff --git a/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdoRepository.java b/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdoRepository.java
deleted file mode 100644
index 183628b..0000000
--- a/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdoRepository.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.
- */
-package org.apache.isis.objectstore.jdo.applib.service.audit;
-
-import java.sql.Timestamp;
-import java.util.List;
-import java.util.UUID;
-
-import org.joda.time.LocalDate;
-
-import org.apache.isis.applib.AbstractFactoryAndRepository;
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.query.Query;
-import org.apache.isis.applib.query.QueryDefault;
-import org.apache.isis.applib.services.bookmark.Bookmark;
-
-/**
- * Provides supporting functionality for querying
- * {@link org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo audit entry} entities.
- *
- * <p>
- * This supporting service with no UI and no side-effects, and is there are no other implementations of the service,
- * thus has been annotated with {@link org.apache.isis.applib.annotation.DomainService}. This means that there is no
- * need to explicitly register it as a service (eg in <tt>isis.properties</tt>).
- */
-@DomainService
-public class AuditingServiceJdoRepository extends AbstractFactoryAndRepository {
-
- @Programmatic
- public List<AuditEntryJdo> findByTransactionId(final UUID transactionId) {
- return allMatches(
- new QueryDefault<AuditEntryJdo>(AuditEntryJdo.class,
- "findByTransactionId",
- "transactionId", transactionId));
- }
-
- @Programmatic
- public List<AuditEntryJdo> findByTargetAndFromAndTo(
- final Bookmark target,
- final LocalDate from,
- final LocalDate to) {
- final String targetStr = target.toString();
- final Timestamp fromTs = toTimestampStartOfDayWithOffset(from, 0);
- final Timestamp toTs = toTimestampStartOfDayWithOffset(to, 1);
-
- final Query<AuditEntryJdo> query;
- if(from != null) {
- if(to != null) {
- query = new QueryDefault<AuditEntryJdo>(AuditEntryJdo.class,
- "findByTargetAndTimestampBetween",
- "targetStr", targetStr,
- "from", fromTs,
- "to", toTs);
- } else {
- query = new QueryDefault<AuditEntryJdo>(AuditEntryJdo.class,
- "findByTargetAndTimestampAfter",
- "targetStr", targetStr,
- "from", fromTs);
- }
- } else {
- if(to != null) {
- query = new QueryDefault<AuditEntryJdo>(AuditEntryJdo.class,
- "findByTargetAndTimestampBefore",
- "targetStr", targetStr,
- "to", toTs);
- } else {
- query = new QueryDefault<AuditEntryJdo>(AuditEntryJdo.class,
- "findByTarget",
- "targetStr", targetStr);
- }
- }
- return allMatches(query);
- }
-
- @Programmatic
- public List<AuditEntryJdo> findByFromAndTo(
- final LocalDate from,
- final LocalDate to) {
- final Timestamp fromTs = toTimestampStartOfDayWithOffset(from, 0);
- final Timestamp toTs = toTimestampStartOfDayWithOffset(to, 1);
-
- final Query<AuditEntryJdo> query;
- if(from != null) {
- if(to != null) {
- query = new QueryDefault<AuditEntryJdo>(AuditEntryJdo.class,
- "findByTimestampBetween",
- "from", fromTs,
- "to", toTs);
- } else {
- query = new QueryDefault<AuditEntryJdo>(AuditEntryJdo.class,
- "findByTimestampAfter",
- "from", fromTs);
- }
- } else {
- if(to != null) {
- query = new QueryDefault<AuditEntryJdo>(AuditEntryJdo.class,
- "findByTimestampBefore",
- "to", toTs);
- } else {
- query = new QueryDefault<AuditEntryJdo>(AuditEntryJdo.class,
- "find");
- }
- }
- return allMatches(query);
- }
-
- private static Timestamp toTimestampStartOfDayWithOffset(final LocalDate dt, int daysOffset) {
- return dt!=null
- ?new java.sql.Timestamp(dt.toDateTimeAtStartOfDay().plusDays(daysOffset).getMillis())
- :null;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-audit-jdo/src/main/resources/images/AuditEntryJdo.png
----------------------------------------------------------------------
diff --git a/core/module-audit-jdo/src/main/resources/images/AuditEntryJdo.png b/core/module-audit-jdo/src/main/resources/images/AuditEntryJdo.png
deleted file mode 100644
index 4e4352c..0000000
Binary files a/core/module-audit-jdo/src/main/resources/images/AuditEntryJdo.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-command-jdo/.gitignore
----------------------------------------------------------------------
diff --git a/core/module-command-jdo/.gitignore b/core/module-command-jdo/.gitignore
deleted file mode 100644
index a48e45b..0000000
--- a/core/module-command-jdo/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/target-ide
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-command-jdo/pom.xml
----------------------------------------------------------------------
diff --git a/core/module-command-jdo/pom.xml b/core/module-command-jdo/pom.xml
deleted file mode 100644
index 199308b..0000000
--- a/core/module-command-jdo/pom.xml
+++ /dev/null
@@ -1,162 +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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-command-jdo</artifactId>
-
- <name>Isis Module: Command (JDO Implementation)</name>
- <description>
- CommandService and BackgroundCommandService implementations that
- persist commands to database (via JDO objectstore) for profiling and
- to support background command execution.
- </description>
-
- <properties>
- <siteBaseDir>..</siteBaseDir>
- <relativeUrl>module-command/</relativeUrl>
- </properties>
-
- <url>http://isis.apache.org/${relativeUrl}</url>
-
- <build>
- <resources>
- <resource>
- <filtering>false</filtering>
- <directory>src/main/resources</directory>
- </resource>
- <resource>
- <filtering>false</filtering>
- <directory>src/main/java</directory>
- <includes>
- <include>**</include>
- </includes>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.datanucleus</groupId>
- <artifactId>datanucleus-maven-plugin</artifactId>
- <version>${datanucleus-maven-plugin.version}</version>
- <configuration>
- <fork>false</fork>
- <verbose>true</verbose>
- </configuration>
- <executions>
- <execution>
- <phase>compile</phase>
- <goals>
- <goal>enhance</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- <pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>
- org.datanucleus
- </groupId>
- <artifactId>
- datanucleus-maven-plugin
- </artifactId>
- <versionRange>
- [3.2.0-release,)
- </versionRange>
- <goals>
- <goal>enhance</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore />
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-applib</artifactId>
- </dependency>
- <!-- required because provides subclass implementation of BackgroundCommandExecution -->
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-runtime</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-unittestsupport</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <!-- DataNucleus (jdo-api, and for enhancer) -->
- <dependency>
- <groupId>org.datanucleus</groupId>
- <artifactId>datanucleus-accessplatform-jdo-rdbms</artifactId>
- <type>pom</type>
- </dependency>
- <dependency>
- <groupId>org.datanucleus</groupId>
- <artifactId>datanucleus-jodatime</artifactId>
- </dependency>
-
-
- <dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-background</artifactId>
- <!-- optional because may not want to use BackgroundCommandExecutionFromBackgroundCommandServiceJdo -->
- <optional>true</optional>
- </dependency>
-
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-command-jdo/src/main/java/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/core/module-command-jdo/src/main/java/META-INF/persistence.xml b/core/module-command-jdo/src/main/java/META-INF/persistence.xml
deleted file mode 100644
index e6b83a4..0000000
--- a/core/module-command-jdo/src/main/java/META-INF/persistence.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.
--->
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
-
- <persistence-unit name="isis-module-command-jdo">
- </persistence-unit>
-</persistence>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdo.java
----------------------------------------------------------------------
diff --git a/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdo.java b/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdo.java
deleted file mode 100644
index eba9f0a..0000000
--- a/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdo.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.objectstore.jdo.applib.service.background;
-
-import java.util.UUID;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.isis.applib.AbstractService;
-import org.apache.isis.applib.annotation.Command.ExecuteIn;
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.clock.Clock;
-import org.apache.isis.applib.services.background.ActionInvocationMemento;
-import org.apache.isis.applib.services.background.BackgroundCommandService;
-import org.apache.isis.applib.services.command.Command;
-import org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo;
-
-/**
- * Persists a {@link ActionInvocationMemento memento-ized} action such that it can be executed asynchronously,
- * for example through a Quartz scheduler (using
- * {@link org.apache.isis.objectstore.jdo.service.BackgroundCommandExecutionFromBackgroundCommandServiceJdo}).
- *
- * <p>
- * This implementation has no UI and there are no other implementations of the service API, and so it annotated
- * with {@link org.apache.isis.applib.annotation.DomainService}. This class is implemented in the
- * <tt>o.a.i.module:isis-module-command-jdo</tt> module. If that module is included in the classpath, it this means
- * that this service is automatically registered; no further configuration is required.
- *
- * <p>
- * (That said, do note that other services in the <tt>o.a.i.module:isis-module-command-jdo</tt> do require explicit
- * registration as services, eg in <tt>isis.properties</tt>).
- */
-@DomainService
-public class BackgroundCommandServiceJdo extends AbstractService implements BackgroundCommandService {
-
- @SuppressWarnings("unused")
- private static final Logger LOG = LoggerFactory.getLogger(BackgroundCommandServiceJdo.class);
-
- @Programmatic
- @Override
- public void schedule(
- final ActionInvocationMemento aim,
- final Command parentCommand,
- final String targetClassName,
- final String targetActionName,
- final String targetArgs) {
-
- final UUID transactionId = UUID.randomUUID();
- final String user = parentCommand.getUser();
-
- final CommandJdo backgroundCommand = newTransientInstance(CommandJdo.class);
-
- backgroundCommand.setParent(parentCommand);
-
- backgroundCommand.setTransactionId(transactionId);
-
- backgroundCommand.setUser(user);
- backgroundCommand.setTimestamp(Clock.getTimeAsJavaSqlTimestamp());
-
- backgroundCommand.setExecuteIn(ExecuteIn.BACKGROUND);
-
- backgroundCommand.setTargetClass(targetClassName);
- backgroundCommand.setTargetAction(targetActionName);
- backgroundCommand.setTargetStr(aim.getTarget().toString());
- backgroundCommand.setMemberIdentifier(aim.getActionId());
-
- backgroundCommand.setArguments(targetArgs);
- backgroundCommand.setMemento(aim.asMementoString());
-
- parentCommand.setPersistHint(true);
-
- persist(backgroundCommand);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdoContributions.java
----------------------------------------------------------------------
diff --git a/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdoContributions.java b/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdoContributions.java
deleted file mode 100644
index 391975f..0000000
--- a/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdoContributions.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.objectstore.jdo.applib.service.background;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.isis.applib.AbstractFactoryAndRepository;
-import org.apache.isis.applib.annotation.ActionSemantics;
-import org.apache.isis.applib.annotation.ActionSemantics.Of;
-import org.apache.isis.applib.annotation.NotContributed;
-import org.apache.isis.applib.annotation.NotContributed.As;
-import org.apache.isis.applib.annotation.NotInServiceMenu;
-import org.apache.isis.applib.annotation.Render;
-import org.apache.isis.applib.annotation.Render.Type;
-import org.apache.isis.applib.services.command.Command;
-import org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo;
-
-
-/**
- * This service contributes a <tt>childCommands</tt> collection and a <tt>sublingCommands</tt> collection to
- * any {@link CommandJdo} entity.
- *
- * <p>
- * Because this service influences the UI, it must be explicitly registered as a service
- * (eg using <tt>isis.properties</tt>).
- */
-public class BackgroundCommandServiceJdoContributions extends AbstractFactoryAndRepository {
-
- @ActionSemantics(Of.SAFE)
- @NotInServiceMenu
- @NotContributed(As.ACTION)
- @Render(Type.EAGERLY)
- public List<CommandJdo> childCommands(final CommandJdo parent) {
- return backgroundCommandRepository.findByParent(parent);
- }
-
- @ActionSemantics(Of.SAFE)
- @NotInServiceMenu
- @NotContributed(As.ACTION)
- @Render(Type.EAGERLY)
- public List<CommandJdo> siblingCommands(final CommandJdo siblingCommand) {
- final Command parent = siblingCommand.getParent();
- if(parent == null || !(parent instanceof CommandJdo)) {
- return Collections.emptyList();
- }
- final CommandJdo parentJdo = (CommandJdo) parent;
- final List<CommandJdo> siblingCommands = backgroundCommandRepository.findByParent(parentJdo);
- siblingCommands.remove(siblingCommand);
- return siblingCommands;
- }
-
-
- // //////////////////////////////////////
-
- @javax.inject.Inject
- private BackgroundCommandServiceJdoRepository backgroundCommandRepository;
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdoRepository.java
----------------------------------------------------------------------
diff --git a/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdoRepository.java b/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdoRepository.java
deleted file mode 100644
index e41753e..0000000
--- a/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdoRepository.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.objectstore.jdo.applib.service.background;
-
-import java.util.List;
-import java.util.UUID;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.applib.AbstractFactoryAndRepository;
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.query.QueryDefault;
-import org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo;
-
-/**
- * Provides supporting functionality for querying
- * {@link org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo command} entities that have been persisted
- * to execute in the background.
- *
- * <p>
- * This supporting service with no UI and no side-effects, and is there are no other implementations of the service,
- * thus has been annotated with {@link org.apache.isis.applib.annotation.DomainService}. This means that there is no
- * need to explicitly register it as a service (eg in <tt>isis.properties</tt>).
- */
-@DomainService
-public class BackgroundCommandServiceJdoRepository extends AbstractFactoryAndRepository {
-
- @SuppressWarnings("unused")
- private static final Logger LOG = LoggerFactory.getLogger(BackgroundCommandServiceJdoRepository.class);
-
- @Programmatic
- public List<CommandJdo> findByTransactionId(final UUID transactionId) {
- return allMatches(
- new QueryDefault<CommandJdo>(CommandJdo.class,
- "findBackgroundCommandByTransactionId",
- "transactionId", transactionId));
- }
-
- @Programmatic
- public List<CommandJdo> findByParent(CommandJdo parent) {
- return allMatches(
- new QueryDefault<CommandJdo>(CommandJdo.class,
- "findBackgroundCommandsByParent",
- "parent", parent));
- }
-
- @Programmatic
- public List<CommandJdo> findBackgroundCommandsNotYetStarted() {
- return allMatches(
- new QueryDefault<CommandJdo>(CommandJdo.class,
- "findBackgroundCommandsNotYetStarted"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdo.java
----------------------------------------------------------------------
diff --git a/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdo.java b/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdo.java
deleted file mode 100644
index fb5fabc..0000000
--- a/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdo.java
+++ /dev/null
@@ -1,740 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.objectstore.jdo.applib.service.command;
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import javax.jdo.annotations.IdentityType;
-import javax.jdo.annotations.NotPersistent;
-
-import com.google.common.collect.Maps;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.applib.DomainObjectContainer;
-import org.apache.isis.applib.annotation.ActionSemantics;
-import org.apache.isis.applib.annotation.ActionSemantics.Of;
-import org.apache.isis.applib.annotation.Bulk;
-import org.apache.isis.applib.annotation.Command.ExecuteIn;
-import org.apache.isis.applib.annotation.Command.Persistence;
-import org.apache.isis.applib.annotation.Hidden;
-import org.apache.isis.applib.annotation.Immutable;
-import org.apache.isis.applib.annotation.Mandatory;
-import org.apache.isis.applib.annotation.MemberGroupLayout;
-import org.apache.isis.applib.annotation.MemberOrder;
-import org.apache.isis.applib.annotation.MultiLine;
-import org.apache.isis.applib.annotation.Named;
-import org.apache.isis.applib.annotation.ObjectType;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.annotation.TypicalLength;
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.services.bookmark.Bookmark;
-import org.apache.isis.applib.services.bookmark.BookmarkService;
-import org.apache.isis.applib.services.command.Command;
-import org.apache.isis.applib.util.ObjectContracts;
-import org.apache.isis.applib.util.TitleBuffer;
-import org.apache.isis.objectstore.jdo.applib.service.DomainChangeJdoAbstract;
-import org.apache.isis.objectstore.jdo.applib.service.JdoColumnLength;
-import org.apache.isis.objectstore.jdo.applib.service.Util;
-import org.apache.isis.objectstore.jdo.applib.service.DomainChangeJdoAbstract.ChangeType;
-
-
-@javax.jdo.annotations.PersistenceCapable(
- identityType=IdentityType.APPLICATION,
- table="IsisCommand")
-@javax.jdo.annotations.Queries( {
- @javax.jdo.annotations.Query(
- name="findByTransactionId", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo "
- + "WHERE transactionId == :transactionId "),
- @javax.jdo.annotations.Query(
- name="findBackgroundCommandByTransactionId", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo "
- + "WHERE transactionId == :transactionId "
- + "&& executeIn == 'BACKGROUND'"),
- @javax.jdo.annotations.Query(
- name="findBackgroundCommandsByParent", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo "
- + "WHERE parent == :parent "
- + "&& executeIn == 'BACKGROUND'"),
- @javax.jdo.annotations.Query(
- name="findBackgroundCommandsNotYetStarted", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo "
- + "WHERE executeIn == 'BACKGROUND' "
- + "&& startedAt == null "
- + "ORDER BY timestamp ASC "
- ),
- @javax.jdo.annotations.Query(
- name="findCurrent", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo "
- + "WHERE completedAt == null "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findCompleted", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo "
- + "WHERE completedAt != null "
- + "&& executeIn == 'FOREGROUND' "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findByTargetAndTimestampBetween", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
- + "WHERE targetStr == :targetStr "
- + "&& timestamp >= :from "
- + "&& timestamp <= :to "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findByTargetAndTimestampAfter", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
- + "WHERE targetStr == :targetStr "
- + "&& timestamp >= :from "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findByTargetAndTimestampBefore", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
- + "WHERE targetStr == :targetStr "
- + "&& timestamp <= :to "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findByTarget", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
- + "WHERE targetStr == :targetStr "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findByTimestampBetween", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
- + "WHERE timestamp >= :from "
- + "&& timestamp <= :to "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findByTimestampAfter", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
- + "WHERE timestamp >= :from "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findByTimestampBefore", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
- + "WHERE timestamp <= :to "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="find", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
- + "ORDER BY timestamp DESC")
-})
-@ObjectType("IsisCommand")
-@MemberGroupLayout(
- columnSpans={6,0,6,12},
- left={"Identifiers","Target","Notes"},
- right={"Detail","Timings","Results"})
-@Named("Command")
-@Immutable
-public class CommandJdo extends DomainChangeJdoAbstract implements Command {
-
- @SuppressWarnings("unused")
- private static final Logger LOG = LoggerFactory.getLogger(CommandJdo.class);
-
- public CommandJdo() {
- super(ChangeType.COMMAND);
- }
-
-
-
- // //////////////////////////////////////
- // Identification
- // //////////////////////////////////////
-
- public String title() {
- final TitleBuffer buf = new TitleBuffer();
- buf.append(getTargetStr());
- buf.append(" ").append(getMemberIdentifier());
- return buf.toString();
- }
-
-
-
- // //////////////////////////////////////
- // user (property)
- // //////////////////////////////////////
-
- private String user;
-
- @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.USER_NAME)
- @MemberOrder(name="Identifiers", sequence = "10")
- public String getUser() {
- return user;
- }
-
- public void setUser(final String user) {
- this.user = user;
- }
-
-
-
- // //////////////////////////////////////
- // timestamp (property)
- // //////////////////////////////////////
-
- private Timestamp timestamp;
-
- /**
- * The date/time at which this action was created.
- */
- @javax.jdo.annotations.Persistent
- @javax.jdo.annotations.Column(allowsNull="false")
- @MemberOrder(name="Identifiers", sequence = "20")
- public Timestamp getTimestamp() {
- return timestamp;
- }
-
- /**
- * <b>NOT API</b>: intended to be called only by the framework.
- */
- public void setTimestamp(final Timestamp timestamp) {
- this.timestamp = timestamp;
- }
-
-
- // //////////////////////////////////////
- // executor (property)
- // //////////////////////////////////////
-
- private Executor executor;
-
- @Programmatic
- @javax.jdo.annotations.NotPersistent
- @Override
- public Executor getExecutor() {
- return executor;
- }
-
- @Override
- public void setExecutor(Executor nature) {
- this.executor = nature;
- }
-
- // //////////////////////////////////////
- // executeIn (property)
- // //////////////////////////////////////
-
- private ExecuteIn executeIn;
-
- /**
- * Whether the action was invoked explicitly by the user, or scheduled as a background
- * task, or as for some other reason, eg a side-effect of rendering an object due to
- * get-after-post).
- */
- @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.Command.EXECUTE_IN)
- @MemberOrder(name="Identifiers", sequence = "32")
- @Override
- public ExecuteIn getExecuteIn() {
- return executeIn;
- }
-
- /**
- * <b>NOT API</b>: intended to be called only by the framework.
- */
- @Override
- public void setExecuteIn(ExecuteIn nature) {
- this.executeIn = nature;
- }
-
-
- // //////////////////////////////////////
- // parent (property)
- // //////////////////////////////////////
-
- private Command parent;
-
- @Override
- @javax.jdo.annotations.Persistent
- @javax.jdo.annotations.Column(name="parentTransactionId", allowsNull="true")
- @Hidden(where=Where.PARENTED_TABLES)
- @MemberOrder(name="Identifiers",sequence = "40")
- public Command getParent() {
- return parent;
- }
-
- @Override
- public void setParent(Command parent) {
- this.parent = parent;
- }
-
-
- // //////////////////////////////////////
- // transactionId (property)
- // //////////////////////////////////////
-
-
- private UUID transactionId;
-
- /**
- * The unique identifier (a GUID) of the transaction in which this command occurred.
- */
- @javax.jdo.annotations.PrimaryKey
- @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.TRANSACTION_ID)
- @TypicalLength(JdoColumnLength.TRANSACTION_ID)
- @MemberOrder(name="Identifiers",sequence = "50")
- @Override
- public UUID getTransactionId() {
- return transactionId;
- }
-
- /**
- * <b>NOT API</b>: intended to be called only by the framework.
- *
- * <p>
- * Implementation notes: copied over from the Isis transaction when the command is persisted.
- */
- @Override
- public void setTransactionId(final UUID transactionId) {
- this.transactionId = transactionId;
- }
-
-
- // //////////////////////////////////////
- // targetClass (property)
- // //////////////////////////////////////
-
- private String targetClass;
-
- @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.TARGET_CLASS)
- @TypicalLength(30)
- @MemberOrder(name="Target", sequence = "10")
- @Named("Class")
- public String getTargetClass() {
- return targetClass;
- }
-
- public void setTargetClass(final String targetClass) {
- this.targetClass = Util.abbreviated(targetClass, JdoColumnLength.TARGET_CLASS);
- }
-
-
- // //////////////////////////////////////
- // targetAction (property)
- // //////////////////////////////////////
-
- private String targetAction;
-
- @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.TARGET_ACTION)
- @Mandatory
- @Hidden(where=Where.NOWHERE)
- @TypicalLength(30)
- @MemberOrder(name="Target", sequence = "20")
- @Named("Action")
- public String getTargetAction() {
- return targetAction;
- }
-
- public void setTargetAction(final String targetAction) {
- this.targetAction = Util.abbreviated(targetAction, JdoColumnLength.TARGET_ACTION);
- }
-
-
- // //////////////////////////////////////
- // target (property)
- // openTargetObject (action)
- // //////////////////////////////////////
-
- private String targetStr;
- @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.BOOKMARK, name="target")
- @Hidden(where=Where.ALL_TABLES)
- @MemberOrder(name="Target", sequence="30")
- @Named("Object")
- public String getTargetStr() {
- return targetStr;
- }
-
- public void setTargetStr(final String targetStr) {
- this.targetStr = targetStr;
- }
-
- // //////////////////////////////////////
- // arguments (property)
- // //////////////////////////////////////
-
- private String arguments;
-
- @javax.jdo.annotations.Column(allowsNull="true", jdbcType="CLOB")
- @MultiLine(numberOfLines=7)
- @Hidden(where=Where.ALL_TABLES)
- @MemberOrder(name="Target",sequence = "40")
- public String getArguments() {
- return arguments;
- }
-
- public void setArguments(final String arguments) {
- this.arguments = arguments;
- }
-
-
-
- // //////////////////////////////////////
- // memberIdentifier (property)
- // //////////////////////////////////////
-
- private String memberIdentifier;
-
- @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.MEMBER_IDENTIFIER)
- @TypicalLength(60)
- @Hidden(where=Where.ALL_TABLES)
- @MemberOrder(name="Detail",sequence = "1")
- public String getMemberIdentifier() {
- return memberIdentifier;
- }
-
- public void setMemberIdentifier(final String memberIdentifier) {
- this.memberIdentifier = Util.abbreviated(memberIdentifier, JdoColumnLength.MEMBER_IDENTIFIER);
- }
-
-
-
- // //////////////////////////////////////
- // memento (property)
- // //////////////////////////////////////
-
- private String memento;
-
- @javax.jdo.annotations.Column(allowsNull="true", jdbcType="CLOB")
- @MultiLine(numberOfLines=9)
- @Hidden(where=Where.ALL_TABLES)
- @MemberOrder(name="Detail",sequence = "30")
- public String getMemento() {
- return memento;
- }
-
- public void setMemento(final String memento) {
- this.memento = memento;
- }
-
-
-
- // //////////////////////////////////////
- // startedAt (derived property)
- // //////////////////////////////////////
-
- private Timestamp startedAt;
-
- @javax.jdo.annotations.Persistent
- @javax.jdo.annotations.Column(allowsNull="true")
- @MemberOrder(name="Timings", sequence = "3")
- public Timestamp getStartedAt() {
- return startedAt;
- }
-
- /**
- * <b>NOT API</b>: intended to be called only by the framework.
- */
- public void setStartedAt(final Timestamp startedAt) {
- this.startedAt = startedAt;
- }
-
-
-
- // //////////////////////////////////////
- // completedAt (property)
- // //////////////////////////////////////
-
- private Timestamp completedAt;
-
- /**
- * The date/time at which this interaction completed.
- */
- @javax.jdo.annotations.Persistent
- @javax.jdo.annotations.Column(allowsNull="true")
- @MemberOrder(name="Timings", sequence = "4")
- @Override
- public Timestamp getCompletedAt() {
- return completedAt;
- }
-
- @Override
- public void setCompletedAt(final Timestamp completed) {
- this.completedAt = completed;
- }
-
-
- // //////////////////////////////////////
- // duration (derived property)
- // //////////////////////////////////////
-
- /**
- * The number of seconds (to 3 decimal places) that this interaction lasted.
- *
- * <p>
- * Populated only if it has {@link #getCompletedAt() completed}.
- */
- @javax.validation.constraints.Digits(integer=5, fraction=3)
- @Named("Duration")
- @MemberOrder(name="Timings", sequence = "7")
- public BigDecimal getDuration() {
- return Util.durationBetween(getStartedAt(), getCompletedAt());
- }
-
-
-
- // //////////////////////////////////////
- // complete (derived property)
- // //////////////////////////////////////
-
-
- @javax.jdo.annotations.NotPersistent
- @MemberOrder(name="Timings", sequence = "8")
- @Hidden(where=Where.OBJECT_FORMS)
- public boolean isComplete() {
- return getCompletedAt() != null;
- }
-
-
-
- // //////////////////////////////////////
- // state (derived property)
- // //////////////////////////////////////
-
- @javax.jdo.annotations.NotPersistent
- @MemberOrder(name="Results",sequence = "10")
- @Hidden(where=Where.OBJECT_FORMS)
- @Named("Result")
- public String getResultSummary() {
- if(getCompletedAt() == null) {
- return "";
- }
- if(getException() != null) {
- return "EXCEPTION";
- }
- if(getResultStr() != null) {
- return "OK";
- } else {
- return "OK (VOID)";
- }
- }
-
-
- // //////////////////////////////////////
- // result (property)
- // openResultObject (action)
- // //////////////////////////////////////
-
- @Programmatic
- @Override
- public Bookmark getResult() {
- return Util.bookmarkFor(getResultStr());
- }
-
- @Programmatic
- @Override
- public void setResult(Bookmark result) {
- setResultStr(Util.asString(result));
- }
-
- // //////////////////////////////////////
-
- private String resultStr;
-
- @javax.jdo.annotations.Column(allowsNull="true", length=JdoColumnLength.BOOKMARK, name="result")
- @Hidden(where=Where.ALL_TABLES)
- @Named("Result Bookmark")
- @MemberOrder(name="Results", sequence="25")
- public String getResultStr() {
- return resultStr;
- }
-
- public void setResultStr(final String resultStr) {
- this.resultStr = resultStr;
- }
-
- // //////////////////////////////////////
-
- @ActionSemantics(Of.SAFE)
- @MemberOrder(name="ResultStr", sequence="1")
- @Named("Open")
- public Object openResultObject() {
- return Util.lookupBookmark(getResult(), bookmarkService, container);
- }
- public boolean hideOpenResultObject() {
- return getResult() == null;
- }
-
-
- // //////////////////////////////////////
- // exception (property)
- // causedException (derived property)
- // showException (associated action)
- // //////////////////////////////////////
-
- private String exception;
-
- /**
- * Stack trace of any exception that might have occurred if this interaction/transaction aborted.
- *
- * <p>
- * Not visible in the UI, but accessible
- * <p>
- * Not part of the applib API, because the default implementation is not persistent
- * and so there's no object that can be accessed to be annotated.
- */
- @javax.jdo.annotations.Column(allowsNull="true", jdbcType="CLOB")
- @Hidden
- @Override
- public String getException() {
- return exception;
- }
-
- @Override
- public void setException(final String exception) {
- this.exception = exception;
- }
-
-
- // //////////////////////////////////////
-
- @javax.jdo.annotations.NotPersistent
- @MemberOrder(name="Results",sequence = "30")
- @Hidden(where=Where.ALL_TABLES)
- public boolean isCausedException() {
- return getException() != null;
- }
-
-
- // //////////////////////////////////////
-
- @ActionSemantics(Of.SAFE)
- @MemberOrder(name="causedException", sequence = "1")
- public String showException() {
- return getException();
- }
- public boolean hideShowException() {
- return !isCausedException();
- }
-
-
- // //////////////////////////////////////
- // next(...) impl
- // //////////////////////////////////////
-
- private final Map<String, AtomicInteger> sequenceByName = Maps.newHashMap();
-
-
-
- @Programmatic
- @Override
- public int next(String sequenceName) {
- AtomicInteger next = sequenceByName.get(sequenceName);
- if(next == null) {
- next = new AtomicInteger(0);
- sequenceByName.put(sequenceName, next);
- } else {
- next.incrementAndGet();
- }
- return next.get();
- }
-
-
- // //////////////////////////////////////
- // persistence (programmatic)
- // //////////////////////////////////////
-
- private Persistence persistence;
-
- @javax.jdo.annotations.NotPersistent
- @Programmatic
- @Override
- public Persistence getPersistence() {
- return persistence;
- }
-
- @Override
- public void setPersistence(Persistence persistence) {
- this.persistence = persistence;
- }
-
-
- // //////////////////////////////////////
- // setPersistHint (SPI impl)
- // //////////////////////////////////////
-
- private boolean persistHint;
-
- @NotPersistent
- @Programmatic
- public boolean isPersistHint() {
- return persistHint;
- }
-
- @Programmatic
- @Override
- public void setPersistHint(boolean persistHint) {
- this.persistHint = persistHint;
- }
-
-
- // //////////////////////////////////////
-
- @Programmatic
- boolean shouldPersist() {
- if(Persistence.PERSISTED == getPersistence()) {
- return true;
- }
- if(Persistence.IF_HINTED == getPersistence()) {
- return isPersistHint();
- }
- return false;
- }
-
-
-
- // //////////////////////////////////////
- // toString
- // //////////////////////////////////////
-
- @Override
- public String toString() {
- return ObjectContracts.toString(this, "targetStr,memberIdentifier,user,startedAt,completedAt,duration,transactionId");
- }
-
-
-
- // //////////////////////////////////////
- // dependencies
- // //////////////////////////////////////
-
-
- @javax.inject.Inject
- private BookmarkService bookmarkService;
-
- @javax.inject.Inject
- private DomainObjectContainer container;
-
-}
[6/7] ISIS-887: mothballed the core/module* modules,
moved to mothballed/core/module*
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdo.java
----------------------------------------------------------------------
diff --git a/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdo.java b/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdo.java
deleted file mode 100644
index 45616c8..0000000
--- a/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdo.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.objectstore.jdo.applib.service.command;
-
-import java.util.UUID;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.applib.AbstractService;
-import org.apache.isis.applib.annotation.Command.ExecuteIn;
-import org.apache.isis.applib.annotation.Command.Persistence;
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.clock.Clock;
-import org.apache.isis.applib.services.command.Command;
-import org.apache.isis.applib.services.command.Command.Executor;
-import org.apache.isis.applib.services.command.spi.CommandService;
-
-/**
- *
- */
-@DomainService
-public class CommandServiceJdo extends AbstractService implements CommandService {
-
- @SuppressWarnings("unused")
- private static final Logger LOG = LoggerFactory.getLogger(CommandServiceJdo.class);
-
- /**
- * Creates an {@link CommandJdo}, initializing its
- * {@link Command#setExecuteIn(Command.ExecuteIn) nature} to be
- * {@link Command.ExecuteIn#OTHER rendering}.
- */
- @Programmatic
- @Override
- public Command create() {
- CommandJdo command = newTransientInstance(CommandJdo.class);
- command.setExecutor(Executor.OTHER);
- command.setPersistence(Persistence.IF_HINTED);
- return command;
- }
-
- @Programmatic
- @Override
- public void startTransaction(final Command command, final UUID transactionId) {
- if(command instanceof CommandJdo) {
- // should be the case, since this service created the object in the #create() method
- final CommandJdo commandJdo = (CommandJdo) command;
- final UUID currentTransactionId = commandJdo.getTransactionId();
- if(currentTransactionId != null && !currentTransactionId.equals(transactionId)) {
- // the logic in IsisTransaction means that any subsequent transactions within a given command
- // should reuse the xactnId of the first transaction created within that interaction.
- throw new IllegalStateException("Attempting to set a different transactionId on command");
- }
- commandJdo.setTransactionId(transactionId);
- }
- }
-
- @Programmatic
- @Override
- public void complete(final Command command) {
- final CommandJdo commandJdo = asUserInitiatedCommandJdo(command);
- if(commandJdo == null) {
- return;
- }
- if(commandJdo.getCompletedAt() != null) {
- // already attempted to complete.
- // chances are, we're here as the result of a redirect following a previous exception
- // so just ignore.
- return;
- }
-
- commandJdo.setCompletedAt(Clock.getTimeAsJavaSqlTimestamp());
- persistIfNotAlready(commandJdo);
- }
-
- @Override
- public boolean persistIfPossible(Command command) {
- if(!(command instanceof CommandJdo)) {
- // ought not to be the case, since this service created the object in the #create() method
- return false;
- }
- final CommandJdo commandJdo = (CommandJdo)command;
- persistIfNotAlready(commandJdo);
- return true;
- }
-
-
- /**
- * Not API, also used by {@link CommandServiceJdoRepository}.
- */
- CommandJdo asUserInitiatedCommandJdo(final Command command) {
- if(!(command instanceof CommandJdo)) {
- // ought not to be the case, since this service created the object in the #create() method
- return null;
- }
- if(command.getExecuteIn() != ExecuteIn.FOREGROUND) {
- return null;
- }
- final CommandJdo commandJdo = (CommandJdo) command;
- return commandJdo.shouldPersist()? commandJdo: null;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdoContributions.java
----------------------------------------------------------------------
diff --git a/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdoContributions.java b/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdoContributions.java
deleted file mode 100644
index 6142d30..0000000
--- a/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdoContributions.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.objectstore.jdo.applib.service.command;
-
-import java.util.UUID;
-import org.apache.isis.applib.AbstractFactoryAndRepository;
-import org.apache.isis.applib.annotation.MemberOrder;
-import org.apache.isis.applib.annotation.NotContributed;
-import org.apache.isis.applib.annotation.NotContributed.As;
-import org.apache.isis.applib.annotation.NotInServiceMenu;
-import org.apache.isis.applib.services.HasTransactionId;
-import org.apache.isis.applib.services.command.Command;
-
-
-/**
- * This service contributes a <tt>command</tt> action to any (non-command) implementation of
- * {@link org.apache.isis.applib.services.HasTransactionId}; that is: audit entries, and published events. Thus, it
- * is possible to navigate from the effect back to the cause.
- *
- * <p>
- * Because this service influences the UI, it must be explicitly registered as a service
- * (eg using <tt>isis.properties</tt>).
- */
-public class CommandServiceJdoContributions extends AbstractFactoryAndRepository {
-
- @NotInServiceMenu
- @NotContributed(As.ASSOCIATION) // ie contributed as an action
- @MemberOrder(name="transactionId", sequence="1")
- public CommandJdo command(final HasTransactionId hasTransactionId) {
- return commandServiceRepository.findByTransactionId(hasTransactionId.getTransactionId());
- }
- /**
- * Hide if the contributee is a {@link Command}, because {@link Command}s already have a
- * {@link Command#getParent() parent} property.
- */
- public boolean hideCommand(final HasTransactionId hasTransactionId) {
- return (hasTransactionId instanceof Command);
- }
- public String disableCommand(final HasTransactionId hasTransactionId) {
- if(hasTransactionId == null) {
- return "No transaction Id";
- }
- final UUID transactionId = hasTransactionId.getTransactionId();
- final boolean command = commandServiceRepository.findByTransactionId(transactionId) == null;
- return command? "No command found for transaction Id": null;
- }
-
-
- // //////////////////////////////////////
-
-
- @javax.inject.Inject
- private CommandServiceJdoRepository commandServiceRepository;
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdoRepository.java
----------------------------------------------------------------------
diff --git a/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdoRepository.java b/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdoRepository.java
deleted file mode 100644
index 8d573a2..0000000
--- a/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdoRepository.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.objectstore.jdo.applib.service.command;
-
-import java.sql.Timestamp;
-import java.util.List;
-import java.util.UUID;
-
-import org.joda.time.LocalDate;
-
-import org.apache.isis.applib.AbstractFactoryAndRepository;
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.query.Query;
-import org.apache.isis.applib.query.QueryDefault;
-import org.apache.isis.applib.services.bookmark.Bookmark;
-import org.apache.isis.applib.services.command.Command;
-import org.apache.isis.applib.services.command.CommandContext;
-
-
-/**
- * Provides supporting functionality for querying and persisting
- * {@link org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo command} entities.
- *
- * <p>
- * This supporting service with no UI and no side-effects, and is there are no other implementations of the service,
- * thus has been annotated with {@link org.apache.isis.applib.annotation.DomainService}. This means that there is no
- * need to explicitly register it as a service (eg in <tt>isis.properties</tt>).
- */
-@DomainService
-public class CommandServiceJdoRepository extends AbstractFactoryAndRepository {
-
- @Programmatic
- public List<CommandJdo> findByFromAndTo(
- final LocalDate from, final LocalDate to) {
- final Timestamp fromTs = toTimestampStartOfDayWithOffset(from, 0);
- final Timestamp toTs = toTimestampStartOfDayWithOffset(to, 1);
-
- final Query<CommandJdo> query;
- if(from != null) {
- if(to != null) {
- query = new QueryDefault<CommandJdo>(CommandJdo.class,
- "findByTimestampBetween",
- "from", fromTs,
- "to", toTs);
- } else {
- query = new QueryDefault<CommandJdo>(CommandJdo.class,
- "findByTimestampAfter",
- "from", fromTs);
- }
- } else {
- if(to != null) {
- query = new QueryDefault<CommandJdo>(CommandJdo.class,
- "findByTimestampBefore",
- "to", toTs);
- } else {
- query = new QueryDefault<CommandJdo>(CommandJdo.class,
- "find");
- }
- }
- return allMatches(query);
- }
-
-
- @Programmatic
- public CommandJdo findByTransactionId(final UUID transactionId) {
- persistCurrentCommandIfRequired();
- return firstMatch(
- new QueryDefault<CommandJdo>(CommandJdo.class,
- "findByTransactionId",
- "transactionId", transactionId));
- }
-
- @Programmatic
- public List<CommandJdo> findCurrent() {
- persistCurrentCommandIfRequired();
- return allMatches(
- new QueryDefault<CommandJdo>(CommandJdo.class, "findCurrent"));
- }
-
- @Programmatic
- public List<CommandJdo> findCompleted() {
- persistCurrentCommandIfRequired();
- return allMatches(
- new QueryDefault<CommandJdo>(CommandJdo.class, "findCompleted"));
- }
-
- private void persistCurrentCommandIfRequired() {
- if(commandContext == null || commandService == null) {
- return;
- }
- final Command command = commandContext.getCommand();
- final CommandJdo commandJdo = commandService.asUserInitiatedCommandJdo(command);
- if(commandJdo == null) {
- return;
- }
- persistIfNotAlready(commandJdo);
- }
-
- // //////////////////////////////////////
-
-
- @Programmatic
- public List<CommandJdo> findByTargetAndFromAndTo(
- final Bookmark target, final LocalDate from, final LocalDate to) {
- final String targetStr = target.toString();
- final Timestamp fromTs = toTimestampStartOfDayWithOffset(from, 0);
- final Timestamp toTs = toTimestampStartOfDayWithOffset(to, 1);
-
- final Query<CommandJdo> query;
- if(from != null) {
- if(to != null) {
- query = new QueryDefault<CommandJdo>(CommandJdo.class,
- "findByTargetAndTimestampBetween",
- "targetStr", targetStr,
- "from", fromTs,
- "to", toTs);
- } else {
- query = new QueryDefault<CommandJdo>(CommandJdo.class,
- "findByTargetAndTimestampAfter",
- "targetStr", targetStr,
- "from", fromTs);
- }
- } else {
- if(to != null) {
- query = new QueryDefault<CommandJdo>(CommandJdo.class,
- "findByTargetAndTimestampBefore",
- "targetStr", targetStr,
- "to", toTs);
- } else {
- query = new QueryDefault<CommandJdo>(CommandJdo.class,
- "findByTarget",
- "targetStr", targetStr);
- }
- }
- return allMatches(query);
- }
-
- private static Timestamp toTimestampStartOfDayWithOffset(final LocalDate dt, int daysOffset) {
- return dt!=null
- ?new java.sql.Timestamp(dt.toDateTimeAtStartOfDay().plusDays(daysOffset).getMillis())
- :null;
- }
-
- // //////////////////////////////////////
-
-
- @javax.inject.Inject
- private CommandServiceJdo commandService;
-
- @javax.inject.Inject
- private CommandContext commandContext;
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/service/BackgroundCommandExecutionFromBackgroundCommandServiceJdo.java
----------------------------------------------------------------------
diff --git a/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/service/BackgroundCommandExecutionFromBackgroundCommandServiceJdo.java b/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/service/BackgroundCommandExecutionFromBackgroundCommandServiceJdo.java
deleted file mode 100644
index 9c22561..0000000
--- a/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/service/BackgroundCommandExecutionFromBackgroundCommandServiceJdo.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.
- */
-package org.apache.isis.objectstore.jdo.service;
-
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.applib.services.command.Command;
-import org.apache.isis.core.runtime.services.background.BackgroundCommandExecution;
-import org.apache.isis.objectstore.jdo.applib.service.background.BackgroundCommandServiceJdoRepository;
-import org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo;
-
-/**
- * If used, ensure that <code>org.apache.isis.module:isis-module-background</code> is also included on classpath.
- */
-public final class BackgroundCommandExecutionFromBackgroundCommandServiceJdo extends BackgroundCommandExecution {
-
- @SuppressWarnings("unused")
- private final static Logger LOG = LoggerFactory.getLogger(BackgroundCommandExecutionFromBackgroundCommandServiceJdo.class);
-
- @Override
- protected List<? extends Command> findBackgroundCommandsToExecute() {
- final List<CommandJdo> commands = backgroundCommandRepository.findBackgroundCommandsNotYetStarted();
- return commands;
- }
-
- // //////////////////////////////////////
-
- @javax.inject.Inject
- private BackgroundCommandServiceJdoRepository backgroundCommandRepository;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-command-jdo/src/main/resources/images/CommandJdo.png
----------------------------------------------------------------------
diff --git a/core/module-command-jdo/src/main/resources/images/CommandJdo.png b/core/module-command-jdo/src/main/resources/images/CommandJdo.png
deleted file mode 100644
index 7545614..0000000
Binary files a/core/module-command-jdo/src/main/resources/images/CommandJdo.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-command-jdo/src/test/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdoTest_next.java
----------------------------------------------------------------------
diff --git a/core/module-command-jdo/src/test/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdoTest_next.java b/core/module-command-jdo/src/test/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdoTest_next.java
deleted file mode 100644
index b5443e2..0000000
--- a/core/module-command-jdo/src/test/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdoTest_next.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.isis.objectstore.jdo.applib.service.command;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Test;
-
-import org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo;
-
-public class CommandJdoTest_next {
-
- @Test
- public void test() {
- CommandJdo raj = new CommandJdo();
- assertThat(raj.next("foo"), is(0));
- assertThat(raj.next("foo"), is(1));
- assertThat(raj.next("bar"), is(0));
- assertThat(raj.next("bar"), is(1));
- assertThat(raj.next("foo"), is(2));
- assertThat(raj.next("bar"), is(2));
- assertThat(raj.next("bar"), is(3));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-devutils/.gitignore
----------------------------------------------------------------------
diff --git a/core/module-devutils/.gitignore b/core/module-devutils/.gitignore
deleted file mode 100644
index a48e45b..0000000
--- a/core/module-devutils/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/target-ide
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-devutils/applib/.gitignore
----------------------------------------------------------------------
diff --git a/core/module-devutils/applib/.gitignore b/core/module-devutils/applib/.gitignore
deleted file mode 100644
index a48e45b..0000000
--- a/core/module-devutils/applib/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/target-ide
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-devutils/applib/pom.xml
----------------------------------------------------------------------
diff --git a/core/module-devutils/applib/pom.xml b/core/module-devutils/applib/pom.xml
deleted file mode 100644
index 4e8f8f4..0000000
--- a/core/module-devutils/applib/pom.xml
+++ /dev/null
@@ -1,55 +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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-devutils</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>isis-module-devutils-applib</artifactId>
-
- <name>Isis Module: Developer Utilities applib</name>
- <description>
- API for the Developer Utilities module
- </description>
-
- <properties>
- <siteBaseDir>../..</siteBaseDir>
- <relativeUrl>module-devutils/applib/</relativeUrl>
- </properties>
-
- <url>http://isis.apache.org/${relativeUrl}</url>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-applib</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-unittestsupport</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-devutils/applib/src/main/java/org/apache/isis/applib/services/devutils/DeveloperUtilitiesService.java
----------------------------------------------------------------------
diff --git a/core/module-devutils/applib/src/main/java/org/apache/isis/applib/services/devutils/DeveloperUtilitiesService.java b/core/module-devutils/applib/src/main/java/org/apache/isis/applib/services/devutils/DeveloperUtilitiesService.java
deleted file mode 100644
index 6a25cfc..0000000
--- a/core/module-devutils/applib/src/main/java/org/apache/isis/applib/services/devutils/DeveloperUtilitiesService.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.applib.services.devutils;
-
-import org.apache.isis.applib.annotation.ActionSemantics;
-import org.apache.isis.applib.annotation.ActionSemantics.Of;
-import org.apache.isis.applib.annotation.Hidden;
-import org.apache.isis.applib.annotation.MemberOrder;
-import org.apache.isis.applib.annotation.Named;
-import org.apache.isis.applib.annotation.NotInServiceMenu;
-import org.apache.isis.applib.annotation.Prototype;
-import org.apache.isis.applib.value.Blob;
-import org.apache.isis.applib.value.Clob;
-
-@Named("Developer Utilities")
-public interface DeveloperUtilitiesService {
-
- @MemberOrder(sequence="1")
- @ActionSemantics(Of.SAFE)
- @Prototype
- public Clob downloadMetaModel();
-
-
- /**
- * Downloads a zip of the layout of all domain classes.
- */
- @ActionSemantics(Of.SAFE)
- @MemberOrder(sequence="3")
- @Prototype
- public Blob downloadLayouts();
-
- /**
- * Rebuilds the metamodel of all registered domain services.
- */
- @ActionSemantics(Of.SAFE)
- @MemberOrder(sequence="3")
- @Prototype
- public void refreshServices();
-
- /**
- * Download the JSON layout of the domain object's type.
- */
- @NotInServiceMenu
- @ActionSemantics(Of.SAFE)
- @MemberOrder(sequence="2")
- @Prototype
- public Clob downloadLayout(Object domainObject);
-
- /**
- * @deprecated - in prototype mode the Wicket viewer (at least) will automatically invalidate
- * the Isis metamodel whenever the object is re-rendered.
- */
- @Deprecated
- @Hidden
- @NotInServiceMenu
- @ActionSemantics(Of.SAFE)
- @MemberOrder(sequence="99")
- @Prototype
- public Object refreshLayout(Object domainObject);
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-devutils/impl/.gitignore
----------------------------------------------------------------------
diff --git a/core/module-devutils/impl/.gitignore b/core/module-devutils/impl/.gitignore
deleted file mode 100644
index a48e45b..0000000
--- a/core/module-devutils/impl/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/target-ide
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-devutils/impl/pom.xml
----------------------------------------------------------------------
diff --git a/core/module-devutils/impl/pom.xml b/core/module-devutils/impl/pom.xml
deleted file mode 100644
index 6b3c460..0000000
--- a/core/module-devutils/impl/pom.xml
+++ /dev/null
@@ -1,61 +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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-devutils</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>isis-module-devutils-impl</artifactId>
-
- <name>Isis Module: Developer Utilities implementation</name>
- <description>
- Implementation of the Developer Utilities module
- </description>
-
- <properties>
- <siteBaseDir>../..</siteBaseDir>
- <relativeUrl>module-devutils/impl/</relativeUrl>
- </properties>
-
- <url>http://isis.apache.org/${relativeUrl}</url>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-devutils-applib</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-metamodel</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-unittestsupport</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-devutils/impl/src/main/java/org/apache/isis/core/metamodel/services/devutils/DeveloperUtilitiesServiceDefault.java
----------------------------------------------------------------------
diff --git a/core/module-devutils/impl/src/main/java/org/apache/isis/core/metamodel/services/devutils/DeveloperUtilitiesServiceDefault.java b/core/module-devutils/impl/src/main/java/org/apache/isis/core/metamodel/services/devutils/DeveloperUtilitiesServiceDefault.java
deleted file mode 100644
index d36746b..0000000
--- a/core/module-devutils/impl/src/main/java/org/apache/isis/core/metamodel/services/devutils/DeveloperUtilitiesServiceDefault.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * 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.
- */
-package org.apache.isis.core.metamodel.services.devutils;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-import javax.activation.MimeType;
-import javax.activation.MimeTypeParseException;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.Lists;
-import org.apache.isis.applib.FatalException;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.services.devutils.DeveloperUtilitiesService;
-import org.apache.isis.applib.value.Blob;
-import org.apache.isis.applib.value.Clob;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManagerAware;
-import org.apache.isis.core.metamodel.layoutmetadata.json.LayoutMetadataReaderFromJson;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
-import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpiAware;
-import org.apache.isis.core.metamodel.spec.feature.*;
-
-public class DeveloperUtilitiesServiceDefault implements DeveloperUtilitiesService, SpecificationLoaderSpiAware, AdapterManagerAware {
-
-
- private final MimeType mimeTypeTextCsv;
- private final MimeType mimeTypeApplicationZip;
- private final MimeType mimeTypeApplicationJson;
-
- public DeveloperUtilitiesServiceDefault() {
- try {
- mimeTypeTextCsv = new MimeType("text", "csv");
- mimeTypeApplicationJson = new MimeType("application", "jzon");
- mimeTypeApplicationZip = new MimeType("application", "zip");
- } catch (MimeTypeParseException e) {
- throw new RuntimeException(e);
- }
- }
-
- // //////////////////////////////////////
-
-
- @Override
- public Clob downloadMetaModel() {
-
- final Collection<ObjectSpecification> specifications = specificationLoader.allSpecifications();
-
- final List<MetaModelRow> rows = Lists.newArrayList();
- for (ObjectSpecification spec : specifications) {
- if (exclude(spec)) {
- continue;
- }
- final List<ObjectAssociation> properties = spec.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.PROPERTIES);
- for (ObjectAssociation property : properties) {
- final OneToOneAssociation otoa = (OneToOneAssociation) property;
- if (exclude(otoa)) {
- continue;
- }
- rows.add(new MetaModelRow(spec, otoa));
- }
- final List<ObjectAssociation> associations = spec.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.COLLECTIONS);
- for (ObjectAssociation collection : associations) {
- final OneToManyAssociation otma = (OneToManyAssociation) collection;
- if (exclude(otma)) {
- continue;
- }
- rows.add(new MetaModelRow(spec, otma));
- }
- final List<ObjectAction> actions = spec.getObjectActions(Contributed.INCLUDED);
- for (ObjectAction action : actions) {
- if (exclude(action)) {
- continue;
- }
- rows.add(new MetaModelRow(spec, action));
- }
- }
-
- Collections.sort(rows);
-
- final StringBuilder buf = new StringBuilder();
- buf.append(MetaModelRow.header()).append("\n");
- for (MetaModelRow row : rows) {
- buf.append(row.asTextCsv()).append("\n");
- }
- return new Clob("metamodel.csv", mimeTypeTextCsv, buf.toString().toCharArray());
- }
-
- protected boolean exclude(OneToOneAssociation property) {
- return false;
- }
-
- protected boolean exclude(OneToManyAssociation collection) {
- return false;
- }
-
- protected boolean exclude(ObjectAction action) {
- return false;
- }
-
- protected boolean exclude(ObjectSpecification spec) {
- return isBuiltIn(spec) || spec.isAbstract();
- }
-
- protected boolean isBuiltIn(ObjectSpecification spec) {
- final String className = spec.getFullIdentifier();
- return className.startsWith("java") || className.startsWith("org.joda");
- }
-
- // //////////////////////////////////////
-
- @Override
- public void refreshServices() {
- Collection<ObjectSpecification> specifications = Lists.newArrayList(specificationLoader.allSpecifications());
- for (ObjectSpecification objectSpec : specifications) {
- if(objectSpec.isService()){
- specificationLoader.invalidateCache(objectSpec.getCorrespondingClass());
- }
- }
- }
-
- // //////////////////////////////////////
-
- @Override
- public Object refreshLayout(Object domainObject) {
- specificationLoader.invalidateCacheFor(domainObject);
- return domainObject;
- }
-
- // //////////////////////////////////////
-
- @Override
- public Clob downloadLayout(Object domainObject) {
-
- final ObjectAdapter adapterFor = adapterManager.adapterFor(domainObject);
- final ObjectSpecification objectSpec = adapterFor.getSpecification();
-
- final LayoutMetadataReaderFromJson propertiesReader = new LayoutMetadataReaderFromJson();
- final String json = propertiesReader.asJson(objectSpec);
-
- return new Clob(objectSpec.getShortIdentifier() +".layout.json", mimeTypeApplicationJson, json);
- }
-
- // //////////////////////////////////////
-
- @Override
- public Blob downloadLayouts() {
- final LayoutMetadataReaderFromJson propertiesReader = new LayoutMetadataReaderFromJson();
- final Collection<ObjectSpecification> allSpecs = specificationLoader.allSpecifications();
- final Collection<ObjectSpecification> domainObjectSpecs = Collections2.filter(allSpecs, new Predicate<ObjectSpecification>(){
- @Override
- public boolean apply(ObjectSpecification input) {
- return !input.isAbstract() &&
- !input.isService() &&
- !input.isValue() &&
- !input.isParentedOrFreeCollection();
- }});
- try {
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ZipOutputStream zos = new ZipOutputStream(baos);
- OutputStreamWriter writer = new OutputStreamWriter(zos);
- for (ObjectSpecification objectSpec : domainObjectSpecs) {
- zos.putNextEntry(new ZipEntry(zipEntryNameFor(objectSpec)));
- writer.write(propertiesReader.asJson(objectSpec));
- writer.flush();
- zos.closeEntry();
- }
- writer.close();
- return new Blob("layouts.zip", mimeTypeApplicationZip, baos.toByteArray());
- } catch (final IOException ex) {
- throw new FatalException("Unable to create zip of layouts", ex);
- }
- }
-
- private static String zipEntryNameFor(ObjectSpecification objectSpec) {
- final String fqn = objectSpec.getFullIdentifier();
- return fqn.replace(".", File.separator)+".layout.json";
- }
-
-
- // //////////////////////////////////////
-
- private SpecificationLoaderSpi specificationLoader;
- private AdapterManager adapterManager;
-
- @Programmatic
- @Override
- public void setSpecificationLoaderSpi(SpecificationLoaderSpi specificationLoader) {
- this.specificationLoader = specificationLoader;
- }
-
- @Override
- public void setAdapterManager(AdapterManager adapterManager) {
- this.adapterManager = adapterManager;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-devutils/impl/src/main/java/org/apache/isis/core/metamodel/services/devutils/MetaModelRow.java
----------------------------------------------------------------------
diff --git a/core/module-devutils/impl/src/main/java/org/apache/isis/core/metamodel/services/devutils/MetaModelRow.java b/core/module-devutils/impl/src/main/java/org/apache/isis/core/metamodel/services/devutils/MetaModelRow.java
deleted file mode 100644
index a935972..0000000
--- a/core/module-devutils/impl/src/main/java/org/apache/isis/core/metamodel/services/devutils/MetaModelRow.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.core.metamodel.services.devutils;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.SortedSet;
-
-import com.google.common.base.Joiner;
-import com.google.common.base.Strings;
-import com.google.common.collect.Sets;
-
-import org.apache.isis.applib.util.ObjectContracts;
-import org.apache.isis.core.commons.lang.StringExtensions;
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facets.ImperativeFacet;
-import org.apache.isis.core.metamodel.facets.param.choices.ActionChoicesFacet;
-import org.apache.isis.core.metamodel.facets.actions.defaults.ActionDefaultsFacet;
-import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet;
-import org.apache.isis.core.metamodel.facets.param.autocomplete.ActionParameterAutoCompleteFacet;
-import org.apache.isis.core.metamodel.facets.param.choices.ActionParameterChoicesFacet;
-import org.apache.isis.core.metamodel.facets.param.defaults.ActionParameterDefaultsFacet;
-import org.apache.isis.core.metamodel.facets.properties.autocomplete.PropertyAutoCompleteFacet;
-import org.apache.isis.core.metamodel.facets.properties.choices.PropertyChoicesFacet;
-import org.apache.isis.core.metamodel.facets.properties.defaults.PropertyDefaultFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
-import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.core.metamodel.facets.actions.validate.ActionValidationFacet;
-import org.apache.isis.core.metamodel.facets.collections.validate.CollectionValidateAddToFacet;
-import org.apache.isis.core.metamodel.facets.collections.validate.CollectionValidateRemoveFromFacet;
-import org.apache.isis.core.metamodel.facets.members.disabled.DisabledFacet;
-import org.apache.isis.core.metamodel.facets.properties.validating.PropertyValidateFacet;
-
-public class MetaModelRow implements Comparable<MetaModelRow>{
-
- enum MemberType {
- PROPERTY,
- COLLECTION,
- ACTION;
- }
-
- private final ObjectSpecification spec;
- private final MemberType memberType;
- private final ObjectMember member;
- private ObjectAction action;
-
- MetaModelRow(ObjectSpecification spec, OneToOneAssociation property) {
- this.spec = spec;
- this.member = property;
- this.memberType = MemberType.PROPERTY;
- }
-
- MetaModelRow(ObjectSpecification spec, OneToManyAssociation collection) {
- this.spec = spec;
- this.member = collection;
- this.memberType = MemberType.COLLECTION;
- }
-
- MetaModelRow(ObjectSpecification spec, ObjectAction action) {
- this.spec = spec;
- this.member = this.action = action;
- this.memberType = MemberType.ACTION;
- }
-
- public String getClassType() {
- boolean service = false;
- for(ObjectSpecification subspecs: spec.subclasses()) {
- service = service || subspecs.isService();
- }
- return service || spec.isService() ?"2 Service":spec.isValue()?"3 Value":spec.isParentedOrFreeCollection()?"4 Collection":"1 Object";
- }
- public String getClassName() {
- final String fullIdentifier = spec.getFullIdentifier();
- final int lastDot = fullIdentifier.lastIndexOf(".");
- return lastDot>0 && lastDot < fullIdentifier.length()-1
- ?fullIdentifier.substring(lastDot+1,fullIdentifier.length())
- :fullIdentifier;
- }
- public String getPackageName() {
- final String fullIdentifier = spec.getFullIdentifier();
- final int lastDot = fullIdentifier.lastIndexOf(".");
- return lastDot>0?fullIdentifier.substring(0,lastDot):fullIdentifier;
- }
- public String getType() {
- return memberType.name().toLowerCase();
- }
- public String getMemberName() {
- return member.getId();
- }
- public String getNumParams() {
- return action!=null?""+action.getParameterCount():"";
- }
- String getHidden() {
- return interpret(HiddenFacet.class);
- }
- String getDisabled() {
- return interpret(DisabledFacet.class);
- }
- public String getChoices() {
- if(memberType == MemberType.PROPERTY) {
- return interpretRowAndFacet(PropertyChoicesFacet.class);
- } else if(memberType == MemberType.COLLECTION) {
- return "";
- } else {
- final List<ObjectActionParameter> parameters = this.action.getParameters();
- final SortedSet<String> interpretations = Sets.newTreeSet();
- for (ObjectActionParameter param : parameters) {
- final ActionParameterChoicesFacet facet = param.getFacet(ActionParameterChoicesFacet.class);
- addIfNotEmpty(interpretFacet(facet), interpretations);
- }
- return !interpretations.isEmpty()? Joiner.on(";").join(interpretations) : interpretRowAndFacet(ActionChoicesFacet.class);
- }
- }
- public String getAutoComplete() {
- if(memberType == MemberType.PROPERTY) {
- return interpretRowAndFacet(PropertyAutoCompleteFacet.class);
- } else if(memberType == MemberType.COLLECTION) {
- return "";
- } else {
- final List<ObjectActionParameter> parameters = this.action.getParameters();
- final SortedSet<String> interpretations = Sets.newTreeSet();
- for (ObjectActionParameter param : parameters) {
- final ActionParameterAutoCompleteFacet facet = param.getFacet(ActionParameterAutoCompleteFacet.class);
- addIfNotEmpty(interpretFacet(facet), interpretations);
- }
- return !interpretations.isEmpty()? Joiner.on(";").join(interpretations) : "";
- }
- }
- String getDefault() {
- if(memberType == MemberType.PROPERTY) {
- return interpretRowAndFacet(PropertyDefaultFacet.class);
- } else if(memberType == MemberType.COLLECTION) {
- return "";
- } else {
- final List<ObjectActionParameter> parameters = this.action.getParameters();
- final SortedSet<String> interpretations = Sets.newTreeSet();
- for (ObjectActionParameter param : parameters) {
- final ActionParameterDefaultsFacet facet = param.getFacet(ActionParameterDefaultsFacet.class);
- addIfNotEmpty(interpretFacet(facet), interpretations);
- }
- return !interpretations.isEmpty()? Joiner.on(";").join(interpretations) : interpretRowAndFacet(ActionDefaultsFacet.class);
- }
- }
- String getValidate() {
- if(memberType == MemberType.PROPERTY) {
- return interpretRowAndFacet(PropertyValidateFacet.class);
- } else if(memberType == MemberType.COLLECTION) {
- final SortedSet<String> interpretations = Sets.newTreeSet();
- addIfNotEmpty(interpretRowAndFacet(CollectionValidateAddToFacet.class), interpretations);
- addIfNotEmpty(interpretRowAndFacet(CollectionValidateRemoveFromFacet.class), interpretations);
- return !interpretations.isEmpty()? Joiner.on(";").join(interpretations) : "";
- } else {
- return interpretRowAndFacet(ActionValidationFacet.class);
- }
- }
-
- static Object header() {
- return "classType,packageName,className,memberType,memberName,numParams,hidden,disabled,choices,autoComplete,default,validate";
- }
-
- String asTextCsv() {
- return Joiner.on(",").join(
- getClassType(),
- getPackageName(),
- getClassName(),
- getType(),
- getMemberName(),
- getNumParams(),
- getHidden(),
- getDisabled(),
- getChoices(),
- getAutoComplete(),
- getDefault(),
- getValidate());
- }
-
- private String interpretRowAndFacet(Class<? extends Facet> facetClass) {
- final Facet facet = member.getFacet(facetClass);
- return interpretFacet(facet);
- }
-
- private static void addIfNotEmpty(final String str, final SortedSet<String> set) {
- if(!Strings.isNullOrEmpty(str)) {
- set.add(str);
- }
- }
-
- private String interpret(final Class<? extends Facet> cls) {
- return interpretFacet(member.getFacet(cls));
- }
-
- private static String interpretFacet(final Facet facet) {
- if (facet == null || facet.isNoop()) {
- return "";
- }
- if (facet instanceof ImperativeFacet) {
- ImperativeFacet imperativeFacet = (ImperativeFacet) facet;
- return imperativeFacet.getMethods().get(0).getName();
- }
- final String name = facet.getClass().getSimpleName();
- if (ignore(name)) {
- return "";
- }
- final String abbr = StringExtensions.toAbbreviation(name);
- return abbr.length()>0 ? abbr : name;
- }
-
- protected static boolean ignore(final String name) {
- return Arrays.asList("PropertyValidateFacetDefault","PropertyDefaultFacetDerivedFromDefaultedFacet").contains(name);
- }
-
- @Override
- public int compareTo(MetaModelRow o) {
- return ObjectContracts.compare(this, o, "classType,className,type desc,memberName");
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-devutils/pom.xml
----------------------------------------------------------------------
diff --git a/core/module-devutils/pom.xml b/core/module-devutils/pom.xml
deleted file mode 100644
index bae27b3..0000000
--- a/core/module-devutils/pom.xml
+++ /dev/null
@@ -1,94 +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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-devutils</artifactId>
- <packaging>pom</packaging>
-
- <name>Isis Module: Developer Utilities</name>
- <description>
- Developer utilities.
- </description>
-
- <properties>
- <siteBaseDir>..</siteBaseDir>
- <relativeUrl>module-devutils/</relativeUrl>
- </properties>
-
- <url>http://isis.apache.org/${relativeUrl}</url>
-
- <dependencyManagement>
- <dependencies>
-
- <dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-devutils-applib</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-devutils-applib</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- <scope>test</scope>
- <type>test-jar</type>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-devutils-impl</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-devutils-impl</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- <scope>test</scope>
- <type>test-jar</type>
- </dependency>
-
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-applib</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-unittestsupport</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <modules>
- <module>applib</module>
- <module>impl</module>
- </modules>
-
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-publishing-jdo/.gitignore
----------------------------------------------------------------------
diff --git a/core/module-publishing-jdo/.gitignore b/core/module-publishing-jdo/.gitignore
deleted file mode 100644
index a48e45b..0000000
--- a/core/module-publishing-jdo/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/target-ide
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-publishing-jdo/pom.xml
----------------------------------------------------------------------
diff --git a/core/module-publishing-jdo/pom.xml b/core/module-publishing-jdo/pom.xml
deleted file mode 100644
index 420125e..0000000
--- a/core/module-publishing-jdo/pom.xml
+++ /dev/null
@@ -1,147 +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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-publishing-jdo</artifactId>
-
- <name>Isis Module: Publishing (JDO Implementation)</name>
- <description>
- PublishingService implementation that persists published events
- to the database (using JDO Objectstore).
- </description>
-
- <properties>
- <siteBaseDir>..</siteBaseDir>
- <relativeUrl>module-publishing/</relativeUrl>
- </properties>
-
- <url>http://isis.apache.org/${relativeUrl}</url>
-
- <build>
- <resources>
- <resource>
- <filtering>false</filtering>
- <directory>src/main/resources</directory>
- </resource>
- <resource>
- <filtering>false</filtering>
- <directory>src/main/java</directory>
- <includes>
- <include>**</include>
- </includes>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.datanucleus</groupId>
- <artifactId>datanucleus-maven-plugin</artifactId>
- <version>${datanucleus-maven-plugin.version}</version>
- <configuration>
- <fork>false</fork>
- <verbose>true</verbose>
- </configuration>
- <executions>
- <execution>
- <phase>compile</phase>
- <goals>
- <goal>enhance</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- <pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>
- org.datanucleus
- </groupId>
- <artifactId>
- datanucleus-maven-plugin
- </artifactId>
- <versionRange>
- [3.2.0-release,)
- </versionRange>
- <goals>
- <goal>enhance</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore />
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-applib</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-unittestsupport</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <!-- DataNucleus (jdo-api, and for enhancer) -->
- <dependency>
- <groupId>org.datanucleus</groupId>
- <artifactId>datanucleus-accessplatform-jdo-rdbms</artifactId>
- <type>pom</type>
- </dependency>
- <dependency>
- <groupId>org.datanucleus</groupId>
- <artifactId>datanucleus-jodatime</artifactId>
- </dependency>
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-publishing-jdo/src/main/java/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/core/module-publishing-jdo/src/main/java/META-INF/persistence.xml b/core/module-publishing-jdo/src/main/java/META-INF/persistence.xml
deleted file mode 100644
index 1cb71dd..0000000
--- a/core/module-publishing-jdo/src/main/java/META-INF/persistence.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.
--->
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
-
- <persistence-unit name="isis-module-publishing-jdo">
- </persistence-unit>
-</persistence>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/IoUtils.java
----------------------------------------------------------------------
diff --git a/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/IoUtils.java b/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/IoUtils.java
deleted file mode 100644
index d7f1ae0..0000000
--- a/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/IoUtils.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.objectstore.jdo.applib.service.publish;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.Charset;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
-
-import org.apache.isis.applib.FatalException;
-import org.apache.isis.applib.RecoverableException;
-import org.apache.isis.applib.NonRecoverableException;
-
-class IoUtils {
-
- public static byte[] toUtf8ZippedBytes(String entryName, final String toZip) {
- if(toZip == null) {
- return null;
- }
- ZipOutputStream zos = null;
- ByteArrayOutputStream baos = null;
- try {
- baos = new ByteArrayOutputStream();
- zos = new ZipOutputStream(baos);
- ZipEntry entry = new ZipEntry(entryName);
- zos.putNextEntry(entry);
-
- final byte[] utf8Bytes = toZip.getBytes(Charset.forName("UTF-8"));
- zos.write(utf8Bytes);
- zos.flush();
- } catch (final IOException ex) {
- throw new FatalException(ex);
- } finally {
- closeSafely(zos);
- }
- return baos.toByteArray();
- }
-
- public static String fromUtf8ZippedBytes(String entryName, final byte[] toUnzip) {
- if(toUnzip == null) {
- return null;
- }
- ByteArrayInputStream bais = null;
- ZipInputStream zis = null;
- try {
- bais = new ByteArrayInputStream(toUnzip);
- zis = new ZipInputStream(bais);
- ZipEntry entry;
- while ((entry = zis.getNextEntry()) != null) {
- if(!entry.getName().equals(entryName)) {
- zis.closeEntry();
- continue;
- }
- final byte[] utf8Bytes = IoUtils.readBytes(zis);
- return new String(utf8Bytes, Charset.forName("UTF-8"));
- }
- return null;
- } catch(IOException ex) {
- throw new NonRecoverableException(ex);
- } finally {
- IoUtils.closeSafely(zis);
- }
- }
-
- static byte[] readBytes(final InputStream zis) throws IOException {
- final byte[] buffer = new byte[2048];
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- int numBytes;
- while ((numBytes = zis.read(buffer, 0, buffer.length)) != -1) {
- baos.write(buffer, 0, numBytes);
- }
- baos.flush();
- baos.close();
- return baos.toByteArray();
- }
-
- static void closeSafely(ZipInputStream zis) {
- if(zis != null) {
- try {
- zis.closeEntry();
- } catch (IOException e) {
- // ignore
- }
- try {
- zis.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
-
- static void closeSafely(ZipOutputStream zos) {
- if(zos != null) {
- try {
- zos.closeEntry();
- } catch (IOException e) {
- // ignore
- }
- try {
- zos.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishedEventJdo.java
----------------------------------------------------------------------
diff --git a/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishedEventJdo.java b/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishedEventJdo.java
deleted file mode 100644
index 097f64c..0000000
--- a/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishedEventJdo.java
+++ /dev/null
@@ -1,490 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.isis.objectstore.jdo.applib.service.publish;
-
-import java.util.UUID;
-import javax.jdo.annotations.IdentityType;
-import org.apache.isis.applib.DomainObjectContainer;
-import org.apache.isis.applib.Identifier;
-import org.apache.isis.applib.annotation.*;
-import org.apache.isis.applib.annotation.ActionSemantics.Of;
-import org.apache.isis.applib.services.HasTransactionId;
-import org.apache.isis.applib.services.bookmark.BookmarkService;
-import org.apache.isis.applib.services.publish.EventType;
-import org.apache.isis.applib.util.ObjectContracts;
-import org.apache.isis.applib.util.TitleBuffer;
-import org.apache.isis.objectstore.jdo.applib.service.DomainChangeJdoAbstract;
-import org.apache.isis.objectstore.jdo.applib.service.JdoColumnLength;
-import org.apache.isis.objectstore.jdo.applib.service.Util;
-
-@javax.jdo.annotations.PersistenceCapable(
- identityType=IdentityType.APPLICATION,
- table="IsisPublishedEvent",
- objectIdClass=PublishedEventJdoPK.class)
-@javax.jdo.annotations.Queries( {
- @javax.jdo.annotations.Query(
- name="findByStateOrderByTimestamp", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
- + "WHERE state == :state "
- + "ORDER BY timestamp"),
- @javax.jdo.annotations.Query(
- name="findByTransactionId", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
- + "WHERE transactionId == :transactionId"),
- @javax.jdo.annotations.Query(
- name="findByTargetAndTimestampBetween", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
- + "WHERE targetStr == :targetStr "
- + "&& timestamp >= :from "
- + "&& timestamp <= :to "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findByTargetAndTimestampAfter", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
- + "WHERE targetStr == :targetStr "
- + "&& timestamp >= :from "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findByTargetAndTimestampBefore", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
- + "WHERE targetStr == :targetStr "
- + "&& timestamp <= :to "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findByTarget", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
- + "WHERE targetStr == :targetStr "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findByTimestampBetween", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
- + "WHERE timestamp >= :from "
- + "&& timestamp <= :to "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findByTimestampAfter", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
- + "WHERE timestamp >= :from "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="findByTimestampBefore", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
- + "WHERE timestamp <= :to "
- + "ORDER BY timestamp DESC"),
- @javax.jdo.annotations.Query(
- name="find", language="JDOQL",
- value="SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
- + "ORDER BY timestamp DESC")
-})
-@MemberGroupLayout(
- columnSpans={6,0,6},
- left={"Identifiers","Target"},
- right={"Detail","State"})
-@Immutable
-@Named("Published Event")
-@ObjectType("IsisPublishedEvent")
-public class PublishedEventJdo extends DomainChangeJdoAbstract implements HasTransactionId {
-
- public static enum State {
- QUEUED, PROCESSED
- }
-
- // //////////////////////////////////////
-
- public PublishedEventJdo() {
- super(ChangeType.PUBLISHED_EVENT);
- }
-
-
- // //////////////////////////////////////
- // Identification
- // //////////////////////////////////////
-
- public String title() {
- final TitleBuffer buf = new TitleBuffer();
- buf.append(getEventType().name()).append(" ").append(getTargetStr());
- if(getEventType()==EventType.ACTION_INVOCATION) {
- buf.append(" ").append(getMemberIdentifier());
- }
- buf.append(",").append(getState());
- return buf.toString();
- }
-
-
- // //////////////////////////////////////
- // user (property)
- // //////////////////////////////////////
-
- private String user;
-
- @javax.jdo.annotations.Column(allowsNull="false", length=50)
- @MemberOrder(name="Identifiers", sequence = "10")
- @Hidden(where=Where.PARENTED_TABLES)
- public String getUser() {
- return user;
- }
-
- public void setUser(final String user) {
- this.user = user;
- }
-
-
- // //////////////////////////////////////
- // timestamp (property)
- // //////////////////////////////////////
-
- private java.sql.Timestamp timestamp;
-
- @javax.jdo.annotations.Persistent
- @javax.jdo.annotations.Column(allowsNull="false")
- @MemberOrder(name="Identifiers", sequence = "20")
- @Hidden(where=Where.PARENTED_TABLES)
- public java.sql.Timestamp getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(final java.sql.Timestamp timestamp) {
- this.timestamp = timestamp;
- }
-
-
-
- // //////////////////////////////////////
- // transactionId
- // //////////////////////////////////////
-
- private UUID transactionId;
-
- /**
- * The unique identifier (a GUID) of the transaction in which this published event was persisted.
- *
- * <p>
- * The combination of ({@link #getTransactionId() transactionId}, {@link #getSequence() sequence}) makes up the
- * primary key.
- */
- @javax.jdo.annotations.PrimaryKey
- @javax.jdo.annotations.Column(allowsNull="false",length=JdoColumnLength.TRANSACTION_ID)
- @MemberOrder(name="Identifiers", sequence = "30")
- @Hidden(where=Where.PARENTED_TABLES)
- @Override
- public UUID getTransactionId() {
- return transactionId;
- }
-
- @Override
- public void setTransactionId(final UUID transactionId) {
- this.transactionId = transactionId;
- }
-
-
- // //////////////////////////////////////
- // sequence
- // //////////////////////////////////////
-
- private int sequence;
-
- /**
- * The 0-based additional identifier of a published event within the given {@link #getTransactionId() transaction}.
- *
- * <p>
- * The combination of ({@link #getTransactionId() transactionId}, {@link #getSequence() sequence}) makes up the
- * primary key.
- */
- @javax.jdo.annotations.PrimaryKey
- @MemberOrder(name="Identifiers", sequence = "40")
- public int getSequence() {
- return sequence;
- }
-
- public void setSequence(final int sequence) {
- this.sequence = sequence;
- }
-
-
- // //////////////////////////////////////
- // title
- // //////////////////////////////////////
-
- private String title;
-
- /**
- * Consists of the full oidStr (with version info etc), concatenated
- * (if an {@link EventType#ACTION_INVOCATION}) with the name/parms of the action.
- *
- * <p>
- * @deprecated - the oid of the target is also available (without the version info) through {@link #getTarget()}, and
- * the action identifier is available through {@link #getMemberIdentifier()}.
- */
- @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.PublishedEvent.TITLE)
- @Hidden
- @Deprecated
- public String getTitle() {
- return title;
- }
-
- public void setTitle(final String title) {
- this.title = title;
- }
-
-
- // //////////////////////////////////////
- // eventType (property)
- // //////////////////////////////////////
-
- private EventType eventType;
-
- @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.PublishedEvent.EVENT_TYPE)
- @MemberOrder(name="Identifiers",sequence = "50")
- public EventType getEventType() {
- return eventType;
- }
-
- public void setEventType(final EventType eventType) {
- this.eventType = eventType;
- }
-
-
- // //////////////////////////////////////
- // targetClass (property)
- // //////////////////////////////////////
-
- private String targetClass;
-
- @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.TARGET_CLASS)
- @TypicalLength(30)
- @MemberOrder(name="Target", sequence = "10")
- @Named("Class")
- public String getTargetClass() {
- return targetClass;
- }
-
- public void setTargetClass(final String targetClass) {
- this.targetClass = Util.abbreviated(targetClass, JdoColumnLength.TARGET_CLASS);
- }
-
-
- // //////////////////////////////////////
- // targetAction (property)
- // //////////////////////////////////////
-
- private String targetAction;
-
- /**
- * Only populated for {@link EventType#ACTION_INVOCATION}
- */
- @javax.jdo.annotations.Column(allowsNull="true", length=JdoColumnLength.TARGET_ACTION)
- @TypicalLength(30)
- @MemberOrder(name="Target", sequence = "20")
- @Named("Action")
- public String getTargetAction() {
- return targetAction;
- }
-
- public void setTargetAction(final String targetAction) {
- this.targetAction = Util.abbreviated(targetAction, JdoColumnLength.TARGET_ACTION);
- }
-
-
- // //////////////////////////////////////
- // target (property)
- // openTargetObject (action)
- // //////////////////////////////////////
-
-
- private String targetStr;
- @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.BOOKMARK, name="target")
- @MemberOrder(name="Target", sequence="30")
- @Named("Object")
- public String getTargetStr() {
- return targetStr;
- }
-
- public void setTargetStr(final String targetStr) {
- this.targetStr = targetStr;
- }
-
-
- // //////////////////////////////////////
- // memberIdentifier (property)
- // //////////////////////////////////////
-
- private String memberIdentifier;
-
- /**
- * Holds a string representation of the invoked action, equivalent to
- * {@link Identifier#toClassAndNameIdentityString()}.
- *
- * <p>
- * Only populated for {@link EventType#ACTION_INVOCATION},
- * returns <tt>null</tt> otherwise.
- *
- * <p>
- * This property is called 'memberIdentifier' rather than 'actionIdentifier' for
- * consistency with other services (such as auditing and publishing) that may act on
- * properties rather than simply just actions.
- */
- @javax.jdo.annotations.Column(allowsNull="true", length=JdoColumnLength.MEMBER_IDENTIFIER)
- @TypicalLength(60)
- @Hidden(where=Where.ALL_TABLES)
- @MemberOrder(name="Detail",sequence = "20")
- public String getMemberIdentifier() {
- return memberIdentifier;
- }
-
- public void setMemberIdentifier(final String actionIdentifier) {
- this.memberIdentifier = Util.abbreviated(actionIdentifier, JdoColumnLength.MEMBER_IDENTIFIER);
- }
-
-
-
- // //////////////////////////////////////
- // state (property)
- // //////////////////////////////////////
-
- private State state;
-
- @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.PublishedEvent.STATE)
- @MemberOrder(name="State", sequence = "30")
- public State getState() {
- return state;
- }
-
- public void setState(final State state) {
- this.state = state;
- }
- private PublishedEventJdo setStateAndReturn(State state) {
- setState(state);
- return this;
- }
-
-
- // //////////////////////////////////////
- // serializedFormZipped (property)
- // serializedForm (derived property)
- // //////////////////////////////////////
-
- @javax.jdo.annotations.NotPersistent
- @NotPersisted
- @MultiLine(numberOfLines=14)
- @Hidden(where=Where.ALL_TABLES)
- @MemberOrder(name="Detail", sequence = "40")
- public String getSerializedForm() {
- byte[] zipped = getSerializedFormZipped();
- if(zipped != null) {
- return PublishingServiceJdo.fromZippedBytes(zipped);
- } else {
- return getSerializedFormClob();
- }
- }
-
-
- // //////////////////////////////////////
-
- @Deprecated
- @javax.jdo.annotations.Column(allowsNull="true")
- private byte[] serializedFormZipped;
-
- @Deprecated
- @Programmatic // ignored by Isis
- public byte[] getSerializedFormZipped() {
- return serializedFormZipped;
- }
-
- @Deprecated
- public void setSerializedFormZipped(final byte[] serializedFormZipped) {
- this.serializedFormZipped = serializedFormZipped;
- }
-
- // //////////////////////////////////////
-
- private String serializedFormClob;
-
- @Programmatic // ignored by Isis
- @javax.jdo.annotations.Column(allowsNull="true", jdbcType="CLOB")
- public String getSerializedFormClob() {
- return serializedFormClob;
- }
-
- public void setSerializedFormClob(final String serializedFormClob) {
- this.serializedFormClob = serializedFormClob;
- }
-
-
- // //////////////////////////////////////
- // processed (action)
- // reQueue (action)
- // delete (action)
- // //////////////////////////////////////
-
-
- @Bulk
- @ActionSemantics(Of.IDEMPOTENT)
- @MemberOrder( name="State", sequence="10")
- public PublishedEventJdo processed() {
- return setStateAndReturn(State.PROCESSED);
- }
-
-
- @Bulk
- @ActionSemantics(Of.IDEMPOTENT)
- @MemberOrder(name="State", sequence="11")
- public PublishedEventJdo reQueue() {
- return setStateAndReturn(State.QUEUED);
- }
-
- @Bulk
- @MemberOrder(name="State", sequence="12")
- public void delete() {
- container.removeIfNotAlready(this);
- }
-
-
-
- // //////////////////////////////////////
- // toString
- // //////////////////////////////////////
-
- @Override
- public String toString() {
- return ObjectContracts.toString(this, "targetStr,timestamp,user,eventType,memberIdentifier,state");
- }
-
-
- // //////////////////////////////////////
- // dependencies
- // //////////////////////////////////////
-
- @javax.inject.Inject
- private BookmarkService bookmarkService;
-
- @javax.inject.Inject
- private DomainObjectContainer container;
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishedEventJdoPK.java
----------------------------------------------------------------------
diff --git a/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishedEventJdoPK.java b/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishedEventJdoPK.java
deleted file mode 100644
index 0666ed3..0000000
--- a/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishedEventJdoPK.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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.
- */
-package org.apache.isis.objectstore.jdo.applib.service.publish;
-
-import java.io.Serializable;
-import java.util.StringTokenizer;
-import java.util.UUID;
-
-public class PublishedEventJdoPK implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private static final String SEPARATOR = "_";
-
- public UUID transactionId;
- public int sequence;
-
- // //////////////////////////////////////
-
-
- public PublishedEventJdoPK() {
- }
-
- public PublishedEventJdoPK(final String value) {
- final StringTokenizer token = new StringTokenizer (value, SEPARATOR);
- this.transactionId = UUID.fromString(token.nextToken());
- this.sequence = Integer.parseInt(token.nextToken());
- }
-
- // //////////////////////////////////////
-
- public UUID getTransactionId() {
- return transactionId;
- }
- public void setTransactionId(UUID transactionId) {
- this.transactionId = transactionId;
- }
-
- // //////////////////////////////////////
-
- public int getSequence() {
- return sequence;
- }
- public void setSequence(int sequence) {
- this.sequence = sequence;
- }
-
- // //////////////////////////////////////
-
-
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + sequence;
- result = prime * result + ((transactionId == null) ? 0 : transactionId.hashCode());
- return result;
- }
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- PublishedEventJdoPK other = (PublishedEventJdoPK) obj;
- if (sequence != other.sequence)
- return false;
- if (transactionId == null) {
- if (other.transactionId != null)
- return false;
- } else if (!transactionId.equals(other.transactionId))
- return false;
- return true;
- }
-
- // //////////////////////////////////////
-
-
- @Override
- public String toString() {
- return transactionId + SEPARATOR + sequence;
- }
-}
[4/7] ISIS-887: mothballed the core/module* modules,
moved to mothballed/core/module*
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/SettingAbstractJdo.java
----------------------------------------------------------------------
diff --git a/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/SettingAbstractJdo.java b/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/SettingAbstractJdo.java
deleted file mode 100644
index 8e6f8da..0000000
--- a/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/SettingAbstractJdo.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.isis.objectstore.jdo.applib.service.settings;
-
-import javax.jdo.annotations.PersistenceCapable;
-
-import org.joda.time.LocalDate;
-
-import org.apache.isis.applib.DomainObjectContainer;
-import org.apache.isis.applib.annotation.MemberOrder;
-import org.apache.isis.applib.annotation.Named;
-import org.apache.isis.applib.annotation.Optional;
-import org.apache.isis.applib.services.settings.SettingType;
-
-/**
- * Factors out common implementation; however this is annotated with {@link PersistenceCapable},
- * so that each subclass is its own root entity.
- */
-public abstract class SettingAbstractJdo extends org.apache.isis.applib.services.settings.SettingAbstract implements org.apache.isis.applib.services.settings.ApplicationSetting {
-
- private String key;
-
- @javax.jdo.annotations.Column(allowsNull="false")
- public String getKey() {
- return key;
- }
-
- public void setKey(final String key) {
- this.key = key;
- }
-
- // //////////////////////////////////////
-
- private String description;
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(final String description) {
- this.description = description;
- }
-
- @MemberOrder(name="Description", sequence="1")
- @Named("Update")
- public SettingAbstractJdo updateDescription(@Named("Description") @Optional String description) {
- setDescription(description);
- return this;
- }
- public String default0UpdateDescription() {
- return getDescription();
- }
-
- // //////////////////////////////////////
-
- private SettingType type;
-
- @javax.jdo.annotations.Column(allowsNull="false")
- public SettingType getType() {
- return type;
- }
-
- public void setType(final SettingType type) {
- this.type = type;
- }
-
- // //////////////////////////////////////
-
- private String valueRaw;
-
- @javax.jdo.annotations.Column(allowsNull="false")
- public String getValueRaw() {
- return valueRaw;
- }
-
- public void setValueRaw(final String valueAsRaw) {
- this.valueRaw = valueAsRaw;
- }
-
- // //////////////////////////////////////
-
- @MemberOrder(name="ValueAsString", sequence="1")
- @Named("Update")
- public SettingAbstractJdo updateAsString(@Named("Value") String value) {
- setValueRaw(value);
- return this;
- }
- public String default0UpdateAsString() {
- return getValueAsString();
- }
- public boolean hideUpdateAsString() {
- return typeIsNot(SettingType.STRING);
- }
-
- @MemberOrder(name="ValueAsInt", sequence="1")
- @Named("Update")
- public SettingAbstractJdo updateAsInt(@Named("Value") Integer value) {
- setValueRaw(value.toString());
- return this;
- }
- public Integer default0UpdateAsInt() {
- return getValueAsInt();
- }
- public boolean hideUpdateAsInt() {
- return typeIsNot(SettingType.INT);
- }
-
- @MemberOrder(name="ValueAsLong", sequence="1")
- @Named("Update")
- public SettingAbstractJdo updateAsLong(@Named("Value") Long value) {
- setValueRaw(value.toString());
- return this;
- }
- public Long default0UpdateAsLong() {
- return getValueAsLong();
- }
- public boolean hideUpdateAsLong() {
- return typeIsNot(SettingType.LONG);
- }
-
- @MemberOrder(name="ValueAsLocalDate", sequence="1")
- @Named("Update")
- public SettingAbstractJdo updateAsLocalDate(@Named("Value") LocalDate value) {
- setValueRaw(value.toString(DATE_FORMATTER));
- return this;
- }
- public LocalDate default0UpdateAsLocalDate() {
- return getValueAsLocalDate();
- }
- public boolean hideUpdateAsLocalDate() {
- return typeIsNot(SettingType.LOCAL_DATE);
- }
-
- @MemberOrder(name="ValueAsBoolean", sequence="1")
- @Named("Update")
- public SettingAbstractJdo updateAsBoolean(@Named("Value") Boolean value) {
- setValueRaw(value.toString());
- return this;
- }
- public Boolean default0UpdateAsBoolean() {
- return getValueAsBoolean();
- }
- public boolean hideUpdateAsBoolean() {
- return typeIsNot(SettingType.BOOLEAN);
- }
-
- // //////////////////////////////////////
-
-
- public SettingAbstractJdo delete(
- @Named("Are you sure?") @Optional Boolean confirm) {
- if(confirm == null || !confirm) {
- container.informUser("Setting NOT deleted");
- return this;
- }
- container.remove(this);
- container.informUser("Setting deleted");
- return null;
- }
-
-
-
-
- // //////////////////////////////////////
-
- private DomainObjectContainer container;
-
- public void setDomainObjectContainer(final DomainObjectContainer container) {
- this.container = container;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingJdo.java
----------------------------------------------------------------------
diff --git a/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingJdo.java b/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingJdo.java
deleted file mode 100644
index f1ff4b2..0000000
--- a/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingJdo.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.isis.objectstore.jdo.applib.service.settings;
-
-
-import javax.jdo.annotations.IdentityType;
-
-import org.apache.isis.applib.annotation.MemberOrder;
-import org.apache.isis.applib.annotation.Named;
-import org.apache.isis.applib.annotation.Title;
-import org.apache.isis.applib.services.settings.SettingType;
-import org.apache.isis.applib.services.settings.UserSetting;
-import org.apache.isis.objectstore.jdo.applib.service.JdoColumnLength;
-
-@javax.jdo.annotations.PersistenceCapable(
- identityType = IdentityType.APPLICATION,
- objectIdClass=UserSettingJdoPK.class,
- table="IsisUserSetting")
-@javax.jdo.annotations.Queries({
- @javax.jdo.annotations.Query(
- name = "findByUserAndKey", language = "JDOQL",
- value = "SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.settings.UserSettingJdo "
- + "WHERE user == :user "
- + "&& key == :key ")
- ,@javax.jdo.annotations.Query(
- name = "findByUser", language = "JDOQL",
- value = "SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.settings.UserSettingJdo "
- + "WHERE user == :user "
- + "ORDER BY key")
- ,@javax.jdo.annotations.Query(
- name = "findAll", language = "JDOQL",
- value = "SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.settings.UserSettingJdo "
- + "ORDER BY user, key")
-})
-// can't see how to specify this order in the primary key; however HSQLDB objects :-(
-//@javax.jdo.annotations.Unique(name="USER_KEY_IDX", members={"user","key"})
-@Named("User Setting")
-public class UserSettingJdo extends SettingAbstractJdo implements UserSetting {
-
-
- private String user;
-
- @javax.jdo.annotations.Column(length=JdoColumnLength.USER_NAME)
- @javax.jdo.annotations.PrimaryKey
- @Title(sequence="5", append=": ")
- @MemberOrder(sequence = "5")
- public String getUser() {
- return user;
- }
-
- public void setUser(final String user) {
- this.user = user;
- }
-
- // //////////////////////////////////////
-
- @javax.jdo.annotations.Column(length=JdoColumnLength.SettingAbstract.SETTING_KEY)
- @javax.jdo.annotations.PrimaryKey
- @Title(sequence="10")
- @Override
- public String getKey() {
- return super.getKey();
- }
- @Override
- public void setKey(String key) {
- super.setKey(key);
- }
-
- // //////////////////////////////////////
-
- @javax.jdo.annotations.Column(length=JdoColumnLength.DESCRIPTION)
- @javax.jdo.annotations.Persistent
- @Override
- public String getDescription() {
- return super.getDescription();
- }
- @Override
- public void setDescription(String description) {
- super.setDescription(description);
- }
-
- // //////////////////////////////////////
-
- @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.SettingAbstract.VALUE_RAW)
- @javax.jdo.annotations.Persistent
- @Title(prepend=" = ", sequence="30")
- @Override
- public String getValueRaw() {
- return super.getValueRaw();
- }
- @Override
- public void setValueRaw(String valueAsRaw) {
- super.setValueRaw(valueAsRaw);
- }
-
- // //////////////////////////////////////
-
- @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.SettingAbstract.SETTING_TYPE)
- @javax.jdo.annotations.Persistent
- @Override
- public SettingType getType() {
- return super.getType();
- }
- @Override
- public void setType(SettingType type) {
- super.setType(type);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingJdoPK.java
----------------------------------------------------------------------
diff --git a/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingJdoPK.java b/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingJdoPK.java
deleted file mode 100644
index 13a20ed..0000000
--- a/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingJdoPK.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.objectstore.jdo.applib.service.settings;
-
-import java.io.Serializable;
-import java.util.StringTokenizer;
-
-/**
- * @see http://www.datanucleus.org/products/datanucleus/jdo/primary_key.html
- */
-public class UserSettingJdoPK implements Serializable
-{
- private static final long serialVersionUID = 1L;
-
-
- public String user;
- public String key;
-
- public UserSettingJdoPK ()
- {
- }
-
- public String getUser() {
- return user;
- }
-
- public void setUser(String user) {
- this.user = user;
- }
-
- public String getKey() {
- return key;
- }
- public void setKey(String key) {
- this.key = key;
- }
-
-
- /**
- * Constructor accepting same input as generated by toString().
- */
- public UserSettingJdoPK(String value)
- {
- StringTokenizer token = new StringTokenizer (value, ";;");
- token.nextToken(); // className
- this.setUser(token.nextToken()); // user
- this.setKey(token.nextToken()); // key
- }
-
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
- if (!(obj instanceof UserSettingJdoPK))
- {
- return false;
- }
- UserSettingJdoPK c = (UserSettingJdoPK)obj;
-
- return getUser().equals(c.getUser()) && getKey().equals(c.getKey());
- }
-
- public int hashCode ()
- {
- return this.getUser().hashCode() ^ this.getKey().hashCode();
- }
-
- public String toString ()
- {
- // Give output expected by String constructor
- return this.getClass().getName() + ";;" + this.getUser() + ";;" + this.getKey();
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingsServiceJdo.java
----------------------------------------------------------------------
diff --git a/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingsServiceJdo.java b/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingsServiceJdo.java
deleted file mode 100644
index 21ba8b9..0000000
--- a/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingsServiceJdo.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.isis.objectstore.jdo.applib.service.settings;
-
-import java.util.List;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
-import org.joda.time.LocalDate;
-
-import org.apache.isis.applib.AbstractService;
-import org.apache.isis.applib.annotation.MemberOrder;
-import org.apache.isis.applib.annotation.Named;
-import org.apache.isis.applib.annotation.Optional;
-import org.apache.isis.applib.query.QueryDefault;
-import org.apache.isis.applib.services.settings.SettingAbstract;
-import org.apache.isis.applib.services.settings.SettingType;
-import org.apache.isis.applib.services.settings.UserSetting;
-import org.apache.isis.applib.services.settings.UserSettingsService;
-import org.apache.isis.applib.services.settings.UserSettingsServiceRW;
-
-/**
- * An implementation of {@link UserSettingsService} that persists settings
- * as entities into a JDO-backed database.
- */
-@Named("User Settings")
-public class UserSettingsServiceJdo extends AbstractService implements UserSettingsServiceRW {
-
- @Override
- public UserSetting find(
- @Named("User") String user,
- @Named("Key") String key) {
- return firstMatch(
- new QueryDefault<UserSettingJdo>(UserSettingJdo.class,
- "findByUserAndKey",
- "user",user,
- "key", key));
- }
-
-
- // //////////////////////////////////////
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public List<UserSetting> listAllFor(String user) {
- return (List)allMatches(
- new QueryDefault<UserSettingJdo>(UserSettingJdo.class,
- "findByUser",
- "user", user));
- }
- public List<String> choices0ListAllFor() {
- return existingUsers();
- }
-
- private List<String> existingUsers() {
- final List<UserSetting> listAll = listAll();
- return Lists.newArrayList(Sets.newTreeSet(Iterables.transform(listAll, GET_USER)));
- }
-
- private final static Function<UserSetting, String> GET_USER = new Function<UserSetting, String>() {
- public String apply(UserSetting input) {
- return input.getUser();
- }
- };
-
- // //////////////////////////////////////
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public List<UserSetting> listAll() {
- return (List)allMatches(
- new QueryDefault<UserSettingJdo>(UserSettingJdo.class,
- "findAll"));
- }
-
-
- // //////////////////////////////////////
-
- @MemberOrder(sequence="10")
- public UserSettingJdo newString(
- @Named("User") String user,
- @Named("Key") String key,
- @Named("Description") @Optional String description,
- @Named("Value") String value) {
- return newSetting(user, key, description, SettingType.STRING, value);
- }
- public String default0NewString() {
- return getContainer().getUser().getName();
- }
-
- @MemberOrder(sequence="11")
- public UserSettingJdo newInt(
- @Named("User") String user,
- @Named("Key") String key,
- @Named("Description") @Optional String description,
- @Named("Value") Integer value) {
- return newSetting(user, key, description, SettingType.INT, value.toString());
- }
- public String default0NewInt() {
- return getContainer().getUser().getName();
- }
-
- @MemberOrder(sequence="12")
- public UserSettingJdo newLong(
- @Named("User") String user,
- @Named("Key") String key,
- @Named("Description") @Optional String description,
- @Named("Value") Long value) {
- return newSetting(user, key, description, SettingType.LONG, value.toString());
- }
- public String default0NewLong() {
- return getContainer().getUser().getName();
- }
-
- @MemberOrder(sequence="13")
- public UserSettingJdo newLocalDate(
- @Named("User") String user,
- @Named("Key") String key,
- @Named("Description") @Optional String description,
- @Named("Value") LocalDate value) {
- return newSetting(user, key, description, SettingType.LOCAL_DATE, value.toString(SettingAbstract.DATE_FORMATTER));
- }
- public String default0NewLocalDate() {
- return getContainer().getUser().getName();
- }
-
- @MemberOrder(sequence="14")
- public UserSettingJdo newBoolean(
- @Named("User") String user,
- @Named("Key") String key,
- @Named("Description") @Optional String description,
- @Named("Value") @Optional Boolean value) {
- return newSetting(user, key, description, SettingType.BOOLEAN, new Boolean(value != null && value).toString());
- }
- public String default0NewBoolean() {
- return getContainer().getUser().getName();
- }
-
- private UserSettingJdo newSetting(
- String user, String key, String description, SettingType settingType, final String valueRaw) {
- final UserSettingJdo setting = newTransientInstance(UserSettingJdo.class);
- setting.setUser(user);
- setting.setKey(key);
- setting.setType(settingType);
- setting.setDescription(description);
- setting.setValueRaw(valueRaw);
- persist(setting);
- return setting;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingsServiceJdoHidden.java
----------------------------------------------------------------------
diff --git a/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingsServiceJdoHidden.java b/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingsServiceJdoHidden.java
deleted file mode 100644
index a1f2595..0000000
--- a/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/UserSettingsServiceJdoHidden.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.isis.objectstore.jdo.applib.service.settings;
-
-import java.util.List;
-
-import org.joda.time.LocalDate;
-
-import org.apache.isis.applib.annotation.Hidden;
-import org.apache.isis.applib.services.settings.UserSetting;
-
-/**
- * An implementation intended to be hidden in the UI, and delegated to by other services.
- */
-public class UserSettingsServiceJdoHidden extends UserSettingsServiceJdo {
-
- @Hidden
- @Override
- public UserSetting find(String user, String key) {
- return super.find(user, key);
- }
-
- // //////////////////////////////////////
-
- @Hidden
- @Override
- public List<UserSetting> listAll() {
- return super.listAll();
- }
-
- @Hidden
- @Override
- public List<UserSetting> listAllFor(String user) {
- return super.listAllFor(user);
- }
-
- // //////////////////////////////////////
-
- @Hidden
- @Override
- public UserSettingJdo newString(String user, String key, String description, String value) {
- return super.newString(user, key, description, value);
- }
-
- @Hidden
- @Override
- public UserSettingJdo newInt(String user, String key, String description, Integer value) {
- return super.newInt(user, key, description, value);
- }
-
- @Hidden
- @Override
- public UserSettingJdo newLong(String user, String key, String description, Long value) {
- return super.newLong(user, key, description, value);
- }
-
- @Hidden
- @Override
- public UserSettingJdo newLocalDate(String user, String key, String description, LocalDate value) {
- return super.newLocalDate(user, key, description, value);
- }
-
- @Hidden
- @Override
- public UserSettingJdo newBoolean(String user, String key, String description, Boolean value) {
- return super.newBoolean(user, key, description, value);
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/pom.xml
----------------------------------------------------------------------
diff --git a/core/module-settings/pom.xml b/core/module-settings/pom.xml
deleted file mode 100644
index 677f227..0000000
--- a/core/module-settings/pom.xml
+++ /dev/null
@@ -1,94 +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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-settings</artifactId>
- <packaging>pom</packaging>
-
- <name>Isis Module: App and User Settings</name>
- <description>
- Application and user settings
- </description>
-
- <properties>
- <siteBaseDir>..</siteBaseDir>
- <relativeUrl>module-settings/</relativeUrl>
- </properties>
-
- <url>http://isis.apache.org/${relativeUrl}</url>
-
- <dependencyManagement>
- <dependencies>
-
- <dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-settings-applib</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-settings-applib</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- <scope>test</scope>
- <type>test-jar</type>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-settings-impl-jdo</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-settings-impl-jdo</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- <scope>test</scope>
- <type>test-jar</type>
- </dependency>
-
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-applib</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-unittestsupport</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <modules>
- <module>applib</module>
- <module>impl-jdo</module>
- </modules>
-
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-audit-jdo/.gitignore
----------------------------------------------------------------------
diff --git a/mothballed/core/module-audit-jdo/.gitignore b/mothballed/core/module-audit-jdo/.gitignore
new file mode 100644
index 0000000..a48e45b
--- /dev/null
+++ b/mothballed/core/module-audit-jdo/.gitignore
@@ -0,0 +1 @@
+/target-ide
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-audit-jdo/pom.xml
----------------------------------------------------------------------
diff --git a/mothballed/core/module-audit-jdo/pom.xml b/mothballed/core/module-audit-jdo/pom.xml
new file mode 100644
index 0000000..cebf10c
--- /dev/null
+++ b/mothballed/core/module-audit-jdo/pom.xml
@@ -0,0 +1,149 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-audit-jdo</artifactId>
+
+ <name>Isis Module: Audit (JDO Implementation)</name>
+ <description>
+ AuditingService implementation that persists audit entries to
+ database (via JDO objectstore).
+ </description>
+
+ <properties>
+ <siteBaseDir>..</siteBaseDir>
+ <relativeUrl>module-audit/</relativeUrl>
+ </properties>
+
+ <url>http://isis.apache.org/${relativeUrl}</url>
+
+ <build>
+ <resources>
+ <resource>
+ <filtering>false</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ <resource>
+ <filtering>false</filtering>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-maven-plugin</artifactId>
+ <version>${datanucleus-maven-plugin.version}</version>
+ <configuration>
+ <fork>false</fork>
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>enhance</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ org.datanucleus
+ </groupId>
+ <artifactId>
+ datanucleus-maven-plugin
+ </artifactId>
+ <versionRange>
+ [3.2.0-release,)
+ </versionRange>
+ <goals>
+ <goal>enhance</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-applib</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-unittestsupport</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+
+ <!-- DataNucleus (jdo-api, and for enhancer) -->
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-accessplatform-jdo-rdbms</artifactId>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-jodatime</artifactId>
+ </dependency>
+
+ </dependencies>
+
+
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-audit-jdo/src/main/java/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/mothballed/core/module-audit-jdo/src/main/java/META-INF/persistence.xml b/mothballed/core/module-audit-jdo/src/main/java/META-INF/persistence.xml
new file mode 100644
index 0000000..ded7c39
--- /dev/null
+++ b/mothballed/core/module-audit-jdo/src/main/java/META-INF/persistence.xml
@@ -0,0 +1,26 @@
+<?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.
+-->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
+
+ <persistence-unit name="isis-module-audit-jdo">
+ </persistence-unit>
+</persistence>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditEntryJdo.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditEntryJdo.java b/mothballed/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditEntryJdo.java
new file mode 100644
index 0000000..05592db
--- /dev/null
+++ b/mothballed/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditEntryJdo.java
@@ -0,0 +1,359 @@
+/*
+ * 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.
+ */
+package org.apache.isis.objectstore.jdo.applib.service.audit;
+
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.UUID;
+
+import javax.jdo.annotations.IdentityType;
+import javax.jdo.annotations.Index;
+import javax.jdo.annotations.Indices;
+
+import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.annotation.ActionSemantics;
+import org.apache.isis.applib.annotation.ActionSemantics.Of;
+import org.apache.isis.applib.annotation.Disabled;
+import org.apache.isis.applib.annotation.Hidden;
+import org.apache.isis.applib.annotation.Immutable;
+import org.apache.isis.applib.annotation.MemberGroupLayout;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.annotation.ObjectType;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.annotation.TypicalLength;
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.applib.services.HasTransactionId;
+import org.apache.isis.applib.services.bookmark.Bookmark;
+import org.apache.isis.applib.services.bookmark.BookmarkService;
+import org.apache.isis.applib.util.ObjectContracts;
+import org.apache.isis.applib.util.TitleBuffer;
+import org.apache.isis.objectstore.jdo.applib.service.DomainChangeJdoAbstract;
+import org.apache.isis.objectstore.jdo.applib.service.JdoColumnLength;
+import org.apache.isis.objectstore.jdo.applib.service.Util;
+
+@javax.jdo.annotations.PersistenceCapable(
+ identityType=IdentityType.DATASTORE,
+ table="IsisAuditEntry")
+@javax.jdo.annotations.DatastoreIdentity(
+ strategy=javax.jdo.annotations.IdGeneratorStrategy.IDENTITY,
+ column="id")
+@javax.jdo.annotations.Queries( {
+ @javax.jdo.annotations.Query(
+ name="findByTransactionId", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
+ + "WHERE transactionId == :transactionId"),
+ @javax.jdo.annotations.Query(
+ name="findByTargetAndTimestampBetween", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
+ + "WHERE targetStr == :targetStr "
+ + "&& timestamp >= :from "
+ + "&& timestamp <= :to "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findByTargetAndTimestampAfter", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
+ + "WHERE targetStr == :targetStr "
+ + "&& timestamp >= :from "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findByTargetAndTimestampBefore", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
+ + "WHERE targetStr == :targetStr "
+ + "&& timestamp <= :to "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findByTarget", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
+ + "WHERE targetStr == :targetStr "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findByTimestampBetween", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
+ + "WHERE timestamp >= :from "
+ + "&& timestamp <= :to "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findByTimestampAfter", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
+ + "WHERE timestamp >= :from "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findByTimestampBefore", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
+ + "WHERE timestamp <= :to "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="find", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
+ + "ORDER BY timestamp DESC")
+})
+@Indices({
+ @Index(name="IsisAuditEntry_ak", unique="true",
+ columns={
+ @javax.jdo.annotations.Column(name="transactionId"),
+ @javax.jdo.annotations.Column(name="target"),
+ @javax.jdo.annotations.Column(name="propertyId")
+ })
+})
+@Immutable
+@Named("Audit Entry")
+@ObjectType("IsisAuditEntry")
+@MemberGroupLayout(
+ columnSpans={6,0,6},
+ left={"Identifiers","Target"},
+ right={"Detail"})
+public class AuditEntryJdo extends DomainChangeJdoAbstract implements HasTransactionId {
+
+ public AuditEntryJdo() {
+ super(ChangeType.AUDIT_ENTRY);
+ }
+
+ // //////////////////////////////////////
+ // Identification
+ // //////////////////////////////////////
+
+ public String title() {
+ final TitleBuffer buf = new TitleBuffer();
+ buf.append(
+ new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(getTimestamp()));
+ buf.append(",", getUser());
+ buf.append(":", getTargetStr());
+ buf.append(" ", getMemberIdentifier());
+ return buf.toString();
+ }
+
+
+ // //////////////////////////////////////
+ // user (property)
+ // //////////////////////////////////////
+
+ private String user;
+
+ @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.USER_NAME)
+ @Hidden(where=Where.PARENTED_TABLES)
+ @MemberOrder(name="Identifiers",sequence = "10")
+ public String getUser() {
+ return user;
+ }
+
+ public void setUser(final String user) {
+ this.user = user;
+ }
+
+
+ // //////////////////////////////////////
+ // timestamp (property)
+ // //////////////////////////////////////
+
+ private Timestamp timestamp;
+
+ @javax.jdo.annotations.Column(allowsNull="false")
+ @Hidden(where=Where.PARENTED_TABLES)
+ @MemberOrder(name="Identifiers",sequence = "20")
+ public Timestamp getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(final Timestamp timestamp) {
+ this.timestamp = timestamp;
+ }
+
+
+
+
+ // //////////////////////////////////////
+ // transactionId (property)
+ // //////////////////////////////////////
+
+ private UUID transactionId;
+
+ /**
+ * The unique identifier (a GUID) of the transaction in which this audit entry was persisted.
+ *
+ * <p>
+ * The combination of ({@link #getTransactionId() transactionId}, {@link #getTargetStr() target}, {@link #getPropertyId() propertyId} ) makes up the
+ * (non-enforced) alternative key.
+ */
+ @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.TRANSACTION_ID)
+ @TypicalLength(36)
+ @MemberOrder(name="Identifiers",sequence = "30")
+ @Hidden(where=Where.PARENTED_TABLES)
+ @Disabled
+ @Override
+ public UUID getTransactionId() {
+ return transactionId;
+ }
+
+ @Override
+ public void setTransactionId(final UUID transactionId) {
+ this.transactionId = transactionId;
+ }
+
+
+ // //////////////////////////////////////
+ // targetClass (property)
+ // //////////////////////////////////////
+
+ private String targetClass;
+
+ @javax.jdo.annotations.Column(allowsNull="true", length=JdoColumnLength.TARGET_CLASS)
+ @TypicalLength(30)
+ @MemberOrder(name="Target", sequence = "10")
+ @Named("Class")
+ public String getTargetClass() {
+ return targetClass;
+ }
+
+ public void setTargetClass(final String targetClass) {
+ this.targetClass = Util.abbreviated(targetClass, JdoColumnLength.TARGET_CLASS);
+ }
+
+
+ // //////////////////////////////////////
+ // target (property)
+ // openTargetObject (action)
+ // //////////////////////////////////////
+
+ private String targetStr;
+
+ @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.BOOKMARK, name="target")
+ @Named("Object")
+ @MemberOrder(name="Target", sequence="30")
+ public String getTargetStr() {
+ return targetStr;
+ }
+
+ public void setTargetStr(final String targetStr) {
+ this.targetStr = targetStr;
+ }
+
+
+ // //////////////////////////////////////
+ // memberIdentifier (property)
+ // //////////////////////////////////////
+
+ private String memberIdentifier;
+
+ /**
+ * This is the fully-qualified class and property Id, as per
+ * {@link Identifier#toClassAndNameIdentityString()}.
+ */
+ @javax.jdo.annotations.Column(allowsNull="true", length=JdoColumnLength.MEMBER_IDENTIFIER)
+ @TypicalLength(60)
+ @Hidden(where=Where.ALL_TABLES)
+ @MemberOrder(name="Detail",sequence = "1")
+ public String getMemberIdentifier() {
+ return memberIdentifier;
+ }
+
+ public void setMemberIdentifier(final String memberIdentifier) {
+ this.memberIdentifier = Util.abbreviated(memberIdentifier, JdoColumnLength.MEMBER_IDENTIFIER);
+ }
+
+
+ // //////////////////////////////////////
+ // propertyId (property)
+ // //////////////////////////////////////
+
+ private String propertyId;
+
+ /**
+ * This is the property name (without the class).
+ */
+ @javax.jdo.annotations.Column(allowsNull="true", length=JdoColumnLength.AuditEntry.PROPERTY_ID)
+ @Hidden(where=Where.NOWHERE)
+ @MemberOrder(name="Target",sequence = "20")
+ public String getPropertyId() {
+ return propertyId;
+ }
+
+ public void setPropertyId(final String propertyId) {
+ this.propertyId = Util.abbreviated(propertyId, JdoColumnLength.AuditEntry.PROPERTY_ID);
+ }
+
+
+ // //////////////////////////////////////
+ // preValue (property)
+ // //////////////////////////////////////
+
+ private String preValue;
+
+ @javax.jdo.annotations.Column(allowsNull="true", length=JdoColumnLength.AuditEntry.PROPERTY_VALUE)
+ @Hidden(where=Where.NOWHERE)
+ @MemberOrder(name="Detail",sequence = "6")
+ public String getPreValue() {
+ return preValue;
+ }
+
+ public void setPreValue(final String preValue) {
+ this.preValue = Util.abbreviated(preValue, JdoColumnLength.AuditEntry.PROPERTY_VALUE);
+ }
+
+
+ // //////////////////////////////////////
+ // postValue (property)
+ // //////////////////////////////////////
+
+ private String postValue;
+
+ @javax.jdo.annotations.Column(allowsNull="true", length=JdoColumnLength.AuditEntry.PROPERTY_VALUE)
+ @Hidden(where=Where.NOWHERE)
+ @MemberOrder(name="Detail",sequence = "7")
+ public String getPostValue() {
+ return postValue;
+ }
+
+ public void setPostValue(final String postValue) {
+ this.postValue = Util.abbreviated(postValue, JdoColumnLength.AuditEntry.PROPERTY_VALUE);
+ }
+
+
+
+ // //////////////////////////////////////
+ // toString
+ // //////////////////////////////////////
+
+ @Override
+ public String toString() {
+ return ObjectContracts.toString(this, "timestamp,user,targetStr,memberIdentifier");
+ }
+
+
+ // //////////////////////////////////////
+ // Injected services
+ // //////////////////////////////////////
+
+
+ @javax.inject.Inject
+ private BookmarkService bookmarkService;
+
+ @javax.inject.Inject
+ private DomainObjectContainer container;
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdo.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdo.java b/mothballed/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdo.java
new file mode 100644
index 0000000..54a0211
--- /dev/null
+++ b/mothballed/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdo.java
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+package org.apache.isis.objectstore.jdo.applib.service.audit;
+
+import java.util.UUID;
+import org.apache.isis.applib.AbstractService;
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.services.audit.AuditingService3;
+import org.apache.isis.applib.services.bookmark.Bookmark;
+
+@DomainService
+public class AuditingServiceJdo extends AbstractService implements AuditingService3 {
+
+ @Programmatic
+ public void audit(
+ final UUID transactionId, String targetClass, final Bookmark target,
+ String memberIdentifier, final String propertyId,
+ final String preValue, final String postValue,
+ final String user, final java.sql.Timestamp timestamp) {
+
+ final AuditEntryJdo auditEntry = newTransientInstance(AuditEntryJdo.class);
+
+ auditEntry.setTimestamp(timestamp);
+ auditEntry.setUser(user);
+ auditEntry.setTransactionId(transactionId);
+
+ auditEntry.setTargetClass(targetClass);
+ auditEntry.setTarget(target);
+
+ auditEntry.setMemberIdentifier(memberIdentifier);
+ auditEntry.setPropertyId(propertyId);
+
+ auditEntry.setPreValue(preValue);
+ auditEntry.setPostValue(postValue);
+
+ persistIfNotAlready(auditEntry);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdoContributions.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdoContributions.java b/mothballed/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdoContributions.java
new file mode 100644
index 0000000..9fca7d7
--- /dev/null
+++ b/mothballed/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdoContributions.java
@@ -0,0 +1,55 @@
+/**
+ * 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.
+ */
+package org.apache.isis.objectstore.jdo.applib.service.audit;
+
+import java.util.List;
+
+import org.apache.isis.applib.AbstractService;
+import org.apache.isis.applib.annotation.ActionSemantics;
+import org.apache.isis.applib.annotation.ActionSemantics.Of;
+import org.apache.isis.applib.annotation.NotContributed;
+import org.apache.isis.applib.annotation.NotContributed.As;
+import org.apache.isis.applib.annotation.NotInServiceMenu;
+import org.apache.isis.applib.annotation.Render;
+import org.apache.isis.applib.annotation.Render.Type;
+import org.apache.isis.applib.services.HasTransactionId;
+
+/**
+ * This service contributes an <tt>auditEntries</tt> collection to any implementation of
+ * {@link org.apache.isis.applib.services.HasTransactionId}, in other words commands, audit entries and published
+ * events. This allows the user to navigate to other audited effects of the given command.
+ *
+ * <p>
+ * Because this service influences the UI, it must be explicitly registered as a service
+ * (eg using <tt>isis.properties</tt>).
+ */
+public class AuditingServiceJdoContributions extends AbstractService {
+
+ @ActionSemantics(Of.SAFE)
+ @NotInServiceMenu
+ @NotContributed(As.ACTION) // ie contribute as collection
+ @Render(Type.EAGERLY)
+ public List<AuditEntryJdo> auditEntries(final HasTransactionId hasTransactionId) {
+ return auditEntryRepository.findByTransactionId(hasTransactionId.getTransactionId());
+ }
+
+ // //////////////////////////////////////
+
+ @javax.inject.Inject
+ private AuditingServiceJdoRepository auditEntryRepository;
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdoRepository.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdoRepository.java b/mothballed/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdoRepository.java
new file mode 100644
index 0000000..183628b
--- /dev/null
+++ b/mothballed/core/module-audit-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/audit/AuditingServiceJdoRepository.java
@@ -0,0 +1,129 @@
+/*
+ * 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.
+ */
+package org.apache.isis.objectstore.jdo.applib.service.audit;
+
+import java.sql.Timestamp;
+import java.util.List;
+import java.util.UUID;
+
+import org.joda.time.LocalDate;
+
+import org.apache.isis.applib.AbstractFactoryAndRepository;
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.query.Query;
+import org.apache.isis.applib.query.QueryDefault;
+import org.apache.isis.applib.services.bookmark.Bookmark;
+
+/**
+ * Provides supporting functionality for querying
+ * {@link org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo audit entry} entities.
+ *
+ * <p>
+ * This supporting service with no UI and no side-effects, and is there are no other implementations of the service,
+ * thus has been annotated with {@link org.apache.isis.applib.annotation.DomainService}. This means that there is no
+ * need to explicitly register it as a service (eg in <tt>isis.properties</tt>).
+ */
+@DomainService
+public class AuditingServiceJdoRepository extends AbstractFactoryAndRepository {
+
+ @Programmatic
+ public List<AuditEntryJdo> findByTransactionId(final UUID transactionId) {
+ return allMatches(
+ new QueryDefault<AuditEntryJdo>(AuditEntryJdo.class,
+ "findByTransactionId",
+ "transactionId", transactionId));
+ }
+
+ @Programmatic
+ public List<AuditEntryJdo> findByTargetAndFromAndTo(
+ final Bookmark target,
+ final LocalDate from,
+ final LocalDate to) {
+ final String targetStr = target.toString();
+ final Timestamp fromTs = toTimestampStartOfDayWithOffset(from, 0);
+ final Timestamp toTs = toTimestampStartOfDayWithOffset(to, 1);
+
+ final Query<AuditEntryJdo> query;
+ if(from != null) {
+ if(to != null) {
+ query = new QueryDefault<AuditEntryJdo>(AuditEntryJdo.class,
+ "findByTargetAndTimestampBetween",
+ "targetStr", targetStr,
+ "from", fromTs,
+ "to", toTs);
+ } else {
+ query = new QueryDefault<AuditEntryJdo>(AuditEntryJdo.class,
+ "findByTargetAndTimestampAfter",
+ "targetStr", targetStr,
+ "from", fromTs);
+ }
+ } else {
+ if(to != null) {
+ query = new QueryDefault<AuditEntryJdo>(AuditEntryJdo.class,
+ "findByTargetAndTimestampBefore",
+ "targetStr", targetStr,
+ "to", toTs);
+ } else {
+ query = new QueryDefault<AuditEntryJdo>(AuditEntryJdo.class,
+ "findByTarget",
+ "targetStr", targetStr);
+ }
+ }
+ return allMatches(query);
+ }
+
+ @Programmatic
+ public List<AuditEntryJdo> findByFromAndTo(
+ final LocalDate from,
+ final LocalDate to) {
+ final Timestamp fromTs = toTimestampStartOfDayWithOffset(from, 0);
+ final Timestamp toTs = toTimestampStartOfDayWithOffset(to, 1);
+
+ final Query<AuditEntryJdo> query;
+ if(from != null) {
+ if(to != null) {
+ query = new QueryDefault<AuditEntryJdo>(AuditEntryJdo.class,
+ "findByTimestampBetween",
+ "from", fromTs,
+ "to", toTs);
+ } else {
+ query = new QueryDefault<AuditEntryJdo>(AuditEntryJdo.class,
+ "findByTimestampAfter",
+ "from", fromTs);
+ }
+ } else {
+ if(to != null) {
+ query = new QueryDefault<AuditEntryJdo>(AuditEntryJdo.class,
+ "findByTimestampBefore",
+ "to", toTs);
+ } else {
+ query = new QueryDefault<AuditEntryJdo>(AuditEntryJdo.class,
+ "find");
+ }
+ }
+ return allMatches(query);
+ }
+
+ private static Timestamp toTimestampStartOfDayWithOffset(final LocalDate dt, int daysOffset) {
+ return dt!=null
+ ?new java.sql.Timestamp(dt.toDateTimeAtStartOfDay().plusDays(daysOffset).getMillis())
+ :null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-audit-jdo/src/main/resources/images/AuditEntryJdo.png
----------------------------------------------------------------------
diff --git a/mothballed/core/module-audit-jdo/src/main/resources/images/AuditEntryJdo.png b/mothballed/core/module-audit-jdo/src/main/resources/images/AuditEntryJdo.png
new file mode 100644
index 0000000..4e4352c
Binary files /dev/null and b/mothballed/core/module-audit-jdo/src/main/resources/images/AuditEntryJdo.png differ
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-command-jdo/.gitignore
----------------------------------------------------------------------
diff --git a/mothballed/core/module-command-jdo/.gitignore b/mothballed/core/module-command-jdo/.gitignore
new file mode 100644
index 0000000..a48e45b
--- /dev/null
+++ b/mothballed/core/module-command-jdo/.gitignore
@@ -0,0 +1 @@
+/target-ide
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-command-jdo/pom.xml
----------------------------------------------------------------------
diff --git a/mothballed/core/module-command-jdo/pom.xml b/mothballed/core/module-command-jdo/pom.xml
new file mode 100644
index 0000000..199308b
--- /dev/null
+++ b/mothballed/core/module-command-jdo/pom.xml
@@ -0,0 +1,162 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-command-jdo</artifactId>
+
+ <name>Isis Module: Command (JDO Implementation)</name>
+ <description>
+ CommandService and BackgroundCommandService implementations that
+ persist commands to database (via JDO objectstore) for profiling and
+ to support background command execution.
+ </description>
+
+ <properties>
+ <siteBaseDir>..</siteBaseDir>
+ <relativeUrl>module-command/</relativeUrl>
+ </properties>
+
+ <url>http://isis.apache.org/${relativeUrl}</url>
+
+ <build>
+ <resources>
+ <resource>
+ <filtering>false</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ <resource>
+ <filtering>false</filtering>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-maven-plugin</artifactId>
+ <version>${datanucleus-maven-plugin.version}</version>
+ <configuration>
+ <fork>false</fork>
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>enhance</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ org.datanucleus
+ </groupId>
+ <artifactId>
+ datanucleus-maven-plugin
+ </artifactId>
+ <versionRange>
+ [3.2.0-release,)
+ </versionRange>
+ <goals>
+ <goal>enhance</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-applib</artifactId>
+ </dependency>
+ <!-- required because provides subclass implementation of BackgroundCommandExecution -->
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-runtime</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-unittestsupport</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+
+ <!-- DataNucleus (jdo-api, and for enhancer) -->
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-accessplatform-jdo-rdbms</artifactId>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-jodatime</artifactId>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-background</artifactId>
+ <!-- optional because may not want to use BackgroundCommandExecutionFromBackgroundCommandServiceJdo -->
+ <optional>true</optional>
+ </dependency>
+
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-command-jdo/src/main/java/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/mothballed/core/module-command-jdo/src/main/java/META-INF/persistence.xml b/mothballed/core/module-command-jdo/src/main/java/META-INF/persistence.xml
new file mode 100644
index 0000000..e6b83a4
--- /dev/null
+++ b/mothballed/core/module-command-jdo/src/main/java/META-INF/persistence.xml
@@ -0,0 +1,26 @@
+<?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.
+-->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
+
+ <persistence-unit name="isis-module-command-jdo">
+ </persistence-unit>
+</persistence>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdo.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdo.java b/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdo.java
new file mode 100644
index 0000000..eba9f0a
--- /dev/null
+++ b/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdo.java
@@ -0,0 +1,89 @@
+/**
+ * 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.
+ */
+package org.apache.isis.objectstore.jdo.applib.service.background;
+
+import java.util.UUID;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.isis.applib.AbstractService;
+import org.apache.isis.applib.annotation.Command.ExecuteIn;
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.clock.Clock;
+import org.apache.isis.applib.services.background.ActionInvocationMemento;
+import org.apache.isis.applib.services.background.BackgroundCommandService;
+import org.apache.isis.applib.services.command.Command;
+import org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo;
+
+/**
+ * Persists a {@link ActionInvocationMemento memento-ized} action such that it can be executed asynchronously,
+ * for example through a Quartz scheduler (using
+ * {@link org.apache.isis.objectstore.jdo.service.BackgroundCommandExecutionFromBackgroundCommandServiceJdo}).
+ *
+ * <p>
+ * This implementation has no UI and there are no other implementations of the service API, and so it annotated
+ * with {@link org.apache.isis.applib.annotation.DomainService}. This class is implemented in the
+ * <tt>o.a.i.module:isis-module-command-jdo</tt> module. If that module is included in the classpath, it this means
+ * that this service is automatically registered; no further configuration is required.
+ *
+ * <p>
+ * (That said, do note that other services in the <tt>o.a.i.module:isis-module-command-jdo</tt> do require explicit
+ * registration as services, eg in <tt>isis.properties</tt>).
+ */
+@DomainService
+public class BackgroundCommandServiceJdo extends AbstractService implements BackgroundCommandService {
+
+ @SuppressWarnings("unused")
+ private static final Logger LOG = LoggerFactory.getLogger(BackgroundCommandServiceJdo.class);
+
+ @Programmatic
+ @Override
+ public void schedule(
+ final ActionInvocationMemento aim,
+ final Command parentCommand,
+ final String targetClassName,
+ final String targetActionName,
+ final String targetArgs) {
+
+ final UUID transactionId = UUID.randomUUID();
+ final String user = parentCommand.getUser();
+
+ final CommandJdo backgroundCommand = newTransientInstance(CommandJdo.class);
+
+ backgroundCommand.setParent(parentCommand);
+
+ backgroundCommand.setTransactionId(transactionId);
+
+ backgroundCommand.setUser(user);
+ backgroundCommand.setTimestamp(Clock.getTimeAsJavaSqlTimestamp());
+
+ backgroundCommand.setExecuteIn(ExecuteIn.BACKGROUND);
+
+ backgroundCommand.setTargetClass(targetClassName);
+ backgroundCommand.setTargetAction(targetActionName);
+ backgroundCommand.setTargetStr(aim.getTarget().toString());
+ backgroundCommand.setMemberIdentifier(aim.getActionId());
+
+ backgroundCommand.setArguments(targetArgs);
+ backgroundCommand.setMemento(aim.asMementoString());
+
+ parentCommand.setPersistHint(true);
+
+ persist(backgroundCommand);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdoContributions.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdoContributions.java b/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdoContributions.java
new file mode 100644
index 0000000..391975f
--- /dev/null
+++ b/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdoContributions.java
@@ -0,0 +1,73 @@
+/**
+ * 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.
+ */
+package org.apache.isis.objectstore.jdo.applib.service.background;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.isis.applib.AbstractFactoryAndRepository;
+import org.apache.isis.applib.annotation.ActionSemantics;
+import org.apache.isis.applib.annotation.ActionSemantics.Of;
+import org.apache.isis.applib.annotation.NotContributed;
+import org.apache.isis.applib.annotation.NotContributed.As;
+import org.apache.isis.applib.annotation.NotInServiceMenu;
+import org.apache.isis.applib.annotation.Render;
+import org.apache.isis.applib.annotation.Render.Type;
+import org.apache.isis.applib.services.command.Command;
+import org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo;
+
+
+/**
+ * This service contributes a <tt>childCommands</tt> collection and a <tt>sublingCommands</tt> collection to
+ * any {@link CommandJdo} entity.
+ *
+ * <p>
+ * Because this service influences the UI, it must be explicitly registered as a service
+ * (eg using <tt>isis.properties</tt>).
+ */
+public class BackgroundCommandServiceJdoContributions extends AbstractFactoryAndRepository {
+
+ @ActionSemantics(Of.SAFE)
+ @NotInServiceMenu
+ @NotContributed(As.ACTION)
+ @Render(Type.EAGERLY)
+ public List<CommandJdo> childCommands(final CommandJdo parent) {
+ return backgroundCommandRepository.findByParent(parent);
+ }
+
+ @ActionSemantics(Of.SAFE)
+ @NotInServiceMenu
+ @NotContributed(As.ACTION)
+ @Render(Type.EAGERLY)
+ public List<CommandJdo> siblingCommands(final CommandJdo siblingCommand) {
+ final Command parent = siblingCommand.getParent();
+ if(parent == null || !(parent instanceof CommandJdo)) {
+ return Collections.emptyList();
+ }
+ final CommandJdo parentJdo = (CommandJdo) parent;
+ final List<CommandJdo> siblingCommands = backgroundCommandRepository.findByParent(parentJdo);
+ siblingCommands.remove(siblingCommand);
+ return siblingCommands;
+ }
+
+
+ // //////////////////////////////////////
+
+ @javax.inject.Inject
+ private BackgroundCommandServiceJdoRepository backgroundCommandRepository;
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdoRepository.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdoRepository.java b/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdoRepository.java
new file mode 100644
index 0000000..e41753e
--- /dev/null
+++ b/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/background/BackgroundCommandServiceJdoRepository.java
@@ -0,0 +1,70 @@
+/**
+ * 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.
+ */
+package org.apache.isis.objectstore.jdo.applib.service.background;
+
+import java.util.List;
+import java.util.UUID;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.AbstractFactoryAndRepository;
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.query.QueryDefault;
+import org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo;
+
+/**
+ * Provides supporting functionality for querying
+ * {@link org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo command} entities that have been persisted
+ * to execute in the background.
+ *
+ * <p>
+ * This supporting service with no UI and no side-effects, and is there are no other implementations of the service,
+ * thus has been annotated with {@link org.apache.isis.applib.annotation.DomainService}. This means that there is no
+ * need to explicitly register it as a service (eg in <tt>isis.properties</tt>).
+ */
+@DomainService
+public class BackgroundCommandServiceJdoRepository extends AbstractFactoryAndRepository {
+
+ @SuppressWarnings("unused")
+ private static final Logger LOG = LoggerFactory.getLogger(BackgroundCommandServiceJdoRepository.class);
+
+ @Programmatic
+ public List<CommandJdo> findByTransactionId(final UUID transactionId) {
+ return allMatches(
+ new QueryDefault<CommandJdo>(CommandJdo.class,
+ "findBackgroundCommandByTransactionId",
+ "transactionId", transactionId));
+ }
+
+ @Programmatic
+ public List<CommandJdo> findByParent(CommandJdo parent) {
+ return allMatches(
+ new QueryDefault<CommandJdo>(CommandJdo.class,
+ "findBackgroundCommandsByParent",
+ "parent", parent));
+ }
+
+ @Programmatic
+ public List<CommandJdo> findBackgroundCommandsNotYetStarted() {
+ return allMatches(
+ new QueryDefault<CommandJdo>(CommandJdo.class,
+ "findBackgroundCommandsNotYetStarted"));
+ }
+
+}
[3/7] ISIS-887: mothballed the core/module* modules,
moved to mothballed/core/module*
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdo.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdo.java b/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdo.java
new file mode 100644
index 0000000..fb5fabc
--- /dev/null
+++ b/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdo.java
@@ -0,0 +1,740 @@
+/**
+ * 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.
+ */
+package org.apache.isis.objectstore.jdo.applib.service.command;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.jdo.annotations.IdentityType;
+import javax.jdo.annotations.NotPersistent;
+
+import com.google.common.collect.Maps;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.applib.annotation.ActionSemantics;
+import org.apache.isis.applib.annotation.ActionSemantics.Of;
+import org.apache.isis.applib.annotation.Bulk;
+import org.apache.isis.applib.annotation.Command.ExecuteIn;
+import org.apache.isis.applib.annotation.Command.Persistence;
+import org.apache.isis.applib.annotation.Hidden;
+import org.apache.isis.applib.annotation.Immutable;
+import org.apache.isis.applib.annotation.Mandatory;
+import org.apache.isis.applib.annotation.MemberGroupLayout;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.MultiLine;
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.annotation.ObjectType;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.annotation.TypicalLength;
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.applib.services.bookmark.Bookmark;
+import org.apache.isis.applib.services.bookmark.BookmarkService;
+import org.apache.isis.applib.services.command.Command;
+import org.apache.isis.applib.util.ObjectContracts;
+import org.apache.isis.applib.util.TitleBuffer;
+import org.apache.isis.objectstore.jdo.applib.service.DomainChangeJdoAbstract;
+import org.apache.isis.objectstore.jdo.applib.service.JdoColumnLength;
+import org.apache.isis.objectstore.jdo.applib.service.Util;
+import org.apache.isis.objectstore.jdo.applib.service.DomainChangeJdoAbstract.ChangeType;
+
+
+@javax.jdo.annotations.PersistenceCapable(
+ identityType=IdentityType.APPLICATION,
+ table="IsisCommand")
+@javax.jdo.annotations.Queries( {
+ @javax.jdo.annotations.Query(
+ name="findByTransactionId", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo "
+ + "WHERE transactionId == :transactionId "),
+ @javax.jdo.annotations.Query(
+ name="findBackgroundCommandByTransactionId", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo "
+ + "WHERE transactionId == :transactionId "
+ + "&& executeIn == 'BACKGROUND'"),
+ @javax.jdo.annotations.Query(
+ name="findBackgroundCommandsByParent", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo "
+ + "WHERE parent == :parent "
+ + "&& executeIn == 'BACKGROUND'"),
+ @javax.jdo.annotations.Query(
+ name="findBackgroundCommandsNotYetStarted", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo "
+ + "WHERE executeIn == 'BACKGROUND' "
+ + "&& startedAt == null "
+ + "ORDER BY timestamp ASC "
+ ),
+ @javax.jdo.annotations.Query(
+ name="findCurrent", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo "
+ + "WHERE completedAt == null "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findCompleted", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo "
+ + "WHERE completedAt != null "
+ + "&& executeIn == 'FOREGROUND' "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findByTargetAndTimestampBetween", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
+ + "WHERE targetStr == :targetStr "
+ + "&& timestamp >= :from "
+ + "&& timestamp <= :to "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findByTargetAndTimestampAfter", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
+ + "WHERE targetStr == :targetStr "
+ + "&& timestamp >= :from "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findByTargetAndTimestampBefore", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
+ + "WHERE targetStr == :targetStr "
+ + "&& timestamp <= :to "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findByTarget", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
+ + "WHERE targetStr == :targetStr "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findByTimestampBetween", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
+ + "WHERE timestamp >= :from "
+ + "&& timestamp <= :to "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findByTimestampAfter", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
+ + "WHERE timestamp >= :from "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findByTimestampBefore", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
+ + "WHERE timestamp <= :to "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="find", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo "
+ + "ORDER BY timestamp DESC")
+})
+@ObjectType("IsisCommand")
+@MemberGroupLayout(
+ columnSpans={6,0,6,12},
+ left={"Identifiers","Target","Notes"},
+ right={"Detail","Timings","Results"})
+@Named("Command")
+@Immutable
+public class CommandJdo extends DomainChangeJdoAbstract implements Command {
+
+ @SuppressWarnings("unused")
+ private static final Logger LOG = LoggerFactory.getLogger(CommandJdo.class);
+
+ public CommandJdo() {
+ super(ChangeType.COMMAND);
+ }
+
+
+
+ // //////////////////////////////////////
+ // Identification
+ // //////////////////////////////////////
+
+ public String title() {
+ final TitleBuffer buf = new TitleBuffer();
+ buf.append(getTargetStr());
+ buf.append(" ").append(getMemberIdentifier());
+ return buf.toString();
+ }
+
+
+
+ // //////////////////////////////////////
+ // user (property)
+ // //////////////////////////////////////
+
+ private String user;
+
+ @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.USER_NAME)
+ @MemberOrder(name="Identifiers", sequence = "10")
+ public String getUser() {
+ return user;
+ }
+
+ public void setUser(final String user) {
+ this.user = user;
+ }
+
+
+
+ // //////////////////////////////////////
+ // timestamp (property)
+ // //////////////////////////////////////
+
+ private Timestamp timestamp;
+
+ /**
+ * The date/time at which this action was created.
+ */
+ @javax.jdo.annotations.Persistent
+ @javax.jdo.annotations.Column(allowsNull="false")
+ @MemberOrder(name="Identifiers", sequence = "20")
+ public Timestamp getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * <b>NOT API</b>: intended to be called only by the framework.
+ */
+ public void setTimestamp(final Timestamp timestamp) {
+ this.timestamp = timestamp;
+ }
+
+
+ // //////////////////////////////////////
+ // executor (property)
+ // //////////////////////////////////////
+
+ private Executor executor;
+
+ @Programmatic
+ @javax.jdo.annotations.NotPersistent
+ @Override
+ public Executor getExecutor() {
+ return executor;
+ }
+
+ @Override
+ public void setExecutor(Executor nature) {
+ this.executor = nature;
+ }
+
+ // //////////////////////////////////////
+ // executeIn (property)
+ // //////////////////////////////////////
+
+ private ExecuteIn executeIn;
+
+ /**
+ * Whether the action was invoked explicitly by the user, or scheduled as a background
+ * task, or as for some other reason, eg a side-effect of rendering an object due to
+ * get-after-post).
+ */
+ @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.Command.EXECUTE_IN)
+ @MemberOrder(name="Identifiers", sequence = "32")
+ @Override
+ public ExecuteIn getExecuteIn() {
+ return executeIn;
+ }
+
+ /**
+ * <b>NOT API</b>: intended to be called only by the framework.
+ */
+ @Override
+ public void setExecuteIn(ExecuteIn nature) {
+ this.executeIn = nature;
+ }
+
+
+ // //////////////////////////////////////
+ // parent (property)
+ // //////////////////////////////////////
+
+ private Command parent;
+
+ @Override
+ @javax.jdo.annotations.Persistent
+ @javax.jdo.annotations.Column(name="parentTransactionId", allowsNull="true")
+ @Hidden(where=Where.PARENTED_TABLES)
+ @MemberOrder(name="Identifiers",sequence = "40")
+ public Command getParent() {
+ return parent;
+ }
+
+ @Override
+ public void setParent(Command parent) {
+ this.parent = parent;
+ }
+
+
+ // //////////////////////////////////////
+ // transactionId (property)
+ // //////////////////////////////////////
+
+
+ private UUID transactionId;
+
+ /**
+ * The unique identifier (a GUID) of the transaction in which this command occurred.
+ */
+ @javax.jdo.annotations.PrimaryKey
+ @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.TRANSACTION_ID)
+ @TypicalLength(JdoColumnLength.TRANSACTION_ID)
+ @MemberOrder(name="Identifiers",sequence = "50")
+ @Override
+ public UUID getTransactionId() {
+ return transactionId;
+ }
+
+ /**
+ * <b>NOT API</b>: intended to be called only by the framework.
+ *
+ * <p>
+ * Implementation notes: copied over from the Isis transaction when the command is persisted.
+ */
+ @Override
+ public void setTransactionId(final UUID transactionId) {
+ this.transactionId = transactionId;
+ }
+
+
+ // //////////////////////////////////////
+ // targetClass (property)
+ // //////////////////////////////////////
+
+ private String targetClass;
+
+ @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.TARGET_CLASS)
+ @TypicalLength(30)
+ @MemberOrder(name="Target", sequence = "10")
+ @Named("Class")
+ public String getTargetClass() {
+ return targetClass;
+ }
+
+ public void setTargetClass(final String targetClass) {
+ this.targetClass = Util.abbreviated(targetClass, JdoColumnLength.TARGET_CLASS);
+ }
+
+
+ // //////////////////////////////////////
+ // targetAction (property)
+ // //////////////////////////////////////
+
+ private String targetAction;
+
+ @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.TARGET_ACTION)
+ @Mandatory
+ @Hidden(where=Where.NOWHERE)
+ @TypicalLength(30)
+ @MemberOrder(name="Target", sequence = "20")
+ @Named("Action")
+ public String getTargetAction() {
+ return targetAction;
+ }
+
+ public void setTargetAction(final String targetAction) {
+ this.targetAction = Util.abbreviated(targetAction, JdoColumnLength.TARGET_ACTION);
+ }
+
+
+ // //////////////////////////////////////
+ // target (property)
+ // openTargetObject (action)
+ // //////////////////////////////////////
+
+ private String targetStr;
+ @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.BOOKMARK, name="target")
+ @Hidden(where=Where.ALL_TABLES)
+ @MemberOrder(name="Target", sequence="30")
+ @Named("Object")
+ public String getTargetStr() {
+ return targetStr;
+ }
+
+ public void setTargetStr(final String targetStr) {
+ this.targetStr = targetStr;
+ }
+
+ // //////////////////////////////////////
+ // arguments (property)
+ // //////////////////////////////////////
+
+ private String arguments;
+
+ @javax.jdo.annotations.Column(allowsNull="true", jdbcType="CLOB")
+ @MultiLine(numberOfLines=7)
+ @Hidden(where=Where.ALL_TABLES)
+ @MemberOrder(name="Target",sequence = "40")
+ public String getArguments() {
+ return arguments;
+ }
+
+ public void setArguments(final String arguments) {
+ this.arguments = arguments;
+ }
+
+
+
+ // //////////////////////////////////////
+ // memberIdentifier (property)
+ // //////////////////////////////////////
+
+ private String memberIdentifier;
+
+ @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.MEMBER_IDENTIFIER)
+ @TypicalLength(60)
+ @Hidden(where=Where.ALL_TABLES)
+ @MemberOrder(name="Detail",sequence = "1")
+ public String getMemberIdentifier() {
+ return memberIdentifier;
+ }
+
+ public void setMemberIdentifier(final String memberIdentifier) {
+ this.memberIdentifier = Util.abbreviated(memberIdentifier, JdoColumnLength.MEMBER_IDENTIFIER);
+ }
+
+
+
+ // //////////////////////////////////////
+ // memento (property)
+ // //////////////////////////////////////
+
+ private String memento;
+
+ @javax.jdo.annotations.Column(allowsNull="true", jdbcType="CLOB")
+ @MultiLine(numberOfLines=9)
+ @Hidden(where=Where.ALL_TABLES)
+ @MemberOrder(name="Detail",sequence = "30")
+ public String getMemento() {
+ return memento;
+ }
+
+ public void setMemento(final String memento) {
+ this.memento = memento;
+ }
+
+
+
+ // //////////////////////////////////////
+ // startedAt (derived property)
+ // //////////////////////////////////////
+
+ private Timestamp startedAt;
+
+ @javax.jdo.annotations.Persistent
+ @javax.jdo.annotations.Column(allowsNull="true")
+ @MemberOrder(name="Timings", sequence = "3")
+ public Timestamp getStartedAt() {
+ return startedAt;
+ }
+
+ /**
+ * <b>NOT API</b>: intended to be called only by the framework.
+ */
+ public void setStartedAt(final Timestamp startedAt) {
+ this.startedAt = startedAt;
+ }
+
+
+
+ // //////////////////////////////////////
+ // completedAt (property)
+ // //////////////////////////////////////
+
+ private Timestamp completedAt;
+
+ /**
+ * The date/time at which this interaction completed.
+ */
+ @javax.jdo.annotations.Persistent
+ @javax.jdo.annotations.Column(allowsNull="true")
+ @MemberOrder(name="Timings", sequence = "4")
+ @Override
+ public Timestamp getCompletedAt() {
+ return completedAt;
+ }
+
+ @Override
+ public void setCompletedAt(final Timestamp completed) {
+ this.completedAt = completed;
+ }
+
+
+ // //////////////////////////////////////
+ // duration (derived property)
+ // //////////////////////////////////////
+
+ /**
+ * The number of seconds (to 3 decimal places) that this interaction lasted.
+ *
+ * <p>
+ * Populated only if it has {@link #getCompletedAt() completed}.
+ */
+ @javax.validation.constraints.Digits(integer=5, fraction=3)
+ @Named("Duration")
+ @MemberOrder(name="Timings", sequence = "7")
+ public BigDecimal getDuration() {
+ return Util.durationBetween(getStartedAt(), getCompletedAt());
+ }
+
+
+
+ // //////////////////////////////////////
+ // complete (derived property)
+ // //////////////////////////////////////
+
+
+ @javax.jdo.annotations.NotPersistent
+ @MemberOrder(name="Timings", sequence = "8")
+ @Hidden(where=Where.OBJECT_FORMS)
+ public boolean isComplete() {
+ return getCompletedAt() != null;
+ }
+
+
+
+ // //////////////////////////////////////
+ // state (derived property)
+ // //////////////////////////////////////
+
+ @javax.jdo.annotations.NotPersistent
+ @MemberOrder(name="Results",sequence = "10")
+ @Hidden(where=Where.OBJECT_FORMS)
+ @Named("Result")
+ public String getResultSummary() {
+ if(getCompletedAt() == null) {
+ return "";
+ }
+ if(getException() != null) {
+ return "EXCEPTION";
+ }
+ if(getResultStr() != null) {
+ return "OK";
+ } else {
+ return "OK (VOID)";
+ }
+ }
+
+
+ // //////////////////////////////////////
+ // result (property)
+ // openResultObject (action)
+ // //////////////////////////////////////
+
+ @Programmatic
+ @Override
+ public Bookmark getResult() {
+ return Util.bookmarkFor(getResultStr());
+ }
+
+ @Programmatic
+ @Override
+ public void setResult(Bookmark result) {
+ setResultStr(Util.asString(result));
+ }
+
+ // //////////////////////////////////////
+
+ private String resultStr;
+
+ @javax.jdo.annotations.Column(allowsNull="true", length=JdoColumnLength.BOOKMARK, name="result")
+ @Hidden(where=Where.ALL_TABLES)
+ @Named("Result Bookmark")
+ @MemberOrder(name="Results", sequence="25")
+ public String getResultStr() {
+ return resultStr;
+ }
+
+ public void setResultStr(final String resultStr) {
+ this.resultStr = resultStr;
+ }
+
+ // //////////////////////////////////////
+
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(name="ResultStr", sequence="1")
+ @Named("Open")
+ public Object openResultObject() {
+ return Util.lookupBookmark(getResult(), bookmarkService, container);
+ }
+ public boolean hideOpenResultObject() {
+ return getResult() == null;
+ }
+
+
+ // //////////////////////////////////////
+ // exception (property)
+ // causedException (derived property)
+ // showException (associated action)
+ // //////////////////////////////////////
+
+ private String exception;
+
+ /**
+ * Stack trace of any exception that might have occurred if this interaction/transaction aborted.
+ *
+ * <p>
+ * Not visible in the UI, but accessible
+ * <p>
+ * Not part of the applib API, because the default implementation is not persistent
+ * and so there's no object that can be accessed to be annotated.
+ */
+ @javax.jdo.annotations.Column(allowsNull="true", jdbcType="CLOB")
+ @Hidden
+ @Override
+ public String getException() {
+ return exception;
+ }
+
+ @Override
+ public void setException(final String exception) {
+ this.exception = exception;
+ }
+
+
+ // //////////////////////////////////////
+
+ @javax.jdo.annotations.NotPersistent
+ @MemberOrder(name="Results",sequence = "30")
+ @Hidden(where=Where.ALL_TABLES)
+ public boolean isCausedException() {
+ return getException() != null;
+ }
+
+
+ // //////////////////////////////////////
+
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(name="causedException", sequence = "1")
+ public String showException() {
+ return getException();
+ }
+ public boolean hideShowException() {
+ return !isCausedException();
+ }
+
+
+ // //////////////////////////////////////
+ // next(...) impl
+ // //////////////////////////////////////
+
+ private final Map<String, AtomicInteger> sequenceByName = Maps.newHashMap();
+
+
+
+ @Programmatic
+ @Override
+ public int next(String sequenceName) {
+ AtomicInteger next = sequenceByName.get(sequenceName);
+ if(next == null) {
+ next = new AtomicInteger(0);
+ sequenceByName.put(sequenceName, next);
+ } else {
+ next.incrementAndGet();
+ }
+ return next.get();
+ }
+
+
+ // //////////////////////////////////////
+ // persistence (programmatic)
+ // //////////////////////////////////////
+
+ private Persistence persistence;
+
+ @javax.jdo.annotations.NotPersistent
+ @Programmatic
+ @Override
+ public Persistence getPersistence() {
+ return persistence;
+ }
+
+ @Override
+ public void setPersistence(Persistence persistence) {
+ this.persistence = persistence;
+ }
+
+
+ // //////////////////////////////////////
+ // setPersistHint (SPI impl)
+ // //////////////////////////////////////
+
+ private boolean persistHint;
+
+ @NotPersistent
+ @Programmatic
+ public boolean isPersistHint() {
+ return persistHint;
+ }
+
+ @Programmatic
+ @Override
+ public void setPersistHint(boolean persistHint) {
+ this.persistHint = persistHint;
+ }
+
+
+ // //////////////////////////////////////
+
+ @Programmatic
+ boolean shouldPersist() {
+ if(Persistence.PERSISTED == getPersistence()) {
+ return true;
+ }
+ if(Persistence.IF_HINTED == getPersistence()) {
+ return isPersistHint();
+ }
+ return false;
+ }
+
+
+
+ // //////////////////////////////////////
+ // toString
+ // //////////////////////////////////////
+
+ @Override
+ public String toString() {
+ return ObjectContracts.toString(this, "targetStr,memberIdentifier,user,startedAt,completedAt,duration,transactionId");
+ }
+
+
+
+ // //////////////////////////////////////
+ // dependencies
+ // //////////////////////////////////////
+
+
+ @javax.inject.Inject
+ private BookmarkService bookmarkService;
+
+ @javax.inject.Inject
+ private DomainObjectContainer container;
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdo.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdo.java b/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdo.java
new file mode 100644
index 0000000..45616c8
--- /dev/null
+++ b/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdo.java
@@ -0,0 +1,119 @@
+/**
+ * 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.
+ */
+package org.apache.isis.objectstore.jdo.applib.service.command;
+
+import java.util.UUID;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.AbstractService;
+import org.apache.isis.applib.annotation.Command.ExecuteIn;
+import org.apache.isis.applib.annotation.Command.Persistence;
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.clock.Clock;
+import org.apache.isis.applib.services.command.Command;
+import org.apache.isis.applib.services.command.Command.Executor;
+import org.apache.isis.applib.services.command.spi.CommandService;
+
+/**
+ *
+ */
+@DomainService
+public class CommandServiceJdo extends AbstractService implements CommandService {
+
+ @SuppressWarnings("unused")
+ private static final Logger LOG = LoggerFactory.getLogger(CommandServiceJdo.class);
+
+ /**
+ * Creates an {@link CommandJdo}, initializing its
+ * {@link Command#setExecuteIn(Command.ExecuteIn) nature} to be
+ * {@link Command.ExecuteIn#OTHER rendering}.
+ */
+ @Programmatic
+ @Override
+ public Command create() {
+ CommandJdo command = newTransientInstance(CommandJdo.class);
+ command.setExecutor(Executor.OTHER);
+ command.setPersistence(Persistence.IF_HINTED);
+ return command;
+ }
+
+ @Programmatic
+ @Override
+ public void startTransaction(final Command command, final UUID transactionId) {
+ if(command instanceof CommandJdo) {
+ // should be the case, since this service created the object in the #create() method
+ final CommandJdo commandJdo = (CommandJdo) command;
+ final UUID currentTransactionId = commandJdo.getTransactionId();
+ if(currentTransactionId != null && !currentTransactionId.equals(transactionId)) {
+ // the logic in IsisTransaction means that any subsequent transactions within a given command
+ // should reuse the xactnId of the first transaction created within that interaction.
+ throw new IllegalStateException("Attempting to set a different transactionId on command");
+ }
+ commandJdo.setTransactionId(transactionId);
+ }
+ }
+
+ @Programmatic
+ @Override
+ public void complete(final Command command) {
+ final CommandJdo commandJdo = asUserInitiatedCommandJdo(command);
+ if(commandJdo == null) {
+ return;
+ }
+ if(commandJdo.getCompletedAt() != null) {
+ // already attempted to complete.
+ // chances are, we're here as the result of a redirect following a previous exception
+ // so just ignore.
+ return;
+ }
+
+ commandJdo.setCompletedAt(Clock.getTimeAsJavaSqlTimestamp());
+ persistIfNotAlready(commandJdo);
+ }
+
+ @Override
+ public boolean persistIfPossible(Command command) {
+ if(!(command instanceof CommandJdo)) {
+ // ought not to be the case, since this service created the object in the #create() method
+ return false;
+ }
+ final CommandJdo commandJdo = (CommandJdo)command;
+ persistIfNotAlready(commandJdo);
+ return true;
+ }
+
+
+ /**
+ * Not API, also used by {@link CommandServiceJdoRepository}.
+ */
+ CommandJdo asUserInitiatedCommandJdo(final Command command) {
+ if(!(command instanceof CommandJdo)) {
+ // ought not to be the case, since this service created the object in the #create() method
+ return null;
+ }
+ if(command.getExecuteIn() != ExecuteIn.FOREGROUND) {
+ return null;
+ }
+ final CommandJdo commandJdo = (CommandJdo) command;
+ return commandJdo.shouldPersist()? commandJdo: null;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdoContributions.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdoContributions.java b/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdoContributions.java
new file mode 100644
index 0000000..6142d30
--- /dev/null
+++ b/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdoContributions.java
@@ -0,0 +1,70 @@
+/**
+ * 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.
+ */
+package org.apache.isis.objectstore.jdo.applib.service.command;
+
+import java.util.UUID;
+import org.apache.isis.applib.AbstractFactoryAndRepository;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.NotContributed;
+import org.apache.isis.applib.annotation.NotContributed.As;
+import org.apache.isis.applib.annotation.NotInServiceMenu;
+import org.apache.isis.applib.services.HasTransactionId;
+import org.apache.isis.applib.services.command.Command;
+
+
+/**
+ * This service contributes a <tt>command</tt> action to any (non-command) implementation of
+ * {@link org.apache.isis.applib.services.HasTransactionId}; that is: audit entries, and published events. Thus, it
+ * is possible to navigate from the effect back to the cause.
+ *
+ * <p>
+ * Because this service influences the UI, it must be explicitly registered as a service
+ * (eg using <tt>isis.properties</tt>).
+ */
+public class CommandServiceJdoContributions extends AbstractFactoryAndRepository {
+
+ @NotInServiceMenu
+ @NotContributed(As.ASSOCIATION) // ie contributed as an action
+ @MemberOrder(name="transactionId", sequence="1")
+ public CommandJdo command(final HasTransactionId hasTransactionId) {
+ return commandServiceRepository.findByTransactionId(hasTransactionId.getTransactionId());
+ }
+ /**
+ * Hide if the contributee is a {@link Command}, because {@link Command}s already have a
+ * {@link Command#getParent() parent} property.
+ */
+ public boolean hideCommand(final HasTransactionId hasTransactionId) {
+ return (hasTransactionId instanceof Command);
+ }
+ public String disableCommand(final HasTransactionId hasTransactionId) {
+ if(hasTransactionId == null) {
+ return "No transaction Id";
+ }
+ final UUID transactionId = hasTransactionId.getTransactionId();
+ final boolean command = commandServiceRepository.findByTransactionId(transactionId) == null;
+ return command? "No command found for transaction Id": null;
+ }
+
+
+ // //////////////////////////////////////
+
+
+ @javax.inject.Inject
+ private CommandServiceJdoRepository commandServiceRepository;
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdoRepository.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdoRepository.java b/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdoRepository.java
new file mode 100644
index 0000000..8d573a2
--- /dev/null
+++ b/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandServiceJdoRepository.java
@@ -0,0 +1,169 @@
+/**
+ * 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.
+ */
+package org.apache.isis.objectstore.jdo.applib.service.command;
+
+import java.sql.Timestamp;
+import java.util.List;
+import java.util.UUID;
+
+import org.joda.time.LocalDate;
+
+import org.apache.isis.applib.AbstractFactoryAndRepository;
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.query.Query;
+import org.apache.isis.applib.query.QueryDefault;
+import org.apache.isis.applib.services.bookmark.Bookmark;
+import org.apache.isis.applib.services.command.Command;
+import org.apache.isis.applib.services.command.CommandContext;
+
+
+/**
+ * Provides supporting functionality for querying and persisting
+ * {@link org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo command} entities.
+ *
+ * <p>
+ * This supporting service with no UI and no side-effects, and is there are no other implementations of the service,
+ * thus has been annotated with {@link org.apache.isis.applib.annotation.DomainService}. This means that there is no
+ * need to explicitly register it as a service (eg in <tt>isis.properties</tt>).
+ */
+@DomainService
+public class CommandServiceJdoRepository extends AbstractFactoryAndRepository {
+
+ @Programmatic
+ public List<CommandJdo> findByFromAndTo(
+ final LocalDate from, final LocalDate to) {
+ final Timestamp fromTs = toTimestampStartOfDayWithOffset(from, 0);
+ final Timestamp toTs = toTimestampStartOfDayWithOffset(to, 1);
+
+ final Query<CommandJdo> query;
+ if(from != null) {
+ if(to != null) {
+ query = new QueryDefault<CommandJdo>(CommandJdo.class,
+ "findByTimestampBetween",
+ "from", fromTs,
+ "to", toTs);
+ } else {
+ query = new QueryDefault<CommandJdo>(CommandJdo.class,
+ "findByTimestampAfter",
+ "from", fromTs);
+ }
+ } else {
+ if(to != null) {
+ query = new QueryDefault<CommandJdo>(CommandJdo.class,
+ "findByTimestampBefore",
+ "to", toTs);
+ } else {
+ query = new QueryDefault<CommandJdo>(CommandJdo.class,
+ "find");
+ }
+ }
+ return allMatches(query);
+ }
+
+
+ @Programmatic
+ public CommandJdo findByTransactionId(final UUID transactionId) {
+ persistCurrentCommandIfRequired();
+ return firstMatch(
+ new QueryDefault<CommandJdo>(CommandJdo.class,
+ "findByTransactionId",
+ "transactionId", transactionId));
+ }
+
+ @Programmatic
+ public List<CommandJdo> findCurrent() {
+ persistCurrentCommandIfRequired();
+ return allMatches(
+ new QueryDefault<CommandJdo>(CommandJdo.class, "findCurrent"));
+ }
+
+ @Programmatic
+ public List<CommandJdo> findCompleted() {
+ persistCurrentCommandIfRequired();
+ return allMatches(
+ new QueryDefault<CommandJdo>(CommandJdo.class, "findCompleted"));
+ }
+
+ private void persistCurrentCommandIfRequired() {
+ if(commandContext == null || commandService == null) {
+ return;
+ }
+ final Command command = commandContext.getCommand();
+ final CommandJdo commandJdo = commandService.asUserInitiatedCommandJdo(command);
+ if(commandJdo == null) {
+ return;
+ }
+ persistIfNotAlready(commandJdo);
+ }
+
+ // //////////////////////////////////////
+
+
+ @Programmatic
+ public List<CommandJdo> findByTargetAndFromAndTo(
+ final Bookmark target, final LocalDate from, final LocalDate to) {
+ final String targetStr = target.toString();
+ final Timestamp fromTs = toTimestampStartOfDayWithOffset(from, 0);
+ final Timestamp toTs = toTimestampStartOfDayWithOffset(to, 1);
+
+ final Query<CommandJdo> query;
+ if(from != null) {
+ if(to != null) {
+ query = new QueryDefault<CommandJdo>(CommandJdo.class,
+ "findByTargetAndTimestampBetween",
+ "targetStr", targetStr,
+ "from", fromTs,
+ "to", toTs);
+ } else {
+ query = new QueryDefault<CommandJdo>(CommandJdo.class,
+ "findByTargetAndTimestampAfter",
+ "targetStr", targetStr,
+ "from", fromTs);
+ }
+ } else {
+ if(to != null) {
+ query = new QueryDefault<CommandJdo>(CommandJdo.class,
+ "findByTargetAndTimestampBefore",
+ "targetStr", targetStr,
+ "to", toTs);
+ } else {
+ query = new QueryDefault<CommandJdo>(CommandJdo.class,
+ "findByTarget",
+ "targetStr", targetStr);
+ }
+ }
+ return allMatches(query);
+ }
+
+ private static Timestamp toTimestampStartOfDayWithOffset(final LocalDate dt, int daysOffset) {
+ return dt!=null
+ ?new java.sql.Timestamp(dt.toDateTimeAtStartOfDay().plusDays(daysOffset).getMillis())
+ :null;
+ }
+
+ // //////////////////////////////////////
+
+
+ @javax.inject.Inject
+ private CommandServiceJdo commandService;
+
+ @javax.inject.Inject
+ private CommandContext commandContext;
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/service/BackgroundCommandExecutionFromBackgroundCommandServiceJdo.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/service/BackgroundCommandExecutionFromBackgroundCommandServiceJdo.java b/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/service/BackgroundCommandExecutionFromBackgroundCommandServiceJdo.java
new file mode 100644
index 0000000..9c22561
--- /dev/null
+++ b/mothballed/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/service/BackgroundCommandExecutionFromBackgroundCommandServiceJdo.java
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+package org.apache.isis.objectstore.jdo.service;
+
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.services.command.Command;
+import org.apache.isis.core.runtime.services.background.BackgroundCommandExecution;
+import org.apache.isis.objectstore.jdo.applib.service.background.BackgroundCommandServiceJdoRepository;
+import org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo;
+
+/**
+ * If used, ensure that <code>org.apache.isis.module:isis-module-background</code> is also included on classpath.
+ */
+public final class BackgroundCommandExecutionFromBackgroundCommandServiceJdo extends BackgroundCommandExecution {
+
+ @SuppressWarnings("unused")
+ private final static Logger LOG = LoggerFactory.getLogger(BackgroundCommandExecutionFromBackgroundCommandServiceJdo.class);
+
+ @Override
+ protected List<? extends Command> findBackgroundCommandsToExecute() {
+ final List<CommandJdo> commands = backgroundCommandRepository.findBackgroundCommandsNotYetStarted();
+ return commands;
+ }
+
+ // //////////////////////////////////////
+
+ @javax.inject.Inject
+ private BackgroundCommandServiceJdoRepository backgroundCommandRepository;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-command-jdo/src/main/resources/images/CommandJdo.png
----------------------------------------------------------------------
diff --git a/mothballed/core/module-command-jdo/src/main/resources/images/CommandJdo.png b/mothballed/core/module-command-jdo/src/main/resources/images/CommandJdo.png
new file mode 100644
index 0000000..7545614
Binary files /dev/null and b/mothballed/core/module-command-jdo/src/main/resources/images/CommandJdo.png differ
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-command-jdo/src/test/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdoTest_next.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-command-jdo/src/test/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdoTest_next.java b/mothballed/core/module-command-jdo/src/test/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdoTest_next.java
new file mode 100644
index 0000000..b5443e2
--- /dev/null
+++ b/mothballed/core/module-command-jdo/src/test/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdoTest_next.java
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+package org.apache.isis.objectstore.jdo.applib.service.command;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+
+import org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo;
+
+public class CommandJdoTest_next {
+
+ @Test
+ public void test() {
+ CommandJdo raj = new CommandJdo();
+ assertThat(raj.next("foo"), is(0));
+ assertThat(raj.next("foo"), is(1));
+ assertThat(raj.next("bar"), is(0));
+ assertThat(raj.next("bar"), is(1));
+ assertThat(raj.next("foo"), is(2));
+ assertThat(raj.next("bar"), is(2));
+ assertThat(raj.next("bar"), is(3));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-devutils/.gitignore
----------------------------------------------------------------------
diff --git a/mothballed/core/module-devutils/.gitignore b/mothballed/core/module-devutils/.gitignore
new file mode 100644
index 0000000..a48e45b
--- /dev/null
+++ b/mothballed/core/module-devutils/.gitignore
@@ -0,0 +1 @@
+/target-ide
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-devutils/applib/.gitignore
----------------------------------------------------------------------
diff --git a/mothballed/core/module-devutils/applib/.gitignore b/mothballed/core/module-devutils/applib/.gitignore
new file mode 100644
index 0000000..a48e45b
--- /dev/null
+++ b/mothballed/core/module-devutils/applib/.gitignore
@@ -0,0 +1 @@
+/target-ide
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-devutils/applib/pom.xml
----------------------------------------------------------------------
diff --git a/mothballed/core/module-devutils/applib/pom.xml b/mothballed/core/module-devutils/applib/pom.xml
new file mode 100644
index 0000000..4e8f8f4
--- /dev/null
+++ b/mothballed/core/module-devutils/applib/pom.xml
@@ -0,0 +1,55 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-devutils</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>isis-module-devutils-applib</artifactId>
+
+ <name>Isis Module: Developer Utilities applib</name>
+ <description>
+ API for the Developer Utilities module
+ </description>
+
+ <properties>
+ <siteBaseDir>../..</siteBaseDir>
+ <relativeUrl>module-devutils/applib/</relativeUrl>
+ </properties>
+
+ <url>http://isis.apache.org/${relativeUrl}</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-applib</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-unittestsupport</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-devutils/applib/src/main/java/org/apache/isis/applib/services/devutils/DeveloperUtilitiesService.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-devutils/applib/src/main/java/org/apache/isis/applib/services/devutils/DeveloperUtilitiesService.java b/mothballed/core/module-devutils/applib/src/main/java/org/apache/isis/applib/services/devutils/DeveloperUtilitiesService.java
new file mode 100644
index 0000000..6a25cfc
--- /dev/null
+++ b/mothballed/core/module-devutils/applib/src/main/java/org/apache/isis/applib/services/devutils/DeveloperUtilitiesService.java
@@ -0,0 +1,75 @@
+/**
+ * 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.
+ */
+package org.apache.isis.applib.services.devutils;
+
+import org.apache.isis.applib.annotation.ActionSemantics;
+import org.apache.isis.applib.annotation.ActionSemantics.Of;
+import org.apache.isis.applib.annotation.Hidden;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.annotation.NotInServiceMenu;
+import org.apache.isis.applib.annotation.Prototype;
+import org.apache.isis.applib.value.Blob;
+import org.apache.isis.applib.value.Clob;
+
+@Named("Developer Utilities")
+public interface DeveloperUtilitiesService {
+
+ @MemberOrder(sequence="1")
+ @ActionSemantics(Of.SAFE)
+ @Prototype
+ public Clob downloadMetaModel();
+
+
+ /**
+ * Downloads a zip of the layout of all domain classes.
+ */
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(sequence="3")
+ @Prototype
+ public Blob downloadLayouts();
+
+ /**
+ * Rebuilds the metamodel of all registered domain services.
+ */
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(sequence="3")
+ @Prototype
+ public void refreshServices();
+
+ /**
+ * Download the JSON layout of the domain object's type.
+ */
+ @NotInServiceMenu
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(sequence="2")
+ @Prototype
+ public Clob downloadLayout(Object domainObject);
+
+ /**
+ * @deprecated - in prototype mode the Wicket viewer (at least) will automatically invalidate
+ * the Isis metamodel whenever the object is re-rendered.
+ */
+ @Deprecated
+ @Hidden
+ @NotInServiceMenu
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(sequence="99")
+ @Prototype
+ public Object refreshLayout(Object domainObject);
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-devutils/impl/.gitignore
----------------------------------------------------------------------
diff --git a/mothballed/core/module-devutils/impl/.gitignore b/mothballed/core/module-devutils/impl/.gitignore
new file mode 100644
index 0000000..a48e45b
--- /dev/null
+++ b/mothballed/core/module-devutils/impl/.gitignore
@@ -0,0 +1 @@
+/target-ide
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-devutils/impl/pom.xml
----------------------------------------------------------------------
diff --git a/mothballed/core/module-devutils/impl/pom.xml b/mothballed/core/module-devutils/impl/pom.xml
new file mode 100644
index 0000000..6b3c460
--- /dev/null
+++ b/mothballed/core/module-devutils/impl/pom.xml
@@ -0,0 +1,61 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-devutils</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>isis-module-devutils-impl</artifactId>
+
+ <name>Isis Module: Developer Utilities implementation</name>
+ <description>
+ Implementation of the Developer Utilities module
+ </description>
+
+ <properties>
+ <siteBaseDir>../..</siteBaseDir>
+ <relativeUrl>module-devutils/impl/</relativeUrl>
+ </properties>
+
+ <url>http://isis.apache.org/${relativeUrl}</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-devutils-applib</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-metamodel</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-unittestsupport</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-devutils/impl/src/main/java/org/apache/isis/core/metamodel/services/devutils/DeveloperUtilitiesServiceDefault.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-devutils/impl/src/main/java/org/apache/isis/core/metamodel/services/devutils/DeveloperUtilitiesServiceDefault.java b/mothballed/core/module-devutils/impl/src/main/java/org/apache/isis/core/metamodel/services/devutils/DeveloperUtilitiesServiceDefault.java
new file mode 100644
index 0000000..d36746b
--- /dev/null
+++ b/mothballed/core/module-devutils/impl/src/main/java/org/apache/isis/core/metamodel/services/devutils/DeveloperUtilitiesServiceDefault.java
@@ -0,0 +1,223 @@
+/*
+ * 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.
+ */
+package org.apache.isis.core.metamodel.services.devutils;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+import javax.activation.MimeType;
+import javax.activation.MimeTypeParseException;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
+import org.apache.isis.applib.FatalException;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.services.devutils.DeveloperUtilitiesService;
+import org.apache.isis.applib.value.Blob;
+import org.apache.isis.applib.value.Clob;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManagerAware;
+import org.apache.isis.core.metamodel.layoutmetadata.json.LayoutMetadataReaderFromJson;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpiAware;
+import org.apache.isis.core.metamodel.spec.feature.*;
+
+public class DeveloperUtilitiesServiceDefault implements DeveloperUtilitiesService, SpecificationLoaderSpiAware, AdapterManagerAware {
+
+
+ private final MimeType mimeTypeTextCsv;
+ private final MimeType mimeTypeApplicationZip;
+ private final MimeType mimeTypeApplicationJson;
+
+ public DeveloperUtilitiesServiceDefault() {
+ try {
+ mimeTypeTextCsv = new MimeType("text", "csv");
+ mimeTypeApplicationJson = new MimeType("application", "jzon");
+ mimeTypeApplicationZip = new MimeType("application", "zip");
+ } catch (MimeTypeParseException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ // //////////////////////////////////////
+
+
+ @Override
+ public Clob downloadMetaModel() {
+
+ final Collection<ObjectSpecification> specifications = specificationLoader.allSpecifications();
+
+ final List<MetaModelRow> rows = Lists.newArrayList();
+ for (ObjectSpecification spec : specifications) {
+ if (exclude(spec)) {
+ continue;
+ }
+ final List<ObjectAssociation> properties = spec.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.PROPERTIES);
+ for (ObjectAssociation property : properties) {
+ final OneToOneAssociation otoa = (OneToOneAssociation) property;
+ if (exclude(otoa)) {
+ continue;
+ }
+ rows.add(new MetaModelRow(spec, otoa));
+ }
+ final List<ObjectAssociation> associations = spec.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.COLLECTIONS);
+ for (ObjectAssociation collection : associations) {
+ final OneToManyAssociation otma = (OneToManyAssociation) collection;
+ if (exclude(otma)) {
+ continue;
+ }
+ rows.add(new MetaModelRow(spec, otma));
+ }
+ final List<ObjectAction> actions = spec.getObjectActions(Contributed.INCLUDED);
+ for (ObjectAction action : actions) {
+ if (exclude(action)) {
+ continue;
+ }
+ rows.add(new MetaModelRow(spec, action));
+ }
+ }
+
+ Collections.sort(rows);
+
+ final StringBuilder buf = new StringBuilder();
+ buf.append(MetaModelRow.header()).append("\n");
+ for (MetaModelRow row : rows) {
+ buf.append(row.asTextCsv()).append("\n");
+ }
+ return new Clob("metamodel.csv", mimeTypeTextCsv, buf.toString().toCharArray());
+ }
+
+ protected boolean exclude(OneToOneAssociation property) {
+ return false;
+ }
+
+ protected boolean exclude(OneToManyAssociation collection) {
+ return false;
+ }
+
+ protected boolean exclude(ObjectAction action) {
+ return false;
+ }
+
+ protected boolean exclude(ObjectSpecification spec) {
+ return isBuiltIn(spec) || spec.isAbstract();
+ }
+
+ protected boolean isBuiltIn(ObjectSpecification spec) {
+ final String className = spec.getFullIdentifier();
+ return className.startsWith("java") || className.startsWith("org.joda");
+ }
+
+ // //////////////////////////////////////
+
+ @Override
+ public void refreshServices() {
+ Collection<ObjectSpecification> specifications = Lists.newArrayList(specificationLoader.allSpecifications());
+ for (ObjectSpecification objectSpec : specifications) {
+ if(objectSpec.isService()){
+ specificationLoader.invalidateCache(objectSpec.getCorrespondingClass());
+ }
+ }
+ }
+
+ // //////////////////////////////////////
+
+ @Override
+ public Object refreshLayout(Object domainObject) {
+ specificationLoader.invalidateCacheFor(domainObject);
+ return domainObject;
+ }
+
+ // //////////////////////////////////////
+
+ @Override
+ public Clob downloadLayout(Object domainObject) {
+
+ final ObjectAdapter adapterFor = adapterManager.adapterFor(domainObject);
+ final ObjectSpecification objectSpec = adapterFor.getSpecification();
+
+ final LayoutMetadataReaderFromJson propertiesReader = new LayoutMetadataReaderFromJson();
+ final String json = propertiesReader.asJson(objectSpec);
+
+ return new Clob(objectSpec.getShortIdentifier() +".layout.json", mimeTypeApplicationJson, json);
+ }
+
+ // //////////////////////////////////////
+
+ @Override
+ public Blob downloadLayouts() {
+ final LayoutMetadataReaderFromJson propertiesReader = new LayoutMetadataReaderFromJson();
+ final Collection<ObjectSpecification> allSpecs = specificationLoader.allSpecifications();
+ final Collection<ObjectSpecification> domainObjectSpecs = Collections2.filter(allSpecs, new Predicate<ObjectSpecification>(){
+ @Override
+ public boolean apply(ObjectSpecification input) {
+ return !input.isAbstract() &&
+ !input.isService() &&
+ !input.isValue() &&
+ !input.isParentedOrFreeCollection();
+ }});
+ try {
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ZipOutputStream zos = new ZipOutputStream(baos);
+ OutputStreamWriter writer = new OutputStreamWriter(zos);
+ for (ObjectSpecification objectSpec : domainObjectSpecs) {
+ zos.putNextEntry(new ZipEntry(zipEntryNameFor(objectSpec)));
+ writer.write(propertiesReader.asJson(objectSpec));
+ writer.flush();
+ zos.closeEntry();
+ }
+ writer.close();
+ return new Blob("layouts.zip", mimeTypeApplicationZip, baos.toByteArray());
+ } catch (final IOException ex) {
+ throw new FatalException("Unable to create zip of layouts", ex);
+ }
+ }
+
+ private static String zipEntryNameFor(ObjectSpecification objectSpec) {
+ final String fqn = objectSpec.getFullIdentifier();
+ return fqn.replace(".", File.separator)+".layout.json";
+ }
+
+
+ // //////////////////////////////////////
+
+ private SpecificationLoaderSpi specificationLoader;
+ private AdapterManager adapterManager;
+
+ @Programmatic
+ @Override
+ public void setSpecificationLoaderSpi(SpecificationLoaderSpi specificationLoader) {
+ this.specificationLoader = specificationLoader;
+ }
+
+ @Override
+ public void setAdapterManager(AdapterManager adapterManager) {
+ this.adapterManager = adapterManager;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-devutils/impl/src/main/java/org/apache/isis/core/metamodel/services/devutils/MetaModelRow.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-devutils/impl/src/main/java/org/apache/isis/core/metamodel/services/devutils/MetaModelRow.java b/mothballed/core/module-devutils/impl/src/main/java/org/apache/isis/core/metamodel/services/devutils/MetaModelRow.java
new file mode 100644
index 0000000..a935972
--- /dev/null
+++ b/mothballed/core/module-devutils/impl/src/main/java/org/apache/isis/core/metamodel/services/devutils/MetaModelRow.java
@@ -0,0 +1,234 @@
+/**
+ * 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.
+ */
+package org.apache.isis.core.metamodel.services.devutils;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.SortedSet;
+
+import com.google.common.base.Joiner;
+import com.google.common.base.Strings;
+import com.google.common.collect.Sets;
+
+import org.apache.isis.applib.util.ObjectContracts;
+import org.apache.isis.core.commons.lang.StringExtensions;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facets.ImperativeFacet;
+import org.apache.isis.core.metamodel.facets.param.choices.ActionChoicesFacet;
+import org.apache.isis.core.metamodel.facets.actions.defaults.ActionDefaultsFacet;
+import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet;
+import org.apache.isis.core.metamodel.facets.param.autocomplete.ActionParameterAutoCompleteFacet;
+import org.apache.isis.core.metamodel.facets.param.choices.ActionParameterChoicesFacet;
+import org.apache.isis.core.metamodel.facets.param.defaults.ActionParameterDefaultsFacet;
+import org.apache.isis.core.metamodel.facets.properties.autocomplete.PropertyAutoCompleteFacet;
+import org.apache.isis.core.metamodel.facets.properties.choices.PropertyChoicesFacet;
+import org.apache.isis.core.metamodel.facets.properties.defaults.PropertyDefaultFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
+import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
+import org.apache.isis.core.metamodel.facets.actions.validate.ActionValidationFacet;
+import org.apache.isis.core.metamodel.facets.collections.validate.CollectionValidateAddToFacet;
+import org.apache.isis.core.metamodel.facets.collections.validate.CollectionValidateRemoveFromFacet;
+import org.apache.isis.core.metamodel.facets.members.disabled.DisabledFacet;
+import org.apache.isis.core.metamodel.facets.properties.validating.PropertyValidateFacet;
+
+public class MetaModelRow implements Comparable<MetaModelRow>{
+
+ enum MemberType {
+ PROPERTY,
+ COLLECTION,
+ ACTION;
+ }
+
+ private final ObjectSpecification spec;
+ private final MemberType memberType;
+ private final ObjectMember member;
+ private ObjectAction action;
+
+ MetaModelRow(ObjectSpecification spec, OneToOneAssociation property) {
+ this.spec = spec;
+ this.member = property;
+ this.memberType = MemberType.PROPERTY;
+ }
+
+ MetaModelRow(ObjectSpecification spec, OneToManyAssociation collection) {
+ this.spec = spec;
+ this.member = collection;
+ this.memberType = MemberType.COLLECTION;
+ }
+
+ MetaModelRow(ObjectSpecification spec, ObjectAction action) {
+ this.spec = spec;
+ this.member = this.action = action;
+ this.memberType = MemberType.ACTION;
+ }
+
+ public String getClassType() {
+ boolean service = false;
+ for(ObjectSpecification subspecs: spec.subclasses()) {
+ service = service || subspecs.isService();
+ }
+ return service || spec.isService() ?"2 Service":spec.isValue()?"3 Value":spec.isParentedOrFreeCollection()?"4 Collection":"1 Object";
+ }
+ public String getClassName() {
+ final String fullIdentifier = spec.getFullIdentifier();
+ final int lastDot = fullIdentifier.lastIndexOf(".");
+ return lastDot>0 && lastDot < fullIdentifier.length()-1
+ ?fullIdentifier.substring(lastDot+1,fullIdentifier.length())
+ :fullIdentifier;
+ }
+ public String getPackageName() {
+ final String fullIdentifier = spec.getFullIdentifier();
+ final int lastDot = fullIdentifier.lastIndexOf(".");
+ return lastDot>0?fullIdentifier.substring(0,lastDot):fullIdentifier;
+ }
+ public String getType() {
+ return memberType.name().toLowerCase();
+ }
+ public String getMemberName() {
+ return member.getId();
+ }
+ public String getNumParams() {
+ return action!=null?""+action.getParameterCount():"";
+ }
+ String getHidden() {
+ return interpret(HiddenFacet.class);
+ }
+ String getDisabled() {
+ return interpret(DisabledFacet.class);
+ }
+ public String getChoices() {
+ if(memberType == MemberType.PROPERTY) {
+ return interpretRowAndFacet(PropertyChoicesFacet.class);
+ } else if(memberType == MemberType.COLLECTION) {
+ return "";
+ } else {
+ final List<ObjectActionParameter> parameters = this.action.getParameters();
+ final SortedSet<String> interpretations = Sets.newTreeSet();
+ for (ObjectActionParameter param : parameters) {
+ final ActionParameterChoicesFacet facet = param.getFacet(ActionParameterChoicesFacet.class);
+ addIfNotEmpty(interpretFacet(facet), interpretations);
+ }
+ return !interpretations.isEmpty()? Joiner.on(";").join(interpretations) : interpretRowAndFacet(ActionChoicesFacet.class);
+ }
+ }
+ public String getAutoComplete() {
+ if(memberType == MemberType.PROPERTY) {
+ return interpretRowAndFacet(PropertyAutoCompleteFacet.class);
+ } else if(memberType == MemberType.COLLECTION) {
+ return "";
+ } else {
+ final List<ObjectActionParameter> parameters = this.action.getParameters();
+ final SortedSet<String> interpretations = Sets.newTreeSet();
+ for (ObjectActionParameter param : parameters) {
+ final ActionParameterAutoCompleteFacet facet = param.getFacet(ActionParameterAutoCompleteFacet.class);
+ addIfNotEmpty(interpretFacet(facet), interpretations);
+ }
+ return !interpretations.isEmpty()? Joiner.on(";").join(interpretations) : "";
+ }
+ }
+ String getDefault() {
+ if(memberType == MemberType.PROPERTY) {
+ return interpretRowAndFacet(PropertyDefaultFacet.class);
+ } else if(memberType == MemberType.COLLECTION) {
+ return "";
+ } else {
+ final List<ObjectActionParameter> parameters = this.action.getParameters();
+ final SortedSet<String> interpretations = Sets.newTreeSet();
+ for (ObjectActionParameter param : parameters) {
+ final ActionParameterDefaultsFacet facet = param.getFacet(ActionParameterDefaultsFacet.class);
+ addIfNotEmpty(interpretFacet(facet), interpretations);
+ }
+ return !interpretations.isEmpty()? Joiner.on(";").join(interpretations) : interpretRowAndFacet(ActionDefaultsFacet.class);
+ }
+ }
+ String getValidate() {
+ if(memberType == MemberType.PROPERTY) {
+ return interpretRowAndFacet(PropertyValidateFacet.class);
+ } else if(memberType == MemberType.COLLECTION) {
+ final SortedSet<String> interpretations = Sets.newTreeSet();
+ addIfNotEmpty(interpretRowAndFacet(CollectionValidateAddToFacet.class), interpretations);
+ addIfNotEmpty(interpretRowAndFacet(CollectionValidateRemoveFromFacet.class), interpretations);
+ return !interpretations.isEmpty()? Joiner.on(";").join(interpretations) : "";
+ } else {
+ return interpretRowAndFacet(ActionValidationFacet.class);
+ }
+ }
+
+ static Object header() {
+ return "classType,packageName,className,memberType,memberName,numParams,hidden,disabled,choices,autoComplete,default,validate";
+ }
+
+ String asTextCsv() {
+ return Joiner.on(",").join(
+ getClassType(),
+ getPackageName(),
+ getClassName(),
+ getType(),
+ getMemberName(),
+ getNumParams(),
+ getHidden(),
+ getDisabled(),
+ getChoices(),
+ getAutoComplete(),
+ getDefault(),
+ getValidate());
+ }
+
+ private String interpretRowAndFacet(Class<? extends Facet> facetClass) {
+ final Facet facet = member.getFacet(facetClass);
+ return interpretFacet(facet);
+ }
+
+ private static void addIfNotEmpty(final String str, final SortedSet<String> set) {
+ if(!Strings.isNullOrEmpty(str)) {
+ set.add(str);
+ }
+ }
+
+ private String interpret(final Class<? extends Facet> cls) {
+ return interpretFacet(member.getFacet(cls));
+ }
+
+ private static String interpretFacet(final Facet facet) {
+ if (facet == null || facet.isNoop()) {
+ return "";
+ }
+ if (facet instanceof ImperativeFacet) {
+ ImperativeFacet imperativeFacet = (ImperativeFacet) facet;
+ return imperativeFacet.getMethods().get(0).getName();
+ }
+ final String name = facet.getClass().getSimpleName();
+ if (ignore(name)) {
+ return "";
+ }
+ final String abbr = StringExtensions.toAbbreviation(name);
+ return abbr.length()>0 ? abbr : name;
+ }
+
+ protected static boolean ignore(final String name) {
+ return Arrays.asList("PropertyValidateFacetDefault","PropertyDefaultFacetDerivedFromDefaultedFacet").contains(name);
+ }
+
+ @Override
+ public int compareTo(MetaModelRow o) {
+ return ObjectContracts.compare(this, o, "classType,className,type desc,memberName");
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-devutils/pom.xml
----------------------------------------------------------------------
diff --git a/mothballed/core/module-devutils/pom.xml b/mothballed/core/module-devutils/pom.xml
new file mode 100644
index 0000000..bae27b3
--- /dev/null
+++ b/mothballed/core/module-devutils/pom.xml
@@ -0,0 +1,94 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-devutils</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Isis Module: Developer Utilities</name>
+ <description>
+ Developer utilities.
+ </description>
+
+ <properties>
+ <siteBaseDir>..</siteBaseDir>
+ <relativeUrl>module-devutils/</relativeUrl>
+ </properties>
+
+ <url>http://isis.apache.org/${relativeUrl}</url>
+
+ <dependencyManagement>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-devutils-applib</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-devutils-applib</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ <scope>test</scope>
+ <type>test-jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-devutils-impl</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-devutils-impl</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ <scope>test</scope>
+ <type>test-jar</type>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-applib</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-unittestsupport</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <modules>
+ <module>applib</module>
+ <module>impl</module>
+ </modules>
+
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-publishing-jdo/.gitignore
----------------------------------------------------------------------
diff --git a/mothballed/core/module-publishing-jdo/.gitignore b/mothballed/core/module-publishing-jdo/.gitignore
new file mode 100644
index 0000000..a48e45b
--- /dev/null
+++ b/mothballed/core/module-publishing-jdo/.gitignore
@@ -0,0 +1 @@
+/target-ide
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-publishing-jdo/pom.xml
----------------------------------------------------------------------
diff --git a/mothballed/core/module-publishing-jdo/pom.xml b/mothballed/core/module-publishing-jdo/pom.xml
new file mode 100644
index 0000000..420125e
--- /dev/null
+++ b/mothballed/core/module-publishing-jdo/pom.xml
@@ -0,0 +1,147 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-publishing-jdo</artifactId>
+
+ <name>Isis Module: Publishing (JDO Implementation)</name>
+ <description>
+ PublishingService implementation that persists published events
+ to the database (using JDO Objectstore).
+ </description>
+
+ <properties>
+ <siteBaseDir>..</siteBaseDir>
+ <relativeUrl>module-publishing/</relativeUrl>
+ </properties>
+
+ <url>http://isis.apache.org/${relativeUrl}</url>
+
+ <build>
+ <resources>
+ <resource>
+ <filtering>false</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ <resource>
+ <filtering>false</filtering>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-maven-plugin</artifactId>
+ <version>${datanucleus-maven-plugin.version}</version>
+ <configuration>
+ <fork>false</fork>
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>enhance</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ org.datanucleus
+ </groupId>
+ <artifactId>
+ datanucleus-maven-plugin
+ </artifactId>
+ <versionRange>
+ [3.2.0-release,)
+ </versionRange>
+ <goals>
+ <goal>enhance</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-applib</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-unittestsupport</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+
+ <!-- DataNucleus (jdo-api, and for enhancer) -->
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-accessplatform-jdo-rdbms</artifactId>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-jodatime</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-publishing-jdo/src/main/java/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/mothballed/core/module-publishing-jdo/src/main/java/META-INF/persistence.xml b/mothballed/core/module-publishing-jdo/src/main/java/META-INF/persistence.xml
new file mode 100644
index 0000000..1cb71dd
--- /dev/null
+++ b/mothballed/core/module-publishing-jdo/src/main/java/META-INF/persistence.xml
@@ -0,0 +1,26 @@
+<?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.
+-->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
+
+ <persistence-unit name="isis-module-publishing-jdo">
+ </persistence-unit>
+</persistence>
[5/7] ISIS-887: mothballed the core/module* modules,
moved to mothballed/core/module*
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdo.java
----------------------------------------------------------------------
diff --git a/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdo.java b/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdo.java
deleted file mode 100644
index 6611fb9..0000000
--- a/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdo.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.isis.objectstore.jdo.applib.service.publish;
-
-import java.util.Map;
-import javax.annotation.PostConstruct;
-import org.apache.isis.applib.AbstractService;
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.services.command.CommandContext;
-import org.apache.isis.applib.services.publish.EventMetadata;
-import org.apache.isis.applib.services.publish.EventPayload;
-import org.apache.isis.applib.services.publish.EventSerializer;
-import org.apache.isis.applib.services.publish.PublishingService;
-
-/**
- * An implementation of {@link PublishingService} that persists events as
- * entities into a JDO-backed database.
- */
-@DomainService
-public class PublishingServiceJdo extends AbstractService implements PublishingService {
-
- private static final String SERIALIZED_FORM_LOCAL_KEY = "datanucleus.PublishingService.serializedForm";
- private final static String SERIALIZED_FORM_KEY = "isis.persistor." + SERIALIZED_FORM_LOCAL_KEY;
-
- static enum SerializedForm {
- CLOB,
- @Deprecated
- ZIPPED;
- static SerializedForm parse(final String value) {
- return CLOB.toString().equalsIgnoreCase(value)? CLOB: ZIPPED;
- }
- }
-
- private SerializedForm serializedForm;
-
- @Programmatic
- @PostConstruct
- public void init(Map<String,String> configuration) {
- ensureDependenciesInjected();
- serializedForm = SerializedForm.parse(configuration.get(SERIALIZED_FORM_KEY));
- }
-
-
- // //////////////////////////////////////
-
- private void ensureDependenciesInjected() {
- if(this.commandContext == null) {
- throw new IllegalStateException(this.getClassName() + " requires CommandContext service to be configured");
- }
- if(this.eventSerializer == null) {
- throw new IllegalStateException(this.getClassName() + " requires EventSerializer service to be configured");
- }
- }
-
-
- @Override
- @Programmatic
- public void publish(final EventMetadata metadata, final EventPayload payload) {
- final String serializedEvent = eventSerializer.serialize(metadata, payload).toString();
- final PublishedEventJdo publishedEvent = newTransientInstance(PublishedEventJdo.class);
-
- if(this.serializedForm == SerializedForm.ZIPPED) {
- final byte[] zippedBytes = asZippedBytes(serializedEvent);
- publishedEvent.setSerializedFormZipped(zippedBytes);
- } else {
- publishedEvent.setSerializedFormClob(serializedEvent);
- }
-
- publishedEvent.setTransactionId(metadata.getTransactionId());
- publishedEvent.setSequence(metadata.getSequence());
- publishedEvent.setEventType(metadata.getEventType());
- publishedEvent.setTimestamp(metadata.getJavaSqlTimestamp());
- publishedEvent.setUser(metadata.getUser());
- publishedEvent.setTitle(metadata.getTitle());
-
- publishedEvent.setTargetClass(metadata.getTargetClass());
- publishedEvent.setTarget(metadata.getTarget());
- publishedEvent.setTargetAction(metadata.getTargetAction());
- publishedEvent.setMemberIdentifier(metadata.getActionIdentifier());
-
- persist(publishedEvent);
- }
-
-
- static byte[] asZippedBytes(final String serializedEvent) {
- return IoUtils.toUtf8ZippedBytes("serializedForm", serializedEvent);
- }
-
-
- // //////////////////////////////////////
-
- private EventSerializer eventSerializer;
-
- @Override
- public void setEventSerializer(EventSerializer eventSerializer) {
- this.eventSerializer = eventSerializer;
- }
-
- static String fromZippedBytes(byte[] zipped) {
- return IoUtils.fromUtf8ZippedBytes("serializedForm", zipped);
- }
-
-
- @javax.inject.Inject
- private CommandContext commandContext;
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdoContributions.java
----------------------------------------------------------------------
diff --git a/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdoContributions.java b/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdoContributions.java
deleted file mode 100644
index 1709f64..0000000
--- a/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdoContributions.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.objectstore.jdo.applib.service.publish;
-
-import java.util.List;
-
-import org.apache.isis.applib.AbstractFactoryAndRepository;
-import org.apache.isis.applib.annotation.ActionSemantics;
-import org.apache.isis.applib.annotation.Render;
-import org.apache.isis.applib.annotation.ActionSemantics.Of;
-import org.apache.isis.applib.annotation.NotContributed;
-import org.apache.isis.applib.annotation.NotContributed.As;
-import org.apache.isis.applib.annotation.Render.Type;
-import org.apache.isis.applib.annotation.NotInServiceMenu;
-import org.apache.isis.applib.services.HasTransactionId;
-
-
-public class PublishingServiceJdoContributions extends AbstractFactoryAndRepository {
-
- @ActionSemantics(Of.SAFE)
- @NotInServiceMenu
- @NotContributed(As.ACTION)
- @Render(Type.EAGERLY)
- public List<PublishedEventJdo> publishedEvents(final HasTransactionId hasTransactionId) {
- return publishedEventRepository.findByTransactionId(hasTransactionId.getTransactionId());
- }
-
- // //////////////////////////////////////
-
- @javax.inject.Inject
- private PublishingServiceJdoRepository publishedEventRepository;
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdoRepository.java
----------------------------------------------------------------------
diff --git a/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdoRepository.java b/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdoRepository.java
deleted file mode 100644
index 636369d..0000000
--- a/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdoRepository.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.isis.objectstore.jdo.applib.service.publish;
-
-import java.sql.Timestamp;
-import java.util.List;
-import java.util.UUID;
-import org.joda.time.LocalDate;
-import org.apache.isis.applib.AbstractFactoryAndRepository;
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.query.Query;
-import org.apache.isis.applib.query.QueryDefault;
-import org.apache.isis.applib.services.bookmark.Bookmark;
-
-/**
- * Provides supporting functionality for querying and persisting
- * {@link org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo published event} entities.
- *
- * <p>
- * This supporting service with no UI and no side-effects, and is there are no other implementations of the service,
- * thus has been annotated with {@link org.apache.isis.applib.annotation.DomainService}. This means that there is no
- * need to explicitly register it as a service (eg in <tt>isis.properties</tt>).
- */
-@DomainService
-public class PublishingServiceJdoRepository extends AbstractFactoryAndRepository {
-
- @Programmatic
- public List<PublishedEventJdo> findQueued() {
- return allMatches(
- new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
- "findByStateOrderByTimestamp",
- "state", PublishedEventJdo.State.QUEUED));
- }
-
- @Programmatic
- public List<PublishedEventJdo> findProcessed() {
- return allMatches(
- new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
- "findByStateOrderByTimestamp",
- "state", PublishedEventJdo.State.PROCESSED));
- }
-
- @Programmatic
- public List<PublishedEventJdo> findByTransactionId(final UUID transactionId) {
- return allMatches(
- new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
- "findByTransactionId",
- "transactionId", transactionId));
- }
-
- @Programmatic
- public void purgeProcessed() {
- // REVIEW: this is not particularly performant.
- // much better would be to go direct to the JDO API.
- List<PublishedEventJdo> processedEvents = findProcessed();
- for (PublishedEventJdo publishedEvent : processedEvents) {
- publishedEvent.delete();
- }
- }
-
-
- @Programmatic
- public List<PublishedEventJdo> findByTargetAndFromAndTo(
- final Bookmark target,
- final LocalDate from,
- final LocalDate to) {
- final String targetStr = target.toString();
- final Timestamp fromTs = toTimestampStartOfDayWithOffset(from, 0);
- final Timestamp toTs = toTimestampStartOfDayWithOffset(to, 1);
-
- final Query<PublishedEventJdo> query;
- if(from != null) {
- if(to != null) {
- query = new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
- "findByTargetAndTimestampBetween",
- "targetStr", targetStr,
- "from", fromTs,
- "to", toTs);
- } else {
- query = new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
- "findByTargetAndTimestampAfter",
- "targetStr", targetStr,
- "from", fromTs);
- }
- } else {
- if(to != null) {
- query = new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
- "findByTargetAndTimestampBefore",
- "targetStr", targetStr,
- "to", toTs);
- } else {
- query = new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
- "findByTarget",
- "targetStr", targetStr);
- }
- }
- return allMatches(query);
- }
-
- @Programmatic
- public List<PublishedEventJdo> findByFromAndTo(
- final LocalDate from,
- final LocalDate to) {
- final Timestamp fromTs = toTimestampStartOfDayWithOffset(from, 0);
- final Timestamp toTs = toTimestampStartOfDayWithOffset(to, 1);
-
- final Query<PublishedEventJdo> query;
- if(from != null) {
- if(to != null) {
- query = new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
- "findByTimestampBetween",
- "from", fromTs,
- "to", toTs);
- } else {
- query = new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
- "findByTimestampAfter",
- "from", fromTs);
- }
- } else {
- if(to != null) {
- query = new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
- "findByTimestampBefore",
- "to", toTs);
- } else {
- query = new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
- "find");
- }
- }
- return allMatches(query);
- }
-
- private static Timestamp toTimestampStartOfDayWithOffset(final LocalDate dt, int daysOffset) {
- return dt!=null
- ?new java.sql.Timestamp(dt.toDateTimeAtStartOfDay().plusDays(daysOffset).getMillis())
- :null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-publishing-jdo/src/main/resources/images/PublishedEventJdo.png
----------------------------------------------------------------------
diff --git a/core/module-publishing-jdo/src/main/resources/images/PublishedEventJdo.png b/core/module-publishing-jdo/src/main/resources/images/PublishedEventJdo.png
deleted file mode 100644
index cb3a325..0000000
Binary files a/core/module-publishing-jdo/src/main/resources/images/PublishedEventJdo.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-publishing-jdo/src/test/java/org/apache/isis/objectstore/jdo/applib/service/publish/IoUtilsTest.java
----------------------------------------------------------------------
diff --git a/core/module-publishing-jdo/src/test/java/org/apache/isis/objectstore/jdo/applib/service/publish/IoUtilsTest.java b/core/module-publishing-jdo/src/test/java/org/apache/isis/objectstore/jdo/applib/service/publish/IoUtilsTest.java
deleted file mode 100644
index 32cfde0..0000000
--- a/core/module-publishing-jdo/src/test/java/org/apache/isis/objectstore/jdo/applib/service/publish/IoUtilsTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.objectstore.jdo.applib.service.publish;
-
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class IoUtilsTest {
-
- @Test
- public void roundtrip() {
- final String str = "3784y5hrfbdgkjh3qyri f£$%$YTRGFDGER$£\"Eu098987u'!\"£%^&*IO(LUKJM)";
- final byte[] utf8ZippedBytes = IoUtils.toUtf8ZippedBytes("serializedForm", str);
-
- final String str2 = IoUtils.fromUtf8ZippedBytes("serializedForm", utf8ZippedBytes);
-
- assertThat(str, (is(str2)));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-publishingeventserializer-ro/pom.xml
----------------------------------------------------------------------
diff --git a/core/module-publishingeventserializer-ro/pom.xml b/core/module-publishingeventserializer-ro/pom.xml
deleted file mode 100644
index b06d9ee..0000000
--- a/core/module-publishingeventserializer-ro/pom.xml
+++ /dev/null
@@ -1,89 +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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-publishingeventserializer-ro</artifactId>
-
- <name>Isis Module: Publishing Event Servializer (Restful Objects spec)</name>
- <description>
- Implementation of an event serializer (as required by the publishing
- service) that serialized the object as a JSON representation defined
- by the Restful Objects spec.
- </description>
-
- <properties>
- <siteBaseDir>..</siteBaseDir>
- <relativeUrl>module-publishingeventserializer-ro/</relativeUrl>
- </properties>
-
- <url>http://isis.apache.org/${relativeUrl}</url>
-
- <build>
- <resources>
- <resource>
- <filtering>false</filtering>
- <directory>src/main/resources</directory>
- </resource>
- <resource>
- <filtering>false</filtering>
- <directory>src/main/java</directory>
- <includes>
- <include>**</include>
- </includes>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </resource>
- </resources>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-applib</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-viewer-restfulobjects-rendering</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-unittestsupport</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-publishingeventserializer-ro/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/EventSerializerRendererContext.java
----------------------------------------------------------------------
diff --git a/core/module-publishingeventserializer-ro/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/EventSerializerRendererContext.java b/core/module-publishingeventserializer-ro/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/EventSerializerRendererContext.java
deleted file mode 100644
index 6d10cc2..0000000
--- a/core/module-publishingeventserializer-ro/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/EventSerializerRendererContext.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.
- */
-package org.apache.isis.viewer.restfulobjects.rendering.eventserializer;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import com.google.common.collect.Sets;
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.profiles.Localization;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.viewer.restfulobjects.rendering.RendererContext;
-
-class EventSerializerRendererContext implements RendererContext {
-
- private final String baseUrl;
- private final Where where;
-
- public EventSerializerRendererContext(String baseUrl, Where where) {
- this.baseUrl = baseUrl;
- this.where = where;
- }
-
- @Override
- public String urlFor(String url) {
- return baseUrl + url;
- }
-
- @Override
- public AuthenticationSession getAuthenticationSession() {
- return IsisContext.getAuthenticationSession();
- }
-
- @Override
- public PersistenceSession getPersistenceSession() {
- return IsisContext.getPersistenceSession();
- }
-
- @Override
- public IsisConfiguration getConfiguration() {
- return IsisContext.getConfiguration();
- }
-
- @Override
- public AdapterManager getAdapterManager() {
- return getPersistenceSession().getAdapterManager();
- }
-
- @Override
- public List<List<String>> getFollowLinks() {
- return Collections.emptyList();
- }
-
- @Override
- public Where getWhere() {
- return where;
- }
-
- @Override
- public Localization getLocalization() {
- return IsisContext.getLocalization();
- }
-
- private Set<Oid> rendered = Sets.newHashSet();
- @Override
- public boolean canEagerlyRender(ObjectAdapter objectAdapter) {
- final Oid oid = objectAdapter.getOid();
- return rendered.add(oid);
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-publishingeventserializer-ro/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/RestfulObjectsSpecEventSerializer.java
----------------------------------------------------------------------
diff --git a/core/module-publishingeventserializer-ro/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/RestfulObjectsSpecEventSerializer.java b/core/module-publishingeventserializer-ro/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/RestfulObjectsSpecEventSerializer.java
deleted file mode 100644
index 07c19c5..0000000
--- a/core/module-publishingeventserializer-ro/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/RestfulObjectsSpecEventSerializer.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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.
- */
-package org.apache.isis.viewer.restfulobjects.rendering.eventserializer;
-
-import java.io.IOException;
-import java.util.Map;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.services.publish.EventMetadata;
-import org.apache.isis.applib.services.publish.EventPayload;
-import org.apache.isis.applib.services.publish.EventSerializer;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.util.JsonMapper;
-import org.apache.isis.viewer.restfulobjects.rendering.RendererContext;
-import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.DomainObjectReprRenderer;
-
-/**
- * Serializes {@link org.apache.isis.applib.services.publish.EventMetadata event metadata} and corresponding
- * {@link org.apache.isis.applib.services.publish.EventPayload payload} into a JSON format corresponding to the
- * domain object representation specified by the Restful Objects spec.
- *
- * <p>
- * This implementation has no UI, has no side-effects, and there are no other implementations of the service API, and
- * so it annotated with {@link org.apache.isis.applib.annotation.DomainService}. This class is implemented in the
- * <tt>o.a.i.module:isis-module-publishingeventserializer-ro</tt> module. If that module is included in the classpath,
- * it this means that this service is automatically registered; no further configuration is required.
- */
-@DomainService
-public class RestfulObjectsSpecEventSerializer implements EventSerializer {
-
- private final static String BASE_URL_KEY = "isis.viewer.restfulobjects.RestfulObjectsSpecEventSerializer.baseUrl";
- private static final String BASE_URL_DEFAULT = "http://localhost:8080/restful/";
-
- //region > init, shutdown
- private String baseUrl;
-
- @Programmatic
- @PostConstruct
- public void init(Map<String,String> props) {
- final String baseUrlFromConfig = props.get(BASE_URL_KEY);
- baseUrl = baseUrlFromConfig != null? baseUrlFromConfig: BASE_URL_DEFAULT;
- }
-
- @Programmatic
- @PreDestroy
- public void shutdown() {
- }
- //endregion
-
- //region > serialize (API)
- @Programmatic
- @Override
- public Object serialize(EventMetadata metadata, EventPayload payload) {
- final RendererContext rendererContext = new EventSerializerRendererContext(baseUrl, Where.OBJECT_FORMS);
-
- final JsonRepresentation payloadRepr = asPayloadRepr(rendererContext, payload);
- final JsonRepresentation eventRepr = asEventRepr(metadata, payloadRepr);
-
- return jsonFor(eventRepr);
- }
- //endregion
-
- //region > supporting methods
- JsonRepresentation asEventRepr(EventMetadata metadata, final JsonRepresentation payloadRepr) {
- final JsonRepresentation eventRepr = JsonRepresentation.newMap();
- final JsonRepresentation metadataRepr = JsonRepresentation.newMap();
- eventRepr.mapPut("metadata", metadataRepr);
- metadataRepr.mapPut("id", metadata.getId());
- metadataRepr.mapPut("transactionId", metadata.getTransactionId());
- metadataRepr.mapPut("sequence", metadata.getSequence());
- metadataRepr.mapPut("eventType", metadata.getEventType());
- metadataRepr.mapPut("user", metadata.getUser());
- metadataRepr.mapPut("timestamp", metadata.getTimestamp());
- eventRepr.mapPut("payload", payloadRepr);
- return eventRepr;
- }
-
- JsonRepresentation asPayloadRepr(final RendererContext rendererContext, EventPayload payload) {
- final DomainObjectReprRenderer renderer = new DomainObjectReprRenderer(rendererContext, null, JsonRepresentation.newMap());
- final ObjectAdapter objectAdapter = rendererContext.getAdapterManager().adapterFor(payload);
- renderer.with(objectAdapter).asEventSerialization();
- return renderer.render();
- }
-
- String jsonFor(final Object object) {
- try {
- return getJsonMapper().write(object);
- } catch (final JsonGenerationException e) {
- throw new RuntimeException(e);
- } catch (final JsonMappingException e) {
- throw new RuntimeException(e);
- } catch (final IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- private final static JsonMapper jsonMapper = JsonMapper.instance();
-
- JsonMapper getJsonMapper() {
- return jsonMapper;
- }
- //endregion
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-publishingeventserializer-ro/src/main/resources/images/PublishedEventJdo.png
----------------------------------------------------------------------
diff --git a/core/module-publishingeventserializer-ro/src/main/resources/images/PublishedEventJdo.png b/core/module-publishingeventserializer-ro/src/main/resources/images/PublishedEventJdo.png
deleted file mode 100644
index cb3a325..0000000
Binary files a/core/module-publishingeventserializer-ro/src/main/resources/images/PublishedEventJdo.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/.gitignore
----------------------------------------------------------------------
diff --git a/core/module-settings/.gitignore b/core/module-settings/.gitignore
deleted file mode 100644
index a48e45b..0000000
--- a/core/module-settings/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/target-ide
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/applib/.gitignore
----------------------------------------------------------------------
diff --git a/core/module-settings/applib/.gitignore b/core/module-settings/applib/.gitignore
deleted file mode 100644
index a48e45b..0000000
--- a/core/module-settings/applib/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/target-ide
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/applib/pom.xml
----------------------------------------------------------------------
diff --git a/core/module-settings/applib/pom.xml b/core/module-settings/applib/pom.xml
deleted file mode 100644
index 9f586c5..0000000
--- a/core/module-settings/applib/pom.xml
+++ /dev/null
@@ -1,55 +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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-settings</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>isis-module-settings-applib</artifactId>
-
- <name>Isis Module: App and User Settings applib</name>
- <description>
- API for the application and user settings module.
- </description>
-
- <properties>
- <siteBaseDir>../..</siteBaseDir>
- <relativeUrl>module-settings/applib/</relativeUrl>
- </properties>
-
- <url>http://isis.apache.org/${relativeUrl}</url>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-applib</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-unittestsupport</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSetting.java
----------------------------------------------------------------------
diff --git a/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSetting.java b/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSetting.java
deleted file mode 100644
index 06d4ec1..0000000
--- a/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSetting.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.applib.services.settings;
-
-
-
-public interface ApplicationSetting extends Setting {
-
- String getKey();
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSettingsService.java
----------------------------------------------------------------------
diff --git a/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSettingsService.java b/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSettingsService.java
deleted file mode 100644
index d6ded31..0000000
--- a/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSettingsService.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-package org.apache.isis.applib.services.settings;
-
-import java.util.List;
-
-import org.apache.isis.applib.annotation.MemberOrder;
-import org.apache.isis.applib.annotation.Named;
-
-public interface ApplicationSettingsService {
-
- @MemberOrder(sequence="1")
- ApplicationSetting find(@Named("Key") String key);
-
- @MemberOrder(sequence="2")
- List<ApplicationSetting> listAll();
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSettingsServiceRW.java
----------------------------------------------------------------------
diff --git a/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSettingsServiceRW.java b/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSettingsServiceRW.java
deleted file mode 100644
index ae680eb..0000000
--- a/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSettingsServiceRW.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-package org.apache.isis.applib.services.settings;
-
-import org.joda.time.LocalDate;
-
-import org.apache.isis.applib.annotation.MemberOrder;
-
-public interface ApplicationSettingsServiceRW extends ApplicationSettingsService {
-
- @MemberOrder(sequence="11")
- ApplicationSetting newBoolean(String name, String description, Boolean defaultValue);
- @MemberOrder(sequence="12")
- ApplicationSetting newString(String name, String description, String defaultValue);
- @MemberOrder(sequence="13")
- ApplicationSetting newLocalDate(String name, String description, LocalDate defaultValue);
- @MemberOrder(sequence="14")
- ApplicationSetting newInt(String name, String description, Integer defaultValue);
- @MemberOrder(sequence="15")
- ApplicationSetting newLong(String name, String description, Long defaultValue);
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/Setting.java
----------------------------------------------------------------------
diff --git a/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/Setting.java b/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/Setting.java
deleted file mode 100644
index 3999d4c..0000000
--- a/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/Setting.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.applib.services.settings;
-
-import org.joda.time.LocalDate;
-
-import org.apache.isis.applib.annotation.MemberOrder;
-
-
-/**
- * Common supertype for both {@link ApplicationSetting} and {@link UserSetting}.
- *
- * <p>
- * The difference between the two is in the settings unique identifier;
- * the former just is uniquely identified by a single key (defined in
- * {@link #getKey() this interface}, whereas the latter is uniquely identified by
- * the combination of the key plus an identifier of the user.
- */
-public interface Setting {
-
- /**
- * In the case of {@link ApplicationSetting}, this constitutes the unique identifier;
- * for a {@link UserSetting}, the unique identifier is both this key plus an identifier
- * for the user.
- */
- String getKey();
-
- SettingType getType();
- String getDescription();
-
- String getValueRaw();
-
- String valueAsString();
- LocalDate valueAsLocalDate();
- Integer valueAsInt();
- Long valueAsLong();
- Boolean valueAsBoolean();
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/SettingAbstract.java
----------------------------------------------------------------------
diff --git a/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/SettingAbstract.java b/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/SettingAbstract.java
deleted file mode 100644
index 6eb39c8..0000000
--- a/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/SettingAbstract.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.applib.services.settings;
-
-import org.joda.time.LocalDate;
-import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.DateTimeFormatter;
-
-import org.apache.isis.applib.annotation.Hidden;
-import org.apache.isis.applib.annotation.Immutable;
-import org.apache.isis.applib.annotation.MemberOrder;
-import org.apache.isis.applib.annotation.Named;
-import org.apache.isis.applib.annotation.Optional;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.annotation.Title;
-import org.apache.isis.applib.annotation.Where;
-
-
-/**
- * Convenience class to implement {@link Setting}.
- */
-@Immutable
-public abstract class SettingAbstract implements Setting {
-
- public final static DateTimeFormatter DATE_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd");
-
- @Title(sequence="10")
- @MemberOrder(sequence="10")
- public abstract String getKey();
-
- @Optional
- @MemberOrder(sequence="80")
- public abstract String getDescription();
-
- @MemberOrder(sequence="90")
- public abstract SettingType getType();
-
- // //////////////////////////////////////
-
- @Title(prepend=" = ", sequence="30")
- @MemberOrder(sequence="30")
- @Hidden(where=Where.OBJECT_FORMS)
- public abstract String getValueRaw();
-
- // //////////////////////////////////////
-
- @Programmatic
- public String valueAsString() {
- ensure(SettingType.STRING);
- return getValueRaw();
- }
-
- // //////////////////////////////////////
-
- @Programmatic
- public LocalDate valueAsLocalDate() {
- ensure(SettingType.LOCAL_DATE);
- return parseValueAsLocalDate();
- }
-
- protected LocalDate parseValueAsLocalDate() {
- return LocalDate.parse(getValueRaw(), DATE_FORMATTER);
- }
-
- // //////////////////////////////////////
-
- @Programmatic
- public Integer valueAsInt() {
- ensure(SettingType.INT);
- return parseValueAsInt();
- }
-
- protected int parseValueAsInt() {
- return Integer.parseInt(getValueRaw());
- }
-
- // //////////////////////////////////////
-
- @Programmatic
- public Long valueAsLong() {
- ensure(SettingType.LONG);
- return parseValueAsLong();
- }
-
- protected long parseValueAsLong() {
- return Long.parseLong(getValueRaw());
- }
-
- // //////////////////////////////////////
-
- @Programmatic
- public Boolean valueAsBoolean() {
- ensure(SettingType.BOOLEAN);
- return parseValueAsBoolean();
- }
-
- protected boolean parseValueAsBoolean() {
- return Boolean.parseBoolean(getValueRaw());
- }
-
- // //////////////////////////////////////
-
- @MemberOrder(sequence="30")
- @Hidden(where=Where.ALL_TABLES)
- @Named("Value")
- public String getValueAsString() {
- return getValueRaw();
- }
- public boolean hideValueAsString() {
- return typeIsNot(SettingType.STRING);
- }
-
- // //////////////////////////////////////
-
- @MemberOrder(sequence="30")
- @Hidden(where=Where.ALL_TABLES)
- @Named("Value")
- public LocalDate getValueAsLocalDate() {
- return parseValueAsLocalDate();
- }
- public boolean hideValueAsLocalDate() {
- return typeIsNot(SettingType.LOCAL_DATE);
- }
-
- // //////////////////////////////////////
-
-
- @MemberOrder(sequence="30")
- @Hidden(where=Where.ALL_TABLES)
- @Named("Value")
- public Integer getValueAsInt() {
- return parseValueAsInt();
- }
- public boolean hideValueAsInt() {
- return typeIsNot(SettingType.INT);
- }
-
- // //////////////////////////////////////
-
-
-
- @MemberOrder(sequence="30")
- @Hidden(where=Where.ALL_TABLES)
- @Named("Value")
- public Long getValueAsLong() {
- return parseValueAsLong();
- }
- public boolean hideValueAsLong() {
- return typeIsNot(SettingType.LONG);
- }
-
- // //////////////////////////////////////
-
-
-
- @MemberOrder(sequence="30")
- @Hidden(where=Where.ALL_TABLES)
- @Named("Value")
- public Boolean getValueAsBoolean() {
- return parseValueAsBoolean();
- }
- public boolean hideValueAsBoolean() {
- return typeIsNot(SettingType.BOOLEAN);
- }
-
- // //////////////////////////////////////
-
- private void ensure(SettingType settingType) {
- if(typeIsNot(settingType)) {
- throw new IllegalStateException("Setting '" + getKey() + "' is of type " + getType() + ", not of type " + settingType);
- }
- }
-
- protected boolean typeIsNot(SettingType settingType) {
- return getType() != settingType;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/SettingType.java
----------------------------------------------------------------------
diff --git a/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/SettingType.java b/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/SettingType.java
deleted file mode 100644
index a652bf3..0000000
--- a/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/SettingType.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.applib.services.settings;
-
-
-public enum SettingType {
-
- BOOLEAN,
- INT,
- LONG,
- STRING,
- LOCAL_DATE
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSetting.java
----------------------------------------------------------------------
diff --git a/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSetting.java b/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSetting.java
deleted file mode 100644
index 24ccf65..0000000
--- a/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSetting.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.applib.services.settings;
-
-import org.apache.isis.applib.DomainObjectContainer;
-import org.apache.isis.applib.security.UserMemento;
-
-
-
-public interface UserSetting extends Setting {
-
- String getKey();
-
- /**
- * Typically as obtained from the {@link UserMemento#getName() UserMemento} class
- * (accessible in turn from the {@link DomainObjectContainer#getUser() DomainObjectContainer}).
- */
- String getUser();
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSettingsService.java
----------------------------------------------------------------------
diff --git a/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSettingsService.java b/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSettingsService.java
deleted file mode 100644
index f798e62..0000000
--- a/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSettingsService.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-package org.apache.isis.applib.services.settings;
-
-import java.util.List;
-
-import org.apache.isis.applib.annotation.MemberOrder;
-import org.apache.isis.applib.annotation.Named;
-
-public interface UserSettingsService {
-
- @MemberOrder(sequence="1")
- UserSetting find(@Named("User") String user, @Named("Key") String key);
-
- @MemberOrder(sequence="2")
- List<UserSetting> listAll();
-
- @MemberOrder(sequence="3")
- List<UserSetting> listAllFor(@Named("User") String user);
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSettingsServiceRW.java
----------------------------------------------------------------------
diff --git a/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSettingsServiceRW.java b/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSettingsServiceRW.java
deleted file mode 100644
index 8b048ea..0000000
--- a/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSettingsServiceRW.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-package org.apache.isis.applib.services.settings;
-
-import org.joda.time.LocalDate;
-
-import org.apache.isis.applib.annotation.MemberOrder;
-
-public interface UserSettingsServiceRW extends UserSettingsService {
-
- @MemberOrder(sequence="11")
- UserSetting newBoolean(String user, String name, String description, Boolean defaultValue);
- @MemberOrder(sequence="12")
- UserSetting newString(String user, String name, String description, String defaultValue);
- @MemberOrder(sequence="13")
- UserSetting newLocalDate(String user, String name, String description, LocalDate defaultValue);
- @MemberOrder(sequence="14")
- UserSetting newInt(String user, String name, String description, Integer defaultValue);
- @MemberOrder(sequence="15")
- UserSetting newLong(String user, String name, String description, Long defaultValue);
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/applib/src/test/java/org/apache/isis/applib/services/settings/SettingAbstractTest.java
----------------------------------------------------------------------
diff --git a/core/module-settings/applib/src/test/java/org/apache/isis/applib/services/settings/SettingAbstractTest.java b/core/module-settings/applib/src/test/java/org/apache/isis/applib/services/settings/SettingAbstractTest.java
deleted file mode 100644
index bc3693d..0000000
--- a/core/module-settings/applib/src/test/java/org/apache/isis/applib/services/settings/SettingAbstractTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * 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.
- */
-package org.apache.isis.applib.services.settings;
-
-import org.joda.time.LocalDate;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-public class SettingAbstractTest {
-
- @Rule
- public ExpectedException expectedExceptions = ExpectedException.none();
-
- private static final class SettingAbstractForTesting extends SettingAbstract {
- private final String key;
- private final String valueRaw;
- private final SettingType type;
-
- public SettingAbstractForTesting(String key, String valueRaw, SettingType type) {
- this.key = key;
- this.valueRaw = valueRaw;
- this.type = type;
- }
-
- public String getKey() {
- return key;
- }
-
- public String getValueRaw() {
- return valueRaw;
- }
-
- public SettingType getType() {
- return type;
- }
-
- public String getDescription() {
- return null;
- }
- }
-
- private SettingAbstract strSetting;
- private SettingAbstract intSetting;
- private SettingAbstract localDateSetting;
- private SettingAbstract longSetting;
- private SettingAbstract boolSetting;
-
- private LocalDate someLocalDate;
-
- @Before
- public void setUp() throws Exception {
- someLocalDate = new LocalDate(2012,4,1);
-
- strSetting = new SettingAbstractForTesting("strSetting", "ABC", SettingType.STRING);
- intSetting = new SettingAbstractForTesting("intSetting", "" + Integer.MAX_VALUE, SettingType.INT);
- localDateSetting = new SettingAbstractForTesting("localDateSetting", someLocalDate.toString(SettingAbstract.DATE_FORMATTER), SettingType.LOCAL_DATE);
- longSetting = new SettingAbstractForTesting("longSetting", ""+Long.MAX_VALUE, SettingType.LONG);
- boolSetting = new SettingAbstractForTesting("boolSetting", Boolean.TRUE.toString(), SettingType.BOOLEAN);
- }
-
- @Test
- public void happyCases() {
- assertThat(strSetting.valueAsString(), is("ABC"));
- assertThat(intSetting.valueAsInt(), is(Integer.MAX_VALUE));
- assertThat(localDateSetting.valueAsLocalDate(), is(someLocalDate));
- assertThat(longSetting.valueAsLong(), is(Long.MAX_VALUE));
- assertThat(boolSetting.valueAsBoolean(), is(true));
- }
-
- @Test
- public void sadCases() {
- expectedExceptions.expectMessage("Setting 'strSetting' is of type STRING, not of type INT");
- strSetting.valueAsInt();
- expectedExceptions.expectMessage("Setting 'strSetting' is of type STRING, not of type LONG");
- strSetting.valueAsLong();
- expectedExceptions.expectMessage("Setting 'strSetting' is of type STRING, not of type LOCAL_DATE");
- strSetting.valueAsLocalDate();
- expectedExceptions.expectMessage("Setting 'strSetting' is of type STRING, not of type BOOLEAN");
- strSetting.valueAsBoolean();
- expectedExceptions.expectMessage("Setting 'intSetting' is of type INT, not of type STRING");
- intSetting.valueAsString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/impl-jdo/.gitignore
----------------------------------------------------------------------
diff --git a/core/module-settings/impl-jdo/.gitignore b/core/module-settings/impl-jdo/.gitignore
deleted file mode 100644
index a48e45b..0000000
--- a/core/module-settings/impl-jdo/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/target-ide
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/impl-jdo/pom.xml
----------------------------------------------------------------------
diff --git a/core/module-settings/impl-jdo/pom.xml b/core/module-settings/impl-jdo/pom.xml
deleted file mode 100644
index fbbb12a..0000000
--- a/core/module-settings/impl-jdo/pom.xml
+++ /dev/null
@@ -1,146 +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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-settings</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>isis-module-settings-impl-jdo</artifactId>
-
- <name>Isis Module: App and User Settings (JDO impl)</name>
- <description>
- Implementation of the application and user settings module, persisting
- to database (using JDO Objectstore)
- </description>
-
- <properties>
- <siteBaseDir>../..</siteBaseDir>
- <relativeUrl>module-settings/impl/</relativeUrl>
- </properties>
-
- <url>http://isis.apache.org/${relativeUrl}</url>
-
- <build>
- <resources>
- <resource>
- <filtering>false</filtering>
- <directory>src/main/resources</directory>
- </resource>
- <resource>
- <filtering>false</filtering>
- <directory>src/main/java</directory>
- <includes>
- <include>**</include>
- </includes>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.datanucleus</groupId>
- <artifactId>datanucleus-maven-plugin</artifactId>
- <version>${datanucleus-maven-plugin.version}</version>
- <configuration>
- <fork>false</fork>
- <verbose>true</verbose>
- </configuration>
- <executions>
- <execution>
- <phase>compile</phase>
- <goals>
- <goal>enhance</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- <pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>
- org.datanucleus
- </groupId>
- <artifactId>
- datanucleus-maven-plugin
- </artifactId>
- <versionRange>
- [3.2.0-release,)
- </versionRange>
- <goals>
- <goal>enhance</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore />
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-settings-applib</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-unittestsupport</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <!-- DataNucleus (jdo-api, and for enhancer) -->
- <dependency>
- <groupId>org.datanucleus</groupId>
- <artifactId>datanucleus-accessplatform-jdo-rdbms</artifactId>
- <type>pom</type>
- </dependency>
- <dependency>
- <groupId>org.datanucleus</groupId>
- <artifactId>datanucleus-jodatime</artifactId>
- </dependency>
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/impl-jdo/src/main/java/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/core/module-settings/impl-jdo/src/main/java/META-INF/persistence.xml b/core/module-settings/impl-jdo/src/main/java/META-INF/persistence.xml
deleted file mode 100644
index 1b83835..0000000
--- a/core/module-settings/impl-jdo/src/main/java/META-INF/persistence.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.
--->
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
-
- <persistence-unit name="isis-module-settings-impl-jdo">
- </persistence-unit>
-</persistence>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingJdo.java
----------------------------------------------------------------------
diff --git a/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingJdo.java b/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingJdo.java
deleted file mode 100644
index 22d5e77..0000000
--- a/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingJdo.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.isis.objectstore.jdo.applib.service.settings;
-
-import javax.jdo.annotations.IdentityType;
-
-import org.apache.isis.applib.annotation.Named;
-import org.apache.isis.applib.services.settings.ApplicationSetting;
-import org.apache.isis.applib.services.settings.SettingType;
-import org.apache.isis.objectstore.jdo.applib.service.JdoColumnLength;
-
-@javax.jdo.annotations.PersistenceCapable(
- identityType = IdentityType.APPLICATION,
- table="IsisApplicationSetting")
-@javax.jdo.annotations.Queries({
- @javax.jdo.annotations.Query(
- name = "findByKey", language = "JDOQL",
- value = "SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.settings.ApplicationSettingJdo "
- + "WHERE key == :key"),
- @javax.jdo.annotations.Query(
- name = "findAll", language = "JDOQL",
- value = "SELECT "
- + "FROM org.apache.isis.objectstore.jdo.applib.service.settings.ApplicationSettingJdo "
- + "ORDER BY key")
-})
-@Named("Application Setting")
-public class ApplicationSettingJdo extends SettingAbstractJdo implements ApplicationSetting {
-
-
- @javax.jdo.annotations.Column(length=JdoColumnLength.SettingAbstract.SETTING_KEY)
- @javax.jdo.annotations.PrimaryKey
- public String getKey() {
- return super.getKey();
- }
- @Override
- public void setKey(String key) {
- super.setKey(key);
- }
-
- // //////////////////////////////////////
-
- @javax.jdo.annotations.Column(length=JdoColumnLength.DESCRIPTION)
- @javax.jdo.annotations.Persistent
- @Override
- public String getDescription() {
- return super.getDescription();
- }
- @Override
- public void setDescription(String description) {
- super.setDescription(description);
- }
-
- // //////////////////////////////////////
-
- @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.SettingAbstract.VALUE_RAW)
- @javax.jdo.annotations.Persistent
- @Override
- public String getValueRaw() {
- return super.getValueRaw();
- }
- @Override
- public void setValueRaw(String valueAsRaw) {
- super.setValueRaw(valueAsRaw);
- }
-
- // //////////////////////////////////////
-
- @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.SettingAbstract.SETTING_TYPE)
- @javax.jdo.annotations.Persistent
- @Override
- public SettingType getType() {
- return super.getType();
- }
- @Override
- public void setType(SettingType type) {
- super.setType(type);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingsServiceJdo.java
----------------------------------------------------------------------
diff --git a/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingsServiceJdo.java b/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingsServiceJdo.java
deleted file mode 100644
index 014455a..0000000
--- a/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingsServiceJdo.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.isis.objectstore.jdo.applib.service.settings;
-
-import java.util.List;
-
-import org.joda.time.LocalDate;
-
-import org.apache.isis.applib.AbstractService;
-import org.apache.isis.applib.annotation.ActionSemantics;
-import org.apache.isis.applib.annotation.ActionSemantics.Of;
-import org.apache.isis.applib.annotation.MemberOrder;
-import org.apache.isis.applib.annotation.Named;
-import org.apache.isis.applib.annotation.Optional;
-import org.apache.isis.applib.query.QueryDefault;
-import org.apache.isis.applib.services.settings.ApplicationSetting;
-import org.apache.isis.applib.services.settings.ApplicationSettingsService;
-import org.apache.isis.applib.services.settings.ApplicationSettingsServiceRW;
-import org.apache.isis.applib.services.settings.SettingAbstract;
-import org.apache.isis.applib.services.settings.SettingType;
-
-/**
- * An implementation of {@link ApplicationSettingsService} that persists settings
- * as entities into a JDO-backed database.
- */
-@Named("Application Settings")
-public class ApplicationSettingsServiceJdo extends AbstractService implements ApplicationSettingsServiceRW {
-
- @ActionSemantics(Of.SAFE)
- @Override
- public ApplicationSetting find(@Named("Key") String key) {
- return firstMatch(
- new QueryDefault<ApplicationSettingJdo>(ApplicationSettingJdo.class,
- "findByKey",
- "key", key));
- }
-
- // //////////////////////////////////////
-
- @ActionSemantics(Of.SAFE)
- @MemberOrder(sequence="1")
- @SuppressWarnings({ "rawtypes", "unchecked" })
- public List<ApplicationSetting> listAll() {
- return (List)allMatches(
- new QueryDefault<ApplicationSettingJdo>(ApplicationSettingJdo.class,
- "findAll"));
- }
-
- // //////////////////////////////////////
-
- @MemberOrder(sequence="10")
- @Override
- public ApplicationSetting newString(
- @Named("Key") String key,
- @Named("Description") @Optional String description,
- @Named("Value") String value) {
- return newSetting(key, description, SettingType.STRING, value);
- }
- @MemberOrder(sequence="11")
- @Override
- public ApplicationSettingJdo newInt(
- @Named("Key") String key,
- @Named("Description") @Optional String description,
- @Named("Value") Integer value) {
- return newSetting(key, description, SettingType.INT, value.toString());
- }
- @MemberOrder(sequence="12")
- @Override
- public ApplicationSettingJdo newLong(
- @Named("Key") String key,
- @Named("Description") @Optional String description,
- @Named("Value") Long value) {
- return newSetting(key, description, SettingType.LONG, value.toString());
- }
- @MemberOrder(sequence="13")
- @Override
- public ApplicationSettingJdo newLocalDate(
- @Named("Key") String key,
- @Named("Description") @Optional String description,
- @Named("Value") LocalDate value) {
- return newSetting(key, description, SettingType.LOCAL_DATE, value.toString(SettingAbstract.DATE_FORMATTER));
- }
- @MemberOrder(sequence="14")
- @Override
- public ApplicationSettingJdo newBoolean(
- @Named("Key") String key,
- @Named("Description") @Optional String description,
- @Named("Value") @Optional Boolean value) {
- return newSetting(key, description, SettingType.BOOLEAN, new Boolean(value != null && value).toString());
- }
-
- private ApplicationSettingJdo newSetting(
- String key, String description, SettingType settingType, final String valueRaw) {
- final ApplicationSettingJdo setting = newTransientInstance(ApplicationSettingJdo.class);
- setting.setKey(key);
- setting.setDescription(description);
- setting.setValueRaw(valueRaw);
- setting.setType(settingType);
- persist(setting);
- return setting;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingsServiceJdoHidden.java
----------------------------------------------------------------------
diff --git a/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingsServiceJdoHidden.java b/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingsServiceJdoHidden.java
deleted file mode 100644
index 95512c0..0000000
--- a/core/module-settings/impl-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/settings/ApplicationSettingsServiceJdoHidden.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.isis.objectstore.jdo.applib.service.settings;
-
-import java.util.List;
-
-import org.joda.time.LocalDate;
-
-import org.apache.isis.applib.annotation.Hidden;
-import org.apache.isis.applib.annotation.Named;
-import org.apache.isis.applib.services.settings.ApplicationSetting;
-
-/**
- * An implementation intended to be hidden in the UI, and delegated to by other services.
- */
-public class ApplicationSettingsServiceJdoHidden extends ApplicationSettingsServiceJdo {
-
- @Hidden
- @Override
- public ApplicationSetting find(@Named("Key") String key) {
- return super.find(key);
- }
-
- // //////////////////////////////////////
-
- @Hidden
- @Override
- public List<ApplicationSetting> listAll() {
- return super.listAll();
- }
-
- // //////////////////////////////////////
-
- @Hidden
- @Override
- public ApplicationSetting newString(String key, String description, String value) {
- return super.newString(key, description, value);
- }
-
- @Hidden
- @Override
- public ApplicationSettingJdo newInt(String key, String description, Integer value) {
- return super.newInt(key, description, value);
- }
-
- @Hidden
- @Override
- public ApplicationSettingJdo newLong(String key, String description, Long value) {
- return super.newLong(key, description, value);
- }
-
- @Hidden
- @Override
- public ApplicationSettingJdo newLocalDate(String key, String description, LocalDate value) {
- return super.newLocalDate(key, description, value);
- }
-
- @Hidden
- @Override
- public ApplicationSettingJdo newBoolean(String key, String description, Boolean value) {
- return super.newBoolean(key, description, value);
- }
-
-}
[2/7] ISIS-887: mothballed the core/module* modules,
moved to mothballed/core/module*
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/IoUtils.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/IoUtils.java b/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/IoUtils.java
new file mode 100644
index 0000000..d7f1ae0
--- /dev/null
+++ b/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/IoUtils.java
@@ -0,0 +1,126 @@
+/**
+ * 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.
+ */
+package org.apache.isis.objectstore.jdo.applib.service.publish;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.Charset;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
+
+import org.apache.isis.applib.FatalException;
+import org.apache.isis.applib.RecoverableException;
+import org.apache.isis.applib.NonRecoverableException;
+
+class IoUtils {
+
+ public static byte[] toUtf8ZippedBytes(String entryName, final String toZip) {
+ if(toZip == null) {
+ return null;
+ }
+ ZipOutputStream zos = null;
+ ByteArrayOutputStream baos = null;
+ try {
+ baos = new ByteArrayOutputStream();
+ zos = new ZipOutputStream(baos);
+ ZipEntry entry = new ZipEntry(entryName);
+ zos.putNextEntry(entry);
+
+ final byte[] utf8Bytes = toZip.getBytes(Charset.forName("UTF-8"));
+ zos.write(utf8Bytes);
+ zos.flush();
+ } catch (final IOException ex) {
+ throw new FatalException(ex);
+ } finally {
+ closeSafely(zos);
+ }
+ return baos.toByteArray();
+ }
+
+ public static String fromUtf8ZippedBytes(String entryName, final byte[] toUnzip) {
+ if(toUnzip == null) {
+ return null;
+ }
+ ByteArrayInputStream bais = null;
+ ZipInputStream zis = null;
+ try {
+ bais = new ByteArrayInputStream(toUnzip);
+ zis = new ZipInputStream(bais);
+ ZipEntry entry;
+ while ((entry = zis.getNextEntry()) != null) {
+ if(!entry.getName().equals(entryName)) {
+ zis.closeEntry();
+ continue;
+ }
+ final byte[] utf8Bytes = IoUtils.readBytes(zis);
+ return new String(utf8Bytes, Charset.forName("UTF-8"));
+ }
+ return null;
+ } catch(IOException ex) {
+ throw new NonRecoverableException(ex);
+ } finally {
+ IoUtils.closeSafely(zis);
+ }
+ }
+
+ static byte[] readBytes(final InputStream zis) throws IOException {
+ final byte[] buffer = new byte[2048];
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ int numBytes;
+ while ((numBytes = zis.read(buffer, 0, buffer.length)) != -1) {
+ baos.write(buffer, 0, numBytes);
+ }
+ baos.flush();
+ baos.close();
+ return baos.toByteArray();
+ }
+
+ static void closeSafely(ZipInputStream zis) {
+ if(zis != null) {
+ try {
+ zis.closeEntry();
+ } catch (IOException e) {
+ // ignore
+ }
+ try {
+ zis.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+
+ static void closeSafely(ZipOutputStream zos) {
+ if(zos != null) {
+ try {
+ zos.closeEntry();
+ } catch (IOException e) {
+ // ignore
+ }
+ try {
+ zos.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishedEventJdo.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishedEventJdo.java b/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishedEventJdo.java
new file mode 100644
index 0000000..097f64c
--- /dev/null
+++ b/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishedEventJdo.java
@@ -0,0 +1,490 @@
+/*
+ * 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.
+ */
+
+package org.apache.isis.objectstore.jdo.applib.service.publish;
+
+import java.util.UUID;
+import javax.jdo.annotations.IdentityType;
+import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.annotation.*;
+import org.apache.isis.applib.annotation.ActionSemantics.Of;
+import org.apache.isis.applib.services.HasTransactionId;
+import org.apache.isis.applib.services.bookmark.BookmarkService;
+import org.apache.isis.applib.services.publish.EventType;
+import org.apache.isis.applib.util.ObjectContracts;
+import org.apache.isis.applib.util.TitleBuffer;
+import org.apache.isis.objectstore.jdo.applib.service.DomainChangeJdoAbstract;
+import org.apache.isis.objectstore.jdo.applib.service.JdoColumnLength;
+import org.apache.isis.objectstore.jdo.applib.service.Util;
+
+@javax.jdo.annotations.PersistenceCapable(
+ identityType=IdentityType.APPLICATION,
+ table="IsisPublishedEvent",
+ objectIdClass=PublishedEventJdoPK.class)
+@javax.jdo.annotations.Queries( {
+ @javax.jdo.annotations.Query(
+ name="findByStateOrderByTimestamp", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
+ + "WHERE state == :state "
+ + "ORDER BY timestamp"),
+ @javax.jdo.annotations.Query(
+ name="findByTransactionId", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
+ + "WHERE transactionId == :transactionId"),
+ @javax.jdo.annotations.Query(
+ name="findByTargetAndTimestampBetween", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
+ + "WHERE targetStr == :targetStr "
+ + "&& timestamp >= :from "
+ + "&& timestamp <= :to "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findByTargetAndTimestampAfter", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
+ + "WHERE targetStr == :targetStr "
+ + "&& timestamp >= :from "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findByTargetAndTimestampBefore", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
+ + "WHERE targetStr == :targetStr "
+ + "&& timestamp <= :to "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findByTarget", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
+ + "WHERE targetStr == :targetStr "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findByTimestampBetween", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
+ + "WHERE timestamp >= :from "
+ + "&& timestamp <= :to "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findByTimestampAfter", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
+ + "WHERE timestamp >= :from "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="findByTimestampBefore", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
+ + "WHERE timestamp <= :to "
+ + "ORDER BY timestamp DESC"),
+ @javax.jdo.annotations.Query(
+ name="find", language="JDOQL",
+ value="SELECT "
+ + "FROM org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo "
+ + "ORDER BY timestamp DESC")
+})
+@MemberGroupLayout(
+ columnSpans={6,0,6},
+ left={"Identifiers","Target"},
+ right={"Detail","State"})
+@Immutable
+@Named("Published Event")
+@ObjectType("IsisPublishedEvent")
+public class PublishedEventJdo extends DomainChangeJdoAbstract implements HasTransactionId {
+
+ public static enum State {
+ QUEUED, PROCESSED
+ }
+
+ // //////////////////////////////////////
+
+ public PublishedEventJdo() {
+ super(ChangeType.PUBLISHED_EVENT);
+ }
+
+
+ // //////////////////////////////////////
+ // Identification
+ // //////////////////////////////////////
+
+ public String title() {
+ final TitleBuffer buf = new TitleBuffer();
+ buf.append(getEventType().name()).append(" ").append(getTargetStr());
+ if(getEventType()==EventType.ACTION_INVOCATION) {
+ buf.append(" ").append(getMemberIdentifier());
+ }
+ buf.append(",").append(getState());
+ return buf.toString();
+ }
+
+
+ // //////////////////////////////////////
+ // user (property)
+ // //////////////////////////////////////
+
+ private String user;
+
+ @javax.jdo.annotations.Column(allowsNull="false", length=50)
+ @MemberOrder(name="Identifiers", sequence = "10")
+ @Hidden(where=Where.PARENTED_TABLES)
+ public String getUser() {
+ return user;
+ }
+
+ public void setUser(final String user) {
+ this.user = user;
+ }
+
+
+ // //////////////////////////////////////
+ // timestamp (property)
+ // //////////////////////////////////////
+
+ private java.sql.Timestamp timestamp;
+
+ @javax.jdo.annotations.Persistent
+ @javax.jdo.annotations.Column(allowsNull="false")
+ @MemberOrder(name="Identifiers", sequence = "20")
+ @Hidden(where=Where.PARENTED_TABLES)
+ public java.sql.Timestamp getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(final java.sql.Timestamp timestamp) {
+ this.timestamp = timestamp;
+ }
+
+
+
+ // //////////////////////////////////////
+ // transactionId
+ // //////////////////////////////////////
+
+ private UUID transactionId;
+
+ /**
+ * The unique identifier (a GUID) of the transaction in which this published event was persisted.
+ *
+ * <p>
+ * The combination of ({@link #getTransactionId() transactionId}, {@link #getSequence() sequence}) makes up the
+ * primary key.
+ */
+ @javax.jdo.annotations.PrimaryKey
+ @javax.jdo.annotations.Column(allowsNull="false",length=JdoColumnLength.TRANSACTION_ID)
+ @MemberOrder(name="Identifiers", sequence = "30")
+ @Hidden(where=Where.PARENTED_TABLES)
+ @Override
+ public UUID getTransactionId() {
+ return transactionId;
+ }
+
+ @Override
+ public void setTransactionId(final UUID transactionId) {
+ this.transactionId = transactionId;
+ }
+
+
+ // //////////////////////////////////////
+ // sequence
+ // //////////////////////////////////////
+
+ private int sequence;
+
+ /**
+ * The 0-based additional identifier of a published event within the given {@link #getTransactionId() transaction}.
+ *
+ * <p>
+ * The combination of ({@link #getTransactionId() transactionId}, {@link #getSequence() sequence}) makes up the
+ * primary key.
+ */
+ @javax.jdo.annotations.PrimaryKey
+ @MemberOrder(name="Identifiers", sequence = "40")
+ public int getSequence() {
+ return sequence;
+ }
+
+ public void setSequence(final int sequence) {
+ this.sequence = sequence;
+ }
+
+
+ // //////////////////////////////////////
+ // title
+ // //////////////////////////////////////
+
+ private String title;
+
+ /**
+ * Consists of the full oidStr (with version info etc), concatenated
+ * (if an {@link EventType#ACTION_INVOCATION}) with the name/parms of the action.
+ *
+ * <p>
+ * @deprecated - the oid of the target is also available (without the version info) through {@link #getTarget()}, and
+ * the action identifier is available through {@link #getMemberIdentifier()}.
+ */
+ @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.PublishedEvent.TITLE)
+ @Hidden
+ @Deprecated
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(final String title) {
+ this.title = title;
+ }
+
+
+ // //////////////////////////////////////
+ // eventType (property)
+ // //////////////////////////////////////
+
+ private EventType eventType;
+
+ @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.PublishedEvent.EVENT_TYPE)
+ @MemberOrder(name="Identifiers",sequence = "50")
+ public EventType getEventType() {
+ return eventType;
+ }
+
+ public void setEventType(final EventType eventType) {
+ this.eventType = eventType;
+ }
+
+
+ // //////////////////////////////////////
+ // targetClass (property)
+ // //////////////////////////////////////
+
+ private String targetClass;
+
+ @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.TARGET_CLASS)
+ @TypicalLength(30)
+ @MemberOrder(name="Target", sequence = "10")
+ @Named("Class")
+ public String getTargetClass() {
+ return targetClass;
+ }
+
+ public void setTargetClass(final String targetClass) {
+ this.targetClass = Util.abbreviated(targetClass, JdoColumnLength.TARGET_CLASS);
+ }
+
+
+ // //////////////////////////////////////
+ // targetAction (property)
+ // //////////////////////////////////////
+
+ private String targetAction;
+
+ /**
+ * Only populated for {@link EventType#ACTION_INVOCATION}
+ */
+ @javax.jdo.annotations.Column(allowsNull="true", length=JdoColumnLength.TARGET_ACTION)
+ @TypicalLength(30)
+ @MemberOrder(name="Target", sequence = "20")
+ @Named("Action")
+ public String getTargetAction() {
+ return targetAction;
+ }
+
+ public void setTargetAction(final String targetAction) {
+ this.targetAction = Util.abbreviated(targetAction, JdoColumnLength.TARGET_ACTION);
+ }
+
+
+ // //////////////////////////////////////
+ // target (property)
+ // openTargetObject (action)
+ // //////////////////////////////////////
+
+
+ private String targetStr;
+ @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.BOOKMARK, name="target")
+ @MemberOrder(name="Target", sequence="30")
+ @Named("Object")
+ public String getTargetStr() {
+ return targetStr;
+ }
+
+ public void setTargetStr(final String targetStr) {
+ this.targetStr = targetStr;
+ }
+
+
+ // //////////////////////////////////////
+ // memberIdentifier (property)
+ // //////////////////////////////////////
+
+ private String memberIdentifier;
+
+ /**
+ * Holds a string representation of the invoked action, equivalent to
+ * {@link Identifier#toClassAndNameIdentityString()}.
+ *
+ * <p>
+ * Only populated for {@link EventType#ACTION_INVOCATION},
+ * returns <tt>null</tt> otherwise.
+ *
+ * <p>
+ * This property is called 'memberIdentifier' rather than 'actionIdentifier' for
+ * consistency with other services (such as auditing and publishing) that may act on
+ * properties rather than simply just actions.
+ */
+ @javax.jdo.annotations.Column(allowsNull="true", length=JdoColumnLength.MEMBER_IDENTIFIER)
+ @TypicalLength(60)
+ @Hidden(where=Where.ALL_TABLES)
+ @MemberOrder(name="Detail",sequence = "20")
+ public String getMemberIdentifier() {
+ return memberIdentifier;
+ }
+
+ public void setMemberIdentifier(final String actionIdentifier) {
+ this.memberIdentifier = Util.abbreviated(actionIdentifier, JdoColumnLength.MEMBER_IDENTIFIER);
+ }
+
+
+
+ // //////////////////////////////////////
+ // state (property)
+ // //////////////////////////////////////
+
+ private State state;
+
+ @javax.jdo.annotations.Column(allowsNull="false", length=JdoColumnLength.PublishedEvent.STATE)
+ @MemberOrder(name="State", sequence = "30")
+ public State getState() {
+ return state;
+ }
+
+ public void setState(final State state) {
+ this.state = state;
+ }
+ private PublishedEventJdo setStateAndReturn(State state) {
+ setState(state);
+ return this;
+ }
+
+
+ // //////////////////////////////////////
+ // serializedFormZipped (property)
+ // serializedForm (derived property)
+ // //////////////////////////////////////
+
+ @javax.jdo.annotations.NotPersistent
+ @NotPersisted
+ @MultiLine(numberOfLines=14)
+ @Hidden(where=Where.ALL_TABLES)
+ @MemberOrder(name="Detail", sequence = "40")
+ public String getSerializedForm() {
+ byte[] zipped = getSerializedFormZipped();
+ if(zipped != null) {
+ return PublishingServiceJdo.fromZippedBytes(zipped);
+ } else {
+ return getSerializedFormClob();
+ }
+ }
+
+
+ // //////////////////////////////////////
+
+ @Deprecated
+ @javax.jdo.annotations.Column(allowsNull="true")
+ private byte[] serializedFormZipped;
+
+ @Deprecated
+ @Programmatic // ignored by Isis
+ public byte[] getSerializedFormZipped() {
+ return serializedFormZipped;
+ }
+
+ @Deprecated
+ public void setSerializedFormZipped(final byte[] serializedFormZipped) {
+ this.serializedFormZipped = serializedFormZipped;
+ }
+
+ // //////////////////////////////////////
+
+ private String serializedFormClob;
+
+ @Programmatic // ignored by Isis
+ @javax.jdo.annotations.Column(allowsNull="true", jdbcType="CLOB")
+ public String getSerializedFormClob() {
+ return serializedFormClob;
+ }
+
+ public void setSerializedFormClob(final String serializedFormClob) {
+ this.serializedFormClob = serializedFormClob;
+ }
+
+
+ // //////////////////////////////////////
+ // processed (action)
+ // reQueue (action)
+ // delete (action)
+ // //////////////////////////////////////
+
+
+ @Bulk
+ @ActionSemantics(Of.IDEMPOTENT)
+ @MemberOrder( name="State", sequence="10")
+ public PublishedEventJdo processed() {
+ return setStateAndReturn(State.PROCESSED);
+ }
+
+
+ @Bulk
+ @ActionSemantics(Of.IDEMPOTENT)
+ @MemberOrder(name="State", sequence="11")
+ public PublishedEventJdo reQueue() {
+ return setStateAndReturn(State.QUEUED);
+ }
+
+ @Bulk
+ @MemberOrder(name="State", sequence="12")
+ public void delete() {
+ container.removeIfNotAlready(this);
+ }
+
+
+
+ // //////////////////////////////////////
+ // toString
+ // //////////////////////////////////////
+
+ @Override
+ public String toString() {
+ return ObjectContracts.toString(this, "targetStr,timestamp,user,eventType,memberIdentifier,state");
+ }
+
+
+ // //////////////////////////////////////
+ // dependencies
+ // //////////////////////////////////////
+
+ @javax.inject.Inject
+ private BookmarkService bookmarkService;
+
+ @javax.inject.Inject
+ private DomainObjectContainer container;
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishedEventJdoPK.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishedEventJdoPK.java b/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishedEventJdoPK.java
new file mode 100644
index 0000000..0666ed3
--- /dev/null
+++ b/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishedEventJdoPK.java
@@ -0,0 +1,102 @@
+/*
+ * 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.
+ */
+package org.apache.isis.objectstore.jdo.applib.service.publish;
+
+import java.io.Serializable;
+import java.util.StringTokenizer;
+import java.util.UUID;
+
+public class PublishedEventJdoPK implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String SEPARATOR = "_";
+
+ public UUID transactionId;
+ public int sequence;
+
+ // //////////////////////////////////////
+
+
+ public PublishedEventJdoPK() {
+ }
+
+ public PublishedEventJdoPK(final String value) {
+ final StringTokenizer token = new StringTokenizer (value, SEPARATOR);
+ this.transactionId = UUID.fromString(token.nextToken());
+ this.sequence = Integer.parseInt(token.nextToken());
+ }
+
+ // //////////////////////////////////////
+
+ public UUID getTransactionId() {
+ return transactionId;
+ }
+ public void setTransactionId(UUID transactionId) {
+ this.transactionId = transactionId;
+ }
+
+ // //////////////////////////////////////
+
+ public int getSequence() {
+ return sequence;
+ }
+ public void setSequence(int sequence) {
+ this.sequence = sequence;
+ }
+
+ // //////////////////////////////////////
+
+
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + sequence;
+ result = prime * result + ((transactionId == null) ? 0 : transactionId.hashCode());
+ return result;
+ }
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ PublishedEventJdoPK other = (PublishedEventJdoPK) obj;
+ if (sequence != other.sequence)
+ return false;
+ if (transactionId == null) {
+ if (other.transactionId != null)
+ return false;
+ } else if (!transactionId.equals(other.transactionId))
+ return false;
+ return true;
+ }
+
+ // //////////////////////////////////////
+
+
+ @Override
+ public String toString() {
+ return transactionId + SEPARATOR + sequence;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdo.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdo.java b/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdo.java
new file mode 100644
index 0000000..6611fb9
--- /dev/null
+++ b/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdo.java
@@ -0,0 +1,124 @@
+/*
+ * 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.
+ */
+
+package org.apache.isis.objectstore.jdo.applib.service.publish;
+
+import java.util.Map;
+import javax.annotation.PostConstruct;
+import org.apache.isis.applib.AbstractService;
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.services.command.CommandContext;
+import org.apache.isis.applib.services.publish.EventMetadata;
+import org.apache.isis.applib.services.publish.EventPayload;
+import org.apache.isis.applib.services.publish.EventSerializer;
+import org.apache.isis.applib.services.publish.PublishingService;
+
+/**
+ * An implementation of {@link PublishingService} that persists events as
+ * entities into a JDO-backed database.
+ */
+@DomainService
+public class PublishingServiceJdo extends AbstractService implements PublishingService {
+
+ private static final String SERIALIZED_FORM_LOCAL_KEY = "datanucleus.PublishingService.serializedForm";
+ private final static String SERIALIZED_FORM_KEY = "isis.persistor." + SERIALIZED_FORM_LOCAL_KEY;
+
+ static enum SerializedForm {
+ CLOB,
+ @Deprecated
+ ZIPPED;
+ static SerializedForm parse(final String value) {
+ return CLOB.toString().equalsIgnoreCase(value)? CLOB: ZIPPED;
+ }
+ }
+
+ private SerializedForm serializedForm;
+
+ @Programmatic
+ @PostConstruct
+ public void init(Map<String,String> configuration) {
+ ensureDependenciesInjected();
+ serializedForm = SerializedForm.parse(configuration.get(SERIALIZED_FORM_KEY));
+ }
+
+
+ // //////////////////////////////////////
+
+ private void ensureDependenciesInjected() {
+ if(this.commandContext == null) {
+ throw new IllegalStateException(this.getClassName() + " requires CommandContext service to be configured");
+ }
+ if(this.eventSerializer == null) {
+ throw new IllegalStateException(this.getClassName() + " requires EventSerializer service to be configured");
+ }
+ }
+
+
+ @Override
+ @Programmatic
+ public void publish(final EventMetadata metadata, final EventPayload payload) {
+ final String serializedEvent = eventSerializer.serialize(metadata, payload).toString();
+ final PublishedEventJdo publishedEvent = newTransientInstance(PublishedEventJdo.class);
+
+ if(this.serializedForm == SerializedForm.ZIPPED) {
+ final byte[] zippedBytes = asZippedBytes(serializedEvent);
+ publishedEvent.setSerializedFormZipped(zippedBytes);
+ } else {
+ publishedEvent.setSerializedFormClob(serializedEvent);
+ }
+
+ publishedEvent.setTransactionId(metadata.getTransactionId());
+ publishedEvent.setSequence(metadata.getSequence());
+ publishedEvent.setEventType(metadata.getEventType());
+ publishedEvent.setTimestamp(metadata.getJavaSqlTimestamp());
+ publishedEvent.setUser(metadata.getUser());
+ publishedEvent.setTitle(metadata.getTitle());
+
+ publishedEvent.setTargetClass(metadata.getTargetClass());
+ publishedEvent.setTarget(metadata.getTarget());
+ publishedEvent.setTargetAction(metadata.getTargetAction());
+ publishedEvent.setMemberIdentifier(metadata.getActionIdentifier());
+
+ persist(publishedEvent);
+ }
+
+
+ static byte[] asZippedBytes(final String serializedEvent) {
+ return IoUtils.toUtf8ZippedBytes("serializedForm", serializedEvent);
+ }
+
+
+ // //////////////////////////////////////
+
+ private EventSerializer eventSerializer;
+
+ @Override
+ public void setEventSerializer(EventSerializer eventSerializer) {
+ this.eventSerializer = eventSerializer;
+ }
+
+ static String fromZippedBytes(byte[] zipped) {
+ return IoUtils.fromUtf8ZippedBytes("serializedForm", zipped);
+ }
+
+
+ @javax.inject.Inject
+ private CommandContext commandContext;
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdoContributions.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdoContributions.java b/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdoContributions.java
new file mode 100644
index 0000000..1709f64
--- /dev/null
+++ b/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdoContributions.java
@@ -0,0 +1,47 @@
+/**
+ * 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.
+ */
+package org.apache.isis.objectstore.jdo.applib.service.publish;
+
+import java.util.List;
+
+import org.apache.isis.applib.AbstractFactoryAndRepository;
+import org.apache.isis.applib.annotation.ActionSemantics;
+import org.apache.isis.applib.annotation.Render;
+import org.apache.isis.applib.annotation.ActionSemantics.Of;
+import org.apache.isis.applib.annotation.NotContributed;
+import org.apache.isis.applib.annotation.NotContributed.As;
+import org.apache.isis.applib.annotation.Render.Type;
+import org.apache.isis.applib.annotation.NotInServiceMenu;
+import org.apache.isis.applib.services.HasTransactionId;
+
+
+public class PublishingServiceJdoContributions extends AbstractFactoryAndRepository {
+
+ @ActionSemantics(Of.SAFE)
+ @NotInServiceMenu
+ @NotContributed(As.ACTION)
+ @Render(Type.EAGERLY)
+ public List<PublishedEventJdo> publishedEvents(final HasTransactionId hasTransactionId) {
+ return publishedEventRepository.findByTransactionId(hasTransactionId.getTransactionId());
+ }
+
+ // //////////////////////////////////////
+
+ @javax.inject.Inject
+ private PublishingServiceJdoRepository publishedEventRepository;
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdoRepository.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdoRepository.java b/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdoRepository.java
new file mode 100644
index 0000000..636369d
--- /dev/null
+++ b/mothballed/core/module-publishing-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/publish/PublishingServiceJdoRepository.java
@@ -0,0 +1,156 @@
+/*
+ * 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.
+ */
+
+package org.apache.isis.objectstore.jdo.applib.service.publish;
+
+import java.sql.Timestamp;
+import java.util.List;
+import java.util.UUID;
+import org.joda.time.LocalDate;
+import org.apache.isis.applib.AbstractFactoryAndRepository;
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.query.Query;
+import org.apache.isis.applib.query.QueryDefault;
+import org.apache.isis.applib.services.bookmark.Bookmark;
+
+/**
+ * Provides supporting functionality for querying and persisting
+ * {@link org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo published event} entities.
+ *
+ * <p>
+ * This supporting service with no UI and no side-effects, and is there are no other implementations of the service,
+ * thus has been annotated with {@link org.apache.isis.applib.annotation.DomainService}. This means that there is no
+ * need to explicitly register it as a service (eg in <tt>isis.properties</tt>).
+ */
+@DomainService
+public class PublishingServiceJdoRepository extends AbstractFactoryAndRepository {
+
+ @Programmatic
+ public List<PublishedEventJdo> findQueued() {
+ return allMatches(
+ new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
+ "findByStateOrderByTimestamp",
+ "state", PublishedEventJdo.State.QUEUED));
+ }
+
+ @Programmatic
+ public List<PublishedEventJdo> findProcessed() {
+ return allMatches(
+ new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
+ "findByStateOrderByTimestamp",
+ "state", PublishedEventJdo.State.PROCESSED));
+ }
+
+ @Programmatic
+ public List<PublishedEventJdo> findByTransactionId(final UUID transactionId) {
+ return allMatches(
+ new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
+ "findByTransactionId",
+ "transactionId", transactionId));
+ }
+
+ @Programmatic
+ public void purgeProcessed() {
+ // REVIEW: this is not particularly performant.
+ // much better would be to go direct to the JDO API.
+ List<PublishedEventJdo> processedEvents = findProcessed();
+ for (PublishedEventJdo publishedEvent : processedEvents) {
+ publishedEvent.delete();
+ }
+ }
+
+
+ @Programmatic
+ public List<PublishedEventJdo> findByTargetAndFromAndTo(
+ final Bookmark target,
+ final LocalDate from,
+ final LocalDate to) {
+ final String targetStr = target.toString();
+ final Timestamp fromTs = toTimestampStartOfDayWithOffset(from, 0);
+ final Timestamp toTs = toTimestampStartOfDayWithOffset(to, 1);
+
+ final Query<PublishedEventJdo> query;
+ if(from != null) {
+ if(to != null) {
+ query = new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
+ "findByTargetAndTimestampBetween",
+ "targetStr", targetStr,
+ "from", fromTs,
+ "to", toTs);
+ } else {
+ query = new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
+ "findByTargetAndTimestampAfter",
+ "targetStr", targetStr,
+ "from", fromTs);
+ }
+ } else {
+ if(to != null) {
+ query = new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
+ "findByTargetAndTimestampBefore",
+ "targetStr", targetStr,
+ "to", toTs);
+ } else {
+ query = new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
+ "findByTarget",
+ "targetStr", targetStr);
+ }
+ }
+ return allMatches(query);
+ }
+
+ @Programmatic
+ public List<PublishedEventJdo> findByFromAndTo(
+ final LocalDate from,
+ final LocalDate to) {
+ final Timestamp fromTs = toTimestampStartOfDayWithOffset(from, 0);
+ final Timestamp toTs = toTimestampStartOfDayWithOffset(to, 1);
+
+ final Query<PublishedEventJdo> query;
+ if(from != null) {
+ if(to != null) {
+ query = new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
+ "findByTimestampBetween",
+ "from", fromTs,
+ "to", toTs);
+ } else {
+ query = new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
+ "findByTimestampAfter",
+ "from", fromTs);
+ }
+ } else {
+ if(to != null) {
+ query = new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
+ "findByTimestampBefore",
+ "to", toTs);
+ } else {
+ query = new QueryDefault<PublishedEventJdo>(PublishedEventJdo.class,
+ "find");
+ }
+ }
+ return allMatches(query);
+ }
+
+ private static Timestamp toTimestampStartOfDayWithOffset(final LocalDate dt, int daysOffset) {
+ return dt!=null
+ ?new java.sql.Timestamp(dt.toDateTimeAtStartOfDay().plusDays(daysOffset).getMillis())
+ :null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-publishing-jdo/src/main/resources/images/PublishedEventJdo.png
----------------------------------------------------------------------
diff --git a/mothballed/core/module-publishing-jdo/src/main/resources/images/PublishedEventJdo.png b/mothballed/core/module-publishing-jdo/src/main/resources/images/PublishedEventJdo.png
new file mode 100644
index 0000000..cb3a325
Binary files /dev/null and b/mothballed/core/module-publishing-jdo/src/main/resources/images/PublishedEventJdo.png differ
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-publishing-jdo/src/test/java/org/apache/isis/objectstore/jdo/applib/service/publish/IoUtilsTest.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-publishing-jdo/src/test/java/org/apache/isis/objectstore/jdo/applib/service/publish/IoUtilsTest.java b/mothballed/core/module-publishing-jdo/src/test/java/org/apache/isis/objectstore/jdo/applib/service/publish/IoUtilsTest.java
new file mode 100644
index 0000000..32cfde0
--- /dev/null
+++ b/mothballed/core/module-publishing-jdo/src/test/java/org/apache/isis/objectstore/jdo/applib/service/publish/IoUtilsTest.java
@@ -0,0 +1,36 @@
+/**
+ * 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.
+ */
+package org.apache.isis.objectstore.jdo.applib.service.publish;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class IoUtilsTest {
+
+ @Test
+ public void roundtrip() {
+ final String str = "3784y5hrfbdgkjh3qyri f£$%$YTRGFDGER$£\"Eu098987u'!\"£%^&*IO(LUKJM)";
+ final byte[] utf8ZippedBytes = IoUtils.toUtf8ZippedBytes("serializedForm", str);
+
+ final String str2 = IoUtils.fromUtf8ZippedBytes("serializedForm", utf8ZippedBytes);
+
+ assertThat(str, (is(str2)));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-publishingeventserializer-ro/pom.xml
----------------------------------------------------------------------
diff --git a/mothballed/core/module-publishingeventserializer-ro/pom.xml b/mothballed/core/module-publishingeventserializer-ro/pom.xml
new file mode 100644
index 0000000..b06d9ee
--- /dev/null
+++ b/mothballed/core/module-publishingeventserializer-ro/pom.xml
@@ -0,0 +1,89 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-publishingeventserializer-ro</artifactId>
+
+ <name>Isis Module: Publishing Event Servializer (Restful Objects spec)</name>
+ <description>
+ Implementation of an event serializer (as required by the publishing
+ service) that serialized the object as a JSON representation defined
+ by the Restful Objects spec.
+ </description>
+
+ <properties>
+ <siteBaseDir>..</siteBaseDir>
+ <relativeUrl>module-publishingeventserializer-ro/</relativeUrl>
+ </properties>
+
+ <url>http://isis.apache.org/${relativeUrl}</url>
+
+ <build>
+ <resources>
+ <resource>
+ <filtering>false</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ <resource>
+ <filtering>false</filtering>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-applib</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-viewer-restfulobjects-rendering</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-unittestsupport</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-publishingeventserializer-ro/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/EventSerializerRendererContext.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-publishingeventserializer-ro/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/EventSerializerRendererContext.java b/mothballed/core/module-publishingeventserializer-ro/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/EventSerializerRendererContext.java
new file mode 100644
index 0000000..6d10cc2
--- /dev/null
+++ b/mothballed/core/module-publishingeventserializer-ro/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/EventSerializerRendererContext.java
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ */
+package org.apache.isis.viewer.restfulobjects.rendering.eventserializer;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import com.google.common.collect.Sets;
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
+import org.apache.isis.viewer.restfulobjects.rendering.RendererContext;
+
+class EventSerializerRendererContext implements RendererContext {
+
+ private final String baseUrl;
+ private final Where where;
+
+ public EventSerializerRendererContext(String baseUrl, Where where) {
+ this.baseUrl = baseUrl;
+ this.where = where;
+ }
+
+ @Override
+ public String urlFor(String url) {
+ return baseUrl + url;
+ }
+
+ @Override
+ public AuthenticationSession getAuthenticationSession() {
+ return IsisContext.getAuthenticationSession();
+ }
+
+ @Override
+ public PersistenceSession getPersistenceSession() {
+ return IsisContext.getPersistenceSession();
+ }
+
+ @Override
+ public IsisConfiguration getConfiguration() {
+ return IsisContext.getConfiguration();
+ }
+
+ @Override
+ public AdapterManager getAdapterManager() {
+ return getPersistenceSession().getAdapterManager();
+ }
+
+ @Override
+ public List<List<String>> getFollowLinks() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public Where getWhere() {
+ return where;
+ }
+
+ @Override
+ public Localization getLocalization() {
+ return IsisContext.getLocalization();
+ }
+
+ private Set<Oid> rendered = Sets.newHashSet();
+ @Override
+ public boolean canEagerlyRender(ObjectAdapter objectAdapter) {
+ final Oid oid = objectAdapter.getOid();
+ return rendered.add(oid);
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-publishingeventserializer-ro/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/RestfulObjectsSpecEventSerializer.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-publishingeventserializer-ro/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/RestfulObjectsSpecEventSerializer.java b/mothballed/core/module-publishingeventserializer-ro/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/RestfulObjectsSpecEventSerializer.java
new file mode 100644
index 0000000..07c19c5
--- /dev/null
+++ b/mothballed/core/module-publishingeventserializer-ro/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/RestfulObjectsSpecEventSerializer.java
@@ -0,0 +1,126 @@
+/*
+ * 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.
+ */
+package org.apache.isis.viewer.restfulobjects.rendering.eventserializer;
+
+import java.io.IOException;
+import java.util.Map;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import org.codehaus.jackson.JsonGenerationException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.applib.services.publish.EventMetadata;
+import org.apache.isis.applib.services.publish.EventPayload;
+import org.apache.isis.applib.services.publish.EventSerializer;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.JsonMapper;
+import org.apache.isis.viewer.restfulobjects.rendering.RendererContext;
+import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.DomainObjectReprRenderer;
+
+/**
+ * Serializes {@link org.apache.isis.applib.services.publish.EventMetadata event metadata} and corresponding
+ * {@link org.apache.isis.applib.services.publish.EventPayload payload} into a JSON format corresponding to the
+ * domain object representation specified by the Restful Objects spec.
+ *
+ * <p>
+ * This implementation has no UI, has no side-effects, and there are no other implementations of the service API, and
+ * so it annotated with {@link org.apache.isis.applib.annotation.DomainService}. This class is implemented in the
+ * <tt>o.a.i.module:isis-module-publishingeventserializer-ro</tt> module. If that module is included in the classpath,
+ * it this means that this service is automatically registered; no further configuration is required.
+ */
+@DomainService
+public class RestfulObjectsSpecEventSerializer implements EventSerializer {
+
+ private final static String BASE_URL_KEY = "isis.viewer.restfulobjects.RestfulObjectsSpecEventSerializer.baseUrl";
+ private static final String BASE_URL_DEFAULT = "http://localhost:8080/restful/";
+
+ //region > init, shutdown
+ private String baseUrl;
+
+ @Programmatic
+ @PostConstruct
+ public void init(Map<String,String> props) {
+ final String baseUrlFromConfig = props.get(BASE_URL_KEY);
+ baseUrl = baseUrlFromConfig != null? baseUrlFromConfig: BASE_URL_DEFAULT;
+ }
+
+ @Programmatic
+ @PreDestroy
+ public void shutdown() {
+ }
+ //endregion
+
+ //region > serialize (API)
+ @Programmatic
+ @Override
+ public Object serialize(EventMetadata metadata, EventPayload payload) {
+ final RendererContext rendererContext = new EventSerializerRendererContext(baseUrl, Where.OBJECT_FORMS);
+
+ final JsonRepresentation payloadRepr = asPayloadRepr(rendererContext, payload);
+ final JsonRepresentation eventRepr = asEventRepr(metadata, payloadRepr);
+
+ return jsonFor(eventRepr);
+ }
+ //endregion
+
+ //region > supporting methods
+ JsonRepresentation asEventRepr(EventMetadata metadata, final JsonRepresentation payloadRepr) {
+ final JsonRepresentation eventRepr = JsonRepresentation.newMap();
+ final JsonRepresentation metadataRepr = JsonRepresentation.newMap();
+ eventRepr.mapPut("metadata", metadataRepr);
+ metadataRepr.mapPut("id", metadata.getId());
+ metadataRepr.mapPut("transactionId", metadata.getTransactionId());
+ metadataRepr.mapPut("sequence", metadata.getSequence());
+ metadataRepr.mapPut("eventType", metadata.getEventType());
+ metadataRepr.mapPut("user", metadata.getUser());
+ metadataRepr.mapPut("timestamp", metadata.getTimestamp());
+ eventRepr.mapPut("payload", payloadRepr);
+ return eventRepr;
+ }
+
+ JsonRepresentation asPayloadRepr(final RendererContext rendererContext, EventPayload payload) {
+ final DomainObjectReprRenderer renderer = new DomainObjectReprRenderer(rendererContext, null, JsonRepresentation.newMap());
+ final ObjectAdapter objectAdapter = rendererContext.getAdapterManager().adapterFor(payload);
+ renderer.with(objectAdapter).asEventSerialization();
+ return renderer.render();
+ }
+
+ String jsonFor(final Object object) {
+ try {
+ return getJsonMapper().write(object);
+ } catch (final JsonGenerationException e) {
+ throw new RuntimeException(e);
+ } catch (final JsonMappingException e) {
+ throw new RuntimeException(e);
+ } catch (final IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private final static JsonMapper jsonMapper = JsonMapper.instance();
+
+ JsonMapper getJsonMapper() {
+ return jsonMapper;
+ }
+ //endregion
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-publishingeventserializer-ro/src/main/resources/images/PublishedEventJdo.png
----------------------------------------------------------------------
diff --git a/mothballed/core/module-publishingeventserializer-ro/src/main/resources/images/PublishedEventJdo.png b/mothballed/core/module-publishingeventserializer-ro/src/main/resources/images/PublishedEventJdo.png
new file mode 100644
index 0000000..cb3a325
Binary files /dev/null and b/mothballed/core/module-publishingeventserializer-ro/src/main/resources/images/PublishedEventJdo.png differ
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/.gitignore
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/.gitignore b/mothballed/core/module-settings/.gitignore
new file mode 100644
index 0000000..a48e45b
--- /dev/null
+++ b/mothballed/core/module-settings/.gitignore
@@ -0,0 +1 @@
+/target-ide
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/applib/.gitignore
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/applib/.gitignore b/mothballed/core/module-settings/applib/.gitignore
new file mode 100644
index 0000000..a48e45b
--- /dev/null
+++ b/mothballed/core/module-settings/applib/.gitignore
@@ -0,0 +1 @@
+/target-ide
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/applib/pom.xml
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/applib/pom.xml b/mothballed/core/module-settings/applib/pom.xml
new file mode 100644
index 0000000..9f586c5
--- /dev/null
+++ b/mothballed/core/module-settings/applib/pom.xml
@@ -0,0 +1,55 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.isis.module</groupId>
+ <artifactId>isis-module-settings</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>isis-module-settings-applib</artifactId>
+
+ <name>Isis Module: App and User Settings applib</name>
+ <description>
+ API for the application and user settings module.
+ </description>
+
+ <properties>
+ <siteBaseDir>../..</siteBaseDir>
+ <relativeUrl>module-settings/applib/</relativeUrl>
+ </properties>
+
+ <url>http://isis.apache.org/${relativeUrl}</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-applib</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-unittestsupport</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSetting.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSetting.java b/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSetting.java
new file mode 100644
index 0000000..06d4ec1
--- /dev/null
+++ b/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSetting.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.isis.applib.services.settings;
+
+
+
+public interface ApplicationSetting extends Setting {
+
+ String getKey();
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSettingsService.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSettingsService.java b/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSettingsService.java
new file mode 100644
index 0000000..d6ded31
--- /dev/null
+++ b/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSettingsService.java
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+package org.apache.isis.applib.services.settings;
+
+import java.util.List;
+
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.Named;
+
+public interface ApplicationSettingsService {
+
+ @MemberOrder(sequence="1")
+ ApplicationSetting find(@Named("Key") String key);
+
+ @MemberOrder(sequence="2")
+ List<ApplicationSetting> listAll();
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSettingsServiceRW.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSettingsServiceRW.java b/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSettingsServiceRW.java
new file mode 100644
index 0000000..ae680eb
--- /dev/null
+++ b/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/ApplicationSettingsServiceRW.java
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+package org.apache.isis.applib.services.settings;
+
+import org.joda.time.LocalDate;
+
+import org.apache.isis.applib.annotation.MemberOrder;
+
+public interface ApplicationSettingsServiceRW extends ApplicationSettingsService {
+
+ @MemberOrder(sequence="11")
+ ApplicationSetting newBoolean(String name, String description, Boolean defaultValue);
+ @MemberOrder(sequence="12")
+ ApplicationSetting newString(String name, String description, String defaultValue);
+ @MemberOrder(sequence="13")
+ ApplicationSetting newLocalDate(String name, String description, LocalDate defaultValue);
+ @MemberOrder(sequence="14")
+ ApplicationSetting newInt(String name, String description, Integer defaultValue);
+ @MemberOrder(sequence="15")
+ ApplicationSetting newLong(String name, String description, Long defaultValue);
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/Setting.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/Setting.java b/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/Setting.java
new file mode 100644
index 0000000..3999d4c
--- /dev/null
+++ b/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/Setting.java
@@ -0,0 +1,53 @@
+/**
+ * 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.
+ */
+package org.apache.isis.applib.services.settings;
+
+import org.joda.time.LocalDate;
+
+import org.apache.isis.applib.annotation.MemberOrder;
+
+
+/**
+ * Common supertype for both {@link ApplicationSetting} and {@link UserSetting}.
+ *
+ * <p>
+ * The difference between the two is in the settings unique identifier;
+ * the former just is uniquely identified by a single key (defined in
+ * {@link #getKey() this interface}, whereas the latter is uniquely identified by
+ * the combination of the key plus an identifier of the user.
+ */
+public interface Setting {
+
+ /**
+ * In the case of {@link ApplicationSetting}, this constitutes the unique identifier;
+ * for a {@link UserSetting}, the unique identifier is both this key plus an identifier
+ * for the user.
+ */
+ String getKey();
+
+ SettingType getType();
+ String getDescription();
+
+ String getValueRaw();
+
+ String valueAsString();
+ LocalDate valueAsLocalDate();
+ Integer valueAsInt();
+ Long valueAsLong();
+ Boolean valueAsBoolean();
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/SettingAbstract.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/SettingAbstract.java b/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/SettingAbstract.java
new file mode 100644
index 0000000..6eb39c8
--- /dev/null
+++ b/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/SettingAbstract.java
@@ -0,0 +1,192 @@
+/**
+ * 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.
+ */
+package org.apache.isis.applib.services.settings;
+
+import org.joda.time.LocalDate;
+import org.joda.time.format.DateTimeFormat;
+import org.joda.time.format.DateTimeFormatter;
+
+import org.apache.isis.applib.annotation.Hidden;
+import org.apache.isis.applib.annotation.Immutable;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.annotation.Optional;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.annotation.Title;
+import org.apache.isis.applib.annotation.Where;
+
+
+/**
+ * Convenience class to implement {@link Setting}.
+ */
+@Immutable
+public abstract class SettingAbstract implements Setting {
+
+ public final static DateTimeFormatter DATE_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd");
+
+ @Title(sequence="10")
+ @MemberOrder(sequence="10")
+ public abstract String getKey();
+
+ @Optional
+ @MemberOrder(sequence="80")
+ public abstract String getDescription();
+
+ @MemberOrder(sequence="90")
+ public abstract SettingType getType();
+
+ // //////////////////////////////////////
+
+ @Title(prepend=" = ", sequence="30")
+ @MemberOrder(sequence="30")
+ @Hidden(where=Where.OBJECT_FORMS)
+ public abstract String getValueRaw();
+
+ // //////////////////////////////////////
+
+ @Programmatic
+ public String valueAsString() {
+ ensure(SettingType.STRING);
+ return getValueRaw();
+ }
+
+ // //////////////////////////////////////
+
+ @Programmatic
+ public LocalDate valueAsLocalDate() {
+ ensure(SettingType.LOCAL_DATE);
+ return parseValueAsLocalDate();
+ }
+
+ protected LocalDate parseValueAsLocalDate() {
+ return LocalDate.parse(getValueRaw(), DATE_FORMATTER);
+ }
+
+ // //////////////////////////////////////
+
+ @Programmatic
+ public Integer valueAsInt() {
+ ensure(SettingType.INT);
+ return parseValueAsInt();
+ }
+
+ protected int parseValueAsInt() {
+ return Integer.parseInt(getValueRaw());
+ }
+
+ // //////////////////////////////////////
+
+ @Programmatic
+ public Long valueAsLong() {
+ ensure(SettingType.LONG);
+ return parseValueAsLong();
+ }
+
+ protected long parseValueAsLong() {
+ return Long.parseLong(getValueRaw());
+ }
+
+ // //////////////////////////////////////
+
+ @Programmatic
+ public Boolean valueAsBoolean() {
+ ensure(SettingType.BOOLEAN);
+ return parseValueAsBoolean();
+ }
+
+ protected boolean parseValueAsBoolean() {
+ return Boolean.parseBoolean(getValueRaw());
+ }
+
+ // //////////////////////////////////////
+
+ @MemberOrder(sequence="30")
+ @Hidden(where=Where.ALL_TABLES)
+ @Named("Value")
+ public String getValueAsString() {
+ return getValueRaw();
+ }
+ public boolean hideValueAsString() {
+ return typeIsNot(SettingType.STRING);
+ }
+
+ // //////////////////////////////////////
+
+ @MemberOrder(sequence="30")
+ @Hidden(where=Where.ALL_TABLES)
+ @Named("Value")
+ public LocalDate getValueAsLocalDate() {
+ return parseValueAsLocalDate();
+ }
+ public boolean hideValueAsLocalDate() {
+ return typeIsNot(SettingType.LOCAL_DATE);
+ }
+
+ // //////////////////////////////////////
+
+
+ @MemberOrder(sequence="30")
+ @Hidden(where=Where.ALL_TABLES)
+ @Named("Value")
+ public Integer getValueAsInt() {
+ return parseValueAsInt();
+ }
+ public boolean hideValueAsInt() {
+ return typeIsNot(SettingType.INT);
+ }
+
+ // //////////////////////////////////////
+
+
+
+ @MemberOrder(sequence="30")
+ @Hidden(where=Where.ALL_TABLES)
+ @Named("Value")
+ public Long getValueAsLong() {
+ return parseValueAsLong();
+ }
+ public boolean hideValueAsLong() {
+ return typeIsNot(SettingType.LONG);
+ }
+
+ // //////////////////////////////////////
+
+
+
+ @MemberOrder(sequence="30")
+ @Hidden(where=Where.ALL_TABLES)
+ @Named("Value")
+ public Boolean getValueAsBoolean() {
+ return parseValueAsBoolean();
+ }
+ public boolean hideValueAsBoolean() {
+ return typeIsNot(SettingType.BOOLEAN);
+ }
+
+ // //////////////////////////////////////
+
+ private void ensure(SettingType settingType) {
+ if(typeIsNot(settingType)) {
+ throw new IllegalStateException("Setting '" + getKey() + "' is of type " + getType() + ", not of type " + settingType);
+ }
+ }
+
+ protected boolean typeIsNot(SettingType settingType) {
+ return getType() != settingType;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/SettingType.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/SettingType.java b/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/SettingType.java
new file mode 100644
index 0000000..a652bf3
--- /dev/null
+++ b/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/SettingType.java
@@ -0,0 +1,28 @@
+/**
+ * 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.
+ */
+package org.apache.isis.applib.services.settings;
+
+
+public enum SettingType {
+
+ BOOLEAN,
+ INT,
+ LONG,
+ STRING,
+ LOCAL_DATE
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSetting.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSetting.java b/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSetting.java
new file mode 100644
index 0000000..24ccf65
--- /dev/null
+++ b/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSetting.java
@@ -0,0 +1,34 @@
+/**
+ * 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.
+ */
+package org.apache.isis.applib.services.settings;
+
+import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.applib.security.UserMemento;
+
+
+
+public interface UserSetting extends Setting {
+
+ String getKey();
+
+ /**
+ * Typically as obtained from the {@link UserMemento#getName() UserMemento} class
+ * (accessible in turn from the {@link DomainObjectContainer#getUser() DomainObjectContainer}).
+ */
+ String getUser();
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSettingsService.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSettingsService.java b/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSettingsService.java
new file mode 100644
index 0000000..f798e62
--- /dev/null
+++ b/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSettingsService.java
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+package org.apache.isis.applib.services.settings;
+
+import java.util.List;
+
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.Named;
+
+public interface UserSettingsService {
+
+ @MemberOrder(sequence="1")
+ UserSetting find(@Named("User") String user, @Named("Key") String key);
+
+ @MemberOrder(sequence="2")
+ List<UserSetting> listAll();
+
+ @MemberOrder(sequence="3")
+ List<UserSetting> listAllFor(@Named("User") String user);
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/790e70df/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSettingsServiceRW.java
----------------------------------------------------------------------
diff --git a/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSettingsServiceRW.java b/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSettingsServiceRW.java
new file mode 100644
index 0000000..8b048ea
--- /dev/null
+++ b/mothballed/core/module-settings/applib/src/main/java/org/apache/isis/applib/services/settings/UserSettingsServiceRW.java
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+package org.apache.isis.applib.services.settings;
+
+import org.joda.time.LocalDate;
+
+import org.apache.isis.applib.annotation.MemberOrder;
+
+public interface UserSettingsServiceRW extends UserSettingsService {
+
+ @MemberOrder(sequence="11")
+ UserSetting newBoolean(String user, String name, String description, Boolean defaultValue);
+ @MemberOrder(sequence="12")
+ UserSetting newString(String user, String name, String description, String defaultValue);
+ @MemberOrder(sequence="13")
+ UserSetting newLocalDate(String user, String name, String description, LocalDate defaultValue);
+ @MemberOrder(sequence="14")
+ UserSetting newInt(String user, String name, String description, Integer defaultValue);
+ @MemberOrder(sequence="15")
+ UserSetting newLong(String user, String name, String description, Long defaultValue);
+
+}