KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > pim > presentation > enhydrapim > Admin


1 /*
2  * Created on May 6, 2005
3  *
4  * TODO To change the template for this generated file go to
5  * Window - Preferences - Java - Code Style - Code Templates
6  */

7 package org.enhydra.pim.presentation.enhydrapim;
8
9 import org.enhydra.pim.business.DataManagerI;
10 import org.enhydra.pim.business.PersonManagerI;
11 import org.enhydra.pim.exception.EnhydraPimException;
12 import org.enhydra.pim.presentation.BasePO;
13 import org.enhydra.pim.spec.DataManagerFactory;
14 import org.enhydra.pim.spec.PersonManagerFactory;
15 import org.enhydra.xml.xmlc.XMLObject;
16
17 import com.lutris.appserver.server.httpPresentation.ClientPageRedirectException;
18 import com.lutris.appserver.server.httpPresentation.HttpPresentationException;
19
20 /**
21  * @author P.Djojic May 6, 2005 1:24:56 AM
22  *
23  * TODO Admin
24  */

25 public class Admin extends BasePO {
26
27     
28     public XMLObject handleAdminBackup() throws HttpPresentationException {
29         String JavaDoc error = "Unhandled Error: ";
30         try {
31             DataManagerI dataManager = DataManagerFactory.getDataManager();
32             dataManager.adminBackup();
33             return showAdminPage();
34         } catch (Exception JavaDoc e) {
35             error = error + e.getMessage();
36         }
37         return showErrorPage(error);
38     }
39     
40     /**
41      * @return
42      */

43     private AdminHTML showAdminPage() {
44         AdminHTML page = (AdminHTML) myComms.xmlcFactory.create(AdminHTML.class);
45         return page;
46     }
47
48     public XMLObject handleAdminRestore() throws HttpPresentationException {
49         String JavaDoc error = "Unhandled Error: ";
50         try {
51             DataManagerI dataManager = DataManagerFactory.getDataManager();
52             dataManager.adminRestore();
53             //return showAdminPage();
54
throw new ClientPageRedirectException(Common.REDIRECT_LOGOUT);
55         } catch (Exception JavaDoc e) {
56             error = error + e.getMessage();
57         }
58         return showErrorPage(error);
59     }
60     
61     public XMLObject handleAdminClean() throws HttpPresentationException {
62         String JavaDoc error = "Unhandled Error: ";
63         try {
64             DataManagerI dataManager = DataManagerFactory.getDataManager();
65             dataManager.adminClean();
66             //return showAdminPage();
67
throw new ClientPageRedirectException(Common.REDIRECT_LOGOUT);
68         } catch (Exception JavaDoc e) {
69             error = error + e.getMessage();
70         }
71         return showErrorPage(error);
72     }
73     
74     public XMLObject handleAdminCleanBackup() throws HttpPresentationException {
75         String JavaDoc error = "Unhandled Error: ";
76         try {
77             DataManagerI dataManager = DataManagerFactory.getDataManager();
78             dataManager.adminCleanBackup();
79             return showAdminPage();
80         } catch (Exception JavaDoc e) {
81             error = error + e.getMessage();
82         }
83         return showErrorPage(error);
84     }
85     
86     /* (non-Javadoc)
87      * @see org.enhydra.pim.presentation.BasePO#handleDefault()
88      */

89     public XMLObject handleDefault() throws HttpPresentationException {
90         String JavaDoc error = "Unhandled Error: ";
91         try {
92             return showAdminPage();
93         } catch (Exception JavaDoc e) {
94             error = error + e.getMessage();
95         }
96         return showErrorPage(error);
97     }
98
99     /* (non-Javadoc)
100      * @see org.enhydra.pim.presentation.BasePO#loggedInUserRequired()
101      */

102     protected boolean loggedInUserRequired() {
103         // TODO Auto-generated method stub
104
return true;
105     }
106     
107 }
108
Popular Tags