19 package org.sleuthkit.autopsy.ingest;
21 import java.text.SimpleDateFormat;
22 import java.util.Date;
23 import java.util.concurrent.atomic.AtomicLong;
24 import org.openide.util.NbBundle;
50 private static SimpleDateFormat
dateFormat =
new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
63 if (uniqueKey == null)
66 datePosted =
new Date();
104 StringBuilder sb =
new StringBuilder();
105 sb.append(Long.toString(ID)).append(
": ");
106 sb.append(NbBundle.getMessage(
this.getClass(),
"IngestMessage.toString.type.text", messageType.name()));
112 NbBundle.getMessage(
this.getClass(),
"IngestMessage.toString.date.text", dateFormat.format(datePosted)));
113 sb.append(NbBundle.getMessage(
this.getClass(),
"IngestMessage.toString.subject.text",
subject));
114 if (detailsHtml != null) {
115 sb.append(NbBundle.getMessage(
this.getClass(),
"IngestMessage.toString.details.text",
detailsHtml));
118 sb.append(NbBundle.getMessage(
this.getClass(),
"IngestMessage.toString.data.text", data.
toString()));
120 return sb.toString();
128 if (getClass() != obj.getClass()) {
132 if (this.ID != other.
ID) {
138 if (this.source != other.
source && (
this.source == null || !
this.source.equals(other.
source))) {
141 if ((this.subject == null) ? (other.
subject != null) : !this.subject.equals(other.
subject)) {
144 if ((this.detailsHtml == null) ? (other.
detailsHtml != null) : !this.detailsHtml.equals(other.
detailsHtml)) {
147 if ((this.uniqueKey == null) ? (other.
uniqueKey != null) : !this.uniqueKey.equals(other.
uniqueKey)) {
150 if (this.data != other.
data && (
this.data == null || !
this.data.equals(other.
data))) {
159 hash = 59 * hash + (int) (this.ID ^ (this.ID >>> 32));
160 hash = 59 * hash + (this.messageType != null ? this.messageType.hashCode() : 0);
161 hash = 59 * hash + (this.source != null ? this.source.hashCode() : 0);
162 hash = 59 * hash + (this.subject != null ? this.subject.hashCode() : 0);
163 hash = 59 * hash + (this.detailsHtml != null ? this.detailsHtml.hashCode() : 0);
164 hash = 59 * hash + (this.uniqueKey != null ? this.uniqueKey.hashCode() : 0);
165 hash = 59 * hash + (this.data != null ? this.data.
hashCode() : 0);
181 if (messageType == null || source == null || subject == null) {
182 throw new IllegalArgumentException(
183 NbBundle.getMessage(
IngestMessage.class,
"IngestMessage.exception.typeSrcSubjNotNull.msg"));
185 long ID = nextMessageID.getAndIncrement();
186 return new IngestMessage(ID, messageType, source, subject, detailsHtml, null);
211 if (source == null || subject == null) {
212 throw new IllegalArgumentException(
213 NbBundle.getMessage(
IngestMessage.class,
"IngestMessage.exception.srcSubjNotNull.msg"));
215 long ID = nextMessageID.getAndIncrement();
228 if (source == null || subject == null) {
229 throw new IllegalArgumentException(
230 NbBundle.getMessage(
IngestMessage.class,
"IngestMessage.exception.srcSubjNotNull.msg"));
232 long ID = nextMessageID.getAndIncrement();
247 if (source == null || subject == null || detailsHtml == null || data == null) {
248 throw new IllegalArgumentException(
249 NbBundle.getMessage(
IngestMessage.class,
"IngestMessage.exception.srcSubjDetailsDataNotNull.msg"));
252 long ID = nextMessageID.getAndIncrement();
264 static IngestMessage createManagerMessage(String subject, String detailsHtml) {
271 static IngestMessage createManagerErrorMessage(String subject, String detailsHtml) {
272 return new IngestMessage(++managerMessageId, MessageType.ERROR, null, subject, detailsHtml, null);
static IngestMessage createDataMessage(String source, String subject, String detailsHtml, String uniqueKey, BlackboardArtifact data)
static IngestMessage createErrorMessage(String source, String subject, String detailsHtml)
MessageType getMessageType()
BlackboardArtifact getData()
static SimpleDateFormat dateFormat
static IngestMessage createMessage(MessageType messageType, String source, String subject, String detailsHtml)
static int managerMessageId
IngestMessage(long ID, MessageType messageType, String source, String subject, String detailsHtml, String uniqueKey)
static IngestMessage createMessage(MessageType messageType, String source, String subject)
static AtomicLong nextMessageID
boolean equals(Object obj)
static IngestMessage createWarningMessage(String source, String subject, String detailsHtml)