Project

General

Profile

1
/**
2
 *  '$RCSfile$'
3
 *    Purpose: A class represents an event for the solr indexing.
4
 *    Copyright: 2013 Regents of the University of California and the
5
 *             National Center for Ecological Analysis and Synthesis
6
 *    Authors: Jing Tao
7
 *
8
 * This program is free software; you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation; either version 2 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21
 */
22
package edu.ucsb.nceas.metacat.index.event;
23

    
24
import java.util.Date;
25

    
26
import org.dataone.service.types.v1.Identifier;
27

    
28

    
29
/**
30
 * A class represents an event for the solr indexing.
31
 * @author tao
32
 *
33
 */
34
public class IndexEvent {
35
    
36
    public static final int SUCCESSINSERT = 0;
37
    public static final int FAILUREINSERT = 6;
38
    public static final int SUCCESSDELETE = 12;
39
    public static final int FAILUREDELETE = 18;
40
    public static final int STARTTIMEDINDEX = 24;
41
    public static final int FINISHTIMEDINDEX = 30;
42
    private int type = -1;
43
    private Date date = null;
44
    private Identifier pid = null;
45
    private String description = null;
46
    private boolean isArchived = false;
47
    private long serialNumber;
48
    
49
    
50
    
51
    /**
52
     * Get the serial number of this event
53
     * @return
54
     */
55
    public long getSerialNumber() {
56
        return serialNumber;
57
    }
58

    
59
    /**
60
     * Set the serial number for this event
61
     * @param serialNumber
62
     */
63
    public void setSerialNumber(long serialNumber) {
64
        this.serialNumber = serialNumber;
65
    }
66

    
67
    /**
68
     * Get the type of the event.
69
     * @return the type of the event
70
     */
71
    public int getType() {
72
        return this.type;
73
    }
74
    
75
    /**
76
     * Set the type of the event
77
     * @param type
78
     */
79
    public void setType(int type) {
80
        this.type = type;
81
    }
82
    
83
    /**
84
     * Get the date when the event happened
85
     * @return
86
     */
87
    public Date getDate() {
88
        return date;
89
    }
90
    
91
    /**
92
     * Set the date when the event happened
93
     * @param date
94
     */
95
    public void setDate(Date date) {
96
        this.date = date;
97
    }
98
    
99
    /**
100
     * Get the identifier of the data object involving the event
101
     * @return
102
     */
103
    public Identifier getPid() {
104
        return pid;
105
    }
106
    
107
    /**
108
     * Set the identifier of the data object involving the event.
109
     * @param pid
110
     */
111
    public void setPid(Identifier pid) {
112
        this.pid = pid;
113
    }
114
    
115
    /**
116
     * Get the description of the event
117
     * @return
118
     */
119
    public String getDescription() {
120
        return description;
121
    }
122
    
123
    /**
124
     * Set the description of the event
125
     * @param description
126
     */
127
    public void setDescription(String description) {
128
        this.description = description;
129
    }
130
    
131
    /**
132
     * If the event has been archived.
133
     * @return true if it has been archived; otherwise false.
134
     */
135
    public boolean isArchived() {
136
        return isArchived;
137
    }
138

    
139
    /**
140
     * Set the event to be archived
141
     * @param isArchived
142
     */
143
    public void setArchived(boolean isArchived) {
144
        this.isArchived = isArchived;
145
    }
146
}
(2-2/5)