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) {
68 datePosted =
new Date();
106 StringBuilder sb =
new StringBuilder();
107 sb.append(Long.toString(ID)).append(
": ");
108 sb.append(NbBundle.getMessage(
this.getClass(),
"IngestMessage.toString.type.text", messageType.name()));
114 NbBundle.getMessage(
this.getClass(),
"IngestMessage.toString.date.text", dateFormat.format(datePosted)));
115 sb.append(NbBundle.getMessage(
this.getClass(),
"IngestMessage.toString.subject.text",
subject));
116 if (detailsHtml != null) {
117 sb.append(NbBundle.getMessage(
this.getClass(),
"IngestMessage.toString.details.text",
detailsHtml));
120 sb.append(NbBundle.getMessage(
this.getClass(),
"IngestMessage.toString.data.text", data.
toString()));
122 return sb.toString();
130 if (getClass() != obj.getClass()) {
134 if (this.ID != other.
ID) {
140 if (this.source != other.
source && (
this.source == null || !
this.source.equals(other.
source))) {
143 if ((this.subject == null) ? (other.
subject != null) : !this.subject.equals(other.
subject)) {
146 if ((this.detailsHtml == null) ? (other.
detailsHtml != null) : !this.detailsHtml.equals(other.
detailsHtml)) {
149 if ((this.uniqueKey == null) ? (other.
uniqueKey != null) : !this.uniqueKey.equals(other.
uniqueKey)) {
152 if (this.data != other.
data && (
this.data == null || !
this.data.equals(other.
data))) {
161 hash = 59 * hash + (int) (this.ID ^ (this.ID >>> 32));
162 hash = 59 * hash + (this.messageType != null ? this.messageType.hashCode() : 0);
163 hash = 59 * hash + (this.source != null ? this.source.hashCode() : 0);
164 hash = 59 * hash + (this.subject != null ? this.subject.hashCode() : 0);
165 hash = 59 * hash + (this.detailsHtml != null ? this.detailsHtml.hashCode() : 0);
166 hash = 59 * hash + (this.uniqueKey != null ? this.uniqueKey.hashCode() : 0);
167 hash = 59 * hash + (this.data != null ? this.data.
hashCode() : 0);
184 if (messageType == null || source == null || subject == null) {
185 throw new IllegalArgumentException(
186 NbBundle.getMessage(
IngestMessage.class,
"IngestMessage.exception.typeSrcSubjNotNull.msg"));
188 long ID = nextMessageID.getAndIncrement();
189 return new IngestMessage(ID, messageType, source, subject, detailsHtml, null);
217 if (source == null || subject == null) {
218 throw new IllegalArgumentException(
219 NbBundle.getMessage(
IngestMessage.class,
"IngestMessage.exception.srcSubjNotNull.msg"));
221 long ID = nextMessageID.getAndIncrement();
237 if (source == null || subject == null) {
238 throw new IllegalArgumentException(
239 NbBundle.getMessage(
IngestMessage.class,
"IngestMessage.exception.srcSubjNotNull.msg"));
241 long ID = nextMessageID.getAndIncrement();
262 if (source == null || subject == null || detailsHtml == null || data == null) {
263 throw new IllegalArgumentException(
264 NbBundle.getMessage(
IngestMessage.class,
"IngestMessage.exception.srcSubjDetailsDataNotNull.msg"));
267 long ID = nextMessageID.getAndIncrement();
282 static IngestMessage createManagerMessage(String subject, String detailsHtml) {
289 static IngestMessage createManagerErrorMessage(String subject, String detailsHtml) {
290 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)