View Javadoc

1   /*
2    *  Copyright 2004 University of Hannover
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  
17  package olr.presentation;
18  
19  import olr.om.RdfUser;
20  
21  import com.lutris.appserver.server.httpPresentation.ClientPageRedirectException;
22  import com.lutris.appserver.server.httpPresentation.HttpPresentationException;
23  
24  /***
25   * @version $Id: Welcome1.java,v 1.7 2004/08/03 08:33:53 roku Exp $
26   */
27  public class Welcome1 extends ExtendedHttpPresentation {
28  
29      /***
30       * @see olr.presentation.ExtendedHttpPresentation#loggedInUserRequired()
31       */
32      public boolean loggedInUserRequired() {
33          return true;
34      }
35  
36      /***
37       * @see olr.presentation.ExtendedHttpPresentation#handleDefault()
38       */
39      public String handleDefault() throws HttpPresentationException {
40          if (getSessionData().isStarted())
41              throw new ClientPageRedirectException("ContentFrame.po");
42          else
43              return showPage();
44      }
45  
46      public String handleRestart() throws HttpPresentationException {
47          try {
48              getSessionData().clearLock();
49              RdfUser user = getUser();
50              clearSession();
51              setUser(user);
52              return showPage();
53          } catch (Exception e) {
54              throw new HttpPresentationException(e);
55          }
56      }
57  
58      public String showPage() {
59          RdfUser user = getUser();
60          if (!user.isContributor()) {
61              throw new ClientPageRedirectException("Welcome2.po?event=Reader");
62          } else {
63              Welcome1HTML page = new Welcome1HTML();
64              page.setTextName(String.valueOf(String.valueOf((new StringBuffer(String.valueOf(String
65                      .valueOf(user.getFirstName())))).append(" ").append(user.getLastName()))));
66              return page.toDocument();
67          }
68      }
69  }