Menu

#4 Use GraphRelationAccessor Interface to handle Resource graph manipulations

new
code-refactor
minor
all
Unassigned
2014-06-25
2014-06-25
Kevin Black
No

Use the GraphRelationAccessor Interface from DataProvider to handle Resource graph manipulations in all systems.

The GraphRelationAccessor was created to aid in testing the Resource core and utilities. It should now be incorporated into the Resource utilities. This will have several benefits:

  • reduce duplication for each type of relationship (sub, super, source, target)
  • make it easier to add/modify resource relations in the future
  • make the code more functional than object-oriented, more composition than inheritance which makes code more flexible and maintainable long-term

Trac #412.

Related

Tickets: #11

Discussion

  • Kevin Black

    Kevin Black - 2014-06-25
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,3 +1,8 @@
    -Use the GraphRelationAccessor Interface from DataProvider to handle Resource graph manipulations in both the server and client.
    +Use the GraphRelationAccessor Interface from DataProvider to handle Resource graph manipulations in all systems.
    +
    +The GraphRelationAccessor was created to aid in testing the Resource core and utilities. It should now be incorporated into the Resource utilities. This will have several benefits:
    +- reduce duplication for each type of relationship (sub, super, source, target)
    +- make it easier to add/modify resource relations in the future
    +- make the code more functional than object-oriented, more composition than inheritance which makes code more flexible and maintainable long-term
    
     Trac #412.
    
     
  • Kevin Black

    Kevin Black - 2014-06-25
    • System: server --> all
     
  • Kevin Black

    Kevin Black - 2014-06-25
    • assigned_to: Kevin Black
     
  • Kevin Black

    Kevin Black - 2014-06-25

    Commit 238. Ticket [Trac] #412 (in support of [Trac] #419). Extracted the breadth first graph traversal from ResourceUtils into BreadthFirstGraphTraverser. Calling that traverser strategy from ResourceUtils.visitResourceGraphBreadthFirst. Added GraphTraverser interface. Based GraphVisitor interface on ResourceUtils.ResourceVisitor. Moved Pair from orm.testutils.generate to util package and updated references to it. Added Range class in util package.

    Commit 239. Ticket [Trac] #412. Removed commented code and removed unnecessary final classifiers on the Integer parameters to ResourceUtils.visitResourceGraphBreadthFirst.

    Commit 240. Ticket [Trac] #412. Moved the start and end index calculations from ResourceUtils and BreadthFirstGraphTraverser to Range so that it wouldn't be duplicated.

    Commit 241. Ticket [Trac] #412. Added tests for the range start and end index calculations. Updated the start and end index calculations to be more robust."

    Commit 242. Ticket [Trac] #412. Added ensureNotRelated to the GraphRelationAccessor interface. Implemented the method in AbstractGraphRelationAccessor and SuperResourceRelationAccessor. Added tests for the method, including total removal of duplicated relations for sub, source, and target resource relationships.

    Commit 243. Ticket [Trac] #412. Added replace*End methods in GraphRelationAccessor and added implementation and tests. Updated ResourceUtils.replaceResourceInGraph to use the ResourceRelationAccessors.

    Commit 244. Ticket [Trac] #412 (in service of [Trac] #419). Added code to DataProviderRS.getSuperResources to try to replace all of the super Resource proxies with their implementations. What does not appear to work is serializing a Resource and its super. This needs to be tested out.

    Commit 245. Ticket [Trac] #412 (in service of [Trac] #419). Added code to try and explore what is being returned by getSuperResources.

     

    Last edit: Kevin Black 2014-06-25

Log in to post a comment.

MongoDB Logo MongoDB