1 5 package org.exoplatform.portlets.backup.component; 6 7 import org.exoplatform.faces.core.event.CheckRoleInterceptor; 8 import org.exoplatform.faces.core.event.ExoActionEvent; 9 import org.exoplatform.faces.core.event.ExoActionListener; 10 import org.exoplatform.services.backup.BackupService; 11 15 public class UIImportServiceData extends UIImportData { 16 17 public UIImportServiceData(BackupService service) { 18 super(service) ; 19 setId("UIImportServiceData") ; 20 setDirectory(service_.getServiceDataDirectory()) ; 21 populateImportData() ; 22 addActionListener(RefreshActionListener.class, "refresh") ; 23 addActionListener(ViewDataActionListener.class, "viewData") ; 24 addActionListener(ImportServiceActionListener.class, "import") ; 25 addActionListener(ImportAllActionListener.class, "importAll") ; 26 adminRole_ = hasRole("admin") ; 27 } 28 29 static public class ImportServiceActionListener extends ExoActionListener { 30 public ImportServiceActionListener() { 31 addInterceptor(new CheckRoleInterceptor("admin")) ; 32 } 33 34 public void execute(ExoActionEvent event) throws Exception { 35 UIImportServiceData uiComp = (UIImportServiceData) event.getSource() ; 36 String dataName = event.getParameter("dataName") ; 37 String serviceName = dataName.substring(0, dataName.length() - 4) ; 38 uiComp.service_.importServiceData(serviceName) ; 39 } 40 } 41 42 static public class ImportAllActionListener extends ExoActionListener { 43 public ImportAllActionListener() { 44 addInterceptor(new CheckRoleInterceptor("admin")) ; 45 } 46 47 public void execute(ExoActionEvent event) throws Exception { 48 UIImportServiceData uiComp = (UIImportServiceData) event.getSource() ; 49 uiComp.service_.importServiceData() ; 50 } 51 } 52 } | Popular Tags |