[jbpm-commits] JBoss JBPM SVN: r5129 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/api/model and 4 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Jun 26 08:04:40 EDT 2009
Author: tom.baeyens at jboss.com
Date: 2009-06-26 08:04:40 -0400 (Fri, 26 Jun 2009)
New Revision: 5129
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/Comment.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CommentImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java
Log:
JBPM-2348 long commentDbid --> String commentId
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskService.java 2009-06-26 11:51:07 UTC (rev 5128)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskService.java 2009-06-26 12:04:40 UTC (rev 5129)
@@ -147,11 +147,11 @@
List<Comment> getTaskComments(long taskDbid);
/** add a reply to another comment */
- Comment addReplyComment(long commentDbid, String message);
+ Comment addReplyComment(String commentId, String message);
/** delete a comment.
* this will recursively delete all replies to this comment. */
- void deleteComment(long commentDbid);
+ void deleteComment(String commentId);
/** creates or overwrites a variable value on the given task */
void setVariable(long taskDbid, String name, Object value);
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/Comment.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/Comment.java 2009-06-26 11:51:07 UTC (rev 5128)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/model/Comment.java 2009-06-26 12:04:40 UTC (rev 5129)
@@ -38,7 +38,7 @@
public interface Comment extends Discussable {
/** the meaningless database primary key */
- long getDbid();
+ String getId();
/** the id of the user that made this comment. The term actorId is an abstract
* reference to an entity in an external identity component. */
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java 2009-06-26 11:51:07 UTC (rev 5128)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/AddReplyCommentCmd.java 2009-06-26 12:04:40 UTC (rev 5129)
@@ -35,19 +35,22 @@
private static final long serialVersionUID = 1L;
- protected long commentDbid;
+ protected String commentId;
protected String message;
- public AddReplyCommentCmd(long commentDbid, String message) {
- this.commentDbid = commentDbid;
+ public AddReplyCommentCmd(String commentId, String message) {
+ if (commentId==null) {
+ throw new JbpmException("commentId is null");
+ }
+ this.commentId = commentId;
this.message = message;
}
public Comment execute(Environment environment) throws Exception {
DbSession dbSession = environment.get(DbSession.class);
- CommentImpl parentComment = dbSession.get(CommentImpl.class, commentDbid);
+ CommentImpl parentComment = dbSession.get(CommentImpl.class, Long.parseLong(commentId));
if (parentComment==null) {
- throw new JbpmException("parent comment doesn't exist: "+commentDbid);
+ throw new JbpmException("parent comment doesn't exist: "+commentId);
}
Comment replyComment = parentComment.createComment(message);
return replyComment;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java 2009-06-26 11:51:07 UTC (rev 5128)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteCommentCmd.java 2009-06-26 12:04:40 UTC (rev 5129)
@@ -25,7 +25,6 @@
import org.jbpm.pvm.internal.env.Environment;
import org.jbpm.pvm.internal.model.CommentImpl;
import org.jbpm.pvm.internal.session.DbSession;
-import org.jbpm.pvm.internal.task.TaskImpl;
/**
@@ -35,20 +34,23 @@
private static final long serialVersionUID = 1L;
- protected long commentDbid;
+ protected String commentId;
- public DeleteCommentCmd(long commentDbid) {
- this.commentDbid = commentDbid;
+ public DeleteCommentCmd(String commentId) {
+ if (commentId==null) {
+ throw new JbpmException("commentId is null");
+ }
+ this.commentId = commentId;
}
public Object execute(Environment environment) throws Exception {
DbSession dbSession = environment.get(DbSession.class);
- CommentImpl comment = (CommentImpl) dbSession.get(CommentImpl.class, commentDbid);
+ CommentImpl comment = (CommentImpl) dbSession.get(CommentImpl.class, Long.parseLong(commentId));
if (comment!=null) {
dbSession.delete(comment);
} else {
- throw new JbpmException("comment "+commentDbid+" doesn't exist");
+ throw new JbpmException("comment "+commentId+" doesn't exist");
}
return null;
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CommentImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CommentImpl.java 2009-06-26 11:51:07 UTC (rev 5128)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CommentImpl.java 2009-06-26 12:04:40 UTC (rev 5129)
@@ -100,6 +100,12 @@
return EqualsUtil.equals(this, o);
}
+ // cusomtized getters and setters ////////////////////////////////////////////
+
+ public String getId() {
+ return Long.toString(dbid);
+ }
+
// getters and setters //////////////////////////////////////////////////////
public long getDbid() {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java 2009-06-26 11:51:07 UTC (rev 5128)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java 2009-06-26 12:04:40 UTC (rev 5129)
@@ -125,12 +125,12 @@
return commandService.execute(new GetTaskCommentsCmd(taskDbid));
}
- public void deleteComment(long commentDbid) {
- commandService.execute(new DeleteCommentCmd(commentDbid));
+ public void deleteComment(String commentId) {
+ commandService.execute(new DeleteCommentCmd(commentId));
}
- public Comment addReplyComment(long commentDbid, String message) {
- return commandService.execute(new AddReplyCommentCmd(commentDbid, message));
+ public Comment addReplyComment(String commentId, String message) {
+ return commandService.execute(new AddReplyCommentCmd(commentId, message));
}
public void assignTask(long taskDbid, String userId) {
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java 2009-06-26 11:51:07 UTC (rev 5128)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskCommentsTest.java 2009-06-26 12:04:40 UTC (rev 5129)
@@ -43,10 +43,10 @@
// - euh yes. it was a great party :-)
// i'll clean up the mess
Comment comment = taskService.addTaskComment(taskDbid, "what a party yesterday");
- long whatAPartyDbid = comment.getDbid();
- comment = taskService.addReplyComment(whatAPartyDbid, "what! you had a party while i was out ?!");
- long youHadAPartyDbid = comment.getDbid();
- taskService.addReplyComment(youHadAPartyDbid, "euh yes. it was a great party :-)");
+ String whatAPartyId = comment.getId();
+ comment = taskService.addReplyComment(whatAPartyId, "what! you had a party while i was out ?!");
+ String youHadAPartyId = comment.getId();
+ taskService.addReplyComment(youHadAPartyId, "euh yes. it was a great party :-)");
taskService.addTaskComment(taskDbid, "i'll clean up the mess");
@@ -60,7 +60,7 @@
taskComments = taskComments.get(0).getComments();
assertEquals("euh yes. it was a great party :-)", taskComments.get(0).getMessage());
- taskService.deleteComment(whatAPartyDbid);
+ taskService.deleteComment(whatAPartyId);
taskComments = taskService.getTaskComments(taskDbid);
assertEquals("i'll clean up the mess", taskComments.get(0).getMessage());
More information about the jbpm-commits
mailing list