Sleuth Kit Java Bindings (JNI)  4.12.1
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-18 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 final 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  //JIRA-900:Should the display names of predefined types be internationalized?
47  public static final Account.Type CREDIT_CARD = new Type("CREDIT_CARD", "Credit Card");
48  public static final Account.Type DEVICE = new Type("DEVICE", "Device");
49  public static final Account.Type PHONE = new Type("PHONE", "Phone");
50  public static final Account.Type EMAIL = new Type("EMAIL", "Email");
51  public static final Account.Type FACEBOOK = new Type("FACEBOOK", "Facebook");
52  public static final Account.Type TWITTER = new Type("TWITTER", "Twitter");
53  public static final Account.Type INSTAGRAM = new Type("INSTAGRAM", "Instagram");
54  public static final Account.Type WHATSAPP = new Type("WHATSAPP", "WhatsApp");
55  public static final Account.Type MESSAGING_APP = new Type("MESSAGING_APP", "MessagingApp");
56  public static final Account.Type WEBSITE = new Type("WEBSITE", "Website");
57 
58  public static final Account.Type IMO = new Type("IMO", "IMO");
59  public static final Account.Type LINE = new Type("LINE", "LINE");
60  public static final Account.Type SKYPE = new Type("SKYPE", "Skype");
61  public static final Account.Type TANGO = new Type("TANGO", "Tango");
62  public static final Account.Type TEXTNOW = new Type("TEXTNOW", "TextNow");
63  public static final Account.Type THREEMA = new Type("THREEMA", "ThreeMa");
64  public static final Account.Type VIBER = new Type("VIBER", "Viber");
65 
66  public static final Account.Type XENDER = new Type("XENDER", "Xender");
67  public static final Account.Type ZAPYA = new Type("ZAPYA", "Zapya");
68  public static final Account.Type SHAREIT = new Type("SHAREIT", "ShareIt");
69 
70  public static final List<Account.Type> PREDEFINED_ACCOUNT_TYPES = Arrays.asList(
72  DEVICE,
73  PHONE,
74  EMAIL,
75  FACEBOOK,
76  TWITTER,
77  INSTAGRAM,
78  WHATSAPP,
80  WEBSITE,
81  IMO,
82  LINE,
83  SKYPE,
84  TANGO,
85  TEXTNOW,
86  THREEMA,
87  VIBER,
88  XENDER,
89  ZAPYA,
90  SHAREIT
91  );
92 
93  private final String typeName;
94  private final String displayName;
95 
102  public Type(String typeName, String displayName) {
103  this.typeName = typeName;
104  this.displayName = displayName;
105  }
106 
112  public String getTypeName() {
113  return this.typeName;
114  }
115 
121  public String getDisplayName() {
122  return displayName;
123  }
124 
125  @Override
126  public boolean equals(Object that) {
127  if (this == that) {
128  return true;
129  } else if (!(that instanceof Account.Type)) {
130  return false;
131  }
132 
133  Account.Type thatType = (Account.Type) that;
134  // DB table enforces uniqueness for type name
135  return this.typeName.equals(thatType.getTypeName());
136  }
137 
138  @Override
139  public int hashCode() {
140  int hash = 11;
141 
142  hash = 83 * hash + (this.typeName != null ? this.typeName.hashCode() : 0);
143  hash = 83 * hash + (this.displayName != null ? this.displayName.hashCode() : 0);
144 
145  return hash;
146  }
147 
148  @Override
149  public String toString() {
150  return " displayName=" + this.displayName
151  + ", typeName=" + this.typeName + ")";
152  }
153  }
154 
155  Account(long account_id, Account.Type accountType, String typeSpecificId) throws TskCoreException {
156  this.account_id = account_id;
157  this.accountType = accountType;
158  this.typeSpecificID = typeSpecificId;
159  }
160 
167  public String getTypeSpecificID() {
168  return this.typeSpecificID;
169  }
170 
177  return this.accountType;
178  }
179 
186  public long getAccountID() {
187  return this.account_id;
188  }
189 
190  @Override
191  public int hashCode() {
192  int hash = 5;
193  hash = 43 * hash + (int) (this.account_id ^ (this.account_id >>> 32));
194  hash = 43 * hash + (this.accountType != null ? this.accountType.hashCode() : 0);
195  hash = 43 * hash + (this.typeSpecificID != null ? this.typeSpecificID.hashCode() : 0);
196  return hash;
197  }
198 
199  @Override
200  public boolean equals(Object obj) {
201  if (this == obj) {
202  return true;
203  }
204  if (obj == null) {
205  return false;
206  }
207  if (getClass() != obj.getClass()) {
208  return false;
209  }
210  final Account other = (Account) obj;
211  if (this.account_id != other.account_id) {
212  return false;
213  }
214  if ((this.typeSpecificID == null) ? (other.typeSpecificID != null) : !this.typeSpecificID.equals(other.typeSpecificID)) {
215  return false;
216  }
217  if (this.accountType != other.accountType && (this.accountType == null || !this.accountType.equals(other.accountType))) {
218  return false;
219  }
220  return true;
221  }
222 }
static final Account.Type TANGO
Definition: Account.java:61
static final Account.Type INSTAGRAM
Definition: Account.java:53
static final Account.Type MESSAGING_APP
Definition: Account.java:55
static final Account.Type TEXTNOW
Definition: Account.java:62
static final Account.Type WHATSAPP
Definition: Account.java:54
static final Account.Type FACEBOOK
Definition: Account.java:51
static final Account.Type ZAPYA
Definition: Account.java:67
static final Account.Type PHONE
Definition: Account.java:49
static final Account.Type IMO
Definition: Account.java:58
static final Account.Type XENDER
Definition: Account.java:66
static final Account.Type WEBSITE
Definition: Account.java:56
static final Account.Type CREDIT_CARD
Definition: Account.java:47
boolean equals(Object obj)
Definition: Account.java:200
static final List< Account.Type > PREDEFINED_ACCOUNT_TYPES
Definition: Account.java:70
static final Account.Type LINE
Definition: Account.java:59
static final Account.Type TWITTER
Definition: Account.java:52
static final Account.Type VIBER
Definition: Account.java:64
static final Account.Type SHAREIT
Definition: Account.java:68
static final Account.Type THREEMA
Definition: Account.java:63
static final Account.Type SKYPE
Definition: Account.java:60
static final Account.Type DEVICE
Definition: Account.java:48
static final Account.Type EMAIL
Definition: Account.java:50
Type(String typeName, String displayName)
Definition: Account.java:102

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