private void setVariables(Field.BeanTable beanTable) { List variableLists = dataset.getLocalMetadata().getVariables(); if ((variableLists != null) && (variableLists.size() > 0)) { ThreddsMetadata.Variables vars = (ThreddsMetadata.Variables) variableLists.get(0); beanTable.setValue(vars.getVariableList()); setMode(beanTable, 0); return; } variableLists = dataset.getLocalMetadataInheritable().getVariables(); if ((variableLists != null) && (variableLists.size() > 0)) { ThreddsMetadata.Variables vars = (ThreddsMetadata.Variables) variableLists.get(0); beanTable.setValue(vars.getVariableList()); setMode(beanTable, 1); return; } variableLists = dataset.getVariables(); if ((variableLists != null) && (variableLists.size() > 0)) { ThreddsMetadata.Variables vars = (ThreddsMetadata.Variables) variableLists.get(0); beanTable.setValue(vars.getVariableList()); setMode(beanTable, (vars == null || vars.getVariableList().size() == 0) ? 1 : 2); return; } // clear out the table beanTable.setValue(new ArrayList()); }
public void store2Dataset() { PersistentBean persBean = new PersistentBean(dataset); // reset the BeanMaps setStoreValue(NAME, persBean, false); setStoreValue(ID, persBean, false); setStoreValue(AUTHORITY, persBean, true); setStoreValue(SERVICE_NAME, persBean, true); setStoreValue(FORMAT_TYPE, persBean, true); setStoreValue(DATA_TYPE, persBean, true); setStoreValue(COLLECTION_TYPE, persBean, false); setStoreValue(HARVEST, persBean, false); String gcType = (String) metadataPP.getFieldValue(GC_TYPE); if (!gcType.equals(INHERITED)) { ThreddsMetadata.GeospatialCoverage gc = new ThreddsMetadata.GeospatialCoverage(); storeGC(new PersistentBean(gc)); if (gcType.equals(LOCAL)) { dataset.getLocalMetadata().setGeospatialCoverage(gc); dataset.getLocalMetadataInheritable().setGeospatialCoverage(null); } else { dataset.getLocalMetadata().setGeospatialCoverage(null); dataset.getLocalMetadataInheritable().setGeospatialCoverage(gc); } } String tcType = (String) metadataPP.getFieldValue(TC_TYPE); if (!tcType.equals(INHERITED)) { DateRange dateRange = dateRangeSelector.getDateRange(); if (tcType.equals(LOCAL)) { dataset.getLocalMetadata().setTimeCoverage(dateRange); dataset.getLocalMetadataInheritable().setTimeCoverage(null); } else { dataset.getLocalMetadata().setTimeCoverage(null); dataset.getLocalMetadataInheritable().setTimeCoverage(dateRange); } } setStoreValue(SUMMARY, persBean, true); setStoreValue(RIGHTS, persBean, true); setStoreValue(HISTORY, persBean, true); setStoreValue(PROCESSING, persBean, true); // storeBeanList( variablesFld, VARIABLES, persBean); storeBeanList(creatorsFld, CREATORS, persBean); storeBeanList(publishersFld, PUBLISHERS, persBean); storeBeanList(projectsFld, PROJECTS, persBean); storeBeanList(keywordsFld, KEYWORDS, persBean); storeBeanList(datesFld, DATES, persBean); storeBeanList(contributorsFld, CONTRIBUTORS, persBean); storeBeanList(docsFld, DOCUMENTATION, persBean); if (dataset instanceof InvDatasetScan) { setStoreValue(dscanPP, DSCAN_PATH, persBean, false); setStoreValue(dscanPP, DSCAN_DIR, persBean, false); // setStoreValue( dscanPP, DSCAN_FILTER, persBean, false); setStoreValue(dscanPP, DSCAN_ADDSIZE, persBean, false); // setStoreValue( dscanPP, DSCAN_ADDLATEST, persBean, false); // setStoreValue( dscanPP, DSCAN_TC_MATCH, persBean, false); // setStoreValue( dscanPP, DSCAN_TC_SUBS, persBean, false); // setStoreValue( dscanPP, DSCAN_TC_DURATOPN, persBean, false); } dataset.finish(); }
public boolean setDataset(InvDatasetImpl ds) { if (!accept()) return false; this.dataset = ds; this.leafDataset = null; exampleButton.setText("Example Dataset"); ////////// PersistentBean persBean = new PersistentBean(ds); setEditValue(NAME, persBean, 0); setEditValue(ID, persBean, 0); setEditValueWithInheritence(AUTHORITY, persBean); setEditValueWithInheritence(SERVICE_NAME, persBean); setEditValueWithInheritence(FORMAT_TYPE, persBean); setEditValueWithInheritence(DATA_TYPE, persBean); setEditValue(COLLECTION_TYPE, persBean, 0); setEditValue(HARVEST, persBean, 0); // gotta find which GeospatialCoverage to use. int mode = 0; ThreddsMetadata.GeospatialCoverage gc = ds.getLocalMetadata().getGeospatialCoverage(); if ((gc == null) || gc.isEmpty()) { gc = ds.getLocalMetadataInheritable().getGeospatialCoverage(); mode = 1; } if ((gc == null) || gc.isEmpty()) { gc = ds.getGeospatialCoverage(); mode = 2; // inherited } metadataPP.setFieldValue(GC_TYPE, inherit_types.get(mode)); setGC(gc, mode); // gotta find which TimeCoverage to use. mode = 0; DateRange tc = ds.getLocalMetadata().getTimeCoverage(); if (tc == null) { tc = ds.getLocalMetadataInheritable().getTimeCoverage(); mode = 1; } if (tc == null) { tc = ds.getTimeCoverage(); mode = 2; // inherited } metadataPP.setFieldValue(TC_TYPE, inherit_types.get(mode)); if (tc != null) dateRangeSelector.setDateRange(tc); setTCmode(mode); setEditValueWithInheritence(SUMMARY, persBean); setEditValueWithInheritence(RIGHTS, persBean); setEditValueWithInheritence(HISTORY, persBean); setEditValueWithInheritence(PROCESSING, persBean); setVariables(variablesFld); setBeanList(creatorsFld, CREATORS, persBean); setBeanList(publishersFld, PUBLISHERS, persBean); setBeanList(projectsFld, PROJECTS, persBean); setBeanList(keywordsFld, KEYWORDS, persBean); setBeanList(datesFld, DATES, persBean); setBeanList(contributorsFld, CONTRIBUTORS, persBean); setBeanList(docsFld, DOCUMENTATION, persBean); if (ds instanceof InvDatasetScan) { dscanPP.setEnabled(true); setEditValue(dscanPP, DSCAN_PATH, persBean, 0); setEditValue(dscanPP, DSCAN_DIR, persBean, 0); // setEditValue( dscanPP, DSCAN_FILTER, persBean, 0); setEditValue(dscanPP, DSCAN_ADDSIZE, persBean, 0); // setEditValue( dscanPP, DSCAN_ADDLATEST, persBean, 0); // setEditValue( dscanPP, DSCAN_TC_MATCH, persBean, 0); // setEditValue( dscanPP, DSCAN_TC_SUBS, persBean, 0); // setEditValue( dscanPP, DSCAN_TC_DURATOPN, persBean, 0); } else dscanPP.setEnabled(false); return true; }