package com.onaro.sanscreen.client.view.changes; import com.onaro.sanscreen.server.changes.*; import com.onaro.sanscreen.types.*; public class ChangesUtil { /** * Some of the elements described in a change may not exist in the SAN at the time of the change. *

e.g. a host in a host down change is already gone from the SAN. * In order to get information on the host, the query should be of 1 milli second before * This method returns the right query time according to the type of the change * @param change * @return the time of the change or 1 milli second before for changes that describes elements going down. */ public static long getQueryTime(Change change) { ChangeType changeType = change.getType(); long time = change.getTime(); //if the change type belongs to these group, the device will not be in the SAN at the time of the change. //Therefor, in order to query the device, a time stamp of one milli second earlier is used. return ChangeType.DOWN_CHANGE_TYPES.contains(changeType) ? time - 1 : time; } }