本文整理匯總了Java中fr.wseduc.rs.Put類的典型用法代碼示例。如果您正苦於以下問題:Java Put類的具體用法?Java Put怎麽用?Java Put使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Put類屬於fr.wseduc.rs包,在下文中一共展示了Put類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: update
import fr.wseduc.rs.Put; //導入依賴的package包/類
@Put("/:id")
@SecuredAction(value = "", type = ActionType.RESOURCE)
public void update(final HttpServerRequest request) {
RequestUtils.bodyToJson(request, pathPrefix + "update", new Handler<JsonObject>() {
@Override
public void handle(JsonObject body) {
if (body.size() > 0) {
String name = body.getString("name");
Handler<Either<String, JsonObject>> handler = (name != null && !name.trim().isEmpty()) ?
updatePageHandler(request, name) : notEmptyResponseHandler(request);
communityService.update(request.params().get("id"), body, handler);
} else {
badRequest(request, "empty.json");
}
}
});
}
示例2: updateResourceType
import fr.wseduc.rs.Put; //導入依賴的package包/類
@Put("/type/:id")
@ApiDoc("Update resource type")
@SecuredAction(value = "rbs.manager", type = ActionType.RESOURCE)
public void updateResourceType(final HttpServerRequest request) {
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
if (user != null) {
RequestUtils.bodyToJson(request, pathPrefix + "updateResourceType", new Handler<JsonObject>() {
@Override
public void handle(JsonObject object) {
String id = request.params().get("id");
crudService.update(id, object, user, defaultResponseHandler(request));
}
});
} else {
log.debug("User not found in session.");
unauthorized(request);
}
}
});
}
示例3: updateThread
import fr.wseduc.rs.Put; //導入依賴的package包/類
@Put("/thread/:" + Actualites.THREAD_RESOURCE_ID)
@ApiDoc("Update thread by id.")
@ResourceFilter(ThreadFilter.class)
@SecuredAction(value = "thread.manager", type = ActionType.RESOURCE)
public void updateThread(final HttpServerRequest request) {
final String threadId = request.params().get(Actualites.THREAD_RESOURCE_ID);
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
RequestUtils.bodyToJson(request, pathPrefix + SCHEMA_THREAD_UPDATE, new Handler<JsonObject>() {
@Override
public void handle(JsonObject resource) {
crudService.update(threadId, resource, user, notEmptyResponseHandler(request));
}
});
}
});
}
示例4: updateDraft
import fr.wseduc.rs.Put; //導入依賴的package包/類
@Put("/thread/:"+Actualites.THREAD_RESOURCE_ID+"/info/:"+Actualites.INFO_RESOURCE_ID+"/draft")
@ApiDoc("Update : update an Info in Draft state in thread by thread and by id")
@ResourceFilter(InfoFilter.class)
@SecuredAction(value = "thread.contrib", type = ActionType.RESOURCE)
public void updateDraft(final HttpServerRequest request) {
final String infoId = request.params().get(Actualites.INFO_RESOURCE_ID);
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
RequestUtils.bodyToJson(request, pathPrefix + SCHEMA_INFO_UPDATE, new Handler<JsonObject>() {
@Override
public void handle(JsonObject resource) {
resource.putNumber("status", status_list.get(1));
if(!resource.containsField("expiration_date")){
resource.putString("expiration_date", null);
}
if(!resource.containsField("publication_date")){
resource.putString("publication_date", null);
}
notifyOwner(request, user, resource, infoId, NEWS_UPDATE_EVENT_TYPE);
infoService.update(infoId, resource, user, Events.UPDATE.toString(), notEmptyResponseHandler(request));
}
});
}
});
}
示例5: updatePending
import fr.wseduc.rs.Put; //導入依賴的package包/類
@Put("/thread/:"+Actualites.THREAD_RESOURCE_ID+"/info/:"+Actualites.INFO_RESOURCE_ID+"/pending")
@ApiDoc("Update : update an Info in Draft state in thread by thread and by id")
@ResourceFilter(InfoFilter.class)
@SecuredAction(value = "thread.publish", type = ActionType.RESOURCE)
public void updatePending(final HttpServerRequest request) {
final String infoId = request.params().get(Actualites.INFO_RESOURCE_ID);
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
RequestUtils.bodyToJson(request, pathPrefix + SCHEMA_INFO_UPDATE, new Handler<JsonObject>() {
@Override
public void handle(JsonObject resource) {
resource.putNumber("status", status_list.get(2));
if(!resource.containsField("expiration_date")){
resource.putString("expiration_date", null);
}
if(!resource.containsField("publication_date")){
resource.putString("publication_date", null);
}
notifyOwner(request, user, resource, infoId, NEWS_UPDATE_EVENT_TYPE);
infoService.update(infoId, resource, user, Events.PENDING.toString(), notEmptyResponseHandler(request));
}
});
}
});
}
示例6: updateComment
import fr.wseduc.rs.Put; //導入依賴的package包/類
@Put("/info/:"+Actualites.INFO_RESOURCE_ID+"/comment/:"+COMMENT_ID_PARAMETER)
@ApiDoc("Comment : modify a comment of an Info by info and comment id")
@ResourceFilter(InfoFilter.class)
@SecuredAction(value = "info.comment", type = ActionType.RESOURCE)
public void updateComment(final HttpServerRequest request) {
final String commentId = request.params().get(COMMENT_ID_PARAMETER);
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
RequestUtils.bodyToJson(request, pathPrefix + SCHEMA_COMMENT_UPDATE, new Handler<JsonObject>() {
@Override
public void handle(JsonObject resource) {
crudService.update(commentId, resource, user, notEmptyResponseHandler(request));
}
});
}
});
}
示例7: shareJsonSubmit
import fr.wseduc.rs.Put; //導入依賴的package包/類
@Put("/share/json/:id")
@ApiDoc("Add rights for a given resource type")
@SecuredAction(value = "rbs.manager", type = ActionType.RESOURCE)
public void shareJsonSubmit(final HttpServerRequest request){
// TODO Improve : temporary unique share url to match Front-end ShareController urls
super.shareJsonSubmit(request, null, false);
}
示例8: removeShare
import fr.wseduc.rs.Put; //導入依賴的package包/類
@Override
@Put("/share/remove/:id")
@ApiDoc("Remove rights for a given resource type")
@SecuredAction(value = "rbs.manager", type = ActionType.RESOURCE)
public void removeShare(final HttpServerRequest request){
// TODO Improve : temporary unique share url to match Front-end ShareController urls
super.removeShare(request, false);
}
示例9: shareSubmit
import fr.wseduc.rs.Put; //導入依賴的package包/類
@Put("/resource/share/json/:id")
@ApiDoc("Add rights for a given resource")
@ResourceFilter(TypeAndResourceAppendPolicy.class)
@SecuredAction(value = "rbs.manager", type = ActionType.RESOURCE)
public void shareSubmit(final HttpServerRequest request) {
super.shareJsonSubmit(request, null, false);
}
示例10: shareRemove
import fr.wseduc.rs.Put; //導入依賴的package包/類
@Put("/resource/share/remove/:id")
@ApiDoc("Remove rights for a given resource")
@ResourceFilter(TypeAndResourceAppendPolicy.class)
@SecuredAction(value = "rbs.manager", type = ActionType.RESOURCE)
public void shareRemove(final HttpServerRequest request) {
super.removeShare(request, false);
}
示例11: shareThreadRemove
import fr.wseduc.rs.Put; //導入依賴的package包/類
@Put("/thread/share/remove/:"+THREAD_ID_PARAMETER)
@ApiDoc("Remove Share by id.")
@ResourceFilter(ThreadFilter.class)
@SecuredAction(value = "thread.manager", type = ActionType.RESOURCE)
public void shareThreadRemove(final HttpServerRequest request) {
removeShare(request, false);
}
示例12: updatePublished
import fr.wseduc.rs.Put; //導入依賴的package包/類
@Put("/thread/:"+Actualites.THREAD_RESOURCE_ID+"/info/:"+Actualites.INFO_RESOURCE_ID+"/published")
@ApiDoc("Update : update an Info in Draft state in thread by thread and by id")
@ResourceFilter(InfoFilter.class)
@SecuredAction(value = "thread.publish", type = ActionType.RESOURCE)
public void updatePublished(final HttpServerRequest request) {
final String infoId = request.params().get(Actualites.INFO_RESOURCE_ID);
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
RequestUtils.bodyToJson(request, pathPrefix + SCHEMA_INFO_UPDATE, new Handler<JsonObject>() {
@Override
public void handle(JsonObject resource) {
resource.putNumber("status", status_list.get(3));
if(!resource.containsField("expiration_date")){
resource.putString("expiration_date", null);
}
if(!resource.containsField("publication_date")){
resource.putString("publication_date", null);
}
notifyOwner(request, user, resource, infoId, NEWS_UPDATE_EVENT_TYPE);
infoService.update(infoId, resource, user, Events.UPDATE.toString(),
notEmptyResponseHandler(request));
}
});
}
});
}
示例13: submit
import fr.wseduc.rs.Put; //導入依賴的package包/類
@Put("/thread/:"+Actualites.THREAD_RESOURCE_ID+"/info/:"+Actualites.INFO_RESOURCE_ID+"/submit")
@ApiDoc("Submit : Change an Info to Pending state in thread by thread and by id")
@ResourceFilter(InfoFilter.class)
@SecuredAction(value = "thread.contrib", type = ActionType.RESOURCE)
public void submit(final HttpServerRequest request) {
final String threadId = request.params().get(Actualites.THREAD_RESOURCE_ID);
final String infoId = request.params().get(Actualites.INFO_RESOURCE_ID);
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
RequestUtils.bodyToJson(request, new Handler<JsonObject>() {
@Override
public void handle(JsonObject body) {
final String title = body.getString("title");
Handler<Either<String, JsonObject>> handler = new Handler<Either<String, JsonObject>>() {
@Override
public void handle(Either<String, JsonObject> event) {
if (event.isRight()) {
notifyTimeline(request, user, threadId, infoId, title, NEWS_SUBMIT_EVENT_TYPE);
renderJson(request, event.right().getValue(), 200);
} else {
JsonObject error = new JsonObject().putString("error", event.left().getValue());
renderJson(request, error, 400);
}
}
};
JsonObject resource = new JsonObject();
resource.putNumber("status", status_list.get(2));
infoService.update(infoId, resource, user, Events.SUBMIT.toString(),
notEmptyResponseHandler(request));
}
});
}
});
}
示例14: unsubmit
import fr.wseduc.rs.Put; //導入依賴的package包/類
@Put("/thread/:"+Actualites.THREAD_RESOURCE_ID+"/info/:"+Actualites.INFO_RESOURCE_ID+"/unsubmit")
@ApiDoc("Cancel Submit : Change an Info to Draft state in thread by thread and by id")
@ResourceFilter(InfoFilter.class)
@SecuredAction(value = "thread.contrib", type = ActionType.RESOURCE)
public void unsubmit(final HttpServerRequest request) {
final String threadId = request.params().get(Actualites.THREAD_RESOURCE_ID);
final String infoId = request.params().get(Actualites.INFO_RESOURCE_ID);
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
RequestUtils.bodyToJson(request, new Handler<JsonObject>() {
@Override
public void handle(JsonObject body) {
final String title = body.getString("title");
Handler<Either<String, JsonObject>> handler = new Handler<Either<String, JsonObject>>() {
@Override
public void handle(Either<String, JsonObject> event) {
if (event.isRight()) {
// notifyTimeline(request, user, threadId, infoId, title, NEWS_UNSUBMIT_EVENT_TYPE);
renderJson(request, event.right().getValue(), 200);
} else {
JsonObject error = new JsonObject().putString("error", event.left().getValue());
renderJson(request, error, 400);
}
}
};
JsonObject resource = new JsonObject();
resource.putNumber("status", status_list.get(1));
infoService.update(infoId, resource, user, Events.UNPUBLISH.toString(),
notEmptyResponseHandler(request));
}
});
}
});
}
示例15: publish
import fr.wseduc.rs.Put; //導入依賴的package包/類
@Put("/thread/:"+Actualites.THREAD_RESOURCE_ID+"/info/:"+Actualites.INFO_RESOURCE_ID+"/publish")
@ApiDoc("Publish : Change an Info to Published state in thread by thread and by id")
@ResourceFilter(InfoFilter.class)
@SecuredAction(value = "thread.publish", type = ActionType.RESOURCE)
public void publish(final HttpServerRequest request) {
final String threadId = request.params().get(Actualites.THREAD_RESOURCE_ID);
final String infoId = request.params().get(Actualites.INFO_RESOURCE_ID);
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
RequestUtils.bodyToJson(request, new Handler<JsonObject>() {
@Override
public void handle(JsonObject body) {
final String title = body.getString("title");
final UserInfos owner = new UserInfos();
owner.setUserId(body.getString("owner"));
owner.setUsername(body.getString("username"));
Handler<Either<String, JsonObject>> handler = new Handler<Either<String, JsonObject>>() {
@Override
public void handle(Either<String, JsonObject> event) {
if (event.isRight()) {
notifyTimeline(request, user, owner, threadId, infoId, title, NEWS_PUBLISH_EVENT_TYPE);
renderJson(request, event.right().getValue(), 200);
} else {
JsonObject error = new JsonObject().putString("error", event.left().getValue());
renderJson(request, error, 400);
}
}
};
JsonObject resource = new JsonObject();
resource.putNumber("status", status_list.get(3));
infoService.update(infoId, resource, user, Events.PUBLISH.toString(), notEmptyResponseHandler(request));
}
});
}
});
}