From 4df1fcf96954e7ace96ef22ade341da5a527c962 Mon Sep 17 00:00:00 2001 From: Christian Guedemann Date: Fri, 22 May 2015 20:48:13 +0200 Subject: [PATCH 1/6] Activate Activities as exported package --- sdk/com.ibm.sbt.core/META-INF/MANIFEST.MF | 126 +++++++++++++--------- 1 file changed, 78 insertions(+), 48 deletions(-) diff --git a/sdk/com.ibm.sbt.core/META-INF/MANIFEST.MF b/sdk/com.ibm.sbt.core/META-INF/MANIFEST.MF index efe3adf39d..c3a34b52c9 100644 --- a/sdk/com.ibm.sbt.core/META-INF/MANIFEST.MF +++ b/sdk/com.ibm.sbt.core/META-INF/MANIFEST.MF @@ -9,54 +9,84 @@ Require-Bundle: com.ibm.sbt.libs, com.ibm.commons.xml, com.ibm.commons.runtime Bundle-ClassPath: . -Export-Package: com.ibm.sbt.core.configuration,com.ibm.sbt.jslibrary,c - om.ibm.sbt.jslibrary.impl,com.ibm.sbt.jslibrary.servlet,com.ibm.sbt.l - og,com.ibm.sbt.plugin,com.ibm.sbt.security.authentication,com.ibm.sbt - .security.authentication.oauth,com.ibm.sbt.security.authentication.oa - uth.consumer,com.ibm.sbt.security.authentication.oauth.consumer.servl - et,com.ibm.sbt.security.authentication.oauth.consumer.store,com.ibm.s - bt.security.authentication.password,com.ibm.sbt.security.authenticati - on.password.consumer,com.ibm.sbt.security.credential.store,com.ibm.sb - t.security.encryption,com.ibm.sbt.service.basic,com.ibm.sbt.service.c - ore.handlers,com.ibm.sbt.service.core.servlet,com.ibm.sbt.service.deb - ug,com.ibm.sbt.service.ext,com.ibm.sbt.service.proxy,com.ibm.sbt.serv - ice.util,com.ibm.sbt.services.client,com.ibm.sbt.services.client.base - ,com.ibm.sbt.services.client.base.datahandlers,com.ibm.sbt.services.c - lient.base.serializers,com.ibm.sbt.services.client.base.transformers, - com.ibm.sbt.services.client.base.util,com.ibm.sbt.services.client.con - nections,com.ibm.sbt.services.client.connections.activitystreams,com. - ibm.sbt.services.client.connections.activitystreams.model,com.ibm.sbt - .services.client.connections.activitystreams.templates,com.ibm.sbt.se - rvices.client.connections.activitystreams.transformers,com.ibm.sbt.se - rvices.client.connections.blogs,com.ibm.sbt.services.client.connectio - ns.blogs.model,com.ibm.sbt.services.client.connections.bookmarks,com. - ibm.sbt.services.client.connections.bookmarks.model,com.ibm.sbt.servi - ces.client.connections.cmisfiles,com.ibm.sbt.services.client.connecti - ons.cmisfiles.model,com.ibm.sbt.services.client.connections.common,co - m.ibm.sbt.services.client.connections.communities,com.ibm.sbt.service - s.client.connections.communities.model,com.ibm.sbt.services.client.co - nnections.communities.util,com.ibm.sbt.services.client.connections.fi - les,com.ibm.sbt.services.client.connections.files.model,com.ibm.sbt.s - ervices.client.connections.files.util,com.ibm.sbt.services.client.con - nections.follow,com.ibm.sbt.services.client.connections.follow.model, - com.ibm.sbt.services.client.connections.forums,com.ibm.sbt.services.c - lient.connections.forums.model,com.ibm.sbt.services.client.connection - s.forums.serializers,com.ibm.sbt.services.client.connections.forums.u - tils,com.ibm.sbt.services.client.connections.profiles,com.ibm.sbt.ser - vices.client.connections.profiles.model,com.ibm.sbt.services.client.c - onnections.profiles.utils,com.ibm.sbt.services.client.connections.pro - xy,com.ibm.sbt.services.client.connections.search,com.ibm.sbt.service - s.client.connections.wikis,com.ibm.sbt.services.client.connections.wi - kis.serializers,com.ibm.sbt.services.client.domino,com.ibm.sbt.servic - es.client.email,com.ibm.sbt.services.client.navigation,com.ibm.sbt.se - rvices.client.sametime,com.ibm.sbt.services.client.smartcloud,com.ibm - .sbt.services.client.smartcloud.bss,com.ibm.sbt.services.client.smart - cloud.profiles,com.ibm.sbt.services.client.smartcloud.profiles.feedha - ndler,com.ibm.sbt.services.client.smartcloud.profiles.model,com.ibm.s - bt.services.client.smartcloud.profiles.util,com.ibm.sbt.services.endp - oints,com.ibm.sbt.services.endpoints.js,com.ibm.sbt.services.util,com - .ibm.sbt.services.util.extractor.field,com.ibm.sbt.services.util.navi - gable,com.ibm.sbt.util +Export-Package: com.ibm.sbt.core.configuration, + com.ibm.sbt.jslibrary, + com.ibm.sbt.jslibrary.impl, + com.ibm.sbt.jslibrary.servlet, + com.ibm.sbt.log, + com.ibm.sbt.plugin, + com.ibm.sbt.security.authentication, + com.ibm.sbt.security.authentication.oauth, + com.ibm.sbt.security.authentication.oauth.consumer, + com.ibm.sbt.security.authentication.oauth.consumer.servlet, + com.ibm.sbt.security.authentication.oauth.consumer.store, + com.ibm.sbt.security.authentication.password, + com.ibm.sbt.security.authentication.password.consumer, + com.ibm.sbt.security.credential.store, + com.ibm.sbt.security.encryption, + com.ibm.sbt.service.basic, + com.ibm.sbt.service.core.handlers, + com.ibm.sbt.service.core.servlet, + com.ibm.sbt.service.debug, + com.ibm.sbt.service.ext, + com.ibm.sbt.service.proxy, + com.ibm.sbt.service.util, + com.ibm.sbt.services.client, + com.ibm.sbt.services.client.base, + com.ibm.sbt.services.client.base.datahandlers, + com.ibm.sbt.services.client.base.serializers, + com.ibm.sbt.services.client.base.transformers, + com.ibm.sbt.services.client.base.util, + com.ibm.sbt.services.client.connections, + com.ibm.sbt.services.client.connections.activities, + com.ibm.sbt.services.client.connections.activitystreams, + com.ibm.sbt.services.client.connections.activitystreams.model, + com.ibm.sbt.services.client.connections.activitystreams.templates, + com.ibm.sbt.services.client.connections.activitystreams.transformers, + com.ibm.sbt.services.client.connections.blogs, + com.ibm.sbt.services.client.connections.blogs.model, + com.ibm.sbt.services.client.connections.bookmarks, + com.ibm.sbt.services.client.connections.bookmarks.model, + com.ibm.sbt.services.client.connections.cmisfiles, + com.ibm.sbt.services.client.connections.cmisfiles.model, + com.ibm.sbt.services.client.connections.common, + com.ibm.sbt.services.client.connections.communities, + com.ibm.sbt.services.client.connections.communities.model, + com.ibm.sbt.services.client.connections.communities.util, + com.ibm.sbt.services.client.connections.files, + com.ibm.sbt.services.client.connections.files.model, + com.ibm.sbt.services.client.connections.files.util, + com.ibm.sbt.services.client.connections.follow, + com.ibm.sbt.services.client.connections.follow.model, + com.ibm.sbt.services.client.connections.forums, + com.ibm.sbt.services.client.connections.forums.model, + com.ibm.sbt.services.client.connections.forums.serializers, + com.ibm.sbt.services.client.connections.forums.utils, + com.ibm.sbt.services.client.connections.profiles, + com.ibm.sbt.services.client.connections.profiles.model, + com.ibm.sbt.services.client.connections.profiles.utils, + com.ibm.sbt.services.client.connections.proxy, + com.ibm.sbt.services.client.connections.search, + com.ibm.sbt.services.client.connections.wikis, + com.ibm.sbt.services.client.connections.wikis.serializers, + com.ibm.sbt.services.client.domino, + com.ibm.sbt.services.client.email, + com.ibm.sbt.services.client.navigation, + com.ibm.sbt.services.client.sametime, + com.ibm.sbt.services.client.smartcloud, + com.ibm.sbt.services.client.smartcloud.bss, + com.ibm.sbt.services.client.smartcloud.profiles, + com.ibm.sbt.services.client.smartcloud.profiles.feedhandler, + com.ibm.sbt.services.client.smartcloud.profiles.model, + com.ibm.sbt.services.client.smartcloud.profiles.util, + com.ibm.sbt.services.endpoints, + com.ibm.sbt.services.endpoints.js, + com.ibm.sbt.services.rest, + com.ibm.sbt.services.rest.atom, + com.ibm.sbt.services.util, + com.ibm.sbt.services.util.extractor.field, + com.ibm.sbt.services.util.navigable, + com.ibm.sbt.util Import-Package: javax.mail;resolution:=optional, javax.mail.internet;resolution:=optional, javax.servlet, From 3e7c2188d1b4e0e635f61995fc4c3d080b7ebb98 Mon Sep 17 00:00:00 2001 From: Christian Guedemann Date: Sat, 23 May 2015 15:54:44 +0200 Subject: [PATCH 2/6] Adding the needed namespaces to both serializer, otherwise snx Objects has failed during update --- .../serializers/ActivityNodeSerializer.java | 10 +- .../serializers/ActivitySerializer.java | 138 +++++++++--------- 2 files changed, 80 insertions(+), 68 deletions(-) diff --git a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivityNodeSerializer.java b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivityNodeSerializer.java index 0824bba86c..39f3898dbb 100644 --- a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivityNodeSerializer.java +++ b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivityNodeSerializer.java @@ -20,6 +20,7 @@ import static com.ibm.sbt.services.client.base.ConnectionsConstants.ACTIVITY; import static com.ibm.sbt.services.client.base.ConnectionsConstants.CATEGORY; import static com.ibm.sbt.services.client.base.ConnectionsConstants.CONTENT; +import static com.ibm.sbt.services.client.base.ConnectionsConstants.ENTRY; import static com.ibm.sbt.services.client.base.ConnectionsConstants.HREF; import static com.ibm.sbt.services.client.base.ConnectionsConstants.IN_REPLY_TO; import static com.ibm.sbt.services.client.base.ConnectionsConstants.LABEL; @@ -55,7 +56,14 @@ public String generateCreate() { } public String generateUpdate() { - Node entry = genericAtomEntry(); + Element element = element(Namespace.ATOM.getUrl(), ENTRY); + element.setAttributeNS(Namespace.XMLNS.getUrl(), Namespace.APP.getNSPrefix(), Namespace.APP.getUrl()); + element.setAttributeNS(Namespace.XMLNS.getUrl(),Namespace.THR.getNSPrefix(), Namespace.THR.getUrl()); + element.setAttributeNS(Namespace.XMLNS.getUrl(),Namespace.SNX.getNSPrefix(), Namespace.SNX.getUrl()); + element.setAttributeNS(Namespace.XMLNS.getUrl(),Namespace.XHTML.getNSPrefix(), Namespace.XHTML.getUrl()); + element.setAttributeNS(Namespace.XMLNS.getUrl(),Namespace.OPENSEARCH.getNSPrefix(),Namespace.OPENSEARCH.getUrl()); + + Node entry = rootNode(element); appendChildren(entry, activityNodeCategory(), diff --git a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivitySerializer.java b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivitySerializer.java index 02b05092c5..f888230568 100644 --- a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivitySerializer.java +++ b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivitySerializer.java @@ -24,9 +24,10 @@ import static com.ibm.sbt.services.client.base.ConnectionsConstants.COMMUNITYUUID; import static com.ibm.sbt.services.client.base.ConnectionsConstants.COMMUNITY_ACTIVITY; import static com.ibm.sbt.services.client.base.ConnectionsConstants.COMPLETED; +import static com.ibm.sbt.services.client.base.ConnectionsConstants.ENTRY; import static com.ibm.sbt.services.client.base.ConnectionsConstants.EXTERNAL; -import static com.ibm.sbt.services.client.base.ConnectionsConstants.INTERNAL; import static com.ibm.sbt.services.client.base.ConnectionsConstants.HREF; +import static com.ibm.sbt.services.client.base.ConnectionsConstants.INTERNAL; import static com.ibm.sbt.services.client.base.ConnectionsConstants.IN_REPLY_TO; import static com.ibm.sbt.services.client.base.ConnectionsConstants.LABEL; import static com.ibm.sbt.services.client.base.ConnectionsConstants.LABEL_COMMUNITYACTIVITY; @@ -43,7 +44,8 @@ import static com.ibm.sbt.services.client.base.ConnectionsConstants.TERM; import static com.ibm.sbt.services.client.base.ConnectionsConstants.TYPE; import static com.ibm.sbt.services.client.base.ConnectionsConstants.USERID; -import static com.ibm.sbt.services.client.base.ConnectionsConstants.dateFormat; + +import java.text.SimpleDateFormat; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -54,125 +56,127 @@ import com.ibm.sbt.services.client.connections.activities.Activity; import com.ibm.sbt.services.client.connections.common.Person; - /** * @author mwallace - * + * */ public class ActivitySerializer extends AtomEntitySerializer { + public static SimpleDateFormat actvitiyDateFormat = new SimpleDateFormat( + "yyyy-MM-dd'T'HH:mm:ss'Z'"); + NodeSerializer nodeSerializer; - + public ActivitySerializer(Activity activity) { super(activity); nodeSerializer = new NodeSerializer(activity); } - + public String generateCreate() { return generateUpdate(); } - + public String generateUpdate() { - Node entry = genericAtomEntry(); - - appendChildren(entry, - activityCategory(), - duedate(), - communityUuid(), - communityCategory(), - priorityCategory(), - completedCategory(), - templateCategory(), - flagsCategory(), - externalCategory(), - linkContainer(), - subtitle(), - inReplyTo(), - assignedTo() - ); - - //appendChildren(entry, tags()); + // Node entry = genericAtomEntry(); + Element element = element(Namespace.ATOM.getUrl(), ENTRY); + element.setAttributeNS(Namespace.XMLNS.getUrl(), Namespace.APP.getNSPrefix(), Namespace.APP.getUrl()); + element.setAttributeNS(Namespace.XMLNS.getUrl(),Namespace.THR.getNSPrefix(), Namespace.THR.getUrl()); + element.setAttributeNS(Namespace.XMLNS.getUrl(),Namespace.SNX.getNSPrefix(), Namespace.SNX.getUrl()); + element.setAttributeNS(Namespace.XMLNS.getUrl(),Namespace.XHTML.getNSPrefix(), Namespace.XHTML.getUrl()); + element.setAttributeNS(Namespace.XMLNS.getUrl(),Namespace.OPENSEARCH.getNSPrefix(),Namespace.OPENSEARCH.getUrl()); + + Node entry = rootNode(element); + + appendChildren(entry, activityCategory(), duedate(), communityUuid(), + communityCategory(), priorityCategory(), completedCategory(), + templateCategory(), flagsCategory(), externalCategory(), + linkContainer(), subtitle(), inReplyTo(), assignedTo()); + + // appendChildren(entry, tags()); appendChildren(entry, nodeSerializer.fields()); - + return nodeSerializer.payload(serializeToString()); } - + protected Element activityCategory() { String type = entity.getType(); - return element(CATEGORY, - attribute(SCHEME, Namespace.TYPE.getUrl()), + return element(CATEGORY, attribute(SCHEME, Namespace.TYPE.getUrl()), attribute(TERM, StringUtil.isEmpty(type) ? ACTIVITY : type)); } - + protected Element communityCategory() { - return entity.isCommunityActivity() ? element(CATEGORY, - attribute(SCHEME, Namespace.TYPE.getUrl()), - attribute(TERM, COMMUNITY_ACTIVITY), + return entity.isCommunityActivity() ? element(CATEGORY, + attribute(SCHEME, Namespace.TYPE.getUrl()), + attribute(TERM, COMMUNITY_ACTIVITY), attribute(LABEL, LABEL_COMMUNITYACTIVITY)) : null; } - + protected Element flagsCategory() { - return entity.getFlags() != null ? element(CATEGORY, - attribute(SCHEME, Namespace.FLAGS.getUrl()), - attribute(TERM, entity.getFlags()), + return entity.getFlags() != null ? element(CATEGORY, + attribute(SCHEME, Namespace.FLAGS.getUrl()), + attribute(TERM, entity.getFlags()), attribute(LABEL, entity.getFlags())) : null; } - + protected Element communityUuid() { - return entity.isCommunityActivity() ? - textElement(Namespace.SNX.getUrl(), COMMUNITYUUID, entity.getCommunityUuid()) : null; + return entity.isCommunityActivity() ? textElement( + Namespace.SNX.getUrl(), COMMUNITYUUID, + entity.getCommunityUuid()) : null; } - + protected Element linkContainer() { - return entity.isCommunityActivity() ? element(LINK, - attribute(REL, Namespace.CONTAINER.getUrl()), - attribute(TYPE, APPLICATION_ATOM_XML), - attribute(HREF, EMPTY)) : null; + return entity.isCommunityActivity() ? element(LINK, + attribute(REL, Namespace.CONTAINER.getUrl()), + attribute(TYPE, APPLICATION_ATOM_XML), attribute(HREF, EMPTY)) + : null; } - + protected Element priorityCategory() { long priority = entity.getPriority(); - return element(CATEGORY, + return element(CATEGORY, attribute(SCHEME, Namespace.PRIORITY.getUrl()), attribute(TERM, "" + priority)); } - + protected Element externalCategory() { - return element(CATEGORY, + return element( + CATEGORY, attribute(SCHEME, Namespace.FLAGS.getUrl()), - attribute(LABEL, entity.isExternal() ? LABEL_EXTERNAL : LABEL_INTERNAL), - attribute(TERM, entity.isExternal() ? EXTERNAL: INTERNAL)); + attribute(LABEL, entity.isExternal() ? LABEL_EXTERNAL + : LABEL_INTERNAL), + attribute(TERM, entity.isExternal() ? EXTERNAL : INTERNAL)); } - + protected Element completedCategory() { - return entity.isCompleted() ? element(CATEGORY, - attribute(SCHEME, Namespace.FLAGS.getUrl()), + return entity.isCompleted() ? element(CATEGORY, + attribute(SCHEME, Namespace.FLAGS.getUrl()), attribute(TERM, COMPLETED)) : null; } - + protected Element templateCategory() { - return entity.isTemplate() ? element(CATEGORY, - attribute(SCHEME, Namespace.TYPE.getUrl()), + return entity.isTemplate() ? element(CATEGORY, + attribute(SCHEME, Namespace.TYPE.getUrl()), attribute(TERM, TEMPLATE)) : null; } - + protected Element duedate() { - return textElement(SNX_DUEDATE, DateSerializer.toString(dateFormat, entity.getDuedate())); + return textElement(SNX_DUEDATE, DateSerializer.toString( + actvitiyDateFormat, entity.getDuedate())); } - + protected Element inReplyTo() { String inReplyTo = entity.getInReplyTo(); - return StringUtil.isNotEmpty(inReplyTo) ? element(Namespace.THR.getUrl(), IN_REPLY_TO, - attribute(REF, inReplyTo), - attribute(HREF, inReplyTo), + return StringUtil.isNotEmpty(inReplyTo) ? element( + Namespace.THR.getUrl(), IN_REPLY_TO, attribute(REF, inReplyTo), + attribute(HREF, inReplyTo), attribute(TYPE, APPLICATION_ATOM_XML), attribute(SOURCE, entity.getActivityUuid())) : null; } - + protected Element assignedTo() { Person assignedTo = entity.getAssignedTo(); - return (assignedTo != null) ? element(Namespace.SNX.getUrl(), ASSIGNEDTO, - attribute(NAME, assignedTo.getName()), + return (assignedTo != null) ? element(Namespace.SNX.getUrl(), + ASSIGNEDTO, attribute(NAME, assignedTo.getName()), attribute(USERID, assignedTo.getUserid())) : null; } From 5e281c43c6c6ee77753c8a0e3d7d651d7ff8bccf Mon Sep 17 00:00:00 2001 From: Christian Guedemann Date: Tue, 26 May 2015 10:30:10 +0200 Subject: [PATCH 3/6] - Fix assignedTo - New setCompletion for ActivityNode - Correct Namespace for ActivityNode (and also complete NS) - Cleanup ActivtySerializer --- .../connections/activities/ActivityNode.java | 2 +- .../activities/ActivityService.java | 13 +++ .../serializers/ActivityNodeSerializer.java | 88 +++++++++++-------- .../serializers/ActivitySerializer.java | 1 - 4 files changed, 66 insertions(+), 38 deletions(-) diff --git a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/ActivityNode.java b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/ActivityNode.java index 90d68f8f00..62932ea571 100644 --- a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/ActivityNode.java +++ b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/ActivityNode.java @@ -129,7 +129,7 @@ public void setInReplyTo(InReplyTo inReplyTo) { */ public AssignedTo getAssignedTo() { if (assignedTo == null) { - assignedTo = createAssignedTo((Node)getDataHandler().getData(), ActivityXPath.in_reply_to); + assignedTo = createAssignedTo((Node)getDataHandler().getData(), ActivityXPath.assignedto); } return assignedTo; } diff --git a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/ActivityService.java b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/ActivityService.java index ae837472cb..44cc3f6d3f 100644 --- a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/ActivityService.java +++ b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/ActivityService.java @@ -1019,6 +1019,19 @@ public void setCompletion(Activity activity, boolean completed) throws ClientSer updateActivityEntity(requestUrl, null, null, HTTPCode.NO_CONTENT); } + /** + * Change the completion status of the specified TodoNode + * + * @param activity + * @param completed + * @throws ClientServicesException + */ + public void setCompletion(ActivityNode activityNode, boolean completed) throws ClientServicesException { + String requestUrl = ActivityUrls.SET_COMPLETION.format(this, ActivityUrls.activityNodePart(activityNode.getActivityNodeUuid()), ActivityUrls.completedPart(completed)); + updateActivityEntity(requestUrl, null, null, HTTPCode.NO_CONTENT); + } + + /** * * @param destinationUuid diff --git a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivityNodeSerializer.java b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivityNodeSerializer.java index 39f3898dbb..880cc146c8 100644 --- a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivityNodeSerializer.java +++ b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivityNodeSerializer.java @@ -18,29 +18,38 @@ import static com.ibm.sbt.services.client.base.CommonConstants.APPLICATION_XML; import static com.ibm.sbt.services.client.base.ConnectionsConstants.ACTIVITY; +import static com.ibm.sbt.services.client.base.ConnectionsConstants.ASSIGNEDTO; import static com.ibm.sbt.services.client.base.ConnectionsConstants.CATEGORY; import static com.ibm.sbt.services.client.base.ConnectionsConstants.CONTENT; import static com.ibm.sbt.services.client.base.ConnectionsConstants.ENTRY; import static com.ibm.sbt.services.client.base.ConnectionsConstants.HREF; import static com.ibm.sbt.services.client.base.ConnectionsConstants.IN_REPLY_TO; import static com.ibm.sbt.services.client.base.ConnectionsConstants.LABEL; +import static com.ibm.sbt.services.client.base.ConnectionsConstants.NAME; import static com.ibm.sbt.services.client.base.ConnectionsConstants.REF; import static com.ibm.sbt.services.client.base.ConnectionsConstants.SCHEME; +import static com.ibm.sbt.services.client.base.ConnectionsConstants.SNX_DUEDATE; import static com.ibm.sbt.services.client.base.ConnectionsConstants.SOURCE; import static com.ibm.sbt.services.client.base.ConnectionsConstants.TERM; import static com.ibm.sbt.services.client.base.ConnectionsConstants.TYPE; +import static com.ibm.sbt.services.client.base.ConnectionsConstants.USERID; + +import java.util.ArrayList; +import java.util.List; import org.w3c.dom.Element; import org.w3c.dom.Node; +import com.ibm.sbt.services.client.base.ConnectionsConstants; import com.ibm.sbt.services.client.base.ConnectionsConstants.Namespace; import com.ibm.sbt.services.client.base.serializers.AtomEntitySerializer; import com.ibm.sbt.services.client.connections.activities.ActivityNode; +import com.ibm.sbt.services.client.connections.activities.AssignedTo; import com.ibm.sbt.services.client.connections.activities.InReplyTo; /** * @author mwallace - * + * */ public class ActivityNodeSerializer extends AtomEntitySerializer { @@ -50,64 +59,71 @@ public ActivityNodeSerializer(ActivityNode activityNode) { super(activityNode); nodeSerializer = new NodeSerializer(activityNode); } - + public String generateCreate() { return generateUpdate(); } - + public String generateUpdate() { Element element = element(Namespace.ATOM.getUrl(), ENTRY); element.setAttributeNS(Namespace.XMLNS.getUrl(), Namespace.APP.getNSPrefix(), Namespace.APP.getUrl()); - element.setAttributeNS(Namespace.XMLNS.getUrl(),Namespace.THR.getNSPrefix(), Namespace.THR.getUrl()); - element.setAttributeNS(Namespace.XMLNS.getUrl(),Namespace.SNX.getNSPrefix(), Namespace.SNX.getUrl()); - element.setAttributeNS(Namespace.XMLNS.getUrl(),Namespace.XHTML.getNSPrefix(), Namespace.XHTML.getUrl()); - element.setAttributeNS(Namespace.XMLNS.getUrl(),Namespace.OPENSEARCH.getNSPrefix(),Namespace.OPENSEARCH.getUrl()); + element.setAttributeNS(Namespace.XMLNS.getUrl(), Namespace.THR.getNSPrefix(), Namespace.THR.getUrl()); + element.setAttributeNS(Namespace.XMLNS.getUrl(), Namespace.SNX.getNSPrefix(), Namespace.SNX.getUrl()); + element.setAttributeNS(Namespace.XMLNS.getUrl(), Namespace.XHTML.getNSPrefix(), Namespace.XHTML.getUrl()); + element.setAttributeNS(Namespace.XMLNS.getUrl(), Namespace.OPENSEARCH.getNSPrefix(), Namespace.OPENSEARCH.getUrl()); Node entry = rootNode(element); - - appendChildren(entry, - activityNodeCategory(), - activityUuid(), - flagsCategory(), - inReplyTo() - ); - + + appendChildren(entry, + activityNodeCategory(), + activityUuid(), + inReplyTo(), + duedate(), + assignedTo()); + + appendChildren(entry, flagsCategory()); appendChildren(entry, tags()); appendChildren(entry, nodeSerializer.fields()); - + return nodeSerializer.payload(serializeToString()); } - + protected Element activityNodeCategory() { - return element(CATEGORY, - attribute(SCHEME, Namespace.TYPE.getUrl()), - attribute(TERM, entity.getType())); + return element(CATEGORY, attribute(SCHEME, Namespace.TYPE.getUrl()), attribute(TERM, entity.getType())); } - - protected Element flagsCategory() { - return entity.getFlags() != null ? element(CATEGORY, - attribute(SCHEME, Namespace.FLAGS.getUrl()), - attribute(TERM, entity.getFlags()), - attribute(LABEL, entity.getFlags())) : null; + + protected List flagsCategory() { + List elements = new ArrayList(); + if (entity.getFlags() != null) { + String[] values = entity.getFlags().split(" "); + for (String value : values) { + elements.add(element(CATEGORY, attribute(SCHEME, Namespace.FLAGS.getUrl()), attribute(TERM, value), attribute(LABEL, value))); + } + } + return elements; } - + protected Element inReplyTo() { InReplyTo inReplyTo = entity.getInReplyTo(); - return inReplyTo != null ? element(IN_REPLY_TO, - attribute(SCHEME, Namespace.THR.getUrl()), - attribute(REF, inReplyTo.getRef()), - attribute(SOURCE, inReplyTo.getSource()), + return inReplyTo != null ? element(IN_REPLY_TO, attribute(SCHEME, Namespace.THR.getUrl()), attribute(REF, inReplyTo.getRef()), attribute(SOURCE, inReplyTo.getSource()), attribute(HREF, inReplyTo.getHref())) : null; } - + protected Element activityUuid() { return textElement(Namespace.SNX.getUrl(), ACTIVITY, entity.getActivityUuid()); } - + @Override protected Element content() { - return textElement(CONTENT, entity.getContent(), - attribute(TYPE, APPLICATION_XML)); + return textElement(CONTENT, entity.getContent(), attribute(TYPE, APPLICATION_XML)); + } + + protected Element duedate() { + return textElement(SNX_DUEDATE, DateSerializer.toString(ConnectionsConstants.dateFormat, entity.getDuedate())); + } + + protected Element assignedTo() { + AssignedTo assignedTo = entity.getAssignedTo(); + return (assignedTo != null) ? element(Namespace.SNX.getUrl(), ASSIGNEDTO, attribute(NAME, assignedTo.getName()), attribute(USERID, assignedTo.getUserid())) : null; } - } diff --git a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivitySerializer.java b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivitySerializer.java index f888230568..2daaa0f4e7 100644 --- a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivitySerializer.java +++ b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivitySerializer.java @@ -77,7 +77,6 @@ public String generateCreate() { } public String generateUpdate() { - // Node entry = genericAtomEntry(); Element element = element(Namespace.ATOM.getUrl(), ENTRY); element.setAttributeNS(Namespace.XMLNS.getUrl(), Namespace.APP.getNSPrefix(), Namespace.APP.getUrl()); element.setAttributeNS(Namespace.XMLNS.getUrl(),Namespace.THR.getNSPrefix(), Namespace.THR.getUrl()); From bc9b97cca70908b8e50aab0c7ba2711fa139355a Mon Sep 17 00:00:00 2001 From: Christian Guedemann Date: Thu, 28 May 2015 00:14:12 +0200 Subject: [PATCH 4/6] - Incomplete Date in Serializer fixed! - Error in getAssignedTo of ActivityNode fixed. --- .../connections/activities/ActivityNode.java | 2 +- .../serializers/ActivityNodeSerializer.java | 6 +++++- .../serializers/ActivitySerializer.java | 21 +++++++++++++++---- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/ActivityNode.java b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/ActivityNode.java index 62932ea571..8027a71e9c 100644 --- a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/ActivityNode.java +++ b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/ActivityNode.java @@ -128,7 +128,7 @@ public void setInReplyTo(InReplyTo inReplyTo) { * @return */ public AssignedTo getAssignedTo() { - if (assignedTo == null) { + if (assignedTo == null && getDataHandler() != null) { assignedTo = createAssignedTo((Node)getDataHandler().getData(), ActivityXPath.assignedto); } return assignedTo; diff --git a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivityNodeSerializer.java b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivityNodeSerializer.java index 880cc146c8..fe1ebd0de7 100644 --- a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivityNodeSerializer.java +++ b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivityNodeSerializer.java @@ -74,7 +74,11 @@ public String generateUpdate() { Node entry = rootNode(element); - appendChildren(entry, + appendChildren(entry, + title(), + id(), + summary(), + content(), activityNodeCategory(), activityUuid(), inReplyTo(), diff --git a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivitySerializer.java b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivitySerializer.java index 2daaa0f4e7..30600cf421 100644 --- a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivitySerializer.java +++ b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/activities/serializers/ActivitySerializer.java @@ -86,10 +86,23 @@ public String generateUpdate() { Node entry = rootNode(element); - appendChildren(entry, activityCategory(), duedate(), communityUuid(), - communityCategory(), priorityCategory(), completedCategory(), - templateCategory(), flagsCategory(), externalCategory(), - linkContainer(), subtitle(), inReplyTo(), assignedTo()); + appendChildren(entry, title(), + id(), + summary(), + content(), + activityCategory(), + duedate(), + communityUuid(), + communityCategory(), + priorityCategory(), + completedCategory(), + templateCategory(), + flagsCategory(), + externalCategory(), + linkContainer(), + subtitle(), + inReplyTo(), + assignedTo()); // appendChildren(entry, tags()); appendChildren(entry, nodeSerializer.fields()); From a28575772e66cfcb6ec32d508873eec9a80c0441 Mon Sep 17 00:00:00 2001 From: Christian Guedemann Date: Tue, 23 Feb 2016 16:54:59 +0100 Subject: [PATCH 5/6] SBT-1 #DONE SBT-2 #DONE --- .../connections/profiles/ProfileUrls.java | 2 +- sdk/com.ibm.sbt.web/pom.xml | 30 ++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/profiles/ProfileUrls.java b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/profiles/ProfileUrls.java index a82cc024d4..94d4887089 100644 --- a/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/profiles/ProfileUrls.java +++ b/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/profiles/ProfileUrls.java @@ -50,7 +50,7 @@ public enum ProfileUrls implements URLContainer { MESSAGE_BOARD_ENTRIES(new VersionedUrl(v4_0, "{profiles}/{authType}/atom/mv/theboard/entries.do")), MESSAGE_BOARD_COMMENTS(new VersionedUrl(v4_0, "{profiles}/{authType}/atom/mv/theboard/comments.do")), MESSAGES_COLLEAGUES(new VersionedUrl(v4_0, "{profiles}/{authType}/atom/mv/theboard/entries/related.do")), - MY_USER_ID(new VersionedUrl(v4_0, "{connections}/opensocial/basic/rest/people/@me/")), + MY_USER_ID(new VersionedUrl(v4_0, "{connections}/opensocial/{authType}/rest/people/@me/")), /** * ADMIN URLS diff --git a/sdk/com.ibm.sbt.web/pom.xml b/sdk/com.ibm.sbt.web/pom.xml index be594b02c2..54cf7c21b0 100644 --- a/sdk/com.ibm.sbt.web/pom.xml +++ b/sdk/com.ibm.sbt.web/pom.xml @@ -4,6 +4,10 @@ com.ibm.sbt.web eclipse-plugin + + ${maven.build.timestamp} + yyyyMMddHHmm + com.ibm.sbt com.ibm.sbt.sdk @@ -23,6 +27,19 @@ + + org.codehaus.mojo + build-helper-maven-plugin + 1.8 + + + parse-version + + parse-version + + + + org.apache.maven.plugins maven-assembly-plugin @@ -52,7 +69,18 @@ false ${project.build.directory} - META-INF\MANIFEST.MF + + ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${sbt.timestamp} + 2 + Web + com.ibm.sbt.web;singleton:=true + lazy + com.ibm.sbt.web.SbtWebActivator + org.eclipse.core.runtime + . + com.ibm.sbt.web + javax.servlet, javax.servlet.http + From 7a29c2467ec459ec4a06b33ce2286b4785bd89ce Mon Sep 17 00:00:00 2001 From: Christian Guedemann Date: Fri, 10 Jun 2016 15:24:48 +0200 Subject: [PATCH 6/6] Cleanup --- .gitignore | 6 ++++++ commons/com.ibm.commons/.classpath | 7 ------- 2 files changed, 6 insertions(+), 7 deletions(-) delete mode 100644 commons/com.ibm.commons/.classpath diff --git a/.gitignore b/.gitignore index d2bd4fe589..7b308dd540 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,9 @@ Desktop.ini # Desktop Services Store for the Mac .DS_Store +assembly/.settings/ +sdk/com.ibm.sbt.core.test/.settings/ +sdk/com.ibm.sbt.core/.settings/ +samples/java/sbt.sample.app/.settings/ +samples/java/bss.provisioning.sample.app/.settings/org.sonar.ide.eclipse.core.prefs +commons/com.ibm.commons.runtime/.settings/ diff --git a/commons/com.ibm.commons/.classpath b/commons/com.ibm.commons/.classpath deleted file mode 100644 index 3daf882191..0000000000 --- a/commons/com.ibm.commons/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - -