Project

General

Profile

Actions

Architecture #2777

closed

Add Box in ReportsRepository method APIs

Added by François ARMAND over 12 years ago. Updated over 5 years ago.

Status:
Rejected
Priority:
3
Category:
Architecture - Code maintenance
Effort required:
Name check:
Fix check:
Regression:

Description

ReportsRepository method can fail, for example on a database connection problem.

That must be reflected in ReportsRepository method type with Box[...].

For example:

  def findReportsByNode(
      nodeId   : NodeId
    , ruleId   : RuleId
    , serial   : Int
    , beginDate: DateTime
    , endDate  : Option[DateTime]
  ): Seq[Reports]

Should be:

  def findReportsByNode(
      nodeId   : NodeId
    , ruleId   : RuleId
    , serial   : Int
    , beginDate: DateTime
    , endDate  : Option[DateTime]
  ): Box[Seq[Reports]]

Moreover, implementation of ReportsRepository like ReportsJdbcRepository must handle error case. Typically, ReportsJdbcRepository must boxes all call to "jdbcTemplate.query" in a try/catch.

See #2709 and commit 27ddf8848d448943a67d028025fb12c9bf533eee for a place where such a modification is important. That also means that DatabaseManager will have to be modified to remove the try/catch.

Actions

Also available in: Atom PDF