Make method `getReportPrefix(Report)` simpler

This commit is contained in:
Keir Nellyer 2016-07-07 21:05:41 -04:00
parent 8d2916c23e
commit b9f1dcbcd5
1 changed files with 3 additions and 9 deletions

View File

@ -395,16 +395,10 @@ public class ReportManager
*/
public static String getReportPrefix(Report report)
{
Optional<Long> reportIdOptional = report.getId();
long reportId = report.getId().orElseThrow(() ->
new IllegalStateException("Report has not yet been assigned an id."));
if (reportIdOptional.isPresent())
{
return getReportPrefix(reportIdOptional.get());
}
else
{
throw new IllegalStateException("Report has not yet been assigned an id.");
}
return getReportPrefix(reportId);
}
/**