Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vospace-datamodel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VOSpace INAF
vospace-datamodel
Commits
dfa065b5
Commit
dfa065b5
authored
4 years ago
by
Sara Bertocco
Browse files
Options
Downloads
Patches
Plain Diff
Added missing methods
parent
12d3aa54
No related branches found
No related tags found
No related merge requests found
Pipeline
#1053
failed
4 years ago
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/it/inaf/oats/vospace/datamodel/NodeUtils.java
+60
-0
60 additions, 0 deletions
src/main/java/it/inaf/oats/vospace/datamodel/NodeUtils.java
with
60 additions
and
0 deletions
src/main/java/it/inaf/oats/vospace/datamodel/NodeUtils.java
+
60
−
0
View file @
dfa065b5
...
...
@@ -9,6 +9,9 @@ import java.util.Arrays;
import
java.util.List
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
import
net.ivoa.xml.vospace.v2.ContainerNode
;
import
net.ivoa.xml.vospace.v2.DataNode
;
import
net.ivoa.xml.vospace.v2.StructuredDataNode
;
public
class
NodeUtils
{
...
...
@@ -163,5 +166,62 @@ public class NodeUtils {
return
true
;
}
public
static
String
getDbNodeType
(
Node
node
)
{
if
(
node
instanceof
ContainerNode
)
{
return
"container"
;
}
else
if
(
node
instanceof
DataNode
)
{
return
"data"
;
}
throw
new
UnsupportedOperationException
(
"Unable to retrieve database node type for class "
+
node
.
getClass
().
getCanonicalName
());
}
public
static
String
getNodeName
(
String
path
)
{
String
[]
parsedPath
=
path
.
split
(
"/"
);
return
parsedPath
[
parsedPath
.
length
-
1
];
}
public
static
String
getNodeName
(
Node
myNode
)
{
String
uri
=
myNode
.
getUri
();
return
getNodeName
(
uri
);
}
public
static
boolean
getIsBusy
(
Node
myNode
)
{
if
(
myNode
instanceof
DataNode
)
{
DataNode
dataNode
=
(
DataNode
)
myNode
;
return
dataNode
.
isBusy
();
}
return
false
;
}
public
static
Node
getTypedNode
(
String
type
)
{
Node
node
;
switch
(
type
)
{
case
"container"
:
node
=
new
ContainerNode
();
break
;
case
"data"
:
node
=
new
DataNode
();
break
;
case
"structured"
:
node
=
new
StructuredDataNode
();
break
;
default
:
throw
new
UnsupportedOperationException
(
"Node type "
+
type
+
" not supported yet"
);
}
return
node
;
}
}
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