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:23 UTC
[4/7] ISIS-887: mothballed the core/module* modules,
moved to mothballed/core/module*
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"));
+ }
+
+}