com.redhat.rhn.domain.org
Class OrgImpl

java.lang.Object
  extended by com.redhat.rhn.domain.BaseDomainHelper
      extended by com.redhat.rhn.domain.org.OrgImpl
All Implemented Interfaces:
Org

public class OrgImpl
extends BaseDomainHelper
implements Org

Class Org that reflects the DB representation of web_customer DB table: web_customer


Field Summary
protected static Logger log
           
 
Constructor Summary
protected OrgImpl()
          Construct new OrgImpl
 
Method Summary
 void addCustomDataKey(CustomDataKey keyIn)
           
 void addOrgQuota(java.lang.Long totalIn)
          Add a Quota to this Org
 void addOwnedChannel(Channel channelIn)
          Adds a new channel to the orgs set of channels
 void addRole(Role newRole)
          Add a Role to the Org.
 boolean equals(java.lang.Object other)
          
 java.util.List getAccessibleChannels()
          Get the list of channels accessible for this org.
 java.util.List getActiveOrgAdmins()
          Gets the list of active org admins (com.redhat.rhn.domain.user.User objects) in this org.
 java.util.Set getContactGroups()
          Get the Set of com.redhat.rhn.domain.monitoring.notification.ContactGroup objects associated with this Org.
 java.lang.String getCreditApplicationCompleted()
          Gets the current value of creditApplicationCompleted
 java.util.Set getCustomDataKeys()
           
 java.lang.String getCustomerType()
          Gets the current value of customerType
 java.util.List getEntitledServerGroups()
          Get the set of EntitlementServerGroups that this Org is a member of.
 java.util.Set getEntitlements()
          Get entitlements for this Org
 java.lang.Long getId()
          Gets the current value of id
 java.util.List getManagedServerGroups()
          Get the set of ManagedServerGroups that this Org is a member of.
 java.util.Set getMonitoringScouts()
          Gets the com.redhat.rhn.domain.monitoring.satcluster.SatClusters associated with this Org.
 java.lang.String getName()
          Gets the current value of name
 java.lang.Integer getOracleCustomerId()
          Gets the current value of oracleCustomerId
 java.lang.Integer getOracleCustomerNumber()
          Gets the current value of oracleCustomerNumber
 OrgQuota getOrgQuota()
          Get the OrgQuota
 java.util.Set getOwnedChannels()
          Get the set of channels associated with this org.
 java.lang.String getPassword()
          Gets the current value of password
 ChannelFamily getPrivateChannelFamily()
          Returns the channelFamilies.
 java.lang.Long getQuotaTotal()
          Get the value of the OrgQuota's TOTAL allowed
 java.util.Set getRoles()
          Gets the roles assigned to this Org.
 Token getToken()
          Returns the default registration token for this organization.
 UserGroup getUserGroup(Role roleIn)
          Get the Org's UserGroup ID for the specified Role
 java.util.Set getUserGroups()
          Get UserGroups for this Org.
 java.util.Set<Entitlement> getValidAddOnEntitlementsForOrg()
          Set of Entitlements that can be an add-on entitlement available to the Org
 java.util.Set<Entitlement> getValidBaseEntitlementsForOrg()
          Set of Entitlements that can be a BaseEntitlement available to the Org
 boolean hasCustomDataKey(java.lang.String label)
          Convenience method that checks the set of customDataKeys for a custom data key with the given label.
 boolean hasEntitlement(OrgEntitlementType ent)
          Does this org have the requested entitlement
 int hashCode()
          
 boolean hasRole(Role role)
          Does the Org have the specified role
 boolean isDemoEntitled()
          Returns if the given org has a demo entitlement
 boolean isPayingCustomer()
          Returns true if the Org is a paying customer, or false if it's a demo account.
 int numActiveOrgAdmins()
          Gets the number of active org admins in this org.
 void removeChannelPermissions(java.lang.Long uid, java.lang.Long cid, java.lang.String roleLabel)
          TODO: get rid of Role label and pass in the class Remove all channel permissions for a user/channel/role combination
 void resetChannelPermissions(java.lang.Long uid, java.lang.Long cid, java.lang.String roleLabel)
          TODO: get rid of Role label and pass in the class Reset channel permissions for a user/channel/role combination
protected  void setContactGroups(java.util.Set contactGroupsIn)
           
 void setCreditApplicationCompleted(java.lang.String credIn)
          Sets the value of creditApplicationCompleted to new value
 void setCustomDataKeys(java.util.Set customDataKeysIn)
           
 void setCustomerType(java.lang.String customerTypeIn)
          Sets the value of customerType to new value
 void setEntitlements(java.util.Set entsIn)
          Set entitlements for this Org
protected  void setId(java.lang.Long idIn)
          Sets the value of id to new value
 void setMonitoringScouts(java.util.Set monitoringScoutsIn)
          Sets the monitoring Scouts for this Org.
 void setName(java.lang.String nameIn)
          Sets the value of name to new value
 void setOracleCustomerId(java.lang.Integer oracleCustomerIdIn)
          Sets the value of oracleCustomerId to new value
 void setOracleCustomerNumber(java.lang.Integer oracleIn)
          Sets the value of oracleCustomerNumber to new value
 void setOrgQuota(OrgQuota quotaIn)
          Set the OrgQuota.
 void setOwnedChannels(java.util.Set channelsIn)
          Set the channels for this org.
 void setPassword(java.lang.String passwordIn)
          Sets the value of password to new value
 void setToken(Token tokenIn)
          Sets the default registration token for this organization.
 void setUserGroups(java.util.Set ugIn)
          Set UserGroups for this Org.
 java.lang.String toString()
          
 
Methods inherited from class com.redhat.rhn.domain.BaseDomainHelper
getCreated, getModified, setCreated, setModified
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.redhat.rhn.domain.org.Org
getCreated, getModified, setCreated, setModified
 

Field Detail

log

protected static Logger log
Constructor Detail

OrgImpl

protected OrgImpl()
Construct new OrgImpl

Method Detail

getCustomDataKeys

public java.util.Set getCustomDataKeys()
Specified by:
getCustomDataKeys in interface Org
Returns:
Returns the customDataKeys.

setCustomDataKeys

public void setCustomDataKeys(java.util.Set customDataKeysIn)
Specified by:
setCustomDataKeys in interface Org
Parameters:
customDataKeysIn - The customDataKeys to set.

hasCustomDataKey

public boolean hasCustomDataKey(java.lang.String label)
Convenience method that checks the set of customDataKeys for a custom data key with the given label.

Specified by:
hasCustomDataKey in interface Org
Parameters:
label - The label to check for.
Returns:
Returns true if the corresponding custom data key exists, false otherwise.

addCustomDataKey

public void addCustomDataKey(CustomDataKey keyIn)
Specified by:
addCustomDataKey in interface Org
Parameters:
keyIn - The CustomDataKey to add to the customDataKeys set for this org.

getId

public java.lang.Long getId()
Gets the current value of id

Specified by:
getId in interface Org
Returns:
long the current value

setId

protected void setId(java.lang.Long idIn)
Sets the value of id to new value

Parameters:
idIn - New value for id

getName

public java.lang.String getName()
Gets the current value of name

Specified by:
getName in interface Org
Returns:
String the current value

setName

public void setName(java.lang.String nameIn)
Sets the value of name to new value

Specified by:
setName in interface Org
Parameters:
nameIn - New value for name

getPassword

public java.lang.String getPassword()
Gets the current value of password

Specified by:
getPassword in interface Org
Returns:
String the current value

setPassword

public void setPassword(java.lang.String passwordIn)
Sets the value of password to new value

Specified by:
setPassword in interface Org
Parameters:
passwordIn - New value for password

getOracleCustomerId

public java.lang.Integer getOracleCustomerId()
Gets the current value of oracleCustomerId

Specified by:
getOracleCustomerId in interface Org
Returns:
int the current value

setOracleCustomerId

public void setOracleCustomerId(java.lang.Integer oracleCustomerIdIn)
Sets the value of oracleCustomerId to new value

Specified by:
setOracleCustomerId in interface Org
Parameters:
oracleCustomerIdIn - New value for oracleCustomerId

getOracleCustomerNumber

public java.lang.Integer getOracleCustomerNumber()
Gets the current value of oracleCustomerNumber

Specified by:
getOracleCustomerNumber in interface Org
Returns:
int the current value

setOracleCustomerNumber

public void setOracleCustomerNumber(java.lang.Integer oracleIn)
Sets the value of oracleCustomerNumber to new value

Specified by:
setOracleCustomerNumber in interface Org
Parameters:
oracleIn - New value for oracleCustomerNumber

getCustomerType

public java.lang.String getCustomerType()
Gets the current value of customerType

Specified by:
getCustomerType in interface Org
Returns:
String the current value

setCustomerType

public void setCustomerType(java.lang.String customerTypeIn)
Sets the value of customerType to new value

Specified by:
setCustomerType in interface Org
Parameters:
customerTypeIn - New value for customerType

getCreditApplicationCompleted

public java.lang.String getCreditApplicationCompleted()
Gets the current value of creditApplicationCompleted

Specified by:
getCreditApplicationCompleted in interface Org
Returns:
String the current value

setCreditApplicationCompleted

public void setCreditApplicationCompleted(java.lang.String credIn)
Sets the value of creditApplicationCompleted to new value

Specified by:
setCreditApplicationCompleted in interface Org
Parameters:
credIn - New value for creditApplicationCompleted

getRoles

public java.util.Set getRoles()
Gets the roles assigned to this Org. The Map returned from this method has been decorated with a call to Collections.unmodifiableMap(java.util.Map) in order to enforce the rule that roles are not changeable during runtime.

Specified by:
getRoles in interface Org
Returns:
Set of Roles associated with this Org

hasRole

public boolean hasRole(Role role)
Does the Org have the specified role

Specified by:
hasRole in interface Org
Parameters:
role - the Role.label to check
Returns:
boolean if the Org has Role

addRole

public void addRole(Role newRole)
Add a Role to the Org.

Specified by:
addRole in interface Org
Parameters:
newRole - the role label we want to add to this Org

getUserGroup

public UserGroup getUserGroup(Role roleIn)
Get the Org's UserGroup ID for the specified Role

Specified by:
getUserGroup in interface Org
Parameters:
roleIn - the Role.label to translate to a UserGroup.ID
Returns:
the UserGroup if found, otherwise null.

getUserGroups

public java.util.Set getUserGroups()
Get UserGroups for this Org. This is used internally within this package to map Roles to UserGroups

Returns:
userGroup array

setUserGroups

public void setUserGroups(java.util.Set ugIn)
Set UserGroups for this Org. This is used internally within this package to map Roles to UserGroups

Parameters:
ugIn - the new array

setEntitlements

public void setEntitlements(java.util.Set entsIn)
Set entitlements for this Org

Specified by:
setEntitlements in interface Org
Parameters:
entsIn - new Set of Entitlements to update

getEntitlements

public java.util.Set getEntitlements()
Get entitlements for this Org

Specified by:
getEntitlements in interface Org
Returns:
Set of entitlements for this Org

getEntitledServerGroups

public java.util.List getEntitledServerGroups()
Get the set of EntitlementServerGroups that this Org is a member of.

Specified by:
getEntitledServerGroups in interface Org
Returns:
List of ServerGroup classes

getManagedServerGroups

public java.util.List getManagedServerGroups()
Get the set of ManagedServerGroups that this Org is a member of.

Specified by:
getManagedServerGroups in interface Org
Returns:
List of ServerGroup classes

addOwnedChannel

public void addOwnedChannel(Channel channelIn)
Adds a new channel to the orgs set of channels

Specified by:
addOwnedChannel in interface Org
Parameters:
channelIn - The Channel to add

setOwnedChannels

public void setOwnedChannels(java.util.Set channelsIn)
Set the channels for this org.

Specified by:
setOwnedChannels in interface Org
Parameters:
channelsIn - The channels for this org

getOwnedChannels

public java.util.Set getOwnedChannels()
Get the set of channels associated with this org.

Specified by:
getOwnedChannels in interface Org
Returns:
Returns the set of channels for this org.

getAccessibleChannels

public java.util.List getAccessibleChannels()
Get the list of channels accessible for this org.

Specified by:
getAccessibleChannels in interface Org
Returns:
List of channels public or owned by this org.

hasEntitlement

public boolean hasEntitlement(OrgEntitlementType ent)
Does this org have the requested entitlement

Specified by:
hasEntitlement in interface Org
Parameters:
ent - Entitlement to check
Returns:
boolean if or not the org has the Ent

resetChannelPermissions

public void resetChannelPermissions(java.lang.Long uid,
                                    java.lang.Long cid,
                                    java.lang.String roleLabel)
TODO: get rid of Role label and pass in the class Reset channel permissions for a user/channel/role combination

Specified by:
resetChannelPermissions in interface Org
Parameters:
uid - User ID to reset
cid - Channel ID
roleLabel - label of Role to reset

removeChannelPermissions

public void removeChannelPermissions(java.lang.Long uid,
                                     java.lang.Long cid,
                                     java.lang.String roleLabel)
TODO: get rid of Role label and pass in the class Remove all channel permissions for a user/channel/role combination

Specified by:
removeChannelPermissions in interface Org
Parameters:
uid - User ID to reset
cid - Channel ID
roleLabel - label of Role to reset

setOrgQuota

public void setOrgQuota(OrgQuota quotaIn)
Set the OrgQuota.

Parameters:
quotaIn - the new quota to set.

getOrgQuota

public OrgQuota getOrgQuota()
Get the OrgQuota

Specified by:
getOrgQuota in interface Org
Returns:
OrgQuota object

addOrgQuota

public void addOrgQuota(java.lang.Long totalIn)
Add a Quota to this Org

Specified by:
addOrgQuota in interface Org
Parameters:
totalIn - the total size of the quota

getQuotaTotal

public java.lang.Long getQuotaTotal()
Get the value of the OrgQuota's TOTAL allowed

Specified by:
getQuotaTotal in interface Org
Returns:
Long value of the Org's Quota total - null if there isnt one

isPayingCustomer

public boolean isPayingCustomer()
Returns true if the Org is a paying customer, or false if it's a demo account.

Specified by:
isPayingCustomer in interface Org
Returns:
true if the Org is a paying customer, or false if it's a demo account.

numActiveOrgAdmins

public int numActiveOrgAdmins()
Gets the number of active org admins in this org.

Specified by:
numActiveOrgAdmins in interface Org
Returns:
Returns the number of active org admins in this org.

getActiveOrgAdmins

public java.util.List getActiveOrgAdmins()
Gets the list of active org admins (com.redhat.rhn.domain.user.User objects) in this org.

Specified by:
getActiveOrgAdmins in interface Org
Returns:
Returns the set of active org admins in this org.

getMonitoringScouts

public java.util.Set getMonitoringScouts()
Gets the com.redhat.rhn.domain.monitoring.satcluster.SatClusters associated with this Org. Null if there are none or is not a Monitoring Sat.

Specified by:
getMonitoringScouts in interface Org
Returns:
Set of SatClusters (Monitoring Scouts) associated with Org

setMonitoringScouts

public void setMonitoringScouts(java.util.Set monitoringScoutsIn)
Sets the monitoring Scouts for this Org.

Parameters:
monitoringScoutsIn - the new set of Monitoring scouts

getContactGroups

public java.util.Set getContactGroups()
Description copied from interface: Org
Get the Set of com.redhat.rhn.domain.monitoring.notification.ContactGroup objects associated with this Org.

Specified by:
getContactGroups in interface Org
Returns:
Returns the contactGroups.

setContactGroups

protected void setContactGroups(java.util.Set contactGroupsIn)
Parameters:
contactGroupsIn - The contactGroups to set.

getPrivateChannelFamily

public ChannelFamily getPrivateChannelFamily()
Description copied from interface: Org
Returns the channelFamilies.

Specified by:
getPrivateChannelFamily in interface Org
Returns:
Returns the channelFamilies.

equals

public boolean equals(java.lang.Object other)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

isDemoEntitled

public boolean isDemoEntitled()
Returns if the given org has a demo entitlement

Specified by:
isDemoEntitled in interface Org
Returns:
true if entitled, false if not.

getValidBaseEntitlementsForOrg

public java.util.Set<Entitlement> getValidBaseEntitlementsForOrg()
Set of Entitlements that can be a BaseEntitlement available to the Org

Specified by:
getValidBaseEntitlementsForOrg in interface Org
Returns:
Set of Entitlements

getValidAddOnEntitlementsForOrg

public java.util.Set<Entitlement> getValidAddOnEntitlementsForOrg()
Set of Entitlements that can be an add-on entitlement available to the Org

Specified by:
getValidAddOnEntitlementsForOrg in interface Org
Returns:
Set of Entitlements

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

getToken

public Token getToken()
Returns the default registration token for this organization.

Specified by:
getToken in interface Org
Returns:
default token, null if none exists.

setToken

public void setToken(Token tokenIn)
Sets the default registration token for this organization.

Specified by:
setToken in interface Org
Parameters:
tokenIn - Default token.