001: /**********************************************************************************
002: * $URL:https://source.sakaiproject.org/svn/osp/trunk/reports/api/src/java/org/theospi/portfolio/reports/model/ReportsManager.java $
003: * $Id:ReportsManager.java 9134 2006-05-08 20:28:42Z chmaurer@iupui.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.theospi.portfolio.reports.model;
021:
022: import org.quartz.Job;
023: import org.quartz.JobDetail;
024: import org.sakaiproject.exception.ImportException;
025: import org.sakaiproject.exception.UnsupportedFileTypeException;
026: import org.sakaiproject.metaobj.shared.DownloadableManager;
027: import org.sakaiproject.metaobj.shared.model.Id;
028:
029: import javax.sql.DataSource;
030: import java.io.IOException;
031: import java.util.List;
032: import java.util.Map;
033:
034: public interface ReportsManager extends DownloadableManager, Job {
035: public static final String RESULTS_ID = "reportResultsId";
036: public static final String EXPORT_XSL_ID = "reportExportId";
037: public static final String reportGroup = "REPORTS";
038:
039: public static final String REPORTS_MESSAGE_BUNDLE = "org.theospi.portfolio.reports.bundle.Messages";
040:
041: /**
042: * Sets the list of ReportDefinitions. It also iterates through the list
043: * and tells the report definition to complete it's loading.
044: * @param reportDefinitions List of reportDefinitions
045: */
046: public void setReportDefinitions(List reportdefs);
047:
048: /**
049: * Returns the ReportDefinitions. The list returned is filtered
050: * for the worksite type against the report types
051: * @return List of ReportDefinitions
052: */
053: public List getReportDefinitions();
054:
055: /**
056: * Creates parameters in the report linked to the parameters in the report definition
057: *
058: * @param report a Collection of ReportParam
059: */
060: public void createReportParameters(Report report);
061:
062: /**
063: * Creates a new blank Report based on a report definition
064: *
065: * @param reportDefinition a Collection of ReportParam
066: */
067: public Report createReport(ReportDefinition reportDefinition);
068:
069: /**
070: * runs a report and creates a ReportResult. The parameters were
071: * verified on the creation of this report object.
072: * @return ReportResult
073: */
074: public ReportResult generateResults(Report report);
075:
076: /**
077: * Replaces the the system value proxy with the values.
078: * The list of system value proxies(without quote characters):
079: * "{userid}", "{userdisplayname}", "{useremail}",
080: * "{userfirstname}", "{userlastname}", "{worksiteid}",
081: * "{toolid}",
082: * @param inString
083: * @return String with replaced values
084: */
085: public String replaceSystemValues(String inString);
086:
087: /**
088: * gathers the data for dropdown/list box. It runs the query defined in the report param
089: * ane creates a string in the format "[value1, value2, value3, ...]" or
090: * "[(value1; title1), (value2; title2), (value3; title3), ...]"
091: * @return String
092: */
093: public String generateSQLParameterValue(ReportParam reportParam);
094:
095: /**
096: * Takes a report result and an xsl and transforms the results
097: * @param reportResult ReportResult
098: * @param xslFile String to xsl resource
099: * @return String
100: */
101: public String transform(ReportResult result, ReportXsl reportXsl);
102:
103: /**
104: * saves the report into the database
105: * @param result
106: */
107: public void saveReport(Report report);
108:
109: /**
110: * saves the embedded report and then saves the report result
111: * @param result
112: */
113: public void saveReportResult(ReportResult result);
114:
115: /**
116: * this gets the list of report results that a user can view.
117: * If the user has permissions to run or view reports,
118: * then this grabs the ReportResults
119: * If the user has permissions to run reports,
120: * then this grabs the Live Reports
121: *
122: * @return List of ReportResult objects
123: */
124: public List getCurrentUserResults();
125:
126: /**
127: * Reloads a ReportResult. During the loading process it loads the
128: * report from which the ReportResult is derived, It links the report to
129: * the report definition, and sets the report in the report result.
130: * @param ReportResult result
131: * @return ReportResult
132: */
133: public ReportResult loadResult(ReportResult result);
134:
135: /**
136: * Generates a unique id for a reference
137: * @param result
138: * @param ref
139: * @return
140: */
141: public String getReportResultKey(ReportResult result, String ref);
142:
143: /**
144: * checks the id against the generated unique id of the reference.
145: * It throws an AuthorizationFailedException if the ids don't match.
146: * Otherwise it adds the AllowAllSecurityAdvisor to the securityService
147: * @param id
148: * @param ref
149: */
150: public void checkReportAccess(String id, String ref);
151:
152: /**
153: * Checks for edit report permission
154: *
155: */
156: public void checkEditAccess();
157:
158: /**
159: * Puts the ReportResult into the session
160: * @param result
161: */
162: public void setCurrentResult(ReportResult result);
163:
164: /**
165: * Deletes a ReportResult. If the report that this result came from in not on display
166: * then we should try to delete the report too because the user can't do anything with it
167: * @param result
168: */
169: public void deleteReportResult(ReportResult result);
170:
171: /**
172: * if we are deleting a report that is not live, then delete the result associated with it
173: * because it will become invalid. If a report is live, then we need to check how many results
174: * are linked to the report. If there are no results then we can delete it, otherwise we need to
175: * just disable the report from showing in the interface given the display parameter option.
176: * aka, if a report is live and has results associated, the display parameter decides if we should deactivated
177: * the report.
178: *
179: * @param report Report
180: */
181: public void deleteReport(Report report, boolean deactivate);
182:
183: /**
184: *
185: * @return Map
186: */
187: public Map getAuthorizationsMap();
188:
189: /**
190: *
191: * @return boolean
192: */
193: public boolean isMaintaner();
194:
195: /**
196: *
197: * This gets the datasource that the report manager is configured to use.
198: * it may be ambiguous if the data source is set to 3 (aka. both DW reports and live reports)
199: * @return
200: */
201: //public DataSource getDataSource();
202:
203: /**
204: * returns the data source based on if the calling code is using the warehouse or not
205: * @param useWarehouse boolean
206: * @return
207: */
208: public DataSource getDataSourceUseWarehouse(boolean useWarehouse);
209:
210: public boolean importResource(Id worksite, String reference)
211: throws UnsupportedFileTypeException, ImportException;
212:
213: public void deleteReportDefXmlFile(ReportDefinition reportDef);
214:
215: public List getReportsByViewer();
216:
217: public String processSaveResultsToResources(
218: ReportResult reportResult) throws IOException;
219:
220: public JobDetail processCreateJob(Report report);
221: }
|