KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portlets > backup > component > UIImportServiceData


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

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 /**
12  * @email: tuan08@users.sourceforge.net
13  * @version: $Id: UIImportServiceData.java,v 1.6 2004/09/21 00:16:11 tuan08 Exp $
14  */

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 JavaDoc {
35       UIImportServiceData uiComp = (UIImportServiceData) event.getSource() ;
36         String JavaDoc dataName = event.getParameter("dataName") ;
37         String JavaDoc 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 JavaDoc {
48       UIImportServiceData uiComp = (UIImportServiceData) event.getSource() ;
49         uiComp.service_.importServiceData() ;
50     }
51   }
52 }
Popular Tags