KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > properties > DefaultPropertyProfile


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.properties;
21
22 import java.util.Calendar JavaDoc;
23
24 import com.sslexplorer.policyframework.AbstractResource;
25 import com.sslexplorer.policyframework.PolicyConstants;
26 import com.sslexplorer.policyframework.Resource;
27 import com.sslexplorer.policyframework.ResourceType;
28
29 /**
30  * Default implementation of a {@link com.sslexplorer.properties.PropertyProfile}.
31  *
32  * @author Brett Smith <a HREF="mailto: brett@3sp.com">&lt;brett@3sp.com&gt;</a>
33  */

34 public class DefaultPropertyProfile extends AbstractResource implements PropertyProfile {
35         
36     // Private instance variables
37

38     private String JavaDoc user;
39
40     /**
41      * Constructor
42      * @param realmID
43      * @param resourceId
44      * @param user
45      * @param resourceName
46      * @param resourceDescription
47      * @param dateCreated
48      * @param dateAmended
49      */

50     public DefaultPropertyProfile(int realmID, int resourceId, String JavaDoc user, String JavaDoc resourceName, String JavaDoc resourceDescription,
51                     Calendar JavaDoc dateCreated, Calendar JavaDoc dateAmended) {
52         super(realmID, PolicyConstants.PROFILE_RESOURCE_TYPE, resourceId, resourceName, resourceDescription, dateCreated, dateAmended);
53         this.user = user;
54     }
55
56     /* (non-Javadoc)
57      * @see com.sslexplorer.boot.PropertyProfile#getLabel()
58      */

59     public String JavaDoc getLabel() {
60         return resourceName + (user == null || user.equals("") ? " (Global)" : " (Personal)");
61     }
62
63     /* (non-Javadoc)
64      * @see com.sslexplorer.boot.policyframework.OwnedResource#getOwnerUsername()
65      */

66     public String JavaDoc getOwnerUsername() {
67         return user;
68     }
69
70     /* (non-Javadoc)
71      * @see com.sslexplorer.boot.policyframework.Resource#getResourceType()
72      */

73     public ResourceType getResourceType() {
74         return PolicyConstants.PROFILE_RESOURCE_TYPE;
75     }
76
77     /* (non-Javadoc)
78      * @see com.sslexplorer.policyframework.AbstractResource#compareTo(java.lang.Object)
79      */

80     public int compareTo(Object JavaDoc o) {
81         return getResourceName().compareTo(((Resource) o).getResourceName());
82     }
83 }
84
Popular Tags