Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

preliminary support for the Business Event Subscriptions stuff works now

  • Loading branch information...
commit 766725819722cc34649deeea646f577e60b2f866 1 parent 1599171
@mindcrime mindcrime authored
Showing with 375 additions and 83 deletions.
  1. +14 −0 .classpath
  2. +1 −0  .settings/org.eclipse.wst.common.component
  3. +12 −11 grails-app/controllers/org/fogbeam/quoddy/ActivityStreamController.groovy
  4. +9 −8 grails-app/controllers/org/fogbeam/quoddy/StatusController.groovy
  5. +1 −2  grails-app/domain/org/fogbeam/quoddy/Activity.groovy
  6. +1 −3 grails-app/domain/org/fogbeam/quoddy/CalendarEvent.groovy
  7. +1 −2  grails-app/domain/org/fogbeam/quoddy/EventBase.groovy
  8. +4 −3 grails-app/domain/org/fogbeam/quoddy/SubscriptionEvent.groovy
  9. +1 −1  grails-app/jobs/org/fogbeam/quoddy/DummyJob.groovy
  10. +21 −21 grails-app/services/org/fogbeam/quoddy/EventQueueService.groovy
  11. +28 −23 grails-app/services/org/fogbeam/quoddy/EventStreamService.groovy
  12. +8 −8 grails-app/services/org/fogbeam/quoddy/EventSubscriptionService.groovy
  13. +67 −0 grails-app/services/org/fogbeam/quoddy/ExistDBService.groovy
  14. +113 −0 grails-app/taglib/org/fogbeam/quoddy/taglib/XmlTagLib.groovy
  15. +20 −0 grails-app/views/_renderSubscriptionEvent.gsp
  16. +1 −1  grails-app/views/layouts/main.gsp
  17. BIN  lib/excalibur-cli-1.0.jar
  18. BIN  lib/exist-fluent.jar
  19. BIN  lib/exist-optional.jar
  20. BIN  lib/exist.jar
  21. BIN  lib/jgroups-all-2.2.6.jar
  22. BIN  lib/jline-0.9.94.jar
  23. BIN  lib/serializer.jar
  24. BIN  lib/ws-commons-util-1.0.2.jar
  25. BIN  lib/xalan.jar
  26. BIN  lib/xmldb.jar
  27. BIN  lib/xmlrpc-client-3.1.2.jar
  28. BIN  lib/xmlrpc-common-3.1.2.jar
  29. BIN  lib/xmlrpc-server-3.1.2.jar
  30. +27 −0 web-app/css/oagis.css
  31. +46 −0 web-app/stylesheets/oagis3.xsl
View
14 .classpath
@@ -12,6 +12,7 @@
<classpathentry kind="src" path="grails-app/jobs"/>
<classpathentry kind="src" path="src/java"/>
<classpathentry kind="src" path="grails-app/resources"/>
+ <classpathentry kind="src" path="grails-app/taglib"/>
<classpathentry kind="lib" path="lib/activation.jar"/>
<classpathentry kind="lib" path="lib/commons-math-2.1.jar"/>
<classpathentry kind="lib" path="lib/lucene-core-3.0.1.jar"/>
@@ -246,5 +247,18 @@
<attribute name="com.springsource.sts.grails.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
+ <classpathentry kind="lib" path="lib/exist-fluent.jar"/>
+ <classpathentry kind="lib" path="lib/exist-optional.jar"/>
+ <classpathentry kind="lib" path="lib/exist.jar"/>
+ <classpathentry kind="lib" path="lib/excalibur-cli-1.0.jar"/>
+ <classpathentry kind="lib" path="lib/jgroups-all-2.2.6.jar"/>
+ <classpathentry kind="lib" path="lib/jline-0.9.94.jar"/>
+ <classpathentry kind="lib" path="lib/xmldb.jar"/>
+ <classpathentry kind="lib" path="lib/xmlrpc-client-3.1.2.jar"/>
+ <classpathentry kind="lib" path="lib/xmlrpc-common-3.1.2.jar"/>
+ <classpathentry kind="lib" path="lib/xmlrpc-server-3.1.2.jar"/>
+ <classpathentry kind="lib" path="lib/serializer.jar"/>
+ <classpathentry kind="lib" path="lib/xalan.jar"/>
+ <classpathentry kind="lib" path="lib/ws-commons-util-1.0.2.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
View
1  .settings/org.eclipse.wst.common.component
@@ -22,5 +22,6 @@
<wb-resource deploy-path="/" source-path="/.link_to_grails_plugins/jaxrs-0.5-m1/grails-app/conf"/>
<wb-resource deploy-path="/" source-path="/.link_to_grails_plugins/jaxrs-0.5-m1/src/java"/>
<wb-resource deploy-path="/" source-path="/.link_to_grails_plugins/jaxrs-0.5-m1/src/groovy"/>
+ <wb-resource deploy-path="/" source-path="/grails-app/taglib"/>
</wb-module>
</project-modules>
View
23 grails-app/controllers/org/fogbeam/quoddy/ActivityStreamController.groovy
@@ -19,7 +19,6 @@ class ActivityStreamController
// XXX more recent updates waiting
// or something along those lines...
long queueSize = 0;
- // List messages = jmsService.browse(queue: "uitestActivityQueue", "standard", null );
if( session.user != null )
{
// println "checking queueSize for user: ${session.user.userId}";
@@ -47,19 +46,19 @@ class ActivityStreamController
page = "1";
}
println "getContentHtml requested page: ${page}";
- def activities = new ArrayList<Activity>();
+ def events = new ArrayList<EventBase>();
if( user != null )
{
user = userService.findUserByUserId( session.user.userId );
// activities = eventStreamService.getRecentFriendActivitiesForUser( user );
- activities = eventStreamService.getRecentActivitiesForUser( user, 25 * Integer.parseInt( page ) );
+ events = eventStreamService.getRecentActivitiesForUser( user, 25 * Integer.parseInt( page ) );
}
else
{
// don't do anything if we don't have a user
}
- render(template:"/activityStream",model:[activities:activities]);
+ render(template:"/activityStream",model:[activities:events]);
}
@@ -84,17 +83,19 @@ class ActivityStreamController
eventStreamService.saveActivity( activity );
// send notification message
- Map msg = new HashMap();
- msg.creator = activity.owner.userId;
- msg.text = activity.content;
- msg.targetUuid = activity.targetUuid;
+ // Map msg = new HashMap();
+ // msg.creator = activity.owner.userId;
+ // msg.text = activity.content;
+ // msg.targetUuid = activity.targetUuid;
// msg.published = activity.published;
- msg.originTime = activity.dateCreated.time;
+ // msg.originTime = activity.dateCreated.time;
// TODO: figure out what to do with "effectiveDate" here
- msg.effectiveDate = msg.originTime;
+ // msg.effectiveDate = msg.originTime;
+
+ // msg.actualEvent = activity;
println "sending message to JMS";
- jmsService.send( queue: 'uitestActivityQueue', msg, 'standard', null );
+ jmsService.send( queue: 'uitestActivityQueue', /* msg */ activity, 'standard', null );
// println streamEntry.toString();
View
17 grails-app/controllers/org/fogbeam/quoddy/StatusController.groovy
@@ -74,18 +74,19 @@ class StatusController {
eventStreamService.saveActivity( activity );
- Map msg = new HashMap();
- msg.creator = activity.owner.userId;
- msg.text = newStatus.text;
- msg.targetUuid = activity.targetUuid;
- msg.originTime = activity.dateCreated.time; // NOTE: this will be ever so slightly different from "effectiveDate"
+ // Map msg = new HashMap();
+ // msg.creator = activity.owner.userId;
+ // msg.text = newStatus.text;
+ // msg.targetUuid = activity.targetUuid;
+ // msg.originTime = activity.dateCreated.time; // NOTE: this will be ever so slightly different from "effectiveDate"
// due to the latency in writing to the database. So we need to explicitly
// include the effectiveDate as a field in this message as well
- msg.effectiveDate = activity.effectiveDate.time;
-
+ // msg.effectiveDate = activity.effectiveDate.time;
+ // msg.actualEvent = activity;
+
println "sending message to JMS";
- jmsService.send( queue: 'uitestActivityQueue', msg, 'standard', null );
+ jmsService.send( queue: 'uitestActivityQueue', /* msg */ activity, 'standard', null );
}
View
3  grails-app/domain/org/fogbeam/quoddy/Activity.groovy
@@ -1,6 +1,5 @@
package org.fogbeam.quoddy
-import org.fogbeam.quoddy.EventBase;
/* TODO: map the fields of this class to the activitystrea.ms protocol */
/* SPEC: http://activitystrea.ms/specs/json/1.0/ */
@@ -149,7 +148,7 @@ Following is a simple, minimal example of a JSON serialized activity:
url JSON [RFC4627] String An IRI [RFC3987] identifying a resource providing an HTML representation of the object. An object MAY contain a url property
*/
-class Activity extends EventBase
+class Activity extends EventBase implements Serializable
{
public Activity()
View
4 grails-app/domain/org/fogbeam/quoddy/CalendarEvent.groovy
@@ -1,10 +1,8 @@
package org.fogbeam.quoddy
-import org.fogbeam.quoddy.EventBase;
-class CalendarEvent extends EventBase
+class CalendarEvent extends EventBase implements Serializable
{
-
public CalendarEvent()
{
View
3  grails-app/domain/org/fogbeam/quoddy/EventBase.groovy
@@ -1,8 +1,7 @@
package org.fogbeam.quoddy
-class EventBase
+public class EventBase implements Serializable
{
-
static mapping =
{
tablePerHierarchy false
View
7 grails-app/domain/org/fogbeam/quoddy/SubscriptionEvent.groovy
@@ -1,11 +1,13 @@
package org.fogbeam.quoddy
-class SubscriptionEvent extends EventBase
+class SubscriptionEvent extends EventBase implements Serializable
{
static constraints = {
}
- static transients = ['templateName'];
+ static transients = ['templateName', 'xmlDoc'];
+
+ transient org.w3c.dom.Node xmlDoc;
// we'll read this from the XML database, using the UUID stored in our DB
// and populate this just-in-time for rendering in the stream.
@@ -15,5 +17,4 @@ class SubscriptionEvent extends EventBase
{
return "/renderSubscriptionEvent";
}
-
}
View
2  grails-app/jobs/org/fogbeam/quoddy/DummyJob.groovy
@@ -19,7 +19,7 @@ class DummyJob
Date now = new Date();
SimpleDateFormat sdf = SimpleDateFormat.getDateTimeInstance();
- println( "TRIGGER: sending rebuild cache message: ${sdf.format( now )}" );
+ // println( "TRIGGER: sending rebuild cache message: ${sdf.format( now )}" );
}
}
View
42 grails-app/services/org/fogbeam/quoddy/EventQueueService.groovy
@@ -2,7 +2,7 @@ package org.fogbeam.quoddy
import java.util.Set
-import javax.jms.MapMessage
+import javax.jms.Message
class EventQueueService
{
@@ -15,7 +15,7 @@ class EventQueueService
def onMessage(msg)
{
- // println "Message class: ${msg.class}";
+ println "Message class: ${msg.class}";
println "Received message from JMS: ${msg}";
@@ -38,8 +38,8 @@ class EventQueueService
// messages that were to the public stream. We'll come back to deal with
// common group membership and other scenarios later.
def streamPublic = ShareTarget.findByName( ShareTarget.STREAM_PUBLIC);
-
- if( ! msg.getString( 'targetUuid').equals( streamPublic.uuid ))
+ EventBase event = (EventBase)msg.getObject();
+ if( ! event.targetUuid.equals( streamPublic.uuid ))
{
return;
}
@@ -48,14 +48,14 @@ class EventQueueService
// TODO: don't offer message unless the owner of this queue
// and the event creator, are friends (or the owner *is* the creator)
// println "msg creator: ${msg.getString( 'creator')}";
- User msgCreator = userService.findUserByUserId( msg.getString( 'creator') );
+ User msgCreator = userService.findUserByUserId( event.owner.userId );
if( msgCreator )
{
println "found User object for ${msgCreator.userId}";
}
else
{
- println( "No User for ${msg.getString('creator')}");
+ println( "No User for ${event.owner.userId}");
}
FriendCollection friendCollection = FriendCollection.findByOwnerUuid( msgCreator.uuid );
@@ -78,21 +78,21 @@ class EventQueueService
{
println "match found, offering message";
Deque<Map> userQueue = entry.getValue();
- if( msg instanceof MapMessage )
+ if( msg instanceof Message )
{
- println "MapMessage being offered";
+ println "Message being offered";
- Map internalMsg = new HashMap();
+ // Map internalMsg = new HashMap();
// TODO: turn this into a plain old Map
- Enumeration mapNames = msg.getMapNames();
- while( mapNames.hasMoreElements())
- {
- String name = mapNames.nextElement();
- internalMsg.put( name, msg.getObject(name));
- }
+ // Enumeration mapNames = msg.getMapNames();
+ // while( mapNames.hasMoreElements())
+ // {
+ // String name = mapNames.nextElement();
+ // internalMsg.put( name, msg.getObject(name));
+ // }
println "putting message on user queue for user ${key}";
- userQueue.offerFirst( internalMsg );
+ userQueue.offerFirst( event );
}
else
{
@@ -106,7 +106,7 @@ class EventQueueService
public long getQueueSizeForUser( final String userId )
{
- println "getting queue size for user: ${userId}";
+ // println "getting queue size for user: ${userId}";
long queueSize = 0;
Deque<Map> userQueue = eventQueues.get( userId );
@@ -115,15 +115,15 @@ class EventQueueService
queueSize = userQueue.size();
}
- println "Queue size for user: ${userId} = ${queueSize}";
+ // println "Queue size for user: ${userId} = ${queueSize}";
return queueSize;
}
- public List<Map> getMessagesForUser( final String userId, final int msgCount )
+ public List<EventBase> getMessagesForUser( final String userId, final int msgCount )
{
println "getting messages for user: ${userId}, msgCount: ${msgCount}";
- List<Map> messages = new ArrayList<Map>();
+ List<EventBase> messages = new ArrayList<Map>();
Deque<Map> userQueue = eventQueues.get( userId );
if( userQueue != null )
{
@@ -131,7 +131,7 @@ class EventQueueService
for( int i = 0; i < msgCount; i++ )
{
// get message from queue, put it in return set
- Map msg = userQueue.pollFirst();
+ EventBase msg = userQueue.pollFirst();
messages.add( msg );
}
}
View
51 grails-app/services/org/fogbeam/quoddy/EventStreamService.groovy
@@ -7,6 +7,7 @@ class EventStreamService {
def userService;
def jmsService;
def eventQueueService;
+ def existDBService;
public void saveActivity( Activity activity )
{
@@ -90,43 +91,41 @@ class EventStreamService {
// NOTE: we could avoid iterating over this list again by returning the "oldest message time"
// as part of this call. But it'll mean wrapping this stuff up into an object of some
// sort, or returning a Map of Maps instead of a List of Maps
- List<Map> messages = eventQueueService.getMessagesForUser( user.userId, msgsToRead );
- for( Map msg : messages )
+ List<EventBase> messages = eventQueueService.getMessagesForUser( user.userId, msgsToRead );
+ for( EventBase msg : messages )
{
- println "msg.originTime: ${msg.originTime}";
- if( msg.effectiveDate < oldestOriginTime )
+ // println "msg.originTime: ${msg.originTime}";
+ if( msg.effectiveDate.time < oldestOriginTime )
{
- oldestOriginTime = msg.effectiveDate;
+ oldestOriginTime = msg.effectiveDate.time;
}
}
println "oldestOriginTime: ${oldestOriginTime}";
println "as date: " + new Date( oldestOriginTime);
- // TODO: convert our messages to instances of the appropriate type
- // put them in this list...
- // List<EventBase> ...
- List<Activity> recentActivities = new ArrayList<Activity>();
List<EventBase> recentEvents = new ArrayList<EventBase>();
// NOTE: we wouldn't really want to iterate over this list here... better
// to build up this list above, and never bother storing the JMS Message instances
// at all... but for now, just to get something so we can prototype the
// behavior up through the UI...
+
+ // TODO: now that we are passing notifications for different kinds of
+ // events through this mechanism, this has to be smarter... It can't just
+ // conver everything to an activity, it has to convert to Activity, SubscriptionEvent,
+ // CalendarEvent, etc., depending on what the notification is for.
for( int i = 0; i < messages.size(); i++ )
{
- Map msg = messages.get(i);
- println "got message: ${msg} off of queue";
- Activity activity = new Activity();
+ EventBase event = messages.get(i);
+ // println "got message: ${msg} off of queue";
+
+ event = existDBService.populateSubscriptionEventWithXmlDoc( event );
- // println "msg class: " + msg?.getClass().getName();
- activity.owner = userService.findUserByUserId( msg.creator );
- activity.content = msg.text;
- activity.dateCreated = new Date( msg.originTime );
- recentActivities.add( activity );
+ recentEvents.add( event );
}
- println "recentActivities.size() = ${recentActivities.size()}"
+ println "recentEvents.size() = ${recentEvents.size()}"
/* NOTE: here, we need to make sure we don't retrieve anything NEWER than the OLDEST
* message we may have in hand - that we received from the queue. Otherwise, we risk
@@ -167,7 +166,7 @@ class EventStreamService {
// for the purpose of this query, treat a user as their own friend... that is, we
- // will want to read Activities created by this user (we see out own updates in our
+ // will want to read Activities created by this user (we see our own updates in our
// own feed)
friendIds.add( user.id );
ShareTarget streamPublic = ShareTarget.findByName( ShareTarget.STREAM_PUBLIC );
@@ -180,7 +179,13 @@ class EventStreamService {
['max': recordsToRetrieve ]);
println "adding ${queryResults.size()} activities read from DB";
- recentActivities.addAll( queryResults );
+ for( EventBase event : queryResults ) {
+
+ println "Populating XML into SubscriptionEvents";
+
+ event = existDBService.populateSubscriptionEventWithXmlDoc( event );
+ recentEvents.add( event );
+ }
}
else
{
@@ -192,7 +197,7 @@ class EventStreamService {
println "Reading NO messages from DB";
}
- println "recentActivities.size() = ${recentActivities.size()}";
- return recentActivities;
+ println "recentEvents.size() = ${recentEvents.size()}";
+ return recentEvents;
}
-}
+}
View
16 grails-app/services/org/fogbeam/quoddy/EventSubscriptionService.groovy
@@ -41,18 +41,18 @@ class EventSubscriptionService
this.saveEvent( subEvent );
println "sending message to JMS";
- Map uiNotificationMsg = new HashMap();
- uiNotificationMsg.creator = subEvent.owner.userId;
- uiNotificationMsg.text = "Business Event Subscription";
- uiNotificationMsg.targetUuid = subEvent.targetUuid;
+ // Map uiNotificationMsg = new HashMap();
+ // uiNotificationMsg.creator = subEvent.owner.userId;
+ // uiNotificationMsg.text = "Business Event Subscription";
+ // uiNotificationMsg.targetUuid = subEvent.targetUuid;
// msg.published = activity.published;
- uiNotificationMsg.originTime = subEvent.dateCreated.time;
+ // uiNotificationMsg.originTime = subEvent.dateCreated.time;
// TODO: figure out what to do with "effectiveDate" here
- uiNotificationMsg.effectiveDate = subEvent.dateCreated.time;
+ // uiNotificationMsg.effectiveDate = subEvent.dateCreated.time;
+ // uiNotificationMsg.actualEvent = subEvent;
- jmsService.send( queue: 'uitestActivityQueue', uiNotificationMsg, 'standard', null );
-
+ jmsService.send( queue: 'uitestActivityQueue', /* uiNotificationMsg */ subEvent, 'standard', null );
}
View
67 grails-app/services/org/fogbeam/quoddy/ExistDBService.groovy
@@ -0,0 +1,67 @@
+package org.fogbeam.quoddy
+
+import javax.xml.transform.OutputKeys
+
+import org.exist.storage.serializers.EXistOutputKeys
+import org.xmldb.api.DatabaseManager
+import org.xmldb.api.base.Collection
+import org.xmldb.api.base.Database
+import org.xmldb.api.modules.XMLResource
+
+class ExistDBService
+{
+
+ protected static String driver = "org.exist.xmldb.DatabaseImpl";
+ protected static String URI = "xmldb:exist://localhost:8090/exist/xmlrpc";
+
+ public populateSubscriptionEventWithXmlDoc( EventBase event )
+ {
+ // unless we're passed a SubscriptionEvent instance, this is a NOP
+ println "NOT a SubscriptionEvent, nothing to do!";
+ return event;
+ }
+
+ public SubscriptionEvent populateSubscriptionEventWithXmlDoc( SubscriptionEvent event )
+ {
+
+ println "It's a SubscriptionEvent, populate XML body";
+ // get the XML uuid from the event, pull the XML from the existDB instance
+ // and populate it into the object for rendering in the stream
+
+ String collection = "/db/hatteras";
+ System.out.println( "Collection: " + collection );
+
+ // initialize database drivers
+ Class cl = Class.forName(driver);
+ Database database = (Database) cl.newInstance();
+ DatabaseManager.registerDatabase(database);
+
+ // get the collection
+ Collection col = DatabaseManager.getCollection(URI + collection);
+ if( col == null )
+ {
+ println "ERROR: could not locate collection: ${URI + collection}";
+ }
+
+ col.setProperty(OutputKeys.INDENT, "yes");
+ col.setProperty(EXistOutputKeys.EXPAND_XINCLUDES, "no");
+ col.setProperty(EXistOutputKeys.PROCESS_XSL_PI, "yes");
+
+ String xmlUuid = event.xmlUuid;
+
+ XMLResource res = (XMLResource)col.getResource(xmlUuid);
+ if(res == null)
+ System.out.println("document not found!");
+ else {
+ println "Found document for id: ${xmlUuid}";
+ // String content = res.getContent();
+ // println "got content as: ${content}";
+ // StringReader xmlDoc = new StringReader( content );
+ org.w3c.dom.Node xmlDoc = res.getContentAsDOM();
+ event.xmlDoc= xmlDoc;
+ }
+
+ return event;
+ }
+
+}
View
113 grails-app/taglib/org/fogbeam/quoddy/taglib/XmlTagLib.groovy
@@ -0,0 +1,113 @@
+package org.fogbeam.quoddy.taglib
+
+import javax.xml.transform.TransformerFactory
+import javax.xml.transform.dom.DOMSource
+import javax.xml.transform.stream.StreamSource
+import javax.xml.transform.stream.StreamResult
+
+class XmlTagLib
+{
+ /**
+ * Applies an XSL stylesheet to a source DOM document or file and
+ * writes the result to the output stream.
+ */
+ def transform = { attrs ->
+ // Check that some XML to transform has been provided.
+ def input = attrs['source']
+ if (!input)
+ {
+ throwTagError('Tag [transform] missing required attribute [source].')
+ }
+
+ // Check the various attributes.
+ //
+ // We must have one of 'transformer' or 'stylesheet'.
+ def transformer = attrs['transformer']
+
+ if (!transformer)
+ {
+ // No transformer specified, so use a stylesheet instead.
+ def stylesheet = attrs['stylesheet']
+
+ // If there's no stylesheet either, then we're stuck.
+ if (!stylesheet)
+ {
+ throwTagError('Tag [transform] missing required attribute [transformer] or [stylesheet].')
+ }
+
+ // See whether a factory class has been specified. If so,
+ // we use that one to create a transformer. Otherwise, we
+ // just use the default factory.
+ def factory
+ if (attrs['factory'])
+ {
+ factory = Class.forName(attrs['factory']).newInstance()
+ }
+ else
+ {
+ factory = TransformerFactory.newInstance()
+ }
+
+ // Load up the stylesheet into a transformer instance.
+ def xslStream = servletContext.getResourceAsStream("/stylesheets/${stylesheet}.xsl")
+ if( !xslStream )
+ {
+ throw new RuntimeException( "could not load stylesheet resource!");
+ }
+
+ transformer = factory.newTransformer(new StreamSource(xslStream))
+ if( !transformer )
+ {
+ throw new RuntimeException( "could not build XSLT Transformer!" );
+ }
+ }
+ else if (attrs['stylesheet'])
+ {
+ throwTagError('Tag [transform]: [stylesheet] attribute can not be used with [transformer].')
+ }
+
+ // We have the transformer set up, so now prepare the source
+ // XML and wrap the output writer in a Result.
+ def output = new StreamResult(out)
+ println "input is: ${input}";
+ if( input instanceof DOMSource )
+ {
+ // NOP, we can use this directly as is
+ println "input is already DOMSource, using as is";
+ }
+ else if( input instanceof org.w3c.dom.Node )
+ {
+ println "It's an org.w3c.dom.Node, so wrapping in DOMSource";
+ input = new DOMSource(input)
+ }
+ else if (input instanceof Node)
+ {
+ println "It's an groovy.util.Node, so wrapping in DOMSource";
+ input = new DOMSource(input)
+ }
+ else if (input instanceof InputStream || input instanceof Reader)
+ {
+ println "It's an InputStream OR a Reader, so wrapping in StreamSource";
+ // Create a StreamSource for the given file.
+ input = new StreamSource(input)
+ }
+ else
+ {
+ println "It's something else, so trying to use as File()";
+ input = new StreamSource(new File(input))
+ }
+
+ // Perform the transformation!
+ println "Before transform, input is: ${input}";
+ println "Before transform, transformer is: ${transformer}";
+ try
+ {
+ transformer.transform(input, output);
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ throw e;
+ }
+ }
+}
View
20 grails-app/views/_renderSubscriptionEvent.gsp
@@ -0,0 +1,20 @@
+<div class="aseWrapper">
+
+ <div class="aseAvatarBlock">
+ <img src="images/flavour-icons/speed_mph.png" />
+ </div>
+ <div class="aseTitleBar"> <!-- http://localhost:8080/quoddy/user/viewUser?userId=testuser2 -->
+ <a href="${createLink(controller:'user', action:'viewUser', params:[userId:item.owner.userId])}">${item.owner.fullName}</a>
+ </div>
+ <div class="activityStreamEntry">
+ <font color="red">BUSINESS SUBSCRIPTION EVENT</font>
+ <p>
+ <g:transform stylesheet="oagis3" source="${item.xmlDoc}" factory="org.apache.xalan.processor.TransformerFactoryImpl" />
+ </p>
+ </div>
+ <div class="aseClear" >
+ </div>
+ <div class="aseFooter" >
+ <g:formatDate date="${item.dateCreated}" type="datetime" style="LONG" timeStyle="SHORT"/>
+ </div>
+</div>
View
2  grails-app/views/layouts/main.gsp
@@ -6,7 +6,7 @@
<nav:resources />
<link rel="stylesheet" type="text/css" href="${createLinkTo(dir:'css', file:'main.css')}" />
<link rel="stylesheet" type="text/css" href="${createLinkTo(dir:'css', file:'bootstrap.min.css')}" />
-
+ <link rel="stylesheet" type="text/css" href="${createLinkTo(dir:'css', file:'oagis.css')}" />
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.3.0/build/cssgrids/grids-min.css" />
View
BIN  lib/excalibur-cli-1.0.jar
Binary file not shown
View
BIN  lib/exist-fluent.jar
Binary file not shown
View
BIN  lib/exist-optional.jar
Binary file not shown
View
BIN  lib/exist.jar
Binary file not shown
View
BIN  lib/jgroups-all-2.2.6.jar
Binary file not shown
View
BIN  lib/jline-0.9.94.jar
Binary file not shown
View
BIN  lib/serializer.jar
Binary file not shown
View
BIN  lib/ws-commons-util-1.0.2.jar
Binary file not shown
View
BIN  lib/xalan.jar
Binary file not shown
View
BIN  lib/xmldb.jar
Binary file not shown
View
BIN  lib/xmlrpc-client-3.1.2.jar
Binary file not shown
View
BIN  lib/xmlrpc-common-3.1.2.jar
Binary file not shown
View
BIN  lib/xmlrpc-server-3.1.2.jar
Binary file not shown
View
27 web-app/css/oagis.css
@@ -0,0 +1,27 @@
+div.oagisRFQHeader ul
+{
+ list-style-type: none;
+}
+
+div.oagisRFQHeader li
+{
+ float: left;
+ margin-top:6px;
+ padding-left: 20px;
+ padding-right:20px;
+}
+
+
+div.oagisRFQLines ul
+{
+ list-style-type: none;
+}
+
+div.oagisRFQLines li
+{
+ float: left;
+ margin-top:6px;
+ padding-left: 20px;
+ padding-right:20px;
+
+}
View
46 web-app/stylesheets/oagis3.xsl
@@ -0,0 +1,46 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:oagis="http://www.openapplications.org/oagis/9"
+ xmlns:java="http://xml.apache.org/xalan/java"
+ exclude-result-prefixes="xsl oagis java"
+ version="1.0">
+
+ <xsl:output method="html" />
+
+ <xsl:template match="/oagis:RFQ">
+ <div class="oagisRFQ">
+ <div class="oagisRFQHeader">
+ <xsl:apply-templates select="oagis:RFQHeader"/>
+ </div>
+ <div class="oagisRFQLines">
+ <xsl:apply-templates select="oagis:RFQLine"/>
+ </div>
+ </div>
+ </xsl:template>
+ <xsl:template match="oagis:RFQHeader">
+
+ <ul>
+ <li>Customer: <xsl:value-of select="oagis:CustomerParty/oagis:CustomerAccountID"/></li>
+ <li>Document Date: <xsl:value-of select="oagis:DocumentDateTime"/></li>
+ <li>Catalog Reference: <xsl:value-of select="oagis:CatalogReference/oagis:DocumentID/oagis:ID" /></li>
+ <li>Buyer Category: <xsl:value-of select="oagis:BuyerParty/oagis:AccountID" /></li>
+ </ul>
+ <ul>
+ <li>Total Amount: <xsl:value-of select="java:org.apache.commons.lang.StringUtils.trim( oagis:TotalAmount)" /></li>
+ <li>Qualified Amount: <xsl:value-of select="java:org.apache.commons.lang.StringUtils.trim( oagis:QualifiedAmount)" /></li>
+ </ul>
+ <ul>
+ <li>Partial Shipment Allowed: <xsl:value-of select="java:org.apache.commons.lang.StringUtils.trim(oagis:PartialShipmentAllowedIndicator)" /></li>
+ <li>Drop Shipment Allowed: <xsl:value-of select="java:org.apache.commons.lang.StringUtils.trim(oagis:DropShipmentAllowedIndicator)" /></li>
+ <li>Early Shipment Allowed: <xsl:value-of select="java:org.apache.commons.lang.StringUtils.trim(oagis:EarlyShipmentAllowedIndicator)" /></li>
+ </ul>
+
+ </xsl:template>
+
+ <xsl:template match="oagis:RFQLine">
+ <ul>
+ <li>Manufacturer ID: <xsl:value-of select="oagis:Item/oagis:ManufacturerItemID/oagis:ID" /> </li>
+ <li>Quantity: <xsl:value-of select="oagis:Quantity" /> </li>
+ <li>Extended Amount: <xsl:value-of select="oagis:ExtendedAmount" /></li>
+ </ul>
+ </xsl:template>
+</xsl:stylesheet>
Please sign in to comment.
Something went wrong with that request. Please try again.