org.rhq.core.domain.content
Class Channel

java.lang.Object
  extended by org.rhq.core.domain.content.Channel
All Implemented Interfaces:
Serializable

public class Channel
extends Object
implements Serializable

A channel represents a set of related PackageVersions. The packages in this channel are populated by its ContentSources. The relationship with content sources is weak; that is, content sources can come and go, even as the packages contained in the channel remain.

See Also:
Serialized Form

Field Summary
static String QUERY_FIND_ALL
           
static String QUERY_FIND_AVAILABLE_CHANNEL_COMPOSITES_BY_RESOURCE_ID
           
static String QUERY_FIND_AVAILABLE_CHANNEL_COMPOSITES_BY_RESOURCE_ID_COUNT
           
static String QUERY_FIND_BY_CONTENT_SOURCE_ID
           
static String QUERY_FIND_BY_CONTENT_SOURCE_ID_FETCH_CCS
           
static String QUERY_FIND_BY_IDS
           
static String QUERY_FIND_BY_NAME
           
static String QUERY_FIND_CHANNEL_COMPOSITES_BY_RESOURCE_ID
           
static String QUERY_FIND_CHANNEL_COMPOSITES_BY_RESOURCE_ID_COUNT
           
static String QUERY_FIND_CHANNELS_BY_RESOURCE_ID
           
static String QUERY_FIND_SUBSCRIBER_RESOURCES
           
 
Constructor Summary
Channel()
           
Channel(String name)
           
 
Method Summary
 ChannelContentSource addContentSource(ContentSource contentSource)
          Directly assign a content source to this channel.
 ChannelPackageVersion addPackageVersion(PackageVersion packageVersion)
          Directly assign a package version to this channel.
 ResourceChannel addResource(Resource resource)
          Directly subscribe a resource to this channel.
 boolean equals(Object obj)
           
 Set<ChannelContentSource> getChannelContentSources()
          Returns the explicit mapping entities.
 Set<ChannelPackageVersion> getChannelPackageVersions()
          Returns the explicit mapping entities.
 Set<ContentSource> getContentSources()
          The content sources that this channel serves up.
 long getCreationDate()
          Timestamp of when this channel was created.
 String getDescription()
          User specified description of the channel.
 int getId()
           
 long getLastModifiedDate()
          Timestamp of the last time the sources of this channel was changed.
 String getName()
          Programmatic name of the channel.
 Set<PackageVersion> getPackageVersions()
          The package versions that this channel serves up.
 Set<ResourceChannel> getResourceChannels()
          Returns the explicit mapping entities.
 Set<Resource> getResources()
          The resources subscribed to this channel.
 int hashCode()
           
 ChannelContentSource removeContentSource(ContentSource contentSource)
          Removes the content source from this channel, if it exists.
 ChannelPackageVersion removePackageVersion(PackageVersion packageVersion)
          Removes the package version from this channel, if it exists.
 ResourceChannel removeResource(Resource resource)
          Unsubscribes the resource from this channel, if it exists.
 void setCreationDate(long creationDate)
           
 void setDescription(String description)
           
 void setId(int id)
           
 void setLastModifiedDate(long lastModifiedDate)
           
 void setName(String name)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

QUERY_FIND_ALL

public static final String QUERY_FIND_ALL
See Also:
Constant Field Values

QUERY_FIND_BY_IDS

public static final String QUERY_FIND_BY_IDS
See Also:
Constant Field Values

QUERY_FIND_BY_NAME

public static final String QUERY_FIND_BY_NAME
See Also:
Constant Field Values

QUERY_FIND_BY_CONTENT_SOURCE_ID_FETCH_CCS

public static final String QUERY_FIND_BY_CONTENT_SOURCE_ID_FETCH_CCS
See Also:
Constant Field Values

QUERY_FIND_BY_CONTENT_SOURCE_ID

public static final String QUERY_FIND_BY_CONTENT_SOURCE_ID
See Also:
Constant Field Values

QUERY_FIND_SUBSCRIBER_RESOURCES

public static final String QUERY_FIND_SUBSCRIBER_RESOURCES
See Also:
Constant Field Values

QUERY_FIND_CHANNELS_BY_RESOURCE_ID

public static final String QUERY_FIND_CHANNELS_BY_RESOURCE_ID
See Also:
Constant Field Values

QUERY_FIND_CHANNEL_COMPOSITES_BY_RESOURCE_ID

public static final String QUERY_FIND_CHANNEL_COMPOSITES_BY_RESOURCE_ID
See Also:
Constant Field Values

QUERY_FIND_CHANNEL_COMPOSITES_BY_RESOURCE_ID_COUNT

public static final String QUERY_FIND_CHANNEL_COMPOSITES_BY_RESOURCE_ID_COUNT
See Also:
Constant Field Values

QUERY_FIND_AVAILABLE_CHANNEL_COMPOSITES_BY_RESOURCE_ID

public static final String QUERY_FIND_AVAILABLE_CHANNEL_COMPOSITES_BY_RESOURCE_ID
See Also:
Constant Field Values

QUERY_FIND_AVAILABLE_CHANNEL_COMPOSITES_BY_RESOURCE_ID_COUNT

public static final String QUERY_FIND_AVAILABLE_CHANNEL_COMPOSITES_BY_RESOURCE_ID_COUNT
See Also:
Constant Field Values
Constructor Detail

Channel

public Channel()

Channel

public Channel(String name)
Method Detail

getId

public int getId()

setId

public void setId(int id)

getName

public String getName()
Programmatic name of the channel.


setName

public void setName(String name)

getDescription

public String getDescription()
User specified description of the channel.


setDescription

public void setDescription(String description)

getCreationDate

public long getCreationDate()
Timestamp of when this channel was created.


setCreationDate

public void setCreationDate(long creationDate)

getLastModifiedDate

public long getLastModifiedDate()
Timestamp of the last time the sources of this channel was changed. It is not necessarily the last time any other part of this channel object was changed (for example, this last modified date does not necessarily correspond to the time when the description was modified).


setLastModifiedDate

public void setLastModifiedDate(long lastModifiedDate)

getResourceChannels

public Set<ResourceChannel> getResourceChannels()
Returns the explicit mapping entities.

Returns:
the mapping entities
See Also:
getResources()

getResources

public Set<Resource> getResources()
The resources subscribed to this channel.

The returned set is not backed by this entity - if you want to alter the set of associated resources, use getResourceChannels() or addResource(Resource), removeResource(Resource).


addResource

public ResourceChannel addResource(Resource resource)
Directly subscribe a resource to this channel.

Parameters:
resource -
Returns:
the mapping that was added

removeResource

public ResourceChannel removeResource(Resource resource)
Unsubscribes the resource from this channel, if it exists. If it was already subscribed, the mapping that was removed is returned; if not, null is returned.

Parameters:
resource - the resource to unsubscribe from this channel
Returns:
the mapping that was removed or null if the resource was not subscribed to this channel

getChannelContentSources

public Set<ChannelContentSource> getChannelContentSources()
Returns the explicit mapping entities.

Returns:
the mapping entities
See Also:
getContentSources()

getContentSources

public Set<ContentSource> getContentSources()
The content sources that this channel serves up. These are the content sources that provide or provided packages for this channel. This relationship is weak; a content source may not be in this set but the packages it loaded into this channel may still exist.

The returned set is not backed by this entity - if you want to alter the set of associated content sources, use getChannelContentSources() or addContentSource(ContentSource), removeContentSource(ContentSource).


addContentSource

public ChannelContentSource addContentSource(ContentSource contentSource)
Directly assign a content source to this channel.

Parameters:
contentSource -
Returns:
the mapping that was added

removeContentSource

public ChannelContentSource removeContentSource(ContentSource contentSource)
Removes the content source from this channel, if it exists. If it does exist, the mapping that was removed is returned; if the given content source did not exist as one that is a member of this channel, null is returned.

Parameters:
contentSource - the content source to remove from this channel
Returns:
the mapping that was removed or null if the content source was not mapped to this channel

getChannelPackageVersions

public Set<ChannelPackageVersion> getChannelPackageVersions()
Returns the explicit mapping entities.

Returns:
the mapping entities
See Also:
getPackageVersions()

getPackageVersions

public Set<PackageVersion> getPackageVersions()
The package versions that this channel serves up. Subscribers to this channel will have access to the returned set of package versions. These are package versions that were directly assigned to the channel and those that were assigned via its relationship with its content sources. This is the relationship that should be consulted when determining what package versions this channel exposes - do not look at the indirect relationship from content sources to package versions. When content sources are assigned to this channel, this package version relationship will be automatically managed.

The returned set is not backed by this entity - if you want to alter the set of associated package versions, use getChannelPackageVersions() or addPackageVersion(PackageVersion), removePackageVersion(PackageVersion).


addPackageVersion

public ChannelPackageVersion addPackageVersion(PackageVersion packageVersion)
Directly assign a package version to this channel.

Parameters:
packageVersion -
Returns:
the mapping that was added

removePackageVersion

public ChannelPackageVersion removePackageVersion(PackageVersion packageVersion)
Removes the package version from this channel, if it exists. If it does exist, the mapping that was removed is returned; if the given package version did not exist as one that is a member of this channel, null is returned.

Parameters:
packageVersion - the package version to remove from this channel
Returns:
the mapping that was removed or null if the package version was not mapped to this channel

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2008-2009 RHQ Project Advisory Board (Red Hat, Inc.). All Rights Reserved.