n = getOMapComponent(component).getName();
return n;
}
public OMapComponent getOMapComponent(Component component) {
MComponent current = new MComponent(component, windowMonitor);
List<OMapComponent> omapComponents = omapService.findComponentsByProperties(getWrapper(current), topContainer);
OMapComponent omapComponent;
if (omapComponents.size() == 1) {
return omapComponents.get(0);
}
if (omapComponents.size() > 1) {
String message = "More than one component matched for " + getPropertyDisplayList(component);
StringBuilder msg = new StringBuilder(message);
msg.append("\n The matched object map entries are:\n");
for (OMapComponent omc : omapComponents) {
msg.append(" ").append(omc.toString()).append("\n");
}
omapComponent = findClosestMatch(component, omapComponents, msg);
if (omapComponent != null) {
runtimeLogger.warning(MODULE, message, msg.toString());
return omapComponent;
}
runtimeLogger.error(MODULE, message, msg.toString());
throw new ComponentNotFoundException("More than one component matched: " + omapComponents, null, null);
}
StringBuilder msg = new StringBuilder();
omapComponent = findClosestMatch(component, msg);
if (omapComponent != null) {
runtimeLogger.warning(MODULE, "Could not find object map entry for component: " + getPropertyDisplayList(component),
msg.toString());
return omapComponent;
}
List<String> rprops = findUniqueRecognitionProperties(current, component);
current.setMComponentName(createName(current));
List<String> values = new ArrayList<String>();
for (String k : rprops) {
values.add(current.getProperty(k));
}
List<List<String>> rproperties = findRecognitionProperties(current.getProperty("component.class.name"));
List<List<String>> nproperties = findNamingProperties(current.getProperty("component.class.name"));
List<String> gproperties = omapService.getGeneralProperties();
omapComponent = omapService.insertNameForComponent(current.getProperty("MComponentName"), getWrapper(current), rprops,
rproperties, nproperties, gproperties, topContainer);
return omapComponent;
}