use of org.netxms.ui.eclipse.dashboard.dialogs.helpers.ObjectIdMatchingData in project netxms by netxms.
the class StatusMapConfig method remapObjects.
/* (non-Javadoc)
* @see org.netxms.ui.eclipse.dashboard.widgets.internal.DashboardElementConfig#remapObjects(java.util.Map)
*/
@Override
public void remapObjects(Map<Long, ObjectIdMatchingData> remapData) {
super.remapObjects(remapData);
ObjectIdMatchingData md = remapData.get(objectId);
if (md != null)
objectId = md.dstId;
}
use of org.netxms.ui.eclipse.dashboard.dialogs.helpers.ObjectIdMatchingData in project netxms by netxms.
the class ImportDashboard method doIdMapping.
/**
* Map node and DCI ID from source system to destination system
* @throws Exception
* @return true if import operation should continue
*/
private boolean doIdMapping(final Display display, final NXCSession session, List<DashboardElement> dashboardElements, Element root) throws Exception {
final Map<Long, ObjectIdMatchingData> objects = readSourceObjects(root);
final Map<Long, DciIdMatchingData> dcis = readSourceDci(root);
// add all node IDs from DCI list if they are missing
for (DciIdMatchingData d : dcis.values()) {
if (!objects.containsKey(d.srcNodeId))
// $NON-NLS-1$
objects.put(d.srcNodeId, new ObjectIdMatchingData(d.srcNodeId, "", AbstractObject.OBJECT_NODE));
}
// try to match objects
for (ObjectIdMatchingData d : objects.values()) {
if (d.srcId < 10) {
// built-in object
d.dstId = d.srcId;
continue;
}
if (d.srcName.isEmpty())
continue;
AbstractObject object = session.findObjectByName(d.srcName);
if ((object != null) && isCompatibleClasses(object.getObjectClass(), d.objectClass)) {
d.dstId = object.getObjectId();
d.dstName = object.getObjectName();
}
}
// try to match DCIs
for (DciIdMatchingData d : dcis.values()) {
// get node ID on target system
ObjectIdMatchingData od = objects.get(d.srcNodeId);
// bind DCI data to appropriate node data
od.dcis.add(d);
if (od.dstId == 0)
// no match for node
continue;
d.dstNodeId = od.dstId;
DciValue[] dciValues = session.getLastValues(d.dstNodeId);
for (DciValue v : dciValues) {
if (v.getDescription().equalsIgnoreCase(d.srcName)) {
d.dstDciId = v.getId();
d.dstName = v.getDescription();
break;
}
}
}
// show matching results to user
UIJob job = new // $NON-NLS-1$
UIJob(// $NON-NLS-1$
display, // $NON-NLS-1$
"") {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
IdMatchingDialog dlg = new IdMatchingDialog(window.getShell(), objects, dcis);
return (dlg.open() == Window.OK) ? Status.OK_STATUS : Status.CANCEL_STATUS;
}
};
job.schedule();
job.join();
if (job.getResult().equals(Status.OK_STATUS)) {
// update dashboard elements with mapping data
for (DashboardElement e : dashboardElements) updateDashboardElement(e, objects, dcis);
return true;
}
return false;
}
use of org.netxms.ui.eclipse.dashboard.dialogs.helpers.ObjectIdMatchingData in project netxms by netxms.
the class ObjectStatusChartConfig method remapObjects.
/* (non-Javadoc)
* @see org.netxms.ui.eclipse.dashboard.widgets.internal.DashboardElementConfig#remapObjects(java.util.Map)
*/
@Override
public void remapObjects(Map<Long, ObjectIdMatchingData> remapData) {
super.remapObjects(remapData);
ObjectIdMatchingData md = remapData.get(rootObject);
if (md != null)
rootObject = md.dstId;
}
use of org.netxms.ui.eclipse.dashboard.dialogs.helpers.ObjectIdMatchingData in project netxms by netxms.
the class NetworkMapConfig method remapObjects.
/* (non-Javadoc)
* @see org.netxms.ui.eclipse.dashboard.widgets.internal.DashboardElementConfig#remapObjects(java.util.Map)
*/
@Override
public void remapObjects(Map<Long, ObjectIdMatchingData> remapData) {
super.remapObjects(remapData);
ObjectIdMatchingData md = remapData.get(objectId);
if (md != null)
objectId = md.dstId;
}
use of org.netxms.ui.eclipse.dashboard.dialogs.helpers.ObjectIdMatchingData in project netxms by netxms.
the class EmbeddedDashboardConfig method remapObjects.
/* (non-Javadoc)
* @see org.netxms.ui.eclipse.dashboard.widgets.internal.DashboardElementConfig#remapObjects(java.util.Map)
*/
@Override
public void remapObjects(Map<Long, ObjectIdMatchingData> remapData) {
super.remapObjects(remapData);
ObjectIdMatchingData md = remapData.get(objectId);
if (md != null)
objectId = md.dstId;
for (int i = 0; i < dashboardObjects.length; i++) {
md = remapData.get(dashboardObjects[i]);
if (md != null)
dashboardObjects[i] = md.dstId;
}
}
Aggregations