예제 #1
0
 private void saveTaxonomy() {
   UriBuilders.SYSTEM_CONF_TAXONOMY.create().build(taxonomy.getName());
   fireEvent(new TaxonomyUpdatedEvent(taxonomy.getName()));
   ResourceRequestBuilderFactory.<TaxonomyDto>newBuilder()
       .forResource(UriBuilders.SYSTEM_CONF_TAXONOMY.create().build(taxonomy.getName())) //
       .withResourceBody(TaxonomyDto.stringify(taxonomy)) //
       .withCallback(
           new ResponseCodeCallback() {
             @Override
             public void onResponseCode(Request request, Response response) {
               getEventBus().fireEvent(new TaxonomyUpdatedEvent(taxonomy.getName()));
               getView().setDirty(false);
             }
           },
           Response.SC_OK,
           Response.SC_CREATED) //
       .withCallback(
           new ResponseCodeCallback() {
             @Override
             public void onResponseCode(Request request, Response response) {
               if (response.getText() != null && !response.getText().isEmpty()) {
                 fireEvent(NotificationEvent.newBuilder().error(response.getText()).build());
               }
             }
           },
           Response.SC_BAD_REQUEST,
           Response.SC_INTERNAL_SERVER_ERROR) //
       .put()
       .send();
 }
예제 #2
0
 private void refreshTaxonomy(String name) {
   ResourceRequestBuilderFactory.<TaxonomyDto>newBuilder() //
       .forResource(UriBuilders.SYSTEM_CONF_TAXONOMY.create().build(name)) //
       .withCallback(new TaxonomyFoundCallBack()) //
       .withCallback(SC_NOT_FOUND, new TaxonomyNotFoundCallBack(name)) //
       .get()
       .send();
 }
예제 #3
0
 @Override
 public void onDownload() {
   String downloadUrl =
       UriBuilders.SYSTEM_CONF_TAXONOMY.create().build(taxonomy.getName()) + "/_download";
   fireEvent(new FileDownloadRequestEvent(downloadUrl));
 }