Commit 4c16e7b5 authored by Liang Ding's avatar Liang Ding

升级 Latke

parent 9e68a261
...@@ -78,6 +78,21 @@ public class B3ArticleReceiver { ...@@ -78,6 +78,21 @@ public class B3ArticleReceiver {
/** /**
* Adds an article with the specified request. * Adds an article with the specified request.
* <p> * <p>
* Request json:
* <pre>
* {
* "article": {
* "oId": "",
* "articleTitle": "",
* "articleContent": "",
* "articleTags": "tag1,tag2,tag3",
* "userB3Key": "",
* "articleEditorType": ""
* }
* }
* </pre>
* </p>
* <p>
* Renders the response with a json object, for example, * Renders the response with a json object, for example,
* <pre> * <pre>
* { * {
...@@ -88,24 +103,14 @@ public class B3ArticleReceiver { ...@@ -88,24 +103,14 @@ public class B3ArticleReceiver {
* </pre> * </pre>
* </p> * </p>
* *
* @param context the specified http request context * @param context the specified http request context
* @param requestJSONObject the specified http servlet request, for example,
* "article": {
* "oId": "",
* "articleTitle": "",
* "articleContent": "",
* "articleTags": "tag1,tag2,tag3",
* "userB3Key": "",
* "articleEditorType": ""
* }
* @throws Exception exception
*/ */
@RequestProcessing(value = "/apis/symphony/article", method = HttpMethod.POST) @RequestProcessing(value = "/apis/symphony/article", method = HttpMethod.POST)
public void addArticle(final RequestContext context, final JSONObject requestJSONObject) public void addArticle(final RequestContext context) {
throws Exception {
final JsonRenderer renderer = new JsonRenderer(); final JsonRenderer renderer = new JsonRenderer();
context.setRenderer(renderer); context.setRenderer(renderer);
final JSONObject ret = new JSONObject(); final JSONObject ret = new JSONObject();
final JSONObject requestJSONObject = context.requestJSON();
try { try {
final JSONObject article = requestJSONObject.optJSONObject(Article.ARTICLE); final JSONObject article = requestJSONObject.optJSONObject(Article.ARTICLE);
...@@ -151,6 +156,21 @@ public class B3ArticleReceiver { ...@@ -151,6 +156,21 @@ public class B3ArticleReceiver {
/** /**
* Updates an article with the specified request. * Updates an article with the specified request.
* <p> * <p>
* Request json:
* <pre>
* {
* "article": {
* "oId": "", // Symphony Article#clientArticleId
* "articleTitle": "",
* "articleContent": "",
* "articleTags": "tag1,tag2,tag3",
* "userB3Key": "",
* "articleEditorType": ""
* }
* }
* </pre>
* </p>
* <p>
* Renders the response with a json object, for example, * Renders the response with a json object, for example,
* <pre> * <pre>
* { * {
...@@ -160,25 +180,15 @@ public class B3ArticleReceiver { ...@@ -160,25 +180,15 @@ public class B3ArticleReceiver {
* </pre> * </pre>
* </p> * </p>
* *
* @param context the specified http request context * @param context the specified http request context
* @param requestJSONObject the specified http servlet request, for example,
* "article": {
* "oId": "", // Symphony Article#clientArticleId
* "articleTitle": "",
* "articleContent": "",
* "articleTags": "tag1,tag2,tag3",
* "userB3Key": "",
* "articleEditorType": ""
* }
* @throws Exception exception
*/ */
@RequestProcessing(value = "/apis/symphony/article", method = HttpMethod.PUT) @RequestProcessing(value = "/apis/symphony/article", method = HttpMethod.PUT)
public void updateArticle(final RequestContext context, final JSONObject requestJSONObject) public void updateArticle(final RequestContext context) {
throws Exception {
final JsonRenderer renderer = new JsonRenderer(); final JsonRenderer renderer = new JsonRenderer();
context.setRenderer(renderer); context.setRenderer(renderer);
final JSONObject ret = new JSONObject(); final JSONObject ret = new JSONObject();
renderer.setJSONObject(ret); renderer.setJSONObject(ret);
final JSONObject requestJSONObject = context.requestJSON();
try { try {
final JSONObject article = requestJSONObject.optJSONObject(Article.ARTICLE); final JSONObject article = requestJSONObject.optJSONObject(Article.ARTICLE);
......
...@@ -108,6 +108,25 @@ public class B3CommentReceiver { ...@@ -108,6 +108,25 @@ public class B3CommentReceiver {
/** /**
* Adds a comment with the specified request. * Adds a comment with the specified request.
* <p> * <p>
* Request json:
* <pre>
* {
* "comment": {
* "userB3Key": "",
* "oId": "",
* "commentSymphonyArticleId": "",
* "commentOnArticleId": "",
* "commentAuthorName": "",
* "commentAuthorEmail": "",
* "commentAuthorURL": "",
* "commentAuthorThumbnailURL": "",
* "commentContent": "",
* "commentOriginalCommentId": "" // optional, if exists this key, the comment is an reply
* }
* }
* </pre>
* </p>
* <p>
* Renders the response with a json object, for example, * Renders the response with a json object, for example,
* <pre> * <pre>
* { * {
...@@ -116,32 +135,16 @@ public class B3CommentReceiver { ...@@ -116,32 +135,16 @@ public class B3CommentReceiver {
* </pre> * </pre>
* </p> * </p>
* *
* @param context the specified http request context * @param context the specified http request context
* @param requestJSONObject the specified http servlet request, for example,
* {
* "comment": {
* "userB3Key": "",
* "oId": "",
* "commentSymphonyArticleId": "",
* "commentOnArticleId": "",
* "commentAuthorName": "",
* "commentAuthorEmail": "",
* "commentAuthorURL": "",
* "commentAuthorThumbnailURL": "",
* "commentContent": "",
* "commentOriginalCommentId": "" // optional, if exists this key, the comment is an reply
* }
* }
* @throws Exception exception
*/ */
@RequestProcessing(value = "/apis/symphony/comment", method = HttpMethod.PUT) @RequestProcessing(value = "/apis/symphony/comment", method = HttpMethod.PUT)
public void addComment(final RequestContext context, final JSONObject requestJSONObject) public void addComment(final RequestContext context) {
throws Exception {
final JsonRenderer renderer = new JsonRenderer(); final JsonRenderer renderer = new JsonRenderer();
context.setRenderer(renderer); context.setRenderer(renderer);
final JSONObject ret = new JSONObject(); final JSONObject ret = new JSONObject();
renderer.setJSONObject(ret); renderer.setJSONObject(ret);
final JSONObject requestJSONObject = context.requestJSON();
final Transaction transaction = commentRepository.beginTransaction(); final Transaction transaction = commentRepository.beginTransaction();
try { try {
final JSONObject symphonyCmt = requestJSONObject.optJSONObject(Comment.COMMENT); final JSONObject symphonyCmt = requestJSONObject.optJSONObject(Comment.COMMENT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment