use of org.netxms.ui.eclipse.dashboard.dialogs.helpers.DciIdMatchingData in project netxms by netxms.
the class ImportDashboard method readSourceDci.
/**
* Read source DCI from XML document
*
* @param root
* @return
*/
private Map<Long, DciIdMatchingData> readSourceDci(Element root) {
Map<Long, DciIdMatchingData> dcis = new HashMap<Long, DciIdMatchingData>();
// $NON-NLS-1$
NodeList objectsRoot = root.getElementsByTagName("dciMap");
for (int i = 0; i < objectsRoot.getLength(); i++) {
if (objectsRoot.item(i).getNodeType() != Node.ELEMENT_NODE)
continue;
// $NON-NLS-1$
NodeList elements = ((Element) objectsRoot.item(i)).getElementsByTagName("dci");
for (int j = 0; j < elements.getLength(); j++) {
Element e = (Element) elements.item(j);
// $NON-NLS-1$
long id = getAttributeAsLong(e, "id", 0);
// $NON-NLS-1$
dcis.put(id, new DciIdMatchingData(getAttributeAsLong(e, "node", 0), id, e.getTextContent()));
}
}
return dcis;
}
use of org.netxms.ui.eclipse.dashboard.dialogs.helpers.DciIdMatchingData in project netxms by netxms.
the class IdMatchingDialog method okPressed.
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
@Override
protected void okPressed() {
// check if all elements have a match
boolean ok = true;
for (ObjectIdMatchingData o : objects.values()) if (o.dstId == 0) {
ok = false;
break;
}
for (DciIdMatchingData d : dcis.values()) if ((d.dstNodeId == 0) || (d.dstDciId == 0)) {
ok = false;
break;
}
if (!ok) {
if (!MessageDialogHelper.openQuestion(getShell(), Messages.get().IdMatchingDialog_MatchingErrors, Messages.get().IdMatchingDialog_ConfirmationText))
return;
}
super.okPressed();
}
Aggregations