View Javadoc

1   /*
2    * This file is part of Domingo
3    * an Open Source Java-API to Lotus Notes/Domino
4    * hosted at http://domingo.sourceforge.net
5    *
6    * Copyright (c) 2003-2007 Beck et al. projects GmbH Munich, Germany (http://www.bea.de)
7    *
8    * This library is free software; you can redistribute it and/or
9    * modify it under the terms of the GNU Lesser General Public
10   * License as published by the Free Software Foundation; either
11   * version 2.1 of the License, or (at your option) any later version.
12   *
13   * This library is distributed in the hope that it will be useful,
14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16   * Lesser General Public License for more details.
17   *
18   * You should have received a copy of the GNU Lesser General Public
19   * License along with this library; if not, write to the Free Software
20   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21   */
22  
23  package de.bea.domingo.proxy;
24  
25  import lotus.domino.Document;
26  import lotus.domino.NotesException;
27  import de.bea.domingo.DBase;
28  import de.bea.domingo.DNotesMonitor;
29  import de.bea.domingo.DProfileDocument;
30  
31  /***
32   * Represents a document in a database.
33   */
34  public final class ProfileDocumentProxy extends BaseDocumentProxy implements DProfileDocument {
35  
36      /*** serial version ID for serialization. */
37      private static final long serialVersionUID = 3690193256935994673L;
38  
39      /***
40       * Constructor for DDocumentImpl.
41       *
42       * @param theFactory the controlling factory
43       * @param parent the parent object
44       * @param theDocument the Notes document object
45       * @param monitor the monitor
46       */
47      protected ProfileDocumentProxy(final NotesProxyFactory theFactory, final DBase parent,
48                                     final Document theDocument, final DNotesMonitor monitor) {
49          super(theFactory, parent, theDocument, monitor);
50      }
51  
52      /***
53       * {@inheritDoc}
54       * @see de.bea.domingo.DProfileDocument#getKey()
55       */
56      public String getKey() {
57          getFactory().preprocessMethod();
58          try {
59              return getDocument().getKey();
60          } catch (NotesException e) {
61              throw newRuntimeException("Cannot get key", e);
62          }
63      }
64  
65      /***
66       * {@inheritDoc}
67       * @see de.bea.domingo.DProfileDocument#getNameOfProfile()
68       */
69      public String getNameOfProfile() {
70          getFactory().preprocessMethod();
71          try {
72              return getDocument().getNameOfProfile();
73          } catch (NotesException e) {
74              throw newRuntimeException("Cannot get name of profile", e);
75          }
76      }
77  
78      /***
79       * {@inheritDoc}
80       * @see de.bea.domingo.proxy.BaseProxy#toString()
81       */
82      public String toString() {
83          return getKey() + "_" + getNameOfProfile();
84      }
85  }