/** * */ package com.onaro.sanscreen.client.view.selection; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.onaro.client.server.ObjectTypeResourcesManager; import com.onaro.commons.lang.CommonStringUtils; import com.onaro.sanscreen.client.Messages; import com.onaro.sanscreen.client.SANscreenClientPlugin; import com.onaro.sanscreen.server.dataobject.historyobject.path.Approve; import com.onaro.sanscreen.server.interfaces.data.AbstractDataObjectDescription; import com.onaro.sanscreen.server.interfaces.data.reservation.TaskType; import com.onaro.sanscreen.types.ObjectType; import com.onaro.util.enumeration.EnumPresentation; /** * */ /*package*/ final class SelectedObjectDescription extends AbstractDataObjectDescription { public static final String HOST_TYPE_NAME = ObjectTypeResourcesManager.INSTANCE.getTitle(ObjectType.HOST); public static final String STORAGE_TYPE_NAME = ObjectTypeResourcesManager.INSTANCE.getTitle(ObjectType.STORAGE); public static final String DISK_TYPE_NAME = ObjectTypeResourcesManager.INSTANCE.getTitle(ObjectType.DISK); public static final String SWITCH_TYPE_NAME = ObjectTypeResourcesManager.INSTANCE.getTitle(ObjectType.SWITCH); public static final String PORT_TYPE_NAME = ObjectTypeResourcesManager.INSTANCE.getTitle(ObjectType.PORT); public static final String ZONE_TYPE_NAME = ObjectTypeResourcesManager.INSTANCE.getTitle(ObjectType.ZONE); public static final String REQUEST_TYPE_NAME = Messages.INSTANCE.getRequestTypeName(); public static final String TICKET_TYPE_NAME = Messages.INSTANCE.getTicketTypeName(); private static final Logger logger = LogManager.getLogger (SelectedObjectDescription.class); private static final String UNKNOWN_VALUE = "?"; //$NON-NLS-1$ private final SelectedObject selection; // TODO: Because all the properties used are column ID's from the source view tables, we should place these // column ID's in a common place used by both the tables and by this class, so we can always be sure that this // class is using the correct ID. Otherwise, even minor differences like capitalization can prevent this class // from working properly. // In the meantime, note that these should correspond with the COL constants for the respective tables. /** Correspond to com.onaro.sanscreen.client.si.views.inventory.ports.PortsTableModel.COL_DEVICE_NAME **/ private static final String FC_PORTS_COL_DEVICE_NAME = "DeviceName"; //$NON-NLS-1$ /** Correspond to com.onaro.sanscreen.client.sw.perf.views.switchPort.SwitchPortPerformanceTableModel.COL_SWITCH **/ private static final String SWITCH_PORTS_COL_SWITCH = "switch"; //$NON-NLS-1$ /** Corresponds to the WWN property name available to port objects in the topology model. **/ private static final String TOPOLOGY_PORT_PROPERTY_WWN = "WWN"; //$NON-NLS-1$ /** * Constructor

* * @param selection selected object for which the descriptions are generated */ public SelectedObjectDescription (SelectedObject selection) { this.selection = selection; } @Override public String getName() { // Try using Alias property for name, then Name property. String name = selection.getAlias(); if (StringUtils.isBlank (name)) { name = selection.getName(); } // Special case for applications. if (StringUtils.isBlank (name)) { name = CommonStringUtils.getTextFromHtml ( selection.getStringProperty ("application.details.name")); //$NON-NLS-1$ } return name; } @Override public String getShortDescription() { ObjectType objectType = selection.getObjectType(); // Generic devices have no known name or type. if (ObjectType.UNKNOWN.equals (objectType)) { return getGenericDeviceShortDescription(); } // Get the name or a short description of the object. String description; if (ObjectType.DISK.equals (objectType)) { description = getDiskShortDescription(); } else if (ObjectType.VOLUME.equals (objectType)) { description = getVolumeShortDescription(); } else if (ObjectType.PORT.equals (objectType)) { description = getPortShortDescription(); } else { description = getName(); } // Prepend the object type name, if known. String typeName = ObjectTypeResourcesManager.INSTANCE.getTitle (objectType); if (typeName != null) { description = Messages.INSTANCE.getTypedName (typeName, description); } return description; } @Override public String getLongDescription() { /* * Create description according to type of selected object. Unfortunately, * the type is not determined by a simple enum. Sometimes an ObjectType is * defined. Sometimes a type name is defined even if ObjectType is not * defined. And sometimes the selection identifyingKey or other properties * have to be examined to determine the type. * * Note ObjectType is deprecated. Should be replaced with DataObjectType when * legacy views are no longer supported. */ ObjectType objectType = selection.getObjectType(); if (objectType == null) { String typeName = selection.getType(); if ("Task".equals (typeName)) { //$NON-NLS-1$ return getTaskDescription(); } else if ("SwitchMigrationTask".equals (typeName)) { //$NON-NLS-1$ return getMigrationTaskDescription(); } String identifyingKey = selection.getIdentifyingKey(); if ("VulnerabilityType".equals (identifyingKey)) { //$NON-NLS-1$ return getVulnerabilityDescription(); } else if ("objId".equals (identifyingKey)) { //$NON-NLS-1$ // Note it's tough to figure out if a switch performance alert is selected. if ("SWITCH".equals (selection.getStringProperty ("Scope")) //$NON-NLS-1$ //$NON-NLS-2$ && selection.getProperty ("ConnectedDeviceType") != null //$NON-NLS-1$ && selection.getProperty ("Threshold") != null) { //$NON-NLS-1$ return getSwitchPerformanceAlertDescription(); } } } else if (ObjectType.DISK.equals (objectType)) { return getDiskDescription(); } else if (ObjectType.PORT.equals (objectType)) { return getPortDescription(); } else if (ObjectType.PATH.equals (objectType)) { return getPathDescription(); } else if (ObjectType.ZONE.equals (objectType)) { return getZoneDescription(); } else if (ObjectType.APPLICATION.equals (objectType)) { return getApplicationDescription(); } else if (ObjectType.VIOLATION.equals (objectType)) { return getViolationDescription(); } else if (ObjectType.RESERVATION_VIOLATION.equals (objectType)) { return getReservationViolationDescription(); } else if (ObjectType.POLICY.equals (objectType)) { return getPolicyDescription(); } else if (ObjectType.APL.equals (objectType)) { String policyType = selection.getStringProperty ("ApproveType"); //$NON-NLS-1$ if (policyType.equals (Approve.TYPE_HOST)) { return getHostPolicyDescription(); } else if (policyType.equals (Approve.TYPE_PATH)) { return getPathPolicyDescription(); } } else if (ObjectType.REQUEST.equals (objectType)) { return getRequestDescription(); } else if (ObjectType.PENDING_TASK.equals (objectType)) { return getPendingTaskDescription(); } else if (ObjectType.DATA_SOURCE.equals (objectType)) { return getNameDescription(); } else if (ObjectType.ADAPTER.equals (objectType)) { return getTypeAndWwnDescription(); } else if (ObjectType.CONTROLLER.equals (objectType)) { return getTypeAndWwnDescription(); } else if (ObjectType.UNKNOWN.equals (objectType)) { return getGenericDeviceLongDescription(); } else { // For most devices, type and name is a good description. if (StringUtils.isNotBlank (getName())) { return getTypeAndNameDescription(); } } return super.getLongDescription(); } private String getTypeName() { return ObjectTypeResourcesManager.INSTANCE.getName (selection.getObjectType()); } private String getNameDescription() { return Messages.INSTANCE.getSelectionHtml (getName()); } private String getTypeAndNameDescription() { return getTypeAndNameDescription (getTypeName(), getName()); } private String getTypeAndNameDescription (String typeName, String objectName) { // Don't display type if name already begins with type. if (CommonStringUtils.beginsWithIgnoreCase (objectName, typeName)) { return Messages.INSTANCE.getSelectionHtml (objectName); } else { return Messages.INSTANCE.getTypedSelectionHtml (typeName, objectName); } } private String getTypeAndWwnDescription() { String typeName = getTypeName(); String wwn = selection.getStringProperty (TOPOLOGY_PORT_PROPERTY_WWN); if (StringUtils.isBlank (wwn)) { wwn = UNKNOWN_VALUE; logger.warn ("No WWN property for " + selection.getType() //$NON-NLS-1$ + " " + selection.getId()); //$NON-NLS-1$ } return Messages.INSTANCE.getTypedSelectionHtml (typeName, wwn); } private String getDiskDescription() { String diskName = getName(); String storageName = selection.getStringProperty ("StorageName"); //$NON-NLS-1$ /* * Description is of form "Storage Disk " * except that "Storage" is dropped if it's already in , * "Disk" is dropped if it's already in , and * "Storage " is dropped if is not defined. */ if (StringUtils.isBlank (storageName)) { if (CommonStringUtils.beginsWithIgnoreCase (diskName, DISK_TYPE_NAME)) { return Messages.INSTANCE.getSelectionHtml (diskName); } else { return Messages.INSTANCE.getDiskTypeSelectionHtml (diskName); } } else if (CommonStringUtils.beginsWithIgnoreCase (storageName, STORAGE_TYPE_NAME)) { if (CommonStringUtils.beginsWithIgnoreCase (diskName, DISK_TYPE_NAME)) { return Messages.INSTANCE.getStorageDiskSelectionHtml (storageName, diskName); } else { return Messages.INSTANCE.getStorageDiskTypeSelectionHtml (storageName, diskName); } } else if (CommonStringUtils.beginsWithIgnoreCase (diskName, DISK_TYPE_NAME)) { return Messages.INSTANCE.getStorageTypeDiskSelectionHtml (storageName, diskName); } else { return Messages.INSTANCE.getStorageTypeDiskTypeSelectionHtml (storageName, diskName); } } private String getDiskShortDescription() { /* * Description is of form " on " * except that " on " is dropped if is not defined. */ String diskName = getName(); String storageName = selection.getStringProperty ("StorageName"); //$NON-NLS-1$ if (StringUtils.isBlank (storageName)) { return diskName; } else { return Messages.INSTANCE.getSubElementSelection (storageName, diskName); } } private String getVolumeShortDescription() { /* * Description is of form " on " * except that " on " is dropped if is not defined. */ String volumeName = getName(); String storageName = selection.getStringProperty ("StorageName"); //$NON-NLS-1$ if (StringUtils.isBlank (storageName)) { return volumeName; } else { return Messages.INSTANCE.getSubElementSelection (storageName, volumeName); } } private String getPortDescription() { // NOTE: This produces a string with the word "Switch" in it, assuming that the given port is a switch port. // This happens to be true for now, as this is used only to produce the selection description for main views // and would therefore be relevant for ports selected via the Switch Port Performance main view. String portName = getPortName(); // Device/switch name property name depends on whether selected object from FC Ports view or // Switch Ports Performance view: String deviceName = selection.getStringProperty (FC_PORTS_COL_DEVICE_NAME); if (StringUtils.isBlank (deviceName)) { deviceName = selection.getStringProperty(SWITCH_PORTS_COL_SWITCH); } /* * Description is of form "Switch Port " * except that "Switch" is dropped if it's already in , * "Port" is dropped if it's already in , and * "Switch " is dropped if is not defined. */ if (StringUtils.isBlank (deviceName)) { if (CommonStringUtils.beginsWithIgnoreCase (portName, PORT_TYPE_NAME)) { return Messages.INSTANCE.getSelectionHtml (portName); } else { return Messages.INSTANCE.getPortTypeSelectionHtml (portName); } } else if (CommonStringUtils.beginsWithIgnoreCase (deviceName, SWITCH_TYPE_NAME)) { if (CommonStringUtils.beginsWithIgnoreCase (portName, PORT_TYPE_NAME)) { return Messages.INSTANCE.getSwitchPortSelectionHtml (deviceName, portName); } else { return Messages.INSTANCE.getSwitchPortTypeSelectionHtml (deviceName, portName); } } else if (CommonStringUtils.beginsWithIgnoreCase (portName, PORT_TYPE_NAME)) { return Messages.INSTANCE.getSwitchTypePortSelectionHtml (deviceName, portName); } else { return Messages.INSTANCE.getSwitchTypePortTypeSelectionHtml (deviceName, portName); } } private String getPortShortDescription() { String portName = getPortName(); /* * Description is of form " on " * except that "on " is dropped if is not defined. */ String deviceName = selection.getStringProperty (FC_PORTS_COL_DEVICE_NAME); if (StringUtils.isBlank (deviceName)) { deviceName = selection.getStringProperty(SWITCH_PORTS_COL_SWITCH); } if (StringUtils.isBlank (deviceName)) { return portName; } else { return Messages.INSTANCE.getSubElementSelection (deviceName, portName); } } private String getPortName() { String portName = selection.getName(); // If updating the selection status via a selected port in the topology, just have the "WWN" property: if (portName == null) { portName = selection.getStringProperty(TOPOLOGY_PORT_PROPERTY_WWN); } // Shouldn't happen: if (portName == null) { portName = UNKNOWN_VALUE; } return portName; } private String getPathDescription() { // Source. String source = selection.getStringProperty ("SourceName"); //$NON-NLS-1$ if (StringUtils.isBlank (source)) { source = UNKNOWN_VALUE; logger.warn ("No SourceName for path " + selection.getId()); //$NON-NLS-1$ } // Target. String target = selection.getStringProperty ("TargetName"); //$NON-NLS-1$ String targetVolume = null; String targetReplica = null; if (StringUtils.isBlank (target)) { target = UNKNOWN_VALUE; logger.warn ("No TargetName for path " + selection.getId()); //$NON-NLS-1$ } else { targetVolume = selection.getStringProperty ("VolumeName"); //$NON-NLS-1$ targetReplica = selection.getStringProperty ("Replica"); //$NON-NLS-1$ } /* * Description is of form * " - () [target_replica]" * except that the parenthesized expressions are dropped if there * is no corresponding volume or share. */ String pathDescription; if (StringUtils.isBlank (targetReplica)) { if (StringUtils.isBlank (targetVolume)) { pathDescription = Messages.INSTANCE.getPathSelectionHtml (source, target); } else { pathDescription = Messages.INSTANCE.getPathVolumeSelectionHtml (source, target, targetVolume); } } else { pathDescription = Messages.INSTANCE.getPathVolumeReplicaSelectionHtml ( source, target, targetVolume, targetReplica); } return pathDescription; } public String getRemotePathDescription (String localPath) { String remote = selection.getStringProperty ("RemoteStorage"); //$NON-NLS-1$ if (StringUtils.isBlank (remote)) { return localPath; } else { /* * Description is of form * " - () [remote_replica]" * except that the parenthesized expressions are dropped if there * is no corresponding volume or share. */ String remoteVolume = selection.getStringProperty ("RemoteReplica"); //$NON-NLS-1$ String remoteReplica = selection.getStringProperty ("SecondaryReplica"); //$NON-NLS-1$ if (StringUtils.isBlank (remoteReplica)) { if (StringUtils.isBlank (remoteVolume)) { return Messages.INSTANCE.getRemotePathSelectionHtml (localPath, remote); } else { return Messages.INSTANCE.getRemotePathVolumeSelectionHtml (localPath, remote, remoteVolume); } } else { return Messages.INSTANCE.getRemotePathVolumeReplicaSelectionHtml ( localPath, remote, remoteVolume, remoteReplica); } } } private String getZoneDescription() { String fabric = selection.getStringProperty ("Fabric"); //$NON-NLS-1$ if (StringUtils.isBlank (fabric)) { fabric = UNKNOWN_VALUE; logger.warn ("No Fabric for zone " + selection.getId()); //$NON-NLS-1$ } String zoneName = selection.getStringProperty ("ZoneName"); //$NON-NLS-1$ if (StringUtils.isBlank (zoneName)) { return Messages.INSTANCE.getSelectionHtml (fabric); } /* * Description is of form "Zone of " * except that "Zone" is dropped if it's already in . */ if (CommonStringUtils.beginsWithIgnoreCase (zoneName, ZONE_TYPE_NAME)) { return Messages.INSTANCE.getZoneSelectionHtml (fabric, zoneName); } else { return Messages.INSTANCE.getZoneTypeSelectionHtml (fabric, zoneName); } } private String getApplicationDescription() { String description = CommonStringUtils.getTextFromHtml ( selection.getStringProperty ("application.details.name")); //$NON-NLS-1$ if (description == null) { description = UNKNOWN_VALUE; logger.warn ("Can't parse application.details.name for application " //$NON-NLS-1$ + selection.getId()); } return Messages.INSTANCE.getSelectionHtml (description); } private String getViolationDescription() { String description = selection.getStringProperty ("elementDescription"); //$NON-NLS-1$ if (StringUtils.isNotBlank (description)) { return Messages.INSTANCE.getSelectionHtml (description); } else { /* * Description is of form "Violation of " * except that "Zone" is dropped if it's already in . */ EnumPresentation presentation = SANscreenClientPlugin.getDefault().getEnumPresentation(); EnumPresentation.Attributes violationTypePresentation = presentation.getAttributes ("ViolationTypeEnum", //$NON-NLS-1$ selection.getProperty ("ViolationType")); //$NON-NLS-1$ String violationTypeName; if (violationTypePresentation == null) { violationTypeName = UNKNOWN_VALUE; logger.warn ("No elementDescription or ViolationType for violation " //$NON-NLS-1$ + selection.getId()); } else { violationTypeName = violationTypePresentation.toString(); } if (selection.getProperty ("SourceName") == null) { //$NON-NLS-1$ // Description is of form "Violation " return Messages.INSTANCE.getViolationTypeSelectionHtml (violationTypeName); } else { // Description is of form " violation on " return Messages.INSTANCE.getViolationPathSelectionHtml (violationTypeName, getPathDescription()); } } } private String getReservationViolationDescription() { String details = selection.getStringProperty ("details"); //$NON-NLS-1$ if (StringUtils.isNotBlank (details)) { details = CommonStringUtils.getTextFromHtml (details); return Messages.INSTANCE.getSelectionHtml (details); } else { EnumPresentation presentation = SANscreenClientPlugin.getDefault().getEnumPresentation(); EnumPresentation.Attributes violationTypePresentation = presentation.getAttributes ("ReservationViolation.Type", //$NON-NLS-1$ selection.getProperty ("violationType")); //$NON-NLS-1$ String violationTypeName; if (violationTypePresentation == null) { violationTypeName = UNKNOWN_VALUE; logger.warn ("No ReservationViolationType for violation " + selection.getId()); //$NON-NLS-1$ } else { violationTypeName = violationTypePresentation.toString(); } String deviceName = selection.getStringProperty ("targetDevice"); //$NON-NLS-1$ if (StringUtils.isBlank (deviceName)) { // Description is of form "Violation " return Messages.INSTANCE.getViolationTypeSelectionHtml (violationTypeName); } else { /* * Description is of form " for " * except that is dropped if it's already in . */ String deviceType = selection.getStringProperty ("targetDeviceType"); //$NON-NLS-1$ if (StringUtils.isBlank (deviceType) || CommonStringUtils.beginsWithIgnoreCase (deviceName, deviceType)) { return Messages.INSTANCE.getDeviceViolationSelectionHtml (violationTypeName, deviceName); } else { return Messages.INSTANCE.getDeviceTypeViolationSelectionHtml ( violationTypeName, deviceType, deviceName); } } } } private String getPolicyDescription() { // Use (unique) name for Performance Policies. String name = selection.getStringProperty ("name"); //$NON-NLS-1$ if (name != null) { return Messages.INSTANCE.getPerformancePolicySelectionHtml (name); } // Non-performance (legacy) policy. String level = selection.getStringProperty ("policyLevel"); //$NON-NLS-1$ if (level == null) { level = UNKNOWN_VALUE; logger.warn ("No policyLevel for policy " + selection.getId()); //$NON-NLS-1$ } String policyType = selection.getStringProperty ("policyType"); //$NON-NLS-1$ if (policyType == null) { policyType = UNKNOWN_VALUE; logger.warn ("No policyType for policy " + selection.getId()); //$NON-NLS-1$ } // Description is of form is " " return Messages.INSTANCE.getPolicySelectionHtml (level, policyType); } private String getHostPolicyDescription() { String host = selection.getStringProperty ("SourceName"); //$NON-NLS-1$ if (host == null) { host = UNKNOWN_VALUE; logger.warn ("No SourceName for host policy " + selection.getId()); //$NON-NLS-1$ } return getTypeAndNameDescription (HOST_TYPE_NAME, host); } private String getPathPolicyDescription() { // Description is of form "Path " return Messages.INSTANCE.getPathPolicySelectionHtml (getPathDescription()); } private String getRequestDescription() { String ticket = selection.getStringProperty ("ReferenceNumber"); //$NON-NLS-1$ String name = selection.getStringProperty ("displayName"); //$NON-NLS-1$ /* * Description is of form "Ticket , Request " * except that "Ticket" is dropped if it's already in , * "Request" is dropped if it's already in , and * "Ticket ," is dropped if is not defined. */ if (StringUtils.isBlank (ticket)) { return getTypeAndNameDescription (REQUEST_TYPE_NAME, name); } else { if (CommonStringUtils.beginsWithIgnoreCase (ticket, TICKET_TYPE_NAME)) { if (CommonStringUtils.beginsWithIgnoreCase (name, REQUEST_TYPE_NAME)) { return Messages.INSTANCE.getTicketRequestSelectionHtml (ticket, name); } else { return Messages.INSTANCE.getTicketRequestTypeSelectionHtml (ticket, name); } } else if (CommonStringUtils.beginsWithIgnoreCase (name, REQUEST_TYPE_NAME)) { return Messages.INSTANCE.getTicketTypeRequestSelectionHtml (ticket, name); } else { return Messages.INSTANCE.getTicketTypeRequestTypeSelectionHtml (ticket, name); } } } private String getPendingTaskDescription() { String taskName; try { TaskType task = TaskType.valueOf (selection.getStringProperty ("task")); //$NON-NLS-1$ taskName = task.toString(); } catch (Exception e) { taskName = UNKNOWN_VALUE; logger.warn ("Can't determine TaskType for pending task " //$NON-NLS-1$ + selection.getId()); } String description = selection.getStringProperty ("description"); //$NON-NLS-1$ if (StringUtils.isBlank (description)) { description = UNKNOWN_VALUE; logger.warn ("No description for pending task " + selection.getId()); //$NON-NLS-1$ } // Description is of form " " return Messages.INSTANCE.getPendingTaskSelectionHtml (taskName, description); } private String getGenericDeviceShortDescription() { String wwn = selection.getStringProperty ("wwn"); //$NON-NLS-1$ if (StringUtils.isBlank (wwn)) { wwn = UNKNOWN_VALUE; logger.warn ("No wwn property for generic device" + selection.getId()); //$NON-NLS-1$ } return wwn; } private String getGenericDeviceLongDescription() { return Messages.INSTANCE.getSelectionHtml (getGenericDeviceShortDescription()); } private String getTaskDescription() { String taskId = selection.getStringProperty ("UserTaskId"); //$NON-NLS-1$ if (StringUtils.isBlank (taskId)) { taskId = UNKNOWN_VALUE; logger.warn ("Can't determine UserTaskId for task " + selection.getId()); //$NON-NLS-1$ } String ticket = selection.getStringProperty ("ticket"); //$NON-NLS-1$ return getTaskDescription (taskId, ticket); } private String getTaskDescription (String id, String ticket) { /* * Description is of form "Ticket , " * except that "Ticket" is dropped if it's already in * and "Ticket ," is dropped if is not defined. */ if (StringUtils.isBlank (ticket)) { return Messages.INSTANCE.getSelectionHtml (id); } else if (CommonStringUtils.beginsWithIgnoreCase (ticket, TICKET_TYPE_NAME)) { return Messages.INSTANCE.getTaskTicketSelectionHtml (id, ticket); } else { return Messages.INSTANCE.getTaskTicketTypeSelectionHtml (id, ticket); } } private String getMigrationTaskDescription() { String name = getName(); if (StringUtils.isBlank (name)) { name = UNKNOWN_VALUE; logger.warn ("Can't determine name for migration task " //$NON-NLS-1$ + selection.getId()); } String ticket = selection.getStringProperty ("TicketNumber"); //$NON-NLS-1$ return getTaskDescription (name, ticket); } private String getVulnerabilityDescription() { String text = selection.getStringProperty ("VulnerabilityName"); //$NON-NLS-1$ if (StringUtils.isBlank (text)) { text = UNKNOWN_VALUE; logger.warn ("Can't determine VulnerabilityName for vulnerability " //$NON-NLS-1$ + selection.getId()); } return Messages.INSTANCE.getSelectionHtml (text); } private String getSwitchPerformanceAlertDescription() { EnumPresentation presentation = SANscreenClientPlugin.getDefault().getEnumPresentation(); EnumPresentation.Attributes deviceTypePresentation = presentation.getAttributes ("performance.connectedDeviceType", //$NON-NLS-1$ selection.getProperty ("ConnectedDeviceType")); //$NON-NLS-1$ String typeName; if (deviceTypePresentation == null) { typeName = UNKNOWN_VALUE; logger.warn ("Can't determine ConnectedDeviceType for switch performance alert " //$NON-NLS-1$ + selection.getId()); } else { typeName = deviceTypePresentation.toString(); } EnumPresentation.Attributes thresholdPresentation = presentation.getAttributes ("performance.threshold", //$NON-NLS-1$ selection.getProperty ("Threshold")); //$NON-NLS-1$ String objectName; if (thresholdPresentation == null) { objectName = UNKNOWN_VALUE; logger.warn ("Can't determine Threshold for switch performance alert " //$NON-NLS-1$ + selection.getId()); } else { objectName = thresholdPresentation.toString(); } return getTypeAndNameDescription (typeName, objectName); } }