ConsumerPortletRegistrationImpl.java |
1 /* 2 * Copyright 2000-2001,2004 The Apache Software Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /* 18 19 */ 20 21 package org.apache.wsrp4j.producer.provider.driver; 22 23 import java.util.Collection; 24 import java.util.HashSet; 25 26 /** 27 * This class collects the porlet handles for a registered consumer and 28 * is used for persistence purpose. 29 * 30 * @author <a href="mailto:Ralf.Altrichter@de.ibm.com">Ralf Altrichter</a> 31 * 32 * @version 1.0 33 */ 34 public class ConsumerPortletRegistrationImpl { 35 36 // the registrationHandle of the consumer 37 private String _registrationHandle = null; 38 39 // collects all portletHandles for this registrationHandle 40 private HashSet _portletHandles = new HashSet(); 41 42 /** 43 * Default Constructor 44 */ 45 public ConsumerPortletRegistrationImpl() { 46 47 } 48 49 /** 50 * Sets the registration handle for a specific consumer 51 * 52 * @param regHandle, consumer registration handle 53 */ 54 public void setRegistrationHandle(String regHandle) { 55 _registrationHandle = regHandle; 56 } 57 58 /** 59 * Returns the registration handle for a specific consumer 60 * 61 * @return registrationHandle 62 */ 63 public String getRegistrationHandle() { 64 return _registrationHandle; 65 } 66 67 /** 68 * Add a portlet handle to the current registration 69 * 70 * @param portletHandle 71 */ 72 public void addPortletHandle(String portletHandle) { 73 _portletHandles.add(portletHandle); 74 } 75 76 /** 77 * Returns true, if the portletHandle is associated to the 78 * current registration. 79 * 80 * @return true on success, otherwise false 81 */ 82 public boolean containsPortletHandle(String portletHandle) { 83 return _portletHandles.contains(portletHandle); 84 } 85 86 /** 87 * Removes a portlet handle from the current registration 88 * 89 * @param portletHandle 90 */ 91 public void deletePortletHandle(String portletHandle) { 92 _portletHandles.remove(portletHandle); 93 } 94 95 /** 96 * Sets a collection of portlet handles for this registration 97 * 98 * @param collection 99 */ 100 public void setPortletHandles(Collection collection) { 101 _portletHandles = (HashSet) collection; 102 } 103 104 /** 105 * Returns a collection of portlet handles for this registration 106 * 107 * @return collection 108 */ 109 public Collection getPortletHandles() { 110 return _portletHandles; 111 } 112 113 /** 114 * @return true, if no portlet handles are assigned to this registration 115 * false, if at least one portlet handle is assigned to his registration 116 */ 117 public boolean isEmpty() { 118 boolean retVal = false; 119 120 if (_portletHandles.size() == 0) { 121 retVal = true; 122 } 123 return retVal; 124 } 125 }