private void updateDisplay(TableDto tableDto) { getView().clear(table == null || !table.getLink().equals(tableDto.getLink())); table = tableDto; getView().setTable(tableDto); if (tableIsView()) { showViewProperties(table); } else { getView().setFromTables(null); getView().setWhereScript(null); } if (getView().isValuesTabSelected()) { valuesTablePresenter.setTable(tableDto); valuesTablePresenter.updateValuesDisplay(""); } variableFilter = ""; valuesFilter = null; valuesFilterText = ""; updateVariables(); updateTableIndexStatus(); authorize(); }
private void updateTableIndexStatus() { // Table indexation status ResourceAuthorizationRequestBuilderFactory.newBuilder() .forResource(table.getLink() + "/index") .get() .authorize(getView().getTableIndexStatusAuthorizer()) .send(); ResourceAuthorizationRequestBuilderFactory.newBuilder() .forResource(table.getLink() + "/index") .delete() .authorize(getView().getTableIndexEditAuthorizer()) .send(); updateIndexStatus(); }
@Override public void onDownloadDictionary() { String downloadUrl = table.getLink() + "/variables/excel"; fireEvent(new FileDownloadRequestEvent(downloadUrl)); }
private void authorize() { if (table == null) return; // export data ResourceAuthorizationRequestBuilderFactory.newBuilder() .forResource(UriBuilders.PROJECT_COMMANDS_EXPORT.create().build(table.getDatasourceName())) .post() // .authorize(getView().getExportDataAuthorizer()) // .send(); // copy data ResourceAuthorizationRequestBuilderFactory.newBuilder() .forResource(UriBuilders.PROJECT_COMMANDS_COPY.create().build(table.getDatasourceName())) .post() .authorize(getView().getCopyDataAuthorizer()) .send(); // export variables in excel ResourceAuthorizationRequestBuilderFactory.newBuilder() .forResource(table.getLink() + "/variables/excel") .get() .authorize(getView().getExcelDownloadAuthorizer()) .send(); if (table.hasViewLink()) { // download view ResourceAuthorizationRequestBuilderFactory.newBuilder() .forResource(table.getViewLink() + "/xml") .get() .authorize(getView().getViewDownloadAuthorizer()) .send(); // remove view ResourceAuthorizationRequestBuilderFactory.newBuilder() .forResource(table.getViewLink()) .delete() .authorize(getView().getRemoveAuthorizer()) .send(); // edit view ResourceAuthorizationRequestBuilderFactory.newBuilder() .forResource(table.getViewLink()) .put() .authorize(getView().getEditAuthorizer()) .send(); } else { // download view getView().getViewDownloadAuthorizer().unauthorized(); // edit table ResourceAuthorizationRequestBuilderFactory.newBuilder() .forResource(table.getLink()) .put() .authorize(getView().getEditAuthorizer()) .send(); // Drop table ResourceAuthorizationRequestBuilderFactory.newBuilder() .forResource(table.getLink()) .delete() .authorize(getView().getRemoveAuthorizer()) .send(); } // values ResourceAuthorizationRequestBuilderFactory.newBuilder() .forResource(table.getLink() + "/valueSets") .get() .authorize(getView().getValuesAuthorizer()) .send(); // set permissions ResourceAuthorizationRequestBuilderFactory.newBuilder() // .forResource( UriBuilders.PROJECT_PERMISSIONS_TABLE .create() .build(table.getDatasourceName(), table.getName())) // .authorize( new CompositeAuthorizer( getView().getPermissionsAuthorizer(), new PermissionsUpdate())) // .post() .send(); }