Skip to content

Conversation

@colinRenaud
Copy link
Contributor

- Should be merged after #329 since basic class for RDf4jDAO test in present in #329.

Branch content :

  • Delete method into the Rd4j DAO
  • implementation for the Event and the Annotation DAO(s).
  • Implementation of DELETE for the EventResourceService and the AnnotationResourceService using corresponding DAO(s).

renaud colin added 9 commits December 4, 2019 11:48
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>
@vincentmigot vincentmigot requested review from vincentmigot and removed request for vincentmigot December 4, 2019 13:22
renaud colin added 2 commits December 4, 2019 15:33
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>
Copy link

@vincentmigot vincentmigot left a 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

Comment on lines 534 to 537
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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Une variable par ligne

Comment on lines 569 to 573
Node s = NodeFactory.createVariable("s"),
p = NodeFactory.createVariable("p"),
p2 = NodeFactory.createVariable("p2"),
o = NodeFactory.createVariable("o"),
annotationNode = NodeFactory.createURI(annotationUri);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Une variable par ligne

Comment on lines 596 to 598
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

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

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

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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw DAOEX...

Comment on lines 654 to 657
finally {
if(returnedException != null)
throw returnedException;
}

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;

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

/**
* Try to delete an annotation about one event
*/
void test_delete_annotation() throws DAOPersistenceException, Exception {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lowerCamelCase

renaud colin added 2 commits December 13, 2019 00:52
…ions

Signed-off-by: renaud colin <renaud.colin@inra.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants