private void addNodeSettings(DataTransferNodeDescriptor node) { if (node == null) { return; } Class<? extends IDataTransferNode> nodeClass = node.getNodeClass(); if (nodeSettings.containsKey(nodeClass)) { return; } try { nodeSettings.put(nodeClass, new NodeSettings(node)); } catch (DBException e) { log.error("Can't add node '" + node.getId() + "'", e); } }
void loadFrom(IRunnableContext runnableContext, IDialogSettings dialogSettings) { try { maxJobCount = dialogSettings.getInt("maxJobCount"); } catch (NumberFormatException e) { maxJobCount = DEFAULT_THREADS_NUM; } String producerId = dialogSettings.get("producer"); if (!CommonUtils.isEmpty(producerId)) { DataTransferNodeDescriptor producerNode = DataTransferRegistry.getInstance().getNodeById(producerId); if (producerNode != null) { this.producer = producerNode; } } if (consumerOptional) { DataTransferNodeDescriptor savedConsumer = null; String consumerId = dialogSettings.get("consumer"); if (!CommonUtils.isEmpty(consumerId)) { DataTransferNodeDescriptor consumerNode = DataTransferRegistry.getInstance().getNodeById(consumerId); if (consumerNode != null) { savedConsumer = consumerNode; } } DataTransferProcessorDescriptor savedProcessor = null; if (savedConsumer != null) { String processorId = dialogSettings.get("processor"); if (!CommonUtils.isEmpty(processorId)) { savedProcessor = savedConsumer.getProcessor(processorId); } } if (savedConsumer != null) { selectConsumer(savedConsumer, savedProcessor); } } // Load nodes' settings for (Map.Entry<Class, NodeSettings> entry : nodeSettings.entrySet()) { IDialogSettings nodeSection = DialogSettings.getOrCreateSection(dialogSettings, entry.getKey().getSimpleName()); entry.getValue().settings.loadSettings(runnableContext, this, nodeSection); } IDialogSettings processorsSection = dialogSettings.getSection("processors"); if (processorsSection != null) { for (IDialogSettings procSection : ArrayUtils.safeArray(processorsSection.getSections())) { String processorId = procSection.getName(); String nodeId = procSection.get("@node"); String propNamesId = procSection.get("@propNames"); DataTransferNodeDescriptor node = DataTransferRegistry.getInstance().getNodeById(nodeId); if (node != null) { Map<Object, Object> props = new HashMap<>(); DataTransferProcessorDescriptor nodeProcessor = node.getProcessor(processorId); if (nodeProcessor != null) { for (String prop : CommonUtils.splitString(propNamesId, ',')) { props.put(prop, procSection.get(prop)); } processorPropsHistory.put(nodeProcessor, props); NodeSettings nodeSettings = this.nodeSettings.get(node.getNodeClass()); if (nodeSettings != null) {} } } } } }
private boolean isPageValid(IWizardPage page, DataTransferNodeDescriptor node) { NodeSettings nodeSettings = node == null ? null : this.nodeSettings.get(node.getNodeClass()); return nodeSettings != null && ArrayUtils.contains(nodeSettings.pages, page); }