KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > archive > collection > UserCollections


1 /*
2  * Created on Jul 1, 2006
3  */

4 package com.openedit.archive.collection;
5
6 import java.util.ArrayList JavaDoc;
7 import java.util.Iterator JavaDoc;
8 import java.util.List JavaDoc;
9
10 import com.openedit.page.manage.PageManager;
11 import com.openedit.users.User;
12
13 public class UserCollections
14 {
15     protected User fieldUser;
16     protected PageManager fieldPageManager;
17     protected List JavaDoc fieldCollections;
18     protected Collection fieldSelectedCollection;
19     
20     public List JavaDoc getCollections()
21     {
22         if (fieldCollections == null)
23         {
24             fieldCollections = new ArrayList JavaDoc();
25             
26         }
27
28         return fieldCollections;
29     }
30     public void setCollections(List JavaDoc inCollections)
31     {
32         fieldCollections = inCollections;
33     }
34     public Collection getSelectedCollection()
35     {
36         return fieldSelectedCollection;
37     }
38     public void setSelectedCollection(Collection inSelectedCollection)
39     {
40         fieldSelectedCollection = inSelectedCollection;
41     }
42     public PageManager getPageManager()
43     {
44         return fieldPageManager;
45     }
46     public void setPageManager(PageManager inPageManager)
47     {
48         fieldPageManager = inPageManager;
49     }
50     public User getUser()
51     {
52         return fieldUser;
53     }
54     public void setUser(User inUser)
55     {
56         fieldUser = inUser;
57     }
58     public void reload()
59     {
60     }
61     public boolean isCurrent()
62     {
63         return false;
64     }
65     public void addCollection(Collection inCol)
66     {
67         getCollections().add(inCol);
68     }
69     
70     public Collection getCollection(String JavaDoc inId)
71     {
72         for (Iterator JavaDoc iter = getCollections().iterator(); iter.hasNext();)
73         {
74             Collection col = (Collection) iter.next();
75             if( col.getId().equals(inId))
76             {
77                 return col;
78             }
79         }
80         return null;
81     }
82     public void removeCollection(Collection inCol)
83     {
84         getCollections().remove(inCol);
85     }
86     
87     public boolean hasCollections()
88     {
89         if( fieldCollections == null || fieldCollections.size() == 0)
90         {
91             return false;
92         }
93         return true;
94     }
95     
96     public void removeAllCollections()
97     {
98         fieldCollections = new ArrayList JavaDoc();
99     }
100 }
101
Popular Tags