You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2013/02/15 10:24:43 UTC
[2/3] git commit: ISIS-327: changing order of publication,
changing config param
ISIS-327: changing order of publication, changing config param
* publish action, then objects (cause and effect)
* config param now has prefix "isis.viewer.restfulobjects...."
* building on ISIS-342, this config moved to "viewer_restfulobjects.properties" in the example app.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/c41ee303
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/c41ee303
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/c41ee303
Branch: refs/heads/master
Commit: c41ee30363ce155b6a5059bad94e571b2af0a0b6
Parents: d1b1d0c
Author: Dan Haywood <da...@apache.org>
Authored: Fri Feb 15 09:00:05 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Fri Feb 15 09:00:05 2013 +0000
----------------------------------------------------------------------
.../RestfulObjectsSpecEventSerializer.java | 3 +-
.../system/transaction/IsisTransaction.java | 34 ++++++++-------
.../src/main/webapp/WEB-INF/isis.properties | 2 +-
.../WEB-INF/viewer_restfulobjects.properties | 23 ++++++++++
4 files changed, 44 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/c41ee303/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/RestfulObjectsSpecEventSerializer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/RestfulObjectsSpecEventSerializer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/RestfulObjectsSpecEventSerializer.java
index 2a68fea..8e87490 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/RestfulObjectsSpecEventSerializer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/RestfulObjectsSpecEventSerializer.java
@@ -26,7 +26,8 @@ public class RestfulObjectsSpecEventSerializer implements EventSerializer {
private final static JsonMapper jsonMapper = JsonMapper.instance();
private final static DomainObjectReprRenderer.Factory objectRendererFactory = new DomainObjectReprRenderer.Factory();
- private final static String BASE_URL_KEY = RestfulObjectsSpecEventSerializer.class.getName() + ".baseUrl";
+
+ private final static String BASE_URL_KEY = "isis.viewer.restfulobjects.RestfulObjectsSpecEventSerializer.baseUrl";
private static final String BASE_URL_DEFAULT = "http://localhost:8080/restful/";
private String baseUrl;
http://git-wip-us.apache.org/repos/asf/isis/blob/c41ee303/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
index a23fe8c..c1d58f8 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
@@ -32,7 +32,7 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
-import org.apache.isis.applib.annotation.PublishedAction.PayloadFactory;
+import org.apache.isis.applib.annotation.PublishedAction;
import org.apache.isis.applib.annotation.PublishedObject;
import org.apache.isis.applib.clock.Clock;
import org.apache.isis.applib.services.audit.AuditingService;
@@ -424,24 +424,13 @@ public class IsisTransaction implements TransactionScopedComponent {
final String currentUser = getTransactionManager().getAuthenticationSession().getUserName();
final long currentTimestampEpoch = currentTimestampEpoch();
- publishedChangedObjects(changedAdapters, currentUser, currentTimestampEpoch);
publishActionIfRequired(currentUser, currentTimestampEpoch);
- }
-
- protected void publishedChangedObjects(final Set<ObjectAdapter> changedAdapters, final String currentUser, final long currentTimestampEpoch) {
- for (final ObjectAdapter changedAdapter : changedAdapters) {
- final PublishedObjectFacet publishedObjectFacet = changedAdapter.getSpecification().getFacet(PublishedObjectFacet.class);
- if(publishedObjectFacet == null) {
- continue;
- }
- final PublishedObject.PayloadFactory payloadFactory = publishedObjectFacet.value();
- final EventMetadata metadata = new EventMetadata(getGuid(), currentUser, currentTimestampEpoch);
-
- publishingService.publishObject(payloadFactory, metadata, changedAdapter);
- }
+ publishedChangedObjects(changedAdapters, currentUser, currentTimestampEpoch);
}
protected void publishActionIfRequired(final String currentUser, final long currentTimestampEpoch) {
+ // TODO: need some transaction handling here
+
try {
final CurrentInvocation currentInvocation = ActionInvocationFacet.currentInvocation.get();
if(currentInvocation == null) {
@@ -451,7 +440,7 @@ public class IsisTransaction implements TransactionScopedComponent {
if(publishedActionFacet == null) {
return;
}
- final PayloadFactory payloadFactory = publishedActionFacet.value();
+ final PublishedAction.PayloadFactory payloadFactory = publishedActionFacet.value();
final EventMetadata metadata = new EventMetadata(getGuid(), currentUser, currentTimestampEpoch);
publishingService.publishAction(payloadFactory, metadata, currentInvocation);
} finally {
@@ -459,6 +448,19 @@ public class IsisTransaction implements TransactionScopedComponent {
}
}
+ protected void publishedChangedObjects(final Set<ObjectAdapter> changedAdapters, final String currentUser, final long currentTimestampEpoch) {
+ for (final ObjectAdapter changedAdapter : changedAdapters) {
+ final PublishedObjectFacet publishedObjectFacet = changedAdapter.getSpecification().getFacet(PublishedObjectFacet.class);
+ if(publishedObjectFacet == null) {
+ continue;
+ }
+ final PublishedObject.PayloadFactory payloadFactory = publishedObjectFacet.value();
+ final EventMetadata metadata = new EventMetadata(getGuid(), currentUser, currentTimestampEpoch);
+
+ publishingService.publishObject(payloadFactory, metadata, changedAdapter);
+ }
+ }
+
private static long currentTimestampEpoch() {
return Clock.getTime();
}
http://git-wip-us.apache.org/repos/asf/isis/blob/c41ee303/example/application/quickstart_wicket_restful_jdo/viewer-webapp/src/main/webapp/WEB-INF/isis.properties
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/viewer-webapp/src/main/webapp/WEB-INF/isis.properties b/example/application/quickstart_wicket_restful_jdo/viewer-webapp/src/main/webapp/WEB-INF/isis.properties
index 741a7c4..2cde3a3 100644
--- a/example/application/quickstart_wicket_restful_jdo/viewer-webapp/src/main/webapp/WEB-INF/isis.properties
+++ b/example/application/quickstart_wicket_restful_jdo/viewer-webapp/src/main/webapp/WEB-INF/isis.properties
@@ -176,5 +176,5 @@ isis.services = objstore.jdo.todo.ToDoItemsJdo,\
#isis.fixtures=
-org.apache.isis.viewer.restfulobjects.rendering.eventserializer.RestfulObjectsSpecEventSerializer.baseUrl=http://localhost:8080/restful/
+
http://git-wip-us.apache.org/repos/asf/isis/blob/c41ee303/example/application/quickstart_wicket_restful_jdo/viewer-webapp/src/main/webapp/WEB-INF/viewer_restfulobjects.properties
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/viewer-webapp/src/main/webapp/WEB-INF/viewer_restfulobjects.properties b/example/application/quickstart_wicket_restful_jdo/viewer-webapp/src/main/webapp/WEB-INF/viewer_restfulobjects.properties
new file mode 100644
index 0000000..bda9809
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/viewer-webapp/src/main/webapp/WEB-INF/viewer_restfulobjects.properties
@@ -0,0 +1,23 @@
+# 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.
+
+#
+# configuration file for the Restful Objects viewer
+#
+
+# the baseUrl for hrefs in the events generated by the RO EventSerializer
+isis.viewer.restfulobjects.RestfulObjectsSpecEventSerializer.baseUrl=http://localhost:8080/restful/
\ No newline at end of file