001: /*
002: * Copyright (C) 2007 Erik Swenson - erik@oreports.com
003: *
004: * This program is free software; you can redistribute it and/or modify it
005: * under the terms of the GNU General Public License as published by the Free
006: * Software Foundation; either version 2 of the License, or (at your option)
007: * any later version.
008: *
009: * This program is distributed in the hope that it will be useful, but WITHOUT
010: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
011: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
012: * more details.
013: *
014: * You should have received a copy of the GNU General Public License along with
015: * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
016: * Place - Suite 330, Boston, MA 02111-1307, USA.
017: *
018: */
019: package org.efs.openreports;
020:
021: public class ReportConstants {
022: /**
023: * Report delivery methods. Name is used to map a delivery method to a Spring bean identifier using
024: * the following format: name + "DeliveryMethod"
025: */
026: public enum DeliveryMethod {
027: EMAIL("email"), FILE("fileSystem"), FAX("fax"), FTP("ftp"), PRINTER(
028: "printer"), DOCUMENT_REPOSITORY("documentRepository");
029:
030: private final String name;
031:
032: DeliveryMethod(String name) {
033: this .name = name;
034: }
035:
036: public String getName() {
037: return name;
038: }
039:
040: public static DeliveryMethod findByName(String name) {
041: for (DeliveryMethod value : DeliveryMethod.values()) {
042: if (value.getName().equalsIgnoreCase(name)) {
043: return value;
044: }
045: }
046: return null;
047: }
048: }
049:
050: /**
051: * Report export types. int code is used to support legacy export types persisted or serialized
052: * as integers in ReportSchedule and ReportLog objects
053: */
054: public enum ExportType {
055: PDF(0), XLS(1), HTML(2), CSV(3), IMAGE(4), RTF(5), TEXT(6), EXCEL(
056: 7);
057:
058: private final int code;
059:
060: ExportType(int code) {
061: this .code = code;
062: }
063:
064: public int getCode() {
065: return code;
066: }
067:
068: public static ExportType findByCode(int code) {
069: for (ExportType exportType : ExportType.values()) {
070: if (exportType.getCode() == code)
071: return exportType;
072: }
073:
074: return null;
075: }
076: }
077:
078: /**
079: * Report schedule types. int code is used to support legacy schedule types serialized as
080: * integers in ReportSchedule objects.
081: */
082: public enum ScheduleType {
083: ONCE(0), DAILY(1), WEEKLY(2), MONTHLY(3), WEEKDAYS(4), HOURLY(5), CRON(
084: 6);
085:
086: private final int code;
087:
088: ScheduleType(int code) {
089: this .code = code;
090: }
091:
092: public int getCode() {
093: return code;
094: }
095:
096: public static ScheduleType findByCode(int code) {
097: for (ScheduleType scheduleType : ScheduleType.values()) {
098: if (scheduleType.getCode() == code)
099: return scheduleType;
100: }
101:
102: return null;
103: }
104: }
105:
106: /**
107: * AM/PM indicator for scheduled request. The code corresponds to the AM and PM constants
108: * in the java.util.Calendar class.
109: */
110: public enum ScheduleAmPm {
111: AM(0), PM(1);
112:
113: private final int code;
114:
115: ScheduleAmPm(int code) {
116: this .code = code;
117: }
118:
119: public int getCode() {
120: return code;
121: }
122:
123: public static ScheduleAmPm findByCode(int code) {
124: for (ScheduleAmPm scheduleAmPm : ScheduleAmPm.values()) {
125: if (scheduleAmPm.getCode() == code)
126: return scheduleAmPm;
127: }
128:
129: return null;
130: }
131: }
132: }
|