Пример #1
0
 public boolean hasPermission(Acls acls) {
   String decodedResource = URL.decodePathSegment(resource);
   for (Acl acl : JsArrays.toIterable(acls.getAclsArray())) {
     if (acl.getResource().equals(decodedResource) && hasAction(acl)) return true;
   }
   return false;
 }
Пример #2
0
 @Override
 public void onFilterUpdate(String filter) {
   if (Strings.isNullOrEmpty(filter)) {
     getView().setVocabularies(taxonomy.getVocabulariesArray());
   } else {
     JsArray<VocabularyDto> filtered = JsArrays.create();
     for (VocabularyDto vocabulary : JsArrays.toIterable(taxonomy.getVocabulariesArray())) {
       if (vocabularyMatches(vocabulary, filter)) {
         filtered.push(vocabulary);
       }
     }
     getView().setVocabularies(filtered);
   }
 }
  public void addUpdateVariablesResourceRequests(ConclusionStepPresenter conclusionStepPresenter) {
    final List<String> selectedTableNames = getView().getSelectedTables();
    Iterable<TableCompareDto> filteredTables =
        Iterables.filter(
            JsArrays.toIterable(authorizedComparedTables),
            new Predicate<TableCompareDto>() {

              @Override
              public boolean apply(TableCompareDto input) {
                return selectedTableNames.contains(input.getCompared().getName());
              }
            });
    for (TableCompareDto tableCompareDto : filteredTables) {
      addUpdateVariablesResourceRequest(conclusionStepPresenter, tableCompareDto);
    }
  }
Пример #4
0
  private void redraw() {
    panel.clear();
    for (TaxonomyDto taxonomy : JsArrays.toIterable(taxonomies)) {
      FlowPanel panelTaxonomy = new FlowPanel();
      panelTaxonomy.addStyleName("item");

      Widget taxonomyLink = newTaxonomyLink(getUiHandlers(), taxonomy);
      panelTaxonomy.add(taxonomyLink);

      for (int i = 0; i < taxonomy.getDescriptionsCount(); i++) {
        if (!taxonomy.getDescriptions(i).getText().isEmpty()) {
          panelTaxonomy.add(
              new LocalizedLabel(
                  taxonomy.getDescriptions(i).getLocale(), taxonomy.getDescriptions(i).getText()));
        }
      }

      redrawVocabularies(taxonomy, panelTaxonomy);

      panel.add(panelTaxonomy);
    }
  }
Пример #5
0
 @Override
 public void onEditAttributes(final List<JsArray<AttributeDto>> selectedItems) {
   if (selectedItems == null || selectedItems.isEmpty()) return;
   boolean sameNamespace = true;
   String namespace = null;
   for (JsArray<AttributeDto> selectedArray : selectedItems) {
     for (AttributeDto attr : JsArrays.toIterable(selectedArray)) {
       if (namespace == null) {
         namespace = attr.hasNamespace() ? attr.getNamespace() : null;
       } else {
         sameNamespace = attr.hasNamespace() ? attr.getNamespace().equals(namespace) : true;
       }
     }
   }
   if (!sameNamespace || namespace == null) {
     showEditCustomAttributes(selectedItems);
   } else {
     final String ns = namespace;
     ResourceRequestBuilderFactory.<TaxonomiesDto>newBuilder()
         .forResource(UriBuilders.SYSTEM_CONF_TAXONOMIES_SUMMARIES.create().build())
         .get()
         .withCallback(
             new ResourceCallback<TaxonomiesDto>() {
               @Override
               public void onResource(Response response, TaxonomiesDto resource) {
                 for (TaxonomiesDto.TaxonomySummaryDto summary :
                     JsArrays.toIterable(resource.getSummariesArray())) {
                   if (summary.getName().equals(ns)) {
                     showEditTaxonomyAttributes(selectedItems);
                     return;
                   }
                 }
                 showEditCustomAttributes(selectedItems);
               }
             })
         .send();
   }
 }
Пример #6
0
 private boolean textsContains(JsArray<LocaleTextDto> texts, String token) {
   for (LocaleTextDto text : JsArrays.toIterable(texts)) {
     if (text.getText().contains(token)) return true;
   }
   return false;
 }