Retrieves a security log history for specified monitored objects, determines how many records are available, and specifies how to retrieve and sort the data.
Long getSecurityLogHistoryCount(Collection<MonitoredObject> monitoredObjects, Boolean accessResult, Date startTime, Date endTime) throws SUPAdminException; Collection<SecurityLogHistoryVO> getSecurityLogHistory(Collection<MonitoredObject> monitoredObjects, Boolean accessResult, Date startTime, Date endTime, Long offset, Integer length, SortedField<? extends Enum> sortedField) throws SUPAdminException;
If successful, returns an object of the specified type (can be null). If unsuccessful, returns SUPAdminException.
// Prepare monitored objects MonitoredCluster mc = new MonitoredCluster(); mc.addMonitoredDomain(new MonitoredDomain("default")); mc.addMonitoredDomain(new MonitoredDomain("test")); Collection<MonitoredObject> mos = Arrays .asList(new MonitoredObject[] { mc }); // Prepare time range Date startTime = new Date(0); Date endTime = new Date(); // Should only return successful access Boolean accessResult = true; // Starting from 10th record Long offset = 10L; // Try to retrieve 10000 records Integer target = 10000; // Specify sorting field and sorting order SortedField<SortedField.SECURITY_ACCESS> sf = new SortedField<SortedField.SECURITY_ACCESS>( SECURITY_ACCESS.DOMAIN, SORT_ORDER.ASCENDING); // See how many records are available long count = supMonitor.getSecurityLogHistoryCount(mos, accessResult, startTime, endTime); long available = Math.min(count - offset, target); if (available < 1) { System.out.println("No monitoring data found at offset " + offset); return; } else { System.out.println("There " + available + " records monitoring data at offset " + offset); } // Specify the preferred record number to be fetched from server in one // call. // Management server has imposed a upper limit of 500 for sake of // performance. Integer length = new Integer(new Long(Math.min(500, available)) .intValue()); Collection<SecurityLogHistoryVO> slhvos = supMonitor.getSecurityLogHistory(mos, accessResult, startTime, endTime, offset, length, sf); // All the available records can be fetched at one call. if (slhvos.size() == available) { System.out.println("Fetched " + available + " of " + available + " records of monitoring data."); return; } long read = slhvos.size(); offset += read; while (read < available) { slhvos = supMonitor.getSecurityLogHistory(mos, accessResult, startTime, endTime, offset, length, sf); System.out.println("Fetched " + slhvos.size() + " of " + available + " records of monitoring data."); read += slhvos.size(); offset += read; }