Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
44524ba0
Commit
44524ba0
authored
Jan 17, 2022
by
Piotr Gawron
Browse files
propagate changes in interfaced
parent
bd159730
Pipeline
#51348
canceled with stage
in 52 minutes and 20 seconds
Changes
3
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
rest-api/src/main/java/lcsb/mapviewer/api/projects/ProjectRestImpl.java
View file @
44524ba0
This diff is collapsed.
Click to expand it.
rest-api/src/main/java/lcsb/mapviewer/api/projects/chemicals/ChemicalRestImpl.java
View file @
44524ba0
package
lcsb.mapviewer.api.projects.chemicals
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.TreeMap
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -12,7 +18,6 @@ import lcsb.mapviewer.annotation.data.Chemical;
import
lcsb.mapviewer.annotation.data.MeSH
;
import
lcsb.mapviewer.annotation.services.MeSHParser
;
import
lcsb.mapviewer.annotation.services.TaxonomyBackend
;
import
lcsb.mapviewer.annotation.services.annotators.AnnotatorException
;
import
lcsb.mapviewer.annotation.services.dapi.ChemicalSearchException
;
import
lcsb.mapviewer.api.BaseRestImpl
;
import
lcsb.mapviewer.api.ElementIdentifierType
;
...
...
@@ -41,13 +46,13 @@ public class ChemicalRestImpl extends BaseRestImpl {
private
MeSHParser
meSHParser
;
@Autowired
public
ChemicalRestImpl
(
IChemicalService
chemicalService
,
MeSHParser
meSHParser
,
IElementService
elementService
)
{
public
ChemicalRestImpl
(
final
IChemicalService
chemicalService
,
final
MeSHParser
meSHParser
,
final
IElementService
elementService
)
{
this
.
chemicalService
=
chemicalService
;
this
.
meSHParser
=
meSHParser
;
this
.
elementService
=
elementService
;
}
public
List
<
Map
<
String
,
Object
>>
getChemicalsByQuery
(
String
projectId
,
String
columns
,
String
query
)
public
List
<
Map
<
String
,
Object
>>
getChemicalsByQuery
(
final
String
projectId
,
final
String
columns
,
final
String
query
)
throws
QueryException
{
Project
project
=
getProjectService
().
getProjectByProjectId
(
projectId
);
if
(
project
==
null
)
{
...
...
@@ -74,70 +79,66 @@ public class ChemicalRestImpl extends BaseRestImpl {
return
result
;
}
protected
Map
<
String
,
Object
>
prepareChemical
(
Chemical
chemical
,
Set
<
String
>
columnsSet
,
Project
project
)
{
protected
Map
<
String
,
Object
>
prepareChemical
(
final
Chemical
chemical
,
final
Set
<
String
>
columnsSet
,
final
Project
project
)
{
Map
<
String
,
Object
>
result
=
new
TreeMap
<>();
String
description
=
"Mesh term not available"
;
List
<
String
>
synonyms
=
new
ArrayList
<>();
try
{
MeSH
mesh
=
meSHParser
.
getMeSH
(
chemical
.
getChemicalId
());
if
(
mesh
!=
null
)
{
description
=
mesh
.
getDescription
();
synonyms
=
mesh
.
getSynonyms
();
}
else
{
logger
.
warn
(
"Mesh used by chemical is invalid: "
+
chemical
.
getChemicalId
());
}
}
catch
(
AnnotatorException
e
)
{
logger
.
error
(
"Problem with accessing mesh database"
,
e
);
MeSH
mesh
=
meSHParser
.
getMeSH
(
chemical
.
getChemicalId
());
if
(
mesh
!=
null
)
{
description
=
mesh
.
getDescription
();
synonyms
=
mesh
.
getSynonyms
();
}
else
{
logger
.
warn
(
"Mesh used by chemical is invalid: "
+
chemical
.
getChemicalId
());
}
for
(
String
string
:
columnsSet
)
{
String
column
=
string
.
toLowerCase
();
Object
value
=
null
;
switch
(
column
)
{
case
"id"
:
case
"idobject"
:
value
=
chemical
.
getChemicalId
();
break
;
case
"name"
:
value
=
chemical
.
getChemicalName
();
break
;
case
"references"
:
List
<
Map
<
String
,
Object
>>
references
=
new
ArrayList
<>();
references
.
add
(
createAnnotation
(
chemical
.
getChemicalId
()));
if
(
chemical
.
getCasID
()
!=
null
)
{
references
.
add
(
createAnnotation
(
chemical
.
getCasID
()));
}
value
=
references
;
break
;
case
"directevidencereferences"
:
value
=
createAnnotations
(
chemical
.
getDirectEvidencePublication
());
break
;
case
"description"
:
value
=
description
;
break
;
case
"directevidence"
:
if
(
chemical
.
getDirectEvidence
()
!=
null
)
{
value
=
chemical
.
getDirectEvidence
().
getValue
();
}
break
;
case
"synonyms"
:
value
=
synonyms
;
break
;
case
"targets"
:
value
=
prepareTargets
(
chemical
.
getInferenceNetwork
(),
project
);
break
;
default
:
value
=
"Unknown column"
;
break
;
case
"id"
:
case
"idobject"
:
value
=
chemical
.
getChemicalId
();
break
;
case
"name"
:
value
=
chemical
.
getChemicalName
();
break
;
case
"references"
:
List
<
Map
<
String
,
Object
>>
references
=
new
ArrayList
<>();
references
.
add
(
createAnnotation
(
chemical
.
getChemicalId
()));
if
(
chemical
.
getCasID
()
!=
null
)
{
references
.
add
(
createAnnotation
(
chemical
.
getCasID
()));
}
value
=
references
;
break
;
case
"directevidencereferences"
:
value
=
createAnnotations
(
chemical
.
getDirectEvidencePublication
());
break
;
case
"description"
:
value
=
description
;
break
;
case
"directevidence"
:
if
(
chemical
.
getDirectEvidence
()
!=
null
)
{
value
=
chemical
.
getDirectEvidence
().
getValue
();
}
break
;
case
"synonyms"
:
value
=
synonyms
;
break
;
case
"targets"
:
value
=
prepareTargets
(
chemical
.
getInferenceNetwork
(),
project
);
break
;
default
:
value
=
"Unknown column"
;
break
;
}
result
.
put
(
string
,
value
);
}
return
result
;
}
protected
Set
<
String
>
createChemicalColumnSet
(
String
columns
)
{
protected
Set
<
String
>
createChemicalColumnSet
(
final
String
columns
)
{
Set
<
String
>
columnsSet
=
new
LinkedHashSet
<>();
if
(
columns
.
equals
(
""
))
{
columnsSet
.
addAll
(
getAvailableChemicalColumns
());
...
...
@@ -147,8 +148,8 @@ public class ChemicalRestImpl extends BaseRestImpl {
return
columnsSet
;
}
public
List
<
Map
<
String
,
Object
>>
getChemicalsByTarget
(
String
projectId
,
String
targetType
,
String
targetId
,
String
columns
)
throws
QueryException
{
public
List
<
Map
<
String
,
Object
>>
getChemicalsByTarget
(
final
String
projectId
,
final
String
targetType
,
final
String
targetId
,
final
String
columns
)
throws
QueryException
{
Project
project
=
getProjectService
().
getProjectByProjectId
(
projectId
);
if
(
project
==
null
)
{
throw
new
ObjectNotFoundException
(
"Project with given id doesn't exist"
);
...
...
@@ -184,7 +185,7 @@ public class ChemicalRestImpl extends BaseRestImpl {
return
result
;
}
public
List
<
String
>
getSuggestedQueryList
(
String
projectId
)
throws
ChemicalSearchException
,
ObjectNotFoundException
{
public
List
<
String
>
getSuggestedQueryList
(
final
String
projectId
)
throws
ChemicalSearchException
,
ObjectNotFoundException
{
Project
project
=
getProjectService
().
getProjectByProjectId
(
projectId
);
if
(
project
==
null
)
{
throw
new
ObjectNotFoundException
(
"Project with given id doesn't exist: "
+
projectId
);
...
...
service/src/main/java/lcsb/mapviewer/services/impl/ProjectService.java
View file @
44524ba0
package
lcsb.mapviewer.services.impl
;
import
java.io.*
;
import
java.util.*
;
import
java.io.ByteArrayInputStream
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Queue
;
import
java.util.Set
;
import
java.util.concurrent.CountDownLatch
;
import
javax.mail.MessagingException
;
...
...
@@ -17,27 +29,59 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
lcsb.mapviewer.annotation.services.*
;
import
lcsb.mapviewer.annotation.services.annotators.AnnotatorException
;
import
lcsb.mapviewer.annotation.services.MeSHParser
;
import
lcsb.mapviewer.annotation.services.ModelAnnotator
;
import
lcsb.mapviewer.annotation.services.ProblematicAnnotation
;
import
lcsb.mapviewer.annotation.services.TaxonomyBackend
;
import
lcsb.mapviewer.annotation.services.TaxonomySearchException
;
import
lcsb.mapviewer.annotation.services.annotators.ElementAnnotator
;
import
lcsb.mapviewer.commands.*
;
import
lcsb.mapviewer.common.*
;
import
lcsb.mapviewer.commands.ClearColorModelCommand
;
import
lcsb.mapviewer.commands.CommandExecutionException
;
import
lcsb.mapviewer.commands.CopyCommand
;
import
lcsb.mapviewer.commands.CreateHierarchyCommand
;
import
lcsb.mapviewer.commands.SetFixedHierarchyLevelCommand
;
import
lcsb.mapviewer.common.IProgressUpdater
;
import
lcsb.mapviewer.common.MinervaLoggerAppender
;
import
lcsb.mapviewer.common.Pair
;
import
lcsb.mapviewer.common.exception.InvalidArgumentException
;
import
lcsb.mapviewer.converter.*
;
import
lcsb.mapviewer.converter.ColorSchemaReader
;
import
lcsb.mapviewer.converter.ComplexZipConverter
;
import
lcsb.mapviewer.converter.ComplexZipConverterParams
;
import
lcsb.mapviewer.converter.Converter
;
import
lcsb.mapviewer.converter.ConverterException
;
import
lcsb.mapviewer.converter.ConverterParams
;
import
lcsb.mapviewer.converter.InvalidInputDataExecption
;
import
lcsb.mapviewer.converter.ProjectFactory
;
import
lcsb.mapviewer.converter.graphics.DrawingException
;
import
lcsb.mapviewer.converter.graphics.MapGenerator
;
import
lcsb.mapviewer.converter.graphics.MapGenerator.MapGeneratorParams
;
import
lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser
;
import
lcsb.mapviewer.converter.zip.ZipEntryFile
;
import
lcsb.mapviewer.model.*
;
import
lcsb.mapviewer.model.IgnoredLogMarker
;
import
lcsb.mapviewer.model.LogMarker
;
import
lcsb.mapviewer.model.Project
;
import
lcsb.mapviewer.model.ProjectLogEntry
;
import
lcsb.mapviewer.model.ProjectLogEntryType
;
import
lcsb.mapviewer.model.ProjectStatus
;
import
lcsb.mapviewer.model.cache.UploadedFileEntry
;
import
lcsb.mapviewer.model.map.*
;
import
lcsb.mapviewer.model.map.layout.*
;
import
lcsb.mapviewer.model.map.BioEntity
;
import
lcsb.mapviewer.model.map.MiriamData
;
import
lcsb.mapviewer.model.map.MiriamType
;
import
lcsb.mapviewer.model.map.layout.ProjectBackground
;
import
lcsb.mapviewer.model.map.layout.ProjectBackgroundImageLayer
;
import
lcsb.mapviewer.model.map.layout.ProjectBackgroundStatus
;
import
lcsb.mapviewer.model.map.layout.graphics.Layer
;
import
lcsb.mapviewer.model.map.model.*
;
import
lcsb.mapviewer.model.map.model.Model
;
import
lcsb.mapviewer.model.map.model.ModelData
;
import
lcsb.mapviewer.model.map.model.ModelSubmodelConnection
;
import
lcsb.mapviewer.model.overlay.DataOverlay
;
import
lcsb.mapviewer.model.overlay.InvalidDataOverlayException
;
import
lcsb.mapviewer.model.user.*
;
import
lcsb.mapviewer.model.user.ConfigurationElementType
;
import
lcsb.mapviewer.model.user.User
;
import
lcsb.mapviewer.model.user.UserAnnotationSchema
;
import
lcsb.mapviewer.model.user.UserClassAnnotators
;
import
lcsb.mapviewer.model.user.UserClassRequiredAnnotations
;
import
lcsb.mapviewer.model.user.UserClassValidAnnotations
;
import
lcsb.mapviewer.model.user.annotator.AnnotatorData
;
import
lcsb.mapviewer.modelutils.map.ClassTreeNode
;
import
lcsb.mapviewer.modelutils.map.ElementUtils
;
...
...
@@ -47,7 +91,11 @@ import lcsb.mapviewer.persist.dao.ProjectDao;
import
lcsb.mapviewer.persist.dao.map.ModelDao
;
import
lcsb.mapviewer.persist.dao.map.ProjectBackgroundDao
;
import
lcsb.mapviewer.persist.dao.user.UserDao
;
import
lcsb.mapviewer.services.interfaces.*
;
import
lcsb.mapviewer.services.interfaces.ICommentService
;
import
lcsb.mapviewer.services.interfaces.IConfigurationService
;
import
lcsb.mapviewer.services.interfaces.IModelService
;
import
lcsb.mapviewer.services.interfaces.IProjectService
;
import
lcsb.mapviewer.services.interfaces.IUserService
;
import
lcsb.mapviewer.services.overlay.AnnotatedObjectTreeRow
;
import
lcsb.mapviewer.services.search.chemical.IChemicalService
;
import
lcsb.mapviewer.services.search.drug.IDrugService
;
...
...
@@ -158,21 +206,21 @@ public class ProjectService implements IProjectService {
private
MapGenerator
generator
=
new
MapGenerator
();
@Autowired
public
ProjectService
(
ProjectDao
projectDao
,
ModelDao
modelDao
,
UserDao
userDao
,
IModelService
modelService
,
ICommentService
commentService
,
IConfigurationService
configurationService
,
IUserService
userService
,
IChemicalService
chemicalService
,
IDrugService
drugService
,
IMiRNAService
mirnaService
,
ModelAnnotator
modelAnnotator
,
DbUtils
dbUtils
,
MeSHParser
meshParser
,
TaxonomyBackend
taxonomyBackend
,
ProjectBackgroundDao
projectBackgroundDao
)
{
public
ProjectService
(
final
ProjectDao
projectDao
,
final
ModelDao
modelDao
,
final
UserDao
userDao
,
final
IModelService
modelService
,
final
ICommentService
commentService
,
final
IConfigurationService
configurationService
,
final
IUserService
userService
,
final
IChemicalService
chemicalService
,
final
IDrugService
drugService
,
final
IMiRNAService
mirnaService
,
final
ModelAnnotator
modelAnnotator
,
final
DbUtils
dbUtils
,
final
MeSHParser
meshParser
,
final
TaxonomyBackend
taxonomyBackend
,
final
ProjectBackgroundDao
projectBackgroundDao
)
{
this
.
projectDao
=
projectDao
;
this
.
modelDao
=
modelDao
;
this
.
userDao
=
userDao
;
...
...
@@ -191,12 +239,12 @@ public class ProjectService implements IProjectService {
}
@Override
public
Project
getProjectByProjectId
(
String
name
)
{
public
Project
getProjectByProjectId
(
final
String
name
)
{
return
projectDao
.
getProjectByProjectId
(
name
);
}
@Override
public
boolean
projectExists
(
String
projectName
)
{
public
boolean
projectExists
(
final
String
projectName
)
{
if
(
projectName
==
null
||
projectName
.
equals
(
""
))
{
return
false
;
}
...
...
@@ -457,7 +505,7 @@ public class ProjectService implements IProjectService {
}
@Override
public
TreeNode
createClassAnnotatorTree
(
User
user
)
{
public
TreeNode
createClassAnnotatorTree
(
final
User
user
)
{
UserAnnotationSchema
annotationSchema
=
prepareUserAnnotationSchema
(
user
);
...
...
@@ -517,8 +565,8 @@ public class ProjectService implements IProjectService {
}
@Override
public
void
updateClassAnnotatorTreeForUser
(
User
user
,
TreeNode
annotatorsTree
,
boolean
sbgnFormat
,
boolean
networkBackgroundAsDefault
)
{
public
void
updateClassAnnotatorTreeForUser
(
final
User
user
,
final
TreeNode
annotatorsTree
,
final
boolean
sbgnFormat
,
final
boolean
networkBackgroundAsDefault
)
{
User
dbUser
=
userDao
.
getById
(
user
.
getId
());
if
(
dbUser
.
getAnnotationSchema
()
==
null
)
{
dbUser
.
setAnnotationSchema
(
new
UserAnnotationSchema
());
...
...
@@ -544,7 +592,7 @@ public class ProjectService implements IProjectService {
}
@Override
public
void
updateProject
(
Project
project
)
{
public
void
updateProject
(
final
Project
project
)
{
projectDao
.
update
(
project
);
}
...
...
@@ -555,7 +603,8 @@ public class ProjectService implements IProjectService {
* for this users {@link UserAnnotationSchema} will be prepared
* @return {@link UserAnnotationSchema} for {@link User}
*/
public
UserAnnotationSchema
prepareUserAnnotationSchema
(
User
user
)
{
@Override
public
UserAnnotationSchema
prepareUserAnnotationSchema
(
final
User
user
)
{
UserAnnotationSchema
annotationSchema
=
null
;
if
(
user
!=
null
)
{
annotationSchema
=
userDao
.
getById
(
user
.
getId
()).
getAnnotationSchema
();
...
...
@@ -599,14 +648,14 @@ public class ProjectService implements IProjectService {
/**
* When we encountered hibernate exception we need to handle error reporting
* differently (hibernate session is broken). This method handles such case
when
* hibernate exception occurred when removing project.
* differently (hibernate session is broken). This method handles such case
*
when
hibernate exception occurred when removing project.
*
* @param originalProject
* project that was being removed
* @param exception
*/
protected
void
handleHibernateExceptionRemovingReporting
(
Project
originalProject
,
PersistenceException
exception
)
{
protected
void
handleHibernateExceptionRemovingReporting
(
final
Project
originalProject
,
final
PersistenceException
exception
)
{
// we need to open separate thread because current one thrown db exception
// and transaction is corrupted and will be rolledback
Thread
reportInSeparateThread
=
new
Thread
(
new
Runnable
()
{
...
...
@@ -667,7 +716,7 @@ public class ProjectService implements IProjectService {
final
double
finalSize
=
projectSize
;
IProgressUpdater
updater
=
new
IProgressUpdater
()
{
@Override
public
void
setProgress
(
double
progress
)
{
public
void
setProgress
(
final
double
progress
)
{
updateProjectStatus
(
project
,
ProjectStatus
.
GENERATING_IMAGES
,
IProgressUpdater
.
MAX_PROGRESS
*
imgCounter
/
finalSize
+
progress
/
finalSize
,
params
);
}
...
...
@@ -677,8 +726,8 @@ public class ProjectService implements IProjectService {
}
}
private
void
generateImagesForBuiltInBackground
(
final
CreateProjectParams
params
,
ProjectBackground
background
,
IProgressUpdater
updater
)
throws
CommandExecutionException
,
IOException
,
DrawingException
{
private
void
generateImagesForBuiltInBackground
(
final
CreateProjectParams
params
,
final
ProjectBackground
background
,
final
IProgressUpdater
updater
)
throws
CommandExecutionException
,
IOException
,
DrawingException
{
for
(
ProjectBackgroundImageLayer
imageLayer
:
background
.
getProjectBackgroundImageLayer
())
{
String
directory
=
imageLayer
.
getDirectory
();
Model
model
=
imageLayer
.
getModel
().
getModel
();
...
...
@@ -710,7 +759,7 @@ public class ProjectService implements IProjectService {
* @throws InvalidDataOverlayException
* @throws IOException
*/
protected
void
createModel
(
final
CreateProjectParams
params
,
Project
dbProject
)
protected
void
createModel
(
final
CreateProjectParams
params
,
final
Project
dbProject
)
throws
InvalidInputDataExecption
,
ConverterException
,
IOException
,
InvalidDataOverlayException
{
User
dbUser
=
userDao
.
getById
(
params
.
getUser
().
getId
());
UserAnnotationSchema
userAnnotationSchema
=
dbUser
.
getAnnotationSchema
();
...
...
@@ -887,7 +936,7 @@ public class ProjectService implements IProjectService {
}
}
private
void
assignZoomLevelDataToModel
(
Model
topModel
)
throws
InvalidInputDataExecption
{
private
void
assignZoomLevelDataToModel
(
final
Model
topModel
)
throws
InvalidInputDataExecption
{
Integer
maxZoomLevels
=
Integer
.
parseInt
(
configurationService
.
getValue
(
ConfigurationElementType
.
MAX_NUMBER_OF_MAP_LEVELS
).
getValue
());
...
...
@@ -913,7 +962,7 @@ public class ProjectService implements IProjectService {
* @param params
* parameters used for project creation
*/
private
void
updateProjectStatus
(
Project
project
,
ProjectStatus
status
,
double
progress
,
CreateProjectParams
params
)
{
private
void
updateProjectStatus
(
final
Project
project
,
final
ProjectStatus
status
,
final
double
progress
,
final
CreateProjectParams
params
)
{
if
(
project
!=
null
)
{
if
(!
status
.
equals
(
project
.
getStatus
())
||
(
Math
.
abs
(
progress
-
project
.
getProgress
())
>
IProgressUpdater
.
PROGRESS_BAR_UPDATE_RESOLUTION
))
{
...
...
@@ -941,20 +990,20 @@ public class ProjectService implements IProjectService {
private
void
cacheData
(
final
Model
originalModel
,
final
CreateProjectParams
params
)
{
modelService
.
cacheAllPubmedIds
(
originalModel
,
new
IProgressUpdater
()
{
@Override
public
void
setProgress
(
double
progress
)
{
public
void
setProgress
(
final
double
progress
)
{
updateProjectStatus
(
originalModel
.
getProject
(),
ProjectStatus
.
CACHING
,
progress
,
params
);
}
});
modelService
.
cacheAllMiriamLinks
(
originalModel
,
new
IProgressUpdater
()
{
@Override
public
void
setProgress
(
double
progress
)
{
public
void
setProgress
(
final
double
progress
)
{
updateProjectStatus
(
originalModel
.
getProject
(),
ProjectStatus
.
CACHING_MIRIAM
,
progress
,
params
);
}
});
chemicalService
.
cacheDataForModel
(
originalModel
,
new
IProgressUpdater
()
{
@Override
public
void
setProgress
(
double
progress
)
{
public
void
setProgress
(
final
double
progress
)
{
updateProjectStatus
(
originalModel
.
getProject
(),
ProjectStatus
.
CACHING_CHEMICAL
,
progress
,
params
);
}
...
...
@@ -962,14 +1011,14 @@ public class ProjectService implements IProjectService {
drugService
.
cacheDataForModel
(
originalModel
,
new
IProgressUpdater
()
{
@Override
public
void
setProgress
(
double
progress
)
{
public
void
setProgress
(
final
double
progress
)
{
updateProjectStatus
(
originalModel
.
getProject
(),
ProjectStatus
.
CACHING_DRUG
,
progress
,
params
);
}
});
mirnaService
.
cacheDataForModel
(
originalModel
,
new
IProgressUpdater
()
{
@Override
public
void
setProgress
(
double
progress
)
{
public
void
setProgress
(
final
double
progress
)
{
updateProjectStatus
(
originalModel
.
getProject
(),
ProjectStatus
.
CACHING_MI_RNA
,
progress
,
params
);
}
});
...
...
@@ -989,7 +1038,7 @@ public class ProjectService implements IProjectService {
* the projectDao to set
* @see #projectDao
*/
public
void
setProjectDao
(
ProjectDao
projectDao
)
{
public
void
setProjectDao
(
final
ProjectDao
projectDao
)
{
this
.
projectDao
=
projectDao
;
}
...
...
@@ -1007,7 +1056,7 @@ public class ProjectService implements IProjectService {
.
findImproperAnnotations
(
originalModel
,
new
IProgressUpdater
()
{
@Override
public
void
setProgress
(
double
progress
)
{
public
void
setProgress
(
final
double
progress
)
{
updateProjectStatus
(
originalModel
.
getProject
(),
ProjectStatus
.
VALIDATING_MIRIAM
,
progress
,
params
);
}
},
params
.
getValidAnnotations
());
...
...
@@ -1036,7 +1085,7 @@ public class ProjectService implements IProjectService {
* @throws MessagingException
* thrown when there is a problem with sending email
*/
protected
void
sendSuccesfullRemoveEmail
(
String
projectId
,
String
email
)
throws
MessagingException
{
protected
void
sendSuccesfullRemoveEmail
(
final
String
projectId
,
final
String
email
)
throws
MessagingException
{
EmailSender
emailSender
=
new
EmailSender
(
configurationService
);
emailSender
.
sendEmail
(
"Minerva notification"
,
"Map "
+
projectId
+
" was successfully removed.<br/>"
,
email
);
}
...
...
@@ -1051,7 +1100,7 @@ public class ProjectService implements IProjectService {
* @param e
* exception that caused problem
*/
private
void
sendUnsuccesfullEmail
(
String
projectName
,
String
email
,
Throwable
e
)
{
private
void
sendUnsuccesfullEmail
(
final
String
projectName
,
final
String
email
,
final
Throwable
e
)
{
EmailSender
emailSender
=
new
EmailSender
(
configurationService
);
StringBuilder
content
=
new
StringBuilder
(
""
);
content
.
append
(
"There was a problem with generating "
).
append
(
projectName
).
append
(
" map.<br/>"
);
...
...
@@ -1071,7 +1120,7 @@ public class ProjectService implements IProjectService {
* @throws MessagingException
* exception thrown when there is a problem with sending email
*/
protected
void
sendSuccesfullEmail
(
Model
originalModel
)
throws
MessagingException
{
protected
void
sendSuccesfullEmail
(
final
Model
originalModel
)
throws
MessagingException
{
EmailSender
emailSender
=
new
EmailSender
(
configurationService
);
emailSender
.
sendEmail
(
"Minerva notification"
,
"Your map "
+
originalModel
.
getProject
().
getProjectId
()
+
" was generated successfully.<br/>"
,
...
...
@@ -1087,7 +1136,7 @@ public class ProjectService implements IProjectService {
* @param e
* exception that occurred during uploading of the project
*/
private
void
handleHibernateExceptionReporting
(
CreateProjectParams
params
,
PersistenceException
e
)
{
private
void
handleHibernateExceptionReporting
(
final
CreateProjectParams
params
,
final
PersistenceException
e
)
{
// we need to open separate thread because current one thrown db exception
// and transaction is corrupted and will be rolledback
Thread
reportInSeparateThread
=
new
Thread
(
new
Runnable
()
{
...
...
@@ -1129,7 +1178,7 @@ public class ProjectService implements IProjectService {
* @param e
* exception that caused problems
*/
private
void
handleCreateProjectException
(
final
CreateProjectParams
params
,
Throwable
e
)
{
private
void
handleCreateProjectException
(
final
CreateProjectParams
params
,
final
Throwable
e
)
{
logger
.
error
(
"Problem with uploading project "
+
params
.
getProjectId
(),
e
);
Project
p
=
projectDao
.
getProjectByProjectId
(
params
.
getProjectId
());
if
(
p
!=
null
)
{
...
...
@@ -1169,14 +1218,10 @@ public class ProjectService implements IProjectService {
if
(
params
.
getOrganism
()
!=
null
&&
!
params
.
getOrganism
().
isEmpty
())
{
organism
=
new
MiriamData
(
MiriamType
.
TAXONOMY
,
params
.
getOrganism
());
}
try
{
if
(
meshParser
.
isValidMeshId
(
disease
))
{
project
.
setDisease
(
disease
);
}
else
{
logger
.
warn
(
"No valid disease is provided for project:"
+
project
.
getName
());
}
}
catch
(
AnnotatorException
e1
)
{
logger
.
warn
(
"Problem with accessing mesh db. More info in logs."
,
e1
);
if
(
meshParser
.
isValidMeshId
(
disease
))
{
project
.
setDisease
(
disease
);
}
else
{
logger
.
warn
(
"No valid disease is provided for project:"
+
project
.
getName
());
}
try
{
...
...
@@ -1194,7 +1239,7 @@ public class ProjectService implements IProjectService {
return
project
;
}
Set
<
ProjectLogEntry
>
createLogEntries
(
MinervaLoggerAppender
appender
)
{
Set
<
ProjectLogEntry
>
createLogEntries
(
final
MinervaLoggerAppender
appender
)
{
Set
<
ProjectLogEntry
>
result
=
new
HashSet
<>();
for
(
LogEvent
event
:
appender
.
getWarnings
())
{
result
.
add
(
createLogEntry
(
"WARNING"
,
event
));
...
...
@@ -1206,7 +1251,7 @@ public class ProjectService implements IProjectService {
return
result
;
}
private
ProjectLogEntry
createLogEntry
(
String
severity
,
LogEvent
event
)
{
private
ProjectLogEntry
createLogEntry
(
final
String
severity
,
final
LogEvent
event
)
{
if
(
event
.
getMarker
()
instanceof
IgnoredLogMarker
)
{
return
null
;
}
...
...
@@ -1225,7 +1270,7 @@ public class ProjectService implements IProjectService {
return
entry
;
}
void
fixProjectIssues
(
Project
project
)
{
void
fixProjectIssues
(
final
Project
project
)
{
ObjectValidator
validator
=
new
ObjectValidator
();
List
<
Pair
<
Object
,
String
>>
issues
=
validator
.
getValidationIssues
(
project
);
if
(
issues
.
size
()
>
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment