001: package org.enhydra.dm.business;
002:
003: import org.enhydra.dm.api.FoDocument;
004: import org.enhydra.dm.api.exceptions.BaseException;
005: import org.enhydra.dm.data.FoDocumentDO;
006:
007: import com.lutris.appserver.server.sql.DatabaseManagerException;
008: import com.lutris.appserver.server.sql.ObjectIdException;
009: import com.lutris.dods.builder.generator.query.DataObjectException;
010:
011: /**
012: * Implementation of FoDocument interface.
013: *
014: * @author Zorica Dudarin
015: */
016:
017: public class FoDocumentImpl implements FoDocument {
018:
019: String id;
020:
021: String userPassword;
022:
023: String ownerPassword;
024:
025: boolean allowPrint;
026:
027: boolean allowCopyContent;
028:
029: boolean allowEditContent;
030:
031: boolean allowEditAnnotation;
032:
033: public FoDocumentImpl() {
034:
035: }
036:
037: public FoDocumentImpl(FoDocumentDO foDocumentDO)
038: throws BaseException {
039: try {
040: setId(foDocumentDO.get_OId().toString());
041: setUserPassword(foDocumentDO.getUSERPASSWORD());
042: setOwnerPassword(foDocumentDO.getOWNERPASSWORD());
043: setAllowPrint(foDocumentDO.getALLOWPRINT());
044: setAllowCopyContent(foDocumentDO.getALLOWCOPYCONTENT());
045: setAllowEditContent(foDocumentDO.getALLOWEDITCONTENT());
046: setAllowEditAnnotation(foDocumentDO
047: .getALLOWEDITANNOTATIONS());
048: } catch (Exception e) {
049: throw new BaseException(e);
050: }
051: }
052:
053: public FoDocumentImpl(String id) throws BaseException {
054: try {
055: setId(id);
056: } catch (Exception e) {
057: throw new BaseException(e);
058: }
059: }
060:
061: public String getId() {
062: return id;
063: }
064:
065: public void setId(String id) {
066: this .id = id;
067: }
068:
069: public String getUserPassword() {
070: return userPassword;
071: }
072:
073: public void setUserPassword(String userPassword) {
074: this .userPassword = userPassword;
075: }
076:
077: public String getOwnerPassword() {
078: return ownerPassword;
079: }
080:
081: public void setOwnerPassword(String ownerPassword) {
082: this .ownerPassword = ownerPassword;
083: }
084:
085: public boolean isAllowPrint() {
086: return allowPrint;
087: }
088:
089: public void setAllowPrint(boolean allowPrint) {
090: this .allowPrint = allowPrint;
091: }
092:
093: public boolean isAllowCopyContent() {
094: return allowCopyContent;
095: }
096:
097: public void setAllowCopyContent(boolean allowCopyContent) {
098: this .allowCopyContent = allowCopyContent;
099: }
100:
101: public boolean isAllowEditContent() {
102: return allowEditContent;
103: }
104:
105: public void setAllowEditContent(boolean allowEditContent) {
106: this .allowEditContent = allowEditContent;
107: }
108:
109: public boolean isAllowEditAnnotation() {
110: return allowEditAnnotation;
111: }
112:
113: public void setAllowEditAnnotation(boolean allowEditAnnotation) {
114: this .allowEditAnnotation = allowEditAnnotation;
115: }
116:
117: public FoDocumentDO createDO() throws BaseException {
118: try {
119: FoDocumentDO foDocumentDo = FoDocumentDO.createVirgin();
120: foDocumentDo.setUSERPASSWORD(this .userPassword);
121: foDocumentDo.setOWNERPASSWORD(this .ownerPassword);
122: foDocumentDo.setALLOWPRINT(this .allowPrint);
123: foDocumentDo.setALLOWCOPYCONTENT(this .allowCopyContent);
124: foDocumentDo.setALLOWEDITCONTENT(this .allowEditContent);
125: foDocumentDo
126: .setALLOWEDITANNOTATIONS(this .allowEditAnnotation);
127:
128: return foDocumentDo;
129: } catch (DatabaseManagerException e) {
130: throw new BaseException(e);
131: } catch (ObjectIdException e) {
132: throw new BaseException(e);
133: } catch (DataObjectException e) {
134: throw new BaseException(e);
135: }
136: }
137: }
|