-
Notifications
You must be signed in to change notification settings - Fork 26
Delete event and annotations #330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Delete event and annotations #330
Conversation
the connection is in a good state. Signed-off-by: renaud colin <renaud.colin@inra.fr>
Signed-off-by: renaud colin <renaud.colin@inra.fr>
Signed-off-by: renaud colin <renaud.colin@inra.fr>
Signed-off-by: renaud colin <renaud.colin@inra.fr>
Signed-off-by: renaud colin <renaud.colin@inra.fr>
from a DeleteDTO and a Rdf4jDAO. Signed-off-by: renaud colin <renaud.colin@inra.fr>
Signed-off-by: renaud colin <renaud.colin@inra.fr>
Signed-off-by: renaud colin <renaud.colin@inra.fr>
Signed-off-by: renaud colin <renaud.colin@inra.fr>
var args in order to create event(s) and/or annotation(s) Signed-off-by: renaud colin <renaud.colin@inra.fr>
object creation Signed-off-by: renaud colin <renaud.colin@inra.fr>
vincentmigot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commentaire général:
- Attention à l'indentation
- Déclarer les variables une par une avec des noms significatif où au pire un commentaire expliquant à quoi elle correspondent
- Commentaire javadoc
- Commentaire plutôt sur leur lignes qu'à la fin
| Node s = NodeFactory.createVariable("s"), s2 = NodeFactory.createVariable("s2"), s3 = NodeFactory.createVariable("s3"), | ||
| p = NodeFactory.createVariable("p"), o = NodeFactory.createVariable("o"), | ||
| oaTargetPred = NodeFactory.createURI(Oa.RELATION_HAS_TARGET.toString()), | ||
| annotationNode = NodeFactory.createURI(annotationUri); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Une variable par ligne
| Node s = NodeFactory.createVariable("s"), | ||
| p = NodeFactory.createVariable("p"), | ||
| p2 = NodeFactory.createVariable("p2"), | ||
| o = NodeFactory.createVariable("o"), | ||
| annotationNode = NodeFactory.createURI(annotationUri); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Une variable par ligne
| update.execute(); // first delete all annotation which has the annotationUri as target | ||
| update = conn.prepareUpdate(QueryLanguage.SPARQL,removeAnnotationQuery); | ||
| update.execute(); // then delete the annotation itself |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Met les commentaires sur leur propre ligne
|
|
||
| AnnotationDAO annotationDAO = new AnnotationDAO(user); | ||
| RepositoryConnection conn = getConnection(); | ||
| annotationDAO.setConnection(conn); // make sure the two DAO use the same connection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commentaire sur sa ligne propre
| throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
| public void delete(List<Event> events) throws DAOPersistenceException, Exception { | ||
|
|
||
| List<String> uris = events.stream().map(event -> event.getUri()) // get all events URIs into an ArrayList via Stream API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commentaire sur sa ligne propre
| commitTransaction(); | ||
| } catch (RepositoryException | UpdateExecutionException e) { | ||
| rollbackTransaction(); | ||
| returnedException = new DAOPersistenceException(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw DAOEX...
| finally { | ||
| if(returnedException != null) | ||
| throw returnedException; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A supprimer
| returnedException = new DAOPersistenceException(e); | ||
| } catch(Exception e) { | ||
| rollbackTransaction(); | ||
| returnedException = e; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idem throw et explique la différence entre les deux catch
phis2-ws/src/main/java/opensilex/service/resource/AnnotationResourceService.java
Show resolved
Hide resolved
| /** | ||
| * Try to delete an annotation about one event | ||
| */ | ||
| void test_delete_annotation() throws DAOPersistenceException, Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lowerCamelCase
Improve corresponding Services and unit tests documentation and code style.
…ions Signed-off-by: renaud colin <renaud.colin@inra.fr>
- Should be merged after #329 since basic class for RDf4jDAO test in present in #329.
Branch content :