Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
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
Code review analytics
Issue 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
caosdb
Software
caosdb-server
Commits
ef44357e
Verified
Commit
ef44357e
authored
3 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
DOC: more code docs for the Job class
parent
560eb0a9
No related branches found
No related tags found
2 merge requests
!21
Release v0.4.0
,
!18
fix importance bug
Pipeline
#8886
passed
3 years ago
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/org/caosdb/server/database/proto/Rule.java
+0
-37
0 additions, 37 deletions
src/main/java/org/caosdb/server/database/proto/Rule.java
src/main/java/org/caosdb/server/jobs/Job.java
+36
-12
36 additions, 12 deletions
src/main/java/org/caosdb/server/jobs/Job.java
with
36 additions
and
49 deletions
src/main/java/org/caosdb/server/database/proto/Rule.java
deleted
100644 → 0
+
0
−
37
View file @
560eb0a9
///*
// * ** header v3.0
// * This file is a part of the CaosDB Project.
// *
// * Copyright (C) 2018 Research Group Biomedical Physics,
// * Max-Planck-Institute for Dynamics and Self-Organization Göttingen
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU Affero General Public License as
// * published by the Free Software Foundation, either version 3 of the
// * License, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU Affero General Public License for more details.
// *
// * You should have received a copy of the GNU Affero General Public License
// * along with this program. If not, see <https://www.gnu.org/licenses/>.
// *
// * ** end header
// */
//package org.caosdb.server.database.proto;
//
//import java.io.Serializable;
//import org.caosdb.server.jobs.core.JobFailureSeverity;
/
//public class Rule implements Serializable {
//
// private static final long serialVersionUID = 1122097540596265945L;
//
// public int domain = 0;
// public int entity = 0;
// public String job = null;
// public String transaction = null;
// public JobFailureSeverity severity = null;
//}
This diff is collapsed.
Click to expand it.
src/main/java/org/caosdb/server/jobs/Job.java
+
36
−
12
View file @
ef44357e
...
@@ -162,22 +162,37 @@ public abstract class Job {
...
@@ -162,22 +162,37 @@ public abstract class Job {
}
}
/**
/**
* This assumes that the parent has either an id (persistent or temporary) or a name.
* Check if an entity ('child') is a direct or indirect child of another
* entity ('targetParent').
*
*
* @param child
* This assumes that the parent has either an id (persistent or temporary) or
* @param parent
* a name.
* @return
*
* If the targetParent is not in the set of parents of the child, this method
* iterates through the direct parents of the child.
*
* If the both entities are part of this transaction, they are resolved within
* this transaction. Otherwise they are fetched from the database backend or
* the whole evaluation takes place in the backend (if both have persistent
* ids and are not part of this transaction).
*
* Also, if both entities have the same id or name, the return value is true.
*
* @param child the child entity
* @param targetParent the parent entity
* @return true iff targetParent is a direct or indirect parent of the child
* or when the ids or names match.
* @throws Message
* @throws Message
*/
*/
protected
final
boolean
isSubType
(
final
EntityInterface
child
,
final
EntityInterface
p
arent
)
protected
final
boolean
isSubType
(
final
EntityInterface
child
,
final
EntityInterface
targetP
arent
)
throws
EntityWasNotUniqueException
{
throws
EntityWasNotUniqueException
{
if
(
p
arent
.
hasId
())
{
if
(
targetP
arent
.
hasId
())
{
if
(
p
arent
.
getId
().
equals
(
child
.
getId
()))
{
if
(
targetP
arent
.
getId
().
equals
(
child
.
getId
()))
{
return
true
;
return
true
;
}
}
}
else
if
(
p
arent
.
hasName
())
{
}
else
if
(
targetP
arent
.
hasName
())
{
if
(
p
arent
.
getName
().
equals
(
child
.
getName
()))
{
if
(
targetP
arent
.
getName
().
equals
(
child
.
getName
()))
{
return
true
;
return
true
;
}
}
}
}
...
@@ -198,15 +213,15 @@ public abstract class Job {
...
@@ -198,15 +213,15 @@ public abstract class Job {
}
}
if
(
resolvedDirectParent
!=
null
)
{
if
(
resolvedDirectParent
!=
null
)
{
if
(
isSubType
(
resolvedDirectParent
,
p
arent
))
{
if
(
isSubType
(
resolvedDirectParent
,
targetP
arent
))
{
return
true
;
return
true
;
}
}
}
else
if
(
directParent
.
hasId
())
{
}
else
if
(
directParent
.
hasId
())
{
if
(
isValidSubType
(
directParent
.
getId
(),
p
arent
.
getId
()))
{
if
(
isValidSubType
(
directParent
.
getId
(),
targetP
arent
.
getId
()))
{
return
true
;
return
true
;
}
}
}
else
if
(
directParent
.
hasName
())
{
}
else
if
(
directParent
.
hasName
())
{
if
(
isValidSubType
(
resolve
(
directParent
).
getId
(),
p
arent
.
getId
()))
{
if
(
isValidSubType
(
resolve
(
directParent
).
getId
(),
targetP
arent
.
getId
()))
{
return
true
;
return
true
;
}
}
}
}
...
@@ -538,6 +553,15 @@ public abstract class Job {
...
@@ -538,6 +553,15 @@ public abstract class Job {
return
this
.
stage
;
return
this
.
stage
;
}
}
/**
* Resolve an entity (which might only be specified by it's name or id) to
* it's full representation (with properties, parents and all).
*
* @param entity the entity to be resolved.
* @return the resolved entity.
* @throws EntityWasNotUniqueException if the resolution failed due to
* ambuiguity of the name.
*/
protected
EntityInterface
resolve
(
final
EntityInterface
entity
)
protected
EntityInterface
resolve
(
final
EntityInterface
entity
)
throws
EntityWasNotUniqueException
{
throws
EntityWasNotUniqueException
{
EntityInterface
resolvedParent
=
null
;
EntityInterface
resolvedParent
=
null
;
...
...
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