Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sleuthkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IRT
Sleuthkit
Commits
719a43df
Commit
719a43df
authored
5 years ago
by
Kelly Kelly
Browse files
Options
Downloads
Patches
Plain Diff
Removed the getName code
parent
897f1ee7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bindings/java/src/org/sleuthkit/datamodel/TagName.java
+34
-72
34 additions, 72 deletions
bindings/java/src/org/sleuthkit/datamodel/TagName.java
bindings/java/src/org/sleuthkit/datamodel/TagSet.java
+1
-1
1 addition, 1 deletion
bindings/java/src/org/sleuthkit/datamodel/TagSet.java
with
35 additions
and
73 deletions
bindings/java/src/org/sleuthkit/datamodel/TagName.java
+
34
−
72
View file @
719a43df
...
...
@@ -22,8 +22,6 @@
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
/**
* Instances of this class are data transfer objects (DTOs) that represent the
...
...
@@ -36,23 +34,23 @@ public class TagName implements Comparable<TagName>, Serializable {
public
enum
HTML_COLOR
{
NONE
(
"None"
,
""
),
//NON-NLS
WHITE
(
"White"
,
"#FFFFFF"
),
//NON-NLS
SILVER
(
"Silver"
,
"#C0C0C0"
),
//NON-NLS
GRAY
(
"Gray"
,
"#808080"
),
//NON-NLS
BLACK
(
"Black"
,
"#000000"
),
//NON-NLS
RED
(
"Red"
,
"#FF0000"
),
//NON-NLS
MAROON
(
"Maron"
,
"#800000"
),
//NON-NLS
YELLOW
(
"Yellow"
,
"#FFFF00"
),
//NON-NLS
OLIVE
(
"Olive"
,
"#808000"
),
//NON-NLS
LIME
(
"Lime"
,
"#00FF00"
),
//NON-NLS
GREEN
(
"Green"
,
"#008000"
),
//NON-NLS
AQUA
(
"Aqua"
,
"#00FFFF"
),
//NON-NLS
TEAL
(
"Teal"
,
"#008080"
),
//NON-NLS
BLUE
(
"Blue"
,
"#0000FF"
),
//NON-NLS
NAVY
(
"Navy"
,
"#000080"
),
//NON-NLS
FUCHSIA
(
"Fuchsia"
,
"#FF00FF"
),
//NON-NLS
PURPLE
(
"Purple"
,
"#800080"
);
//NON-NLS
NONE
(
"None"
,
""
),
//NON-NLS
WHITE
(
"White"
,
"#FFFFFF"
),
//NON-NLS
SILVER
(
"Silver"
,
"#C0C0C0"
),
//NON-NLS
GRAY
(
"Gray"
,
"#808080"
),
//NON-NLS
BLACK
(
"Black"
,
"#000000"
),
//NON-NLS
RED
(
"Red"
,
"#FF0000"
),
//NON-NLS
MAROON
(
"Maron"
,
"#800000"
),
//NON-NLS
YELLOW
(
"Yellow"
,
"#FFFF00"
),
//NON-NLS
OLIVE
(
"Olive"
,
"#808000"
),
//NON-NLS
LIME
(
"Lime"
,
"#00FF00"
),
//NON-NLS
GREEN
(
"Green"
,
"#008000"
),
//NON-NLS
AQUA
(
"Aqua"
,
"#00FFFF"
),
//NON-NLS
TEAL
(
"Teal"
,
"#008080"
),
//NON-NLS
BLUE
(
"Blue"
,
"#0000FF"
),
//NON-NLS
NAVY
(
"Navy"
,
"#000080"
),
//NON-NLS
FUCHSIA
(
"Fuchsia"
,
"#FF00FF"
),
//NON-NLS
PURPLE
(
"Purple"
,
"#800080"
);
//NON-NLS
private
final
static
HashMap
<
String
,
HTML_COLOR
>
colorMap
=
new
HashMap
<
String
,
HTML_COLOR
>();
private
final
String
name
;
private
final
String
hexString
;
...
...
@@ -71,7 +69,7 @@ public enum HTML_COLOR {
String
getName
()
{
return
name
;
}
public
String
getRgbValue
()
{
return
hexString
;
}
...
...
@@ -85,21 +83,18 @@ public static HTML_COLOR getColorByName(String colorName) {
}
}
private
final
long
id
;
private
final
String
n
ame
;
private
final
String
displayN
ame
;
private
final
String
description
;
private
final
HTML_COLOR
color
;
private
final
TskData
.
FileKnown
knownStatus
;
private
final
long
tagSetId
;
private
final
int
rank
;
private
final
SleuthkitCase
skCase
;
// Build this when needed
private
String
displayName
=
null
;
// Clients of the org.sleuthkit.datamodel package should not directly create these objects.
TagName
(
SleuthkitCase
sleuthkitCase
,
long
id
,
String
n
ame
,
String
description
,
HTML_COLOR
color
,
TskData
.
FileKnown
knownStatus
,
long
tagSetId
,
int
rank
)
{
TagName
(
SleuthkitCase
sleuthkitCase
,
long
id
,
String
displayN
ame
,
String
description
,
HTML_COLOR
color
,
TskData
.
FileKnown
knownStatus
,
long
tagSetId
,
int
rank
)
{
this
.
id
=
id
;
this
.
name
=
n
ame
;
this
.
displayName
=
displayN
ame
;
this
.
description
=
description
;
this
.
color
=
color
;
this
.
knownStatus
=
knownStatus
;
...
...
@@ -112,32 +107,7 @@ public long getId() {
return
id
;
}
/**
* Returns a formatted TagName display name that includes the TagName's
* TagSet name notable status.
*
* @return Returns TagName display name.
*/
public
String
getDisplayName
()
{
if
(
displayName
==
null
)
{
try
{
TagSet
set
=
getTagSet
();
displayName
=
new
String
();
if
(
set
!=
null
)
{
displayName
+=
set
.
getName
()
+
" "
;
}
}
catch
(
TskCoreException
ex
)
{
Logger
.
getLogger
(
TagName
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
"Unable to add TagSet name to TagName displayName"
,
ex
);
}
displayName
+=
name
;
if
(
knownStatus
==
TskData
.
FileKnown
.
BAD
)
{
displayName
+=
" (Notable)"
;
}
}
return
displayName
;
}
...
...
@@ -156,37 +126,29 @@ public TskData.FileKnown getKnownStatus() {
long
getTagSetId
()
{
return
tagSetId
;
}
public
int
getRank
()
{
return
rank
;
}
/**
* Returns the TagName name. A TagName name is not unique.
*
* @return The TagName name.
*/
public
String
getName
()
{
return
name
;
}
/**
* Returns the TagName TagSet object.
*
* @return TagName TagSet object or null if the TagName is not a part of a TagSet.
*
* @throws TskCoreException
*
* @return TagName TagSet object or null if the TagName is not a part of a
* TagSet.
*
* @throws TskCoreException
*/
public
TagSet
getTagSet
()
throws
TskCoreException
{
if
(
tagSetId
!=
0
)
{
if
(
tagSetId
!=
0
)
{
List
<
TagSet
>
tagSets
=
skCase
.
getTaggingManager
().
getTagSets
();
for
(
TagSet
set:
tagSets
)
{
if
(
tagSetId
==
set
.
getId
())
{
for
(
TagSet
set
:
tagSets
)
{
if
(
tagSetId
==
set
.
getId
())
{
return
set
;
}
}
}
return
null
;
}
...
...
@@ -206,7 +168,7 @@ public int compareTo(TagName other) {
public
int
hashCode
()
{
int
hash
=
5
;
hash
=
89
*
hash
+
(
int
)
(
this
.
id
^
(
this
.
id
>>>
32
));
hash
=
89
*
hash
+
(
this
.
n
ame
!=
null
?
this
.
n
ame
.
hashCode
()
:
0
);
hash
=
89
*
hash
+
(
this
.
displayN
ame
!=
null
?
this
.
displayN
ame
.
hashCode
()
:
0
);
hash
=
89
*
hash
+
(
this
.
description
!=
null
?
this
.
description
.
hashCode
()
:
0
);
hash
=
89
*
hash
+
(
this
.
color
!=
null
?
this
.
color
.
hashCode
()
:
0
);
hash
=
89
*
hash
+
(
this
.
knownStatus
!=
null
?
this
.
knownStatus
.
hashCode
()
:
0
);
...
...
@@ -224,7 +186,7 @@ public boolean equals(Object obj) {
}
final
TagName
other
=
(
TagName
)
obj
;
return
(
this
.
id
==
other
.
id
&&
Objects
.
equals
(
this
.
n
ame
,
other
.
n
ame
)
&&
Objects
.
equals
(
this
.
displayN
ame
,
other
.
displayN
ame
)
&&
Objects
.
equals
(
this
.
description
,
other
.
description
)
&&
Objects
.
equals
(
this
.
color
,
other
.
color
)
&&
Objects
.
equals
(
this
.
knownStatus
,
other
.
knownStatus
)
...
...
This diff is collapsed.
Click to expand it.
bindings/java/src/org/sleuthkit/datamodel/TagSet.java
+
1
−
1
View file @
719a43df
...
...
@@ -111,7 +111,7 @@ private class TagNameComparator implements Comparator<TagName> {
public
int
compare
(
TagName
tagName1
,
TagName
tagName2
)
{
int
result
=
((
Integer
)
tagName1
.
getRank
()).
compareTo
(
tagName2
.
getRank
());
if
(
result
==
0
)
{
result
=
tagName1
.
getName
().
compareTo
(
tagName2
.
getName
());
result
=
tagName1
.
get
Display
Name
().
compareTo
(
tagName2
.
get
Display
Name
());
}
return
result
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment