Search in sources :

Example 1 with DeletePageRequest

use of com.willshex.blogwt.shared.api.page.call.DeletePageRequest in project blogwt by billy1380.

the class PageController method deletePage.

/**
 * @param page
 */
public void deletePage(Page page) {
    final DeletePageRequest input = SessionController.get().setSession(ApiHelper.setAccessCode(new DeletePageRequest())).page(page);
    ApiHelper.createPageClient().deletePage(input, new AsyncCallback<DeletePageResponse>() {

        @Override
        public void onSuccess(DeletePageResponse output) {
            if (output.status == StatusType.StatusTypeSuccess) {
                if (input.page != null) {
                }
            }
            DefaultEventBus.get().fireEventFromSource(new DeletePageSuccess(input, output), PageController.this);
        }

        @Override
        public void onFailure(Throwable caught) {
            DefaultEventBus.get().fireEventFromSource(new DeletePageFailure(input, caught), PageController.this);
        }
    });
}
Also used : DeletePageRequest(com.willshex.blogwt.shared.api.page.call.DeletePageRequest) DeletePageFailure(com.willshex.blogwt.client.api.page.event.DeletePageEventHandler.DeletePageFailure) DeletePageResponse(com.willshex.blogwt.shared.api.page.call.DeletePageResponse) DeletePageSuccess(com.willshex.blogwt.client.api.page.event.DeletePageEventHandler.DeletePageSuccess)

Example 2 with DeletePageRequest

use of com.willshex.blogwt.shared.api.page.call.DeletePageRequest in project blogwt by billy1380.

the class PageJsonServlet method processAction.

@Override
protected String processAction(String action, JsonObject request) {
    String output = "null";
    if ("SubmitForm".equals(action)) {
        SubmitFormRequest input = new SubmitFormRequest();
        input.fromJson(request);
        output = new SubmitFormActionHandler().handle(input).toString();
    } else if ("GetPages".equals(action)) {
        GetPagesRequest input = new GetPagesRequest();
        input.fromJson(request);
        output = new GetPagesActionHandler().handle(input).toString();
    } else if ("GetPage".equals(action)) {
        GetPageRequest input = new GetPageRequest();
        input.fromJson(request);
        output = new GetPageActionHandler().handle(input).toString();
    } else if ("UpdatePage".equals(action)) {
        UpdatePageRequest input = new UpdatePageRequest();
        input.fromJson(request);
        output = new UpdatePageActionHandler().handle(input).toString();
    } else if ("DeletePage".equals(action)) {
        DeletePageRequest input = new DeletePageRequest();
        input.fromJson(request);
        output = new DeletePageActionHandler().handle(input).toString();
    } else if ("CreatePage".equals(action)) {
        CreatePageRequest input = new CreatePageRequest();
        input.fromJson(request);
        output = new CreatePageActionHandler().handle(input).toString();
    }
    return output;
}
Also used : GetPagesRequest(com.willshex.blogwt.shared.api.page.call.GetPagesRequest) DeletePageActionHandler(com.willshex.blogwt.server.api.page.action.DeletePageActionHandler) UpdatePageActionHandler(com.willshex.blogwt.server.api.page.action.UpdatePageActionHandler) CreatePageRequest(com.willshex.blogwt.shared.api.page.call.CreatePageRequest) CreatePageActionHandler(com.willshex.blogwt.server.api.page.action.CreatePageActionHandler) UpdatePageRequest(com.willshex.blogwt.shared.api.page.call.UpdatePageRequest) GetPageRequest(com.willshex.blogwt.shared.api.page.call.GetPageRequest) GetPageActionHandler(com.willshex.blogwt.server.api.page.action.GetPageActionHandler) DeletePageRequest(com.willshex.blogwt.shared.api.page.call.DeletePageRequest) SubmitFormRequest(com.willshex.blogwt.shared.api.page.call.SubmitFormRequest) SubmitFormActionHandler(com.willshex.blogwt.server.api.page.action.SubmitFormActionHandler) GetPagesActionHandler(com.willshex.blogwt.server.api.page.action.GetPagesActionHandler)

Example 3 with DeletePageRequest

use of com.willshex.blogwt.shared.api.page.call.DeletePageRequest in project blogwt by billy1380.

the class PageService method deletePage.

public Request deletePage(DeletePageRequest input, AsyncSuccess<DeletePageRequest, DeletePageResponse> onSuccess, AsyncFailure<DeletePageRequest> onFailure) {
    Request handle = null;
    try {
        handle = sendRequest(PageMethodDeletePage, input, new RequestCallback() {

            @Override
            public void onResponseReceived(Request request, Response response) {
                try {
                    DeletePageResponse outputParameter = new DeletePageResponse();
                    parseResponse(response, outputParameter);
                    if (onSuccess != null) {
                        onSuccess.call(input, outputParameter);
                    }
                    onCallSuccess(PageService.this, PageMethodDeletePage, input, outputParameter);
                } catch (JSONException | HttpException exception) {
                    if (onFailure != null) {
                        onFailure.call(input, exception);
                    }
                    onCallFailure(PageService.this, PageMethodDeletePage, input, exception);
                }
            }

            @Override
            public void onError(Request request, Throwable exception) {
                if (onFailure != null) {
                    onFailure.call(input, exception);
                }
                onCallFailure(PageService.this, PageMethodDeletePage, input, exception);
            }
        });
        onCallStart(PageService.this, PageMethodDeletePage, input, handle);
    } catch (RequestException exception) {
        if (onFailure != null) {
            onFailure.call(input, exception);
        }
        onCallFailure(PageService.this, PageMethodDeletePage, input, exception);
    }
    return handle;
}
Also used : GetPagesResponse(com.willshex.blogwt.shared.api.page.call.GetPagesResponse) UpdatePageResponse(com.willshex.blogwt.shared.api.page.call.UpdatePageResponse) SubmitFormResponse(com.willshex.blogwt.shared.api.page.call.SubmitFormResponse) CreatePageResponse(com.willshex.blogwt.shared.api.page.call.CreatePageResponse) GetPageResponse(com.willshex.blogwt.shared.api.page.call.GetPageResponse) Response(com.google.gwt.http.client.Response) DeletePageResponse(com.willshex.blogwt.shared.api.page.call.DeletePageResponse) DeletePageResponse(com.willshex.blogwt.shared.api.page.call.DeletePageResponse) RequestCallback(com.google.gwt.http.client.RequestCallback) GetPageRequest(com.willshex.blogwt.shared.api.page.call.GetPageRequest) CreatePageRequest(com.willshex.blogwt.shared.api.page.call.CreatePageRequest) Request(com.google.gwt.http.client.Request) GetPagesRequest(com.willshex.blogwt.shared.api.page.call.GetPagesRequest) SubmitFormRequest(com.willshex.blogwt.shared.api.page.call.SubmitFormRequest) DeletePageRequest(com.willshex.blogwt.shared.api.page.call.DeletePageRequest) UpdatePageRequest(com.willshex.blogwt.shared.api.page.call.UpdatePageRequest) JSONException(com.google.gwt.json.client.JSONException) HttpException(com.willshex.gson.web.service.client.HttpException) RequestException(com.google.gwt.http.client.RequestException)

Aggregations

DeletePageRequest (com.willshex.blogwt.shared.api.page.call.DeletePageRequest)3 CreatePageRequest (com.willshex.blogwt.shared.api.page.call.CreatePageRequest)2 DeletePageResponse (com.willshex.blogwt.shared.api.page.call.DeletePageResponse)2 GetPageRequest (com.willshex.blogwt.shared.api.page.call.GetPageRequest)2 GetPagesRequest (com.willshex.blogwt.shared.api.page.call.GetPagesRequest)2 SubmitFormRequest (com.willshex.blogwt.shared.api.page.call.SubmitFormRequest)2 UpdatePageRequest (com.willshex.blogwt.shared.api.page.call.UpdatePageRequest)2 Request (com.google.gwt.http.client.Request)1 RequestCallback (com.google.gwt.http.client.RequestCallback)1 RequestException (com.google.gwt.http.client.RequestException)1 Response (com.google.gwt.http.client.Response)1 JSONException (com.google.gwt.json.client.JSONException)1 DeletePageFailure (com.willshex.blogwt.client.api.page.event.DeletePageEventHandler.DeletePageFailure)1 DeletePageSuccess (com.willshex.blogwt.client.api.page.event.DeletePageEventHandler.DeletePageSuccess)1 CreatePageActionHandler (com.willshex.blogwt.server.api.page.action.CreatePageActionHandler)1 DeletePageActionHandler (com.willshex.blogwt.server.api.page.action.DeletePageActionHandler)1 GetPageActionHandler (com.willshex.blogwt.server.api.page.action.GetPageActionHandler)1 GetPagesActionHandler (com.willshex.blogwt.server.api.page.action.GetPagesActionHandler)1 SubmitFormActionHandler (com.willshex.blogwt.server.api.page.action.SubmitFormActionHandler)1 UpdatePageActionHandler (com.willshex.blogwt.server.api.page.action.UpdatePageActionHandler)1