KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > raptus > owxv3 > api > components > CmpCategoryAction


1 /*
2  * eAdmin/OWX
3  * Copyright (C) 1996-2003 OWX-Project Team <owx-team@gmx.net>
4  */

5
6 package com.raptus.owxv3.api.components;
7
8 import javax.servlet.http.HttpServletRequest JavaDoc;
9
10 import org.apache.struts.action.*;
11
12 /**
13  *
14  * <hr>
15  * <table width="100%" border="0">
16  * <tr>
17  * <td width="24%"><b>Filename</b></td><td width="76%">CmpCategoryAction.java</td>
18  * </tr>
19  * <tr>
20  * <td width="24%"><b>Author</b></td><td width="76%">REEA</td>
21  * </tr>
22  * <tr>
23  * <td width="24%"><b>Date</b></td><td width="76%">10th Decembrie 2001</td>
24  * </tr>
25  * </table>
26  * <hr>
27  * <table width="100%" border="0">
28  * <tr>
29  * <td width="24%"><b>Date / Author</b></td><td width="76%"><b>Changes</b></td>
30  * </tr>
31  * </table>
32  * <hr>
33  */

34 public class CmpCategoryAction extends ComponentAction
35 {
36     /**
37      *The following actions is handled:
38      * 1. if catid parameter is present the category with id catid is toggled
39      * 2. if selecatid parameter is present the current entry is added to category with id selcatid
40      * 3. if unlinkcatid parameter is present the current entry is removed from category with id selcatid
41      */

42     public void dispatchComponent(HttpServletRequest JavaDoc request, ComponentBean cbean)
43     {
44         String JavaDoc scat= request.getParameter("catid");
45         if(scat != null)
46         {
47
48
49             ((com.raptus.owxv3.api.components.CmpCategoryBean) cbean).togleFolder(scat);
50         }
51
52         String JavaDoc selcat=request.getParameter("selcatid");
53         if(selcat!=null)
54         {
55
56             int x=0;
57             try
58             {
59                 x=Integer.parseInt(selcat);
60             }catch(NumberFormatException JavaDoc e) {};
61             boolean linksuccess=true;
62             if(x!=0) linksuccess=((com.raptus.owxv3.api.components.CmpCategoryBean) cbean).linkItemToCategory(x);
63
64             if(! linksuccess)
65             {
66                 /*
67                  *
68                  */

69                 //unable to link item to Category, category full
70

71                 ActionErrors errors=new ActionErrors();
72                 errors.add(ActionErrors.GLOBAL_ERROR,new ActionError("owx.api.components.fc_categories.error.catfull"));
73
74                 saveErrors(request,errors);
75                 return;
76
77             }//end if
78

79         }
80
81         String JavaDoc unlinkcat=request.getParameter("unlinkcatid");
82         if(unlinkcat!=null)
83         {
84
85             int x=0;
86             try
87             {
88                 x=Integer.parseInt(unlinkcat);
89             }catch(NumberFormatException JavaDoc e) {};
90             if(x!=0) ((com.raptus.owxv3.api.components.CmpCategoryBean) cbean).unlinkItemFromCategory(x);
91         }
92
93     }
94
95 }
96
97 // eof
98
Popular Tags