Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Feature/activate activies for osgi #1690

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
7 changes: 0 additions & 7 deletions commons/com.ibm.commons/.classpath

This file was deleted.

126 changes: 78 additions & 48 deletions sdk/com.ibm.sbt.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ public void setInReplyTo(InReplyTo inReplyTo) {
* @return {AssignedTo}
*/
public AssignedTo getAssignedTo() {
if (assignedTo == null) {
assignedTo = createAssignedTo((Node)getDataHandler().getData(), ActivityXPath.in_reply_to);
if (assignedTo == null && getDataHandler() != null) {
assignedTo = createAssignedTo((Node)getDataHandler().getData(), ActivityXPath.assignedto);
}
return assignedTo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +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<ActivityNode> {

Expand All @@ -49,57 +59,75 @@ public ActivityNodeSerializer(ActivityNode activityNode) {
super(activityNode);
nodeSerializer = new NodeSerializer(activityNode);
}

public String generateCreate() {
return generateUpdate();
}

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(),
activityUuid(),
flagsCategory(),
inReplyTo()
);

title(),
id(),
summary(),
content(),
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<Element> flagsCategory() {
List<Element> elements = new ArrayList<Element>();
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;
}

}
Loading