Project

General

Profile

« Previous | Next » 

Revision 8896

Added by Jing Tao about 10 years ago

Add a utility method for determine if there is a delete event for a given id.

View differences:

src/edu/ucsb/nceas/metacat/EventLog.java
75 75
 */
76 76
public class EventLog
77 77
{
78
    public static final String DELETE = "delete";
78 79
    /**
79 80
     * The single instance of the event log that is always returned.
80 81
     */
......
367 368
        return resultDoc.toString();
368 369
    }
369 370
    
371
    /**
372
     * A utility method to determine if the given docid was deleted. 
373
     * @param docid the specified docid
374
     * @return true if there is a delete event for the id; false otherwise.
375
     */
376
    public boolean isDeleted(String docid) {
377
        boolean deleted =false;
378
        if(docid != null || !docid.trim().equals("")) {
379
            String[] docids = new String[1];
380
            docids[0] = docid;
381
            String[] events = new String[1];
382
            events[0]= DELETE;
383
            String[] ipAddress = null;
384
            String[] principal = null;
385
            Timestamp startDate = null;
386
            Timestamp endDate = null;
387
            boolean anonymous = false;
388
            
389
            String report =getReport(ipAddress, principal, docids,
390
                     events, startDate, endDate, anonymous);
391
            //System.out.println("the report is "+report);
392
            if(report != null && report.contains("<event>"+DELETE+"</event>") ){
393
                deleted = true;
394
            }
395
        }
396
        return deleted;
397
    }
370 398
    
371
    
372 399
    public Log getD1Report(String[] ipAddress, String[] principal, String[] docid,
373 400
            String event, Timestamp startDate, Timestamp endDate, boolean anonymous, Integer start, Integer count)
374 401
    {

Also available in: Unified diff