001: /*
002: * Copyright (c) 2007, intarsys consulting GmbH
003: *
004: * Redistribution and use in source and binary forms, with or without
005: * modification, are permitted provided that the following conditions are met:
006: *
007: * - Redistributions of source code must retain the above copyright notice,
008: * this list of conditions and the following disclaimer.
009: *
010: * - Redistributions in binary form must reproduce the above copyright notice,
011: * this list of conditions and the following disclaimer in the documentation
012: * and/or other materials provided with the distribution.
013: *
014: * - Neither the name of intarsys nor the names of its contributors may be used
015: * to endorse or promote products derived from this software without specific
016: * prior written permission.
017: *
018: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
019: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
020: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
021: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
022: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
023: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
024: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
025: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
026: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
027: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
028: * POSSIBILITY OF SUCH DAMAGE.
029: */
030: package de.intarsys.pdf.pd;
031:
032: import de.intarsys.pdf.cds.CDSDate;
033: import de.intarsys.pdf.cos.COSBasedObject;
034: import de.intarsys.pdf.cos.COSName;
035: import de.intarsys.pdf.cos.COSObject;
036: import de.intarsys.tools.string.StringTools;
037:
038: /**
039: *
040: *
041: */
042: public class PDBuildData extends PDObject {
043:
044: /**
045: * The meta class implementation
046: */
047: public static class MetaClass extends PDObject.MetaClass {
048: protected MetaClass(Class instanceClass) {
049: super (instanceClass);
050: }
051:
052: protected COSBasedObject doCreateCOSBasedObject(COSObject object) {
053: return new PDBuildData(object);
054: }
055:
056: protected boolean isIndirect() {
057: return false;
058: }
059: }
060:
061: /** The meta class instance */
062: public static final MetaClass META = new MetaClass(MetaClass.class
063: .getDeclaringClass());
064:
065: public static final COSName DK_Name = COSName.constant("Name"); //$NON-NLS-1$
066: public static final COSName DK_Date = COSName.constant("Date"); //$NON-NLS-1$
067: public static final COSName DK_R = COSName.constant("R"); //$NON-NLS-1$
068: public static final COSName DK_V = COSName.constant("V"); //$NON-NLS-1$
069: public static final COSName DK_PreRelease = COSName
070: .constant("PreRelease"); //$NON-NLS-1$
071: public static final COSName DK_OS = COSName.constant("OS"); //$NON-NLS-1$
072: public static final COSName DK_NonEFontNoWarn = COSName
073: .constant("NonEFontNoWarn"); //$NON-NLS-1$
074: public static final COSName DK_TrustedMode = COSName
075: .constant("TrustedMode"); //$NON-NLS-1$
076:
077: protected PDBuildData(COSObject object) {
078: super (object);
079: }
080:
081: public CDSDate getDate() {
082: return getFieldDate(DK_Date, null);
083: }
084:
085: public String getName() {
086: return getFieldString(DK_Name, StringTools.EMPTY);
087: }
088:
089: public String getOS() {
090: return getFieldString(DK_OS, StringTools.EMPTY);
091: }
092:
093: public int getR() {
094: return getFieldInt(DK_R, 0);
095: }
096:
097: public int getV() {
098: return getFieldInt(DK_V, 0);
099: }
100:
101: public boolean isNonEFontNoWarn() {
102: return getFieldBoolean(DK_NonEFontNoWarn, true);
103: }
104:
105: public boolean isPreRelease() {
106: return getFieldBoolean(DK_PreRelease, false);
107: }
108:
109: public boolean isTrustedMode() {
110: return getFieldBoolean(DK_TrustedMode, false);
111: }
112:
113: public void setDate(CDSDate date) {
114: setFieldString(DK_Date, date == null ? null : date
115: .stringValue());
116: }
117:
118: public void setName(String name) {
119: setFieldString(DK_Name, name);
120: }
121:
122: public void setNonEFontNoWarn(boolean nonEFontNoWarn) {
123: setFieldBoolean(DK_NonEFontNoWarn, nonEFontNoWarn);
124: }
125:
126: public void setOS(String osString) {
127: setFieldString(DK_OS, osString);
128: }
129:
130: public void setPreRelease(boolean preRelease) {
131: setFieldBoolean(DK_PreRelease, preRelease);
132: }
133:
134: public void setR(int moduleRevision) {
135: setFieldInt(DK_R, moduleRevision);
136: }
137:
138: public void setTrustedMode(boolean trustedMode) {
139: setFieldBoolean(DK_TrustedMode, trustedMode);
140: }
141:
142: public void setV(int minimumSoftwareVersion) {
143: setFieldInt(DK_V, minimumSoftwareVersion);
144: }
145: }
|