[ 
https://issues.apache.org/jira/browse/STREAMS-629?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16670290#comment-16670290
 ] 

ASF GitHub Bot commented on STREAMS-629:
----------------------------------------

steveblackmon closed pull request #468: resolves STREAMS-629
URL: https://github.com/apache/streams/pull/468
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/streams-contrib/streams-provider-twitter/src/main/templates/twitter.ttl.ftl 
b/streams-contrib/streams-provider-twitter/src/main/templates/twitter.ttl.ftl
index 1f13837849..5b183f09eb 100644
--- 
a/streams-contrib/streams-provider-twitter/src/main/templates/twitter.ttl.ftl
+++ 
b/streams-contrib/streams-provider-twitter/src/main/templates/twitter.ttl.ftl
@@ -59,6 +59,8 @@
   as:url "${profile.description.website}" ;
   .
 
+<#assign idshash = {} />
+
 <#attempt>
 <#assign followers = pp.loadData('json', 'follower.js')>
 <#recover>
@@ -67,6 +69,7 @@
 <#if followers??>
 <#list followers as follower>
 <#assign fid = "${follower.follower.accountId}">
+<#assign idshash += { fid: fid } />
 :${fid} a apst:TwitterProfile .
 :${fid}-follow-${id} a as:Follow ;
   as:actor :${fid} ;
@@ -83,10 +86,65 @@
 <#if friends??>
 <#list friends as friend>
 <#assign fid = "${friend.following.accountId}">
+<#if idshash[fid]??>
 :${fid} a apst:TwitterProfile .
+<#else>
+  <#assign idshash += { fid: fid } />
+</#if>
+
 :${id}-follow-${fid} a as:Follow ;
   as:actor :${id} ;
   as:object :${fid} .
 
 </#list>
 </#if>
+
+<#attempt>
+  <#assign directmessageheaders = pp.loadData('json', 
'direct-message-headers.js')>
+  <#recover>
+</#attempt>
+
+<#if directmessageheaders??>
+  <#list directmessageheaders as directmessageheader>
+    <#assign conversation = directmessageheader.dmConversation/>
+    <#list conversation.messages as message>
+      <#if message.messageCreate??>
+        <#assign senderId = "${message.messageCreate.senderId}">
+        <#assign recipientId = "${message.messageCreate.recipientId}">
+        <#assign messageId = "${message.messageCreate.id}">
+        <#if idshash[senderId]??>
+        <#else>
+:${senderId} a apst:TwitterProfile .
+          <#assign idshash += { senderId: senderId } />
+        </#if>
+        <#if idshash[recipientId]??>
+        <#else>
+:${recipientId} a apst:TwitterProfile .
+          <#assign idshash += { recipientId: recipientId } />
+        </#if>
+:${senderId}-message-${recipientId}-${messageId}
+  a as:Note ;
+  as:actor :${senderId} ;
+  as:object :${recipientId} ;
+        <#attempt>
+        <#assign createdAt_datetime = 
message.messageCreate.createdAt?datetime.iso>
+        <#assign createdAt_datetime_xsnz = createdAt_datetime?string.xs_nz>
+  as:published "${createdAt_datetime_xsnz}"^^xs:dateTime ;
+        <#recover>
+  # DIRECT MESSAGE TIMESTAMP PROCESSING FAILED
+          <#if message.messageCreate.createdAt??>
+  # message.messageCreate.createdAt: ${message.messageCreate.createdAt}
+          </#if>
+          <#if createdAt_datetime??>
+  # createdAt_datetime: ${createdAt_datetime}
+          </#if>
+          <#if createdAt_datetime_xsnz??>
+  # createdAt_datetime_xsnz: ${createdAt_datetime_xsnz}
+          </#if>
+        </#attempt>
+  .
+      </#if>
+    </#list>
+  </#list>
+</#if>
+


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add Direct Messages to twitter AS2.0 TTL output
> -----------------------------------------------
>
>                 Key: STREAMS-629
>                 URL: https://issues.apache.org/jira/browse/STREAMS-629
>             Project: Streams
>          Issue Type: Task
>            Reporter: Steve Blackmon
>            Assignee: Steve Blackmon
>            Priority: Major
>
> direct_message_headers.js contains metadata about messages sent and recieved 
> by the export owner.
> Add these to the TTL output using as:Note, setting as:actor as:object and 
> as:published as appropriate



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to