Sleuth Kit Java Bindings (JNI)  4.6.0
Java bindings for using The Sleuth Kit
Account.java
Go to the documentation of this file.
1 /*
2  * Sleuth Kit Data Model
3  *
4  * Copyright 2016 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.datamodel;
20 
21 import java.util.Arrays;
22 import java.util.List;
23 
30 public class Account {
31 
35  private final long account_id;
36 
37  private final Account.Type accountType;
42  private final String typeSpecificID;
43 
44  public static final class Type {
45 
46  private static final long serialVersionUID = 1L;
47  //JIRA-900:Should the display names of predefined types be internationalized?
48  public static final Account.Type CREDIT_CARD = new Type("CREDIT_CARD", "Credit Card");
49  public static final Account.Type DEVICE = new Type("DEVICE", "Device");
50  public static final Account.Type PHONE = new Type("PHONE", "Phone");
51  public static final Account.Type EMAIL = new Type("EMAIL", "Email");
52  public static final Account.Type FACEBOOK = new Type("FACEBOOK", "Facebook");
53  public static final Account.Type TWITTER = new Type("TWITTER", "Twitter");
54  public static final Account.Type INSTAGRAM = new Type("INSTAGRAM", "Instagram");
55  public static final Account.Type WHATSAPP = new Type("WHATSAPP", "Facebook");
56  public static final Account.Type MESSAGING_APP = new Type("MESSAGING_APP", "MessagingApp");
57  public static final Account.Type WEBSITE = new Type("WEBSITE", "Website");
58 
59  public static final List<Account.Type> PREDEFINED_ACCOUNT_TYPES = Arrays.asList(
61  DEVICE,
62  PHONE,
63  EMAIL,
64  FACEBOOK,
65  TWITTER,
66  INSTAGRAM,
67  WHATSAPP,
69  WEBSITE
70  );
71 
72  private final String typeName;
73  private final String displayName;
74 
81  Type(String typeName, String displayName) {
82  this.typeName = typeName;
83  this.displayName = displayName;
84  }
85 
91  public String getTypeName() {
92  return this.typeName;
93  }
94 
95  public String getDisplayName() {
96  return displayName;
97  }
98 
99  @Override
100  public boolean equals(Object that) {
101  if (this == that) {
102  return true;
103  } else if (!(that instanceof Account.Type)) {
104  return false;
105  }
106 
107  Account.Type thatType = (Account.Type) that;
108  // DB table enforces uniqueness for type name
109  return this.typeName.equals(thatType.getTypeName());
110  }
111 
112  @Override
113  public int hashCode() {
114  int hash = 11;
115 
116  hash = 83 * hash + (this.typeName != null ? this.typeName.hashCode() : 0);
117  hash = 83 * hash + (this.displayName != null ? this.displayName.hashCode() : 0);
118 
119  return hash;
120  }
121 
122  @Override
123  public String toString() {
124  return " displayName=" + this.displayName
125  + ", typeName=" + this.typeName + ")";
126  }
127  }
128 
129  Account(long account_id, Account.Type accountType, String typeSpecificId) throws TskCoreException {
130  this.account_id = account_id;
131  this.accountType = accountType;
132  this.typeSpecificID = typeSpecificId;
133  }
134 
141  public String getTypeSpecificID() {
142  return this.typeSpecificID;
143  }
144 
151  return this.accountType;
152  }
153 
160  public long getAccountID() {
161  return this.account_id;
162  }
163 }
static final Account.Type INSTAGRAM
Definition: Account.java:54
static final Account.Type MESSAGING_APP
Definition: Account.java:56
static final Account.Type WHATSAPP
Definition: Account.java:55
static final Account.Type FACEBOOK
Definition: Account.java:52
static final Account.Type PHONE
Definition: Account.java:50
static final Account.Type WEBSITE
Definition: Account.java:57
static final Account.Type CREDIT_CARD
Definition: Account.java:48
static final List< Account.Type > PREDEFINED_ACCOUNT_TYPES
Definition: Account.java:59
static final Account.Type TWITTER
Definition: Account.java:53
static final Account.Type DEVICE
Definition: Account.java:49
static final Account.Type EMAIL
Definition: Account.java:51

Copyright © 2011-2018 Brian Carrier. (carrier -at- sleuthkit -dot- org)
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.