1 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 25 public class Admin extends BasePO { 26 27 28 public XMLObject handleAdminBackup() throws HttpPresentationException { 29 String error = "Unhandled Error: "; 30 try { 31 DataManagerI dataManager = DataManagerFactory.getDataManager(); 32 dataManager.adminBackup(); 33 return showAdminPage(); 34 } catch (Exception e) { 35 error = error + e.getMessage(); 36 } 37 return showErrorPage(error); 38 } 39 40 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 error = "Unhandled Error: "; 50 try { 51 DataManagerI dataManager = DataManagerFactory.getDataManager(); 52 dataManager.adminRestore(); 53 throw new ClientPageRedirectException(Common.REDIRECT_LOGOUT); 55 } catch (Exception e) { 56 error = error + e.getMessage(); 57 } 58 return showErrorPage(error); 59 } 60 61 public XMLObject handleAdminClean() throws HttpPresentationException { 62 String error = "Unhandled Error: "; 63 try { 64 DataManagerI dataManager = DataManagerFactory.getDataManager(); 65 dataManager.adminClean(); 66 throw new ClientPageRedirectException(Common.REDIRECT_LOGOUT); 68 } catch (Exception e) { 69 error = error + e.getMessage(); 70 } 71 return showErrorPage(error); 72 } 73 74 public XMLObject handleAdminCleanBackup() throws HttpPresentationException { 75 String error = "Unhandled Error: "; 76 try { 77 DataManagerI dataManager = DataManagerFactory.getDataManager(); 78 dataManager.adminCleanBackup(); 79 return showAdminPage(); 80 } catch (Exception e) { 81 error = error + e.getMessage(); 82 } 83 return showErrorPage(error); 84 } 85 86 89 public XMLObject handleDefault() throws HttpPresentationException { 90 String error = "Unhandled Error: "; 91 try { 92 return showAdminPage(); 93 } catch (Exception e) { 94 error = error + e.getMessage(); 95 } 96 return showErrorPage(error); 97 } 98 99 102 protected boolean loggedInUserRequired() { 103 return true; 105 } 106 107 } 108 | Popular Tags |