Autopsy  4.14.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
CentralRepoAccount.java
Go to the documentation of this file.
1 /*
2  * Central Repository
3  *
4  * Copyright 2020 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.autopsy.centralrepository.datamodel;
20 
21 import org.sleuthkit.datamodel.Account;
22 
23 
27 public final class CentralRepoAccount {
28 
29  // primary key in the Accounts table in CR database
30  private final long accountId;
31 
33  // type specifc unique account id
34  private final String typeSpecificId;
35 
40  public static final class CentralRepoAccountType {
41 
42  // id is the primary key in the account_types table
43  private final int accountTypeId;
44  private final Account.Type acctType;
45  private final int correlationTypeId;
46 
47  CentralRepoAccountType(int acctTypeID, Account.Type acctType, int correlationTypeId) {
48  this.acctType = acctType;
49  this.correlationTypeId = correlationTypeId;
50  this.accountTypeId = acctTypeID;
51  }
52 
53 
57  public Account.Type getAcctType() {
58  return acctType;
59  }
60 
61  public int getCorrelationTypeId() {
62  return this.correlationTypeId;
63  }
64 
65  public int getAccountTypeId() {
66  return this.accountTypeId;
67  }
68  }
69 
70  public CentralRepoAccount(long accountId, CentralRepoAccountType accountType, String typeSpecificId) {
71  this.accountId = accountId;
72  this.accountType = accountType;
73  this.typeSpecificId = typeSpecificId;
74  }
75 
82  public String getTypeSpecificId() {
83  return this.typeSpecificId;
84  }
85 
92  return this.accountType;
93  }
94 
100  public long getAccountId() {
101  return this.accountId;
102  }
103 
104  @Override
105  public int hashCode() {
106  int hash = 5;
107  hash = 43 * hash + (int) (this.accountId ^ (this.accountId >>> 32));
108  hash = 43 * hash + (this.accountType != null ? this.accountType.hashCode() : 0);
109  hash = 43 * hash + (this.typeSpecificId != null ? this.typeSpecificId.hashCode() : 0);
110  return hash;
111  }
112 
113  @Override
114  public boolean equals(Object obj) {
115  if (this == obj) {
116  return true;
117  }
118  if (obj == null) {
119  return false;
120  }
121  if (getClass() != obj.getClass()) {
122  return false;
123  }
124  final CentralRepoAccount other = (CentralRepoAccount) obj;
125  if (this.accountId != other.getAccountId()) {
126  return false;
127  }
128  if ((this.typeSpecificId == null) ? (other.getTypeSpecificId() != null) : !this.typeSpecificId.equals(other.getTypeSpecificId())) {
129  return false;
130  }
131  if (this.accountType != other.getAccountType() && (this.accountType == null || !this.accountType.equals(other.getAccountType()))) {
132  return false;
133  }
134  return true;
135  }
136 
137 }
CentralRepoAccount(long accountId, CentralRepoAccountType accountType, String typeSpecificId)

Copyright © 2012-2020 Basis Technology. Generated on: Wed Apr 8 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.