# WebReports.Api.Common

## ReportObjectFactory Class

The ReportObjectFactory class is the entry point to application report object manipulation. This factory manages access to reports via API, updating that report’s schedules when required (rename, delete), and creation of new reports. This class logically sits on top of ReportMgmtBase and ReportScheduler for higher level report management.

The ReportObjectFactory has the following properties:

- Active – The active report object. The active report object is whichever report was most recently created/loaded/deleted/etc.

The ReportObjectFactory has the following methods:

#### ReportObject Create(wrReportType reportType)

Description | Create a new report object, it has yet to be saved into the report repository
Remarks | The created report object is made the active report object on return. Both the Report class and the DashboardReport class inherit from ReportObject, a cast to the appropriate child class is required for more specific access to the report.

#### ReportObject LoadFromRepository(string name)

Description | Load an existing report object from the report repository.
Remarks | The loaded report object is made the active report object on return. Both the Report class and the DashboardReport class inherit from ReportObject, a cast to the appropriate child class is required for more specific access to the report.

#### void Delete(string name)

Description | Delete the provided report from the report repository.
Remarks | The deleted report object is made the active report object on return.

#### void Delete(ReportObject reportObject)

Description | Delete the provided report object the report repository.
Remarks | The deleted report object is made the active report object on return.

#### void Delete( )

Description | Delete the currently active report object from the report repository.

#### void Rename(string name, string newName)

Description | Rename the provided report in the report repository.
Remarks | The renamed report object is made the active report object on return.

#### void Rename(ReportObject reportObject, string newName)

Description | Rename the provided report object in the report repository.
Remarks | The renamed report object is made the active report object on return.

#### void Rename(string newName)

Description | Rename the currently active report object in the report repository.

#### void Copy(string name, string newName)

Description | Copy the provided report in the report repository to another location in the report repository.

#### void Copy(ReportObject reportObject, string newName)

Description | Copy the provided report object to another location in the report repository.

#### void SaveToRepository(ReportObject reportObject)

Description | Save the provided report object to the report repository. If it already exists it will be overwritten.

#### void SaveToApi(ReportObject reportObject)

Description | Save the provided report object to an API area which can be accessed by the application once it’s given control via Api.GetUrlParamString

## ReportObject Class

The ReportObject class is an abstract class that all report objects derive from. It contains all properties and methods that are common for any type of report within the application.

The ReportObject has the following properties:

- ExportType – This value indicates which format to export the report.
  - Uses the enumeration wrExportType (Html, Excel, Pdf, Rtf, Csv).
- IsEditAllowed – Boolean value. If False the report object cannot be edited because the active role does not have access to one or more elements defined in the report object.
- IsExecuteAllowed - Boolean value. If False the report cannot be executed because the active role does not permit access to one or more Data objects on the report.