/** * Update the data based on the information provided by the data provider. * * @param adaptor The adaptor from which to update the data */ public void update(final DataAdaptor adaptor) { if (_correctorSupplyMap != null) { final List<DataAdaptor> supplyAdaptors = adaptor.childAdaptors("supply"); for (final DataAdaptor supplyAdaptor : supplyAdaptors) { final String supplyID = supplyAdaptor.stringValue("id"); final CorrectorSupply supply = _correctorSupplyMap.get(supplyID); if (supply != null) { if (supplyAdaptor.hasAttribute("enable")) { final boolean enable = supplyAdaptor.booleanValue("enable"); supply.setEnabled(enable); } if (supplyAdaptor.hasAttribute("lowerFieldLimit")) { supply.setLowerFieldLimit(supplyAdaptor.doubleValue("lowerFieldLimit")); } if (supplyAdaptor.hasAttribute("upperFieldLimit")) { supply.setUpperFieldLimit(supplyAdaptor.doubleValue("upperFieldLimit")); } } } } final List<DataAdaptor> bpmAdaptors = adaptor.childAdaptors("bpm"); if (bpmAdaptors != null && bpmAdaptors.size() > 0 && _bpmAgents != null) { // cache all our bpms so we can access them by ID final Map<String, BpmAgent> bpmAgentMap = new HashMap<String, BpmAgent>(_bpmAgents.size()); for (final BpmAgent bpmAgent : _bpmAgents) { bpmAgentMap.put(bpmAgent.getID(), bpmAgent); } for (final DataAdaptor bpmAdaptor : bpmAdaptors) { final String bpmID = bpmAdaptor.stringValue("id"); final BpmAgent bpmAgent = bpmAgentMap.get(bpmID); if (bpmAgent != null) { if (bpmAdaptor.hasAttribute("flattenEnable")) { bpmAgent.setFlattenEnabled(bpmAdaptor.booleanValue("flattenEnable")); } } } } final DataAdaptor flattenerAdaptor = adaptor.childAdaptor(Flattener.DATA_LABEL); if (flattenerAdaptor != null) { getFlattener().update(flattenerAdaptor); } final List<DataAdaptor> orbitSourceAdaptors = adaptor.childAdaptors(OrbitSource.DATA_LABEL); for (DataAdaptor orbitSourceAdaptor : orbitSourceAdaptors) { final String type = orbitSourceAdaptor.stringValue("type"); if (type.equals("snapshot")) { final SnapshotOrbitSource orbitSource = SnapshotOrbitSource.getInstance(orbitSourceAdaptor, _sequence, _bpmAgents); addOrbitSource(orbitSource); } } }
/** * Load the contents of this data structure from the given data source exposing the <code> * DataAdaptor</code> interface. * * @param daptSrc data source used to populate this data structure * @see xal.tools.data.DataListener#update(xal.tools.data.DataAdaptor) * @author Christopher K. Allen * @since Apr 14, 2014 */ @Override public void update(DataAdaptor daptSrc) { // Get the device ID of the configuration data // (The version information is not used this.strDevId = daptSrc.stringValue(STR_ATTR_DEVID); @SuppressWarnings("unused") long lngVer = daptSrc.longValue(STR_ATTR_FMTVER); }