Esempio n. 1
0
  private void setVariables(Field.BeanTableField beanTableField) {
    List<ThreddsMetadata.Variables> variableLists = dataset.getLocalMetadata().getVariables();
    if ((variableLists != null) && (variableLists.size() > 0)) {
      ThreddsMetadata.Variables vars = variableLists.get(0);
      beanTableField.setValue(vars.getVariableList());
      setMode(beanTableField, 0);
      return;
    }

    variableLists = dataset.getLocalMetadataInheritable().getVariables();
    if ((variableLists != null) && (variableLists.size() > 0)) {
      ThreddsMetadata.Variables vars = variableLists.get(0);
      beanTableField.setValue(vars.getVariableList());
      setMode(beanTableField, 1);
      return;
    }

    variableLists = dataset.getVariables();
    if ((variableLists != null) && (variableLists.size() > 0)) {
      ThreddsMetadata.Variables vars = variableLists.get(0);
      beanTableField.setValue(vars.getVariableList());
      setMode(beanTableField, vars.getVariableList().size() == 0 ? 1 : 2);
      return;
    }

    // clear out the table
    beanTableField.setValue(new ArrayList());
  }
Esempio n. 2
0
  private void extractVariables() {
    if (leafDataset == null) leafDataset = findLeafDataset(dataset);
    if (leafDataset == null) return;

    ThreddsMetadata.Variables vars;
    try {
      vars = MetadataExtractor.extractVariables(leafDataset);
    } catch (IOException e) {
      return;
    }

    if (vars != null) {
      ThreddsMetadata tm = dataset.getLocalMetadataInheritable();
      List<ThreddsMetadata.Variables> varsList = tm.getVariables();
      boolean replaced = false;
      for (int i = 0; i < varsList.size(); i++) {
        ThreddsMetadata.Variables vs = varsList.get(i);
        if (vs.getVocabulary().equals(vars.getVocabulary())) {
          varsList.set(i, vars); // replace
          replaced = true;
          break;
        }
      }
      if (!replaced) tm.addVariables(vars);

      variablesFld.setValue(vars.getVariableList());
      setMode(variablesFld, 1);
    }
  }
Esempio n. 3
0
 private void setBeanList(Field.BeanTableField beanTableField, String name, PersistentBean bean) {
   List value = (List) bean.getObject("localMetadata." + name); // local, non inheritable
   if ((value != null) && (value.size() > 0)) {
     beanTableField.setValue(value);
     setMode(beanTableField, 0);
   } else {
     value = (List) bean.getObject("localMetadataInheritable." + name); // local, inheritable
     if ((value != null) && (value.size() > 0)) {
       beanTableField.setValue(value);
       setMode(beanTableField, 1);
     } else {
       value = (List) bean.getObject(name); // inherited
       beanTableField.setValue(value);
       setMode(beanTableField, (value == null || value.size() == 0) ? 1 : 2);
     }
   }
 }