Skip to content
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

Delete event and annotations #330

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Delete event and annotations #330

wants to merge 14 commits into from

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 <[email protected]>
Signed-off-by: renaud colin <[email protected]>
Signed-off-by: renaud colin <[email protected]>
Signed-off-by: renaud colin <[email protected]>
from a DeleteDTO and a Rdf4jDAO.

Signed-off-by: renaud colin <[email protected]>
@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 <[email protected]>
object creation

Signed-off-by: renaud colin <[email protected]>
Copy link
Member

@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);
Copy link
Member

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);
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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);
Copy link
Member

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;
}
Copy link
Member

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;
Copy link
Member

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 {
Copy link
Member

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