public class ChannelFactory extends HibernateFactory
Modifier and Type | Method and Description |
---|---|
static void |
addChannelPackage(java.lang.Long cid,
java.lang.Long pid) |
static void |
addClonedErrataToChannel(java.util.Set<java.lang.Long> eids,
java.lang.Long cid)
Adds errata to channel mapping.
|
static void |
clearContentSourceFilters(java.lang.Long id)
Clear a content source's filters
|
static void |
cloneNewestPackageCache(java.lang.Long fromChannelId,
java.lang.Long toChannelId)
Clones the "newest" channel packages according to clone.
|
static boolean |
containsDistributions(Channel ch)
Method to check if the channel contains any kickstart distributions
associated to it.
|
static Channel |
createChannel()
Creates an empty Channel
|
static ContentSource |
createRepo()
Creates an empty Repo
|
static SslContentSource |
createRepoSslSet()
Creates empty SSL set for repository
|
static boolean |
doesChannelLabelExist(java.lang.String label)
Returns true if the given label is in use.
|
static boolean |
doesChannelNameExist(java.lang.String name)
Returns true if the given name is in use.
|
static ChannelArch |
findArchByLabel(java.lang.String label)
returns a ChannelArch by label
|
static java.util.List<java.lang.String> |
findChannelArchLabelsSyncdChannels()
Returns a distinct list of ChannelArch labels for all synch'd and custom
channels in the satellite.
|
static ChecksumType |
findChecksumTypeByLabel(java.lang.String checksum)
Find checksumtype by label
|
static java.util.List<java.lang.Long> |
findOriginalPackages(Channel channel)
Find the original packages that were part of a channel.
|
static java.util.List<Channel> |
getAccessibleChannelsByOrg(java.lang.Long orgid)
Returns the list of Channels accessible by an org
Channels are accessible if they are owned by an org or public.
|
static java.util.List<Channel> |
getAccessibleChildChannels(Channel baseChannel,
User user)
Returns the accessible child channels associated to a base channel.
|
static Channel |
getBaseChannel(java.lang.Long sid)
Returns the base channel for the given server id.
|
static java.util.List<ChannelArch> |
getChannelArchitectures()
Returns list of channel architectures
|
static java.util.List |
getChannelIds(java.util.List<java.lang.String> labelsIn)
Retrieve a list of channel ids associated with the labels provided
|
static java.util.List<java.lang.Long> |
getChannelPackageWithErrata(Channel chan,
java.util.Collection<java.lang.Long> eids)
Get a list of packages ids that are in a channel
and in a list of errata.
|
static java.util.List<ClonedChannel> |
getChannelsWithClonableErrata(Org org)
Returns a list of Channels which have clonable errata.
|
static int |
getErrataCount(Channel channel)
Get the errata count for a channel
|
static java.util.List<Channel> |
getKickstartableChannels(Org org)
Return a list of channels that are kickstartable to the Org passed in,
i.e.
|
static java.util.List<Channel> |
getKickstartableTreeChannels(Org org)
Return a list of kickstartable tree channels, i.e.
|
protected org.apache.log4j.Logger |
getLogger()
Get the Logger for the derived class so log messages
show up on the correct class
|
static int |
getPackageCount(Channel channel)
Looksup the number of Packages in a channel
|
static java.util.List<java.lang.Long> |
getPackageIds(java.lang.Long cid)
Get package ids for a channel
|
static java.util.List<Channel> |
getUserAcessibleChannels(java.lang.Long orgid,
java.lang.Long cid)
Returns the list of Channel ids which the given orgid has access to.
|
static boolean |
isGloballySubscribable(Org org,
Channel c)
Returns true if the given channel is globally subscribable for the
given org.
|
static java.util.List<Channel> |
listAllBaseChannels()
List all accessible base channels for the entire satellite
|
static java.util.List<Channel> |
listAllBaseChannels(User user)
List all accessible base channels for an org
|
static java.util.List<Channel> |
listAllChildrenForChannel(Channel parent)
List all child channels of the given parent regardless of the user
|
static java.util.List<DistChannelMap> |
listAllDistChannelMaps()
List all defined dist channel maps
Returns empty array if none is found.
|
static java.util.List<DistChannelMap> |
listAllDistChannelMapsByOrg(Org org)
Lists all dist channel maps for an user organization
|
static java.util.List<Channel> |
listCompatibleBasesForSSMNoBaseInNullOrg(User user)
Lists *common* compatible channels for all SSM systems subscribed to a common base
Returns empty list if none is found.
|
static java.util.List<DistChannelMap> |
listCompatibleDcmByServerInNullOrg(Server server)
Lists compatible dist channel mappings for a server available within an organization
Returns empty list if none is found.
|
static java.util.List<Channel> |
listCompatibleDcmForChannelSSMInNullOrg(User user,
Channel channel)
Lists *common* compatible channels for all SSM systems subscribed to a common base
Returns empty list if none is found.
|
static java.util.List<ContentSourceType> |
listContentSourceTypes()
List all available content source types
|
static java.util.List<Channel> |
listCustomBaseChannels(User user)
Get a list of base channels that have an org associated
|
static java.util.List<Channel> |
listCustomBaseChannelsForSSM(User user,
Channel channel)
Lists *common* custom compatible channels
for all SSM systems subscribed to a common base
|
static java.util.List<Channel> |
listCustomBaseChannelsForSSMNoBase(User user)
Lists *common* custom compatible channels
for all SSM systems without base channel
|
static java.util.List<DistChannelMap> |
listDistChannelMaps(Channel c)
Lookup dist channel mappings for the given channel.
|
static java.util.List<java.lang.Long> |
listManagerIdsForChannel(Org org,
java.lang.Long channelId)
returns channel manager id for given channel
|
static java.util.List<Channel> |
listRedHatBaseChannels()
Get a list of channels with no org that are not a child
|
static java.util.List<Channel> |
listRedHatBaseChannels(User user)
List all accessible Red Hat base channels for a given user
|
static java.util.List<Channel> |
listSubscribableBaseChannels(User user)
List all accessible base channels for an org
|
static java.util.List<java.lang.Long> |
listSubscriberIdsForChannel(Org org,
java.lang.Long channelId)
returns channel subscriber id for given channel
|
static java.util.List<ChecksumType> |
listYumSupportedChecksums()
Find yum supported checksum types
|
static void |
lock(Channel c)
Locks the given Channel for update on a database level
|
static ChannelArch |
lookupArchByLabel(java.lang.String label)
Lookup a ChannelArch based on its label
|
static ChannelArch |
lookupArchByName(java.lang.String name)
Lookup a ChannelArch based on its name
|
static Channel |
lookupById(java.lang.Long id)
Lookup a Channel by its id
|
static Channel |
lookupByIdAndUser(java.lang.Long id,
User userIn)
Lookup a Channel by id and User
|
static Channel |
lookupByLabel(Org org,
java.lang.String label)
Returns the Channel whose label matches the given label.
|
static Channel |
lookupByLabel(java.lang.String label)
Returns the Channel whose label matches the given label.
|
static Channel |
lookupByLabelAndUser(java.lang.String label,
User userIn)
Lookup a Channel by label and User
|
static ContentSource |
lookupContentSource(java.lang.Long id,
Org orgIn)
lookup content source by id and org
|
static ContentSource |
lookupContentSourceByOrgAndLabel(Org org,
java.lang.String label)
Lookup a content source by org and label
|
static java.util.List<ContentSource> |
lookupContentSourceByOrgAndRepo(Org org,
ContentSourceType repoType,
java.lang.String repoUrl)
Lookup a content source by org and repo
|
static java.util.List<ContentSourceFilter> |
lookupContentSourceFiltersById(java.lang.Long id)
Lookup a content source's filters by id
|
static java.util.List<ContentSource> |
lookupContentSources(Org org)
Lookup a content source by org
|
static java.util.List<ContentSource> |
lookupContentSources(Org org,
Channel c)
Lookup a content source by org/channel
|
static ContentSourceType |
lookupContentSourceType(java.lang.String label)
Lookup a content source type by label
|
static ReleaseChannelMap |
lookupDefaultReleaseChannelMapForChannel(Channel channel)
Lookup the default release channel map for the given channel.
|
static DistChannelMap |
lookupDistChannelMapById(java.lang.Long id)
Lookup the dist channel map by id
|
static DistChannelMap |
lookupDistChannelMapByOrgReleaseArch(Org org,
java.lang.String release,
ChannelArch channelArch)
Lookup the dist channel map for the given organization according to
release and channel arch.
|
static DistChannelMap |
lookupDistChannelMapByPnReleaseArch(Org org,
java.lang.String productName,
java.lang.String release,
ChannelArch channelArch)
Lookup the dist channel map for the given product name, release, and channel arch.
|
static Channel |
lookupOriginalChannel(Channel chan)
Lookup the original channel of a cloned channel
|
static Package |
lookupPackageByFilename(Channel channel,
java.lang.String fileName)
Lookup a Package based on the channel and package file name
|
static ProductName |
lookupProductNameByLabel(java.lang.String label)
Lookup a product name by label.
|
static void |
refreshNewestPackageCache(Channel c,
java.lang.String label)
Utility to call
refreshNewestPackageCache(Long, String) given a channel. |
static void |
refreshNewestPackageCache(java.lang.Long channelId,
java.lang.String label)
Refreshes the channel with the "newest" packages.
|
static void |
remove(Channel c)
Remove a Channel from the DB
|
static void |
remove(ContentSource src)
Remove a Content Source from the DB
|
static void |
remove(ContentSourceFilter filter)
Remove a ContentSourceFilter from the DB
|
static void |
remove(DistChannelMap dcm)
Remove a DistChannelMap from the DB
|
static void |
save(Channel c)
Insert or Update a Channel.
|
static void |
save(ContentSource c)
Insert or Update a content source.
|
static void |
save(ContentSourceFilter f)
Insert or Update a content source filter.
|
static void |
save(DistChannelMap dcm)
Insert or Update a DistChannelMap.
|
static void |
setGloballySubscribable(Org org,
Channel channel,
boolean value)
Set the globally subscribable attribute for a given channel
|
addConfigurator, blobToByteArray, byteArrayToBlob, closeSession, closeSessionFactory, commitTransaction, createSessionFactory, createSessionFactory, executeCallableMode, executeSelectMode, getBlobContents, getByteArrayContents, getObject, getSession, initialize, inTransaction, isClosed, isInitialized, listObjectsByNamedQuery, listObjectsByNamedQuery, listObjectsByNamedQuery, lockObject, lookupObjectByNamedQuery, lookupObjectByNamedQuery, reload, removeObject, rollbackTransaction, saveObject, saveObject, stringToByteArray
protected org.apache.log4j.Logger getLogger()
getLogger
in class HibernateFactory
public static Channel lookupById(java.lang.Long id)
id
- the id to search forpublic static Channel lookupByIdAndUser(java.lang.Long id, User userIn)
id
- the id to search foruserIn
- User who is doing the lookingpublic static Channel lookupByLabelAndUser(java.lang.String label, User userIn)
label
- the label to search foruserIn
- User who is doing the lookingpublic static ContentSourceType lookupContentSourceType(java.lang.String label)
label
- the label to lookuppublic static java.util.List<ContentSourceType> listContentSourceTypes()
public static java.util.List<ContentSource> lookupContentSources(Org org)
org
- the org to lookuppublic static java.util.List<ContentSource> lookupContentSources(Org org, Channel c)
org
- the org to lookupc
- the channelpublic static ContentSource lookupContentSourceByOrgAndLabel(Org org, java.lang.String label)
org
- the org to lookuplabel
- repo labelpublic static java.util.List<ContentSource> lookupContentSourceByOrgAndRepo(Org org, ContentSourceType repoType, java.lang.String repoUrl)
org
- the org to lookuprepoType
- repo typerepoUrl
- repo urlpublic static ContentSource lookupContentSource(java.lang.Long id, Org orgIn)
id
- id of content sourceorgIn
- org to checkpublic static java.util.List<ContentSourceFilter> lookupContentSourceFiltersById(java.lang.Long id)
id
- source idpublic static java.util.List getChannelIds(java.util.List<java.lang.String> labelsIn)
labelsIn
- the labels to search forpublic static void save(Channel c)
c
- Channel to be stored in database.public static void save(ContentSource c)
c
- content source to be stored in database.public static void save(DistChannelMap dcm)
dcm
- DistChannelMap to be stored in database.public static void save(ContentSourceFilter f)
f
- content source filter to be stored in database.public static void remove(Channel c)
c
- Action to be removed from database.public static void remove(DistChannelMap dcm)
dcm
- Action to be removed from database.public static void remove(ContentSource src)
src
- to be removed from databasepublic static void remove(ContentSourceFilter filter)
filter
- to be removed from databasepublic static Channel getBaseChannel(java.lang.Long sid)
sid
- Server id whose base channel we want.public static java.util.List<ClonedChannel> getChannelsWithClonableErrata(Org org)
org
- Org.public static java.util.List<Channel> getUserAcessibleChannels(java.lang.Long orgid, java.lang.Long cid)
orgid
- Org idcid
- Base Channel id.public static java.util.List<Channel> getAccessibleChildChannels(Channel baseChannel, User user)
baseChannel
- the base channel who's child channels are neededuser
- the user requesting the info.. (has to be globally subscribed etc.)public static java.util.List<Channel> getAccessibleChannelsByOrg(java.lang.Long orgid)
orgid
- The id for the orgpublic static java.util.List<ChannelArch> getChannelArchitectures()
public static ChannelArch findArchByLabel(java.lang.String label)
label
- ChannelArch labelpublic static Channel lookupByLabel(Org org, java.lang.String label)
org
- The org of the user looking up the channellabel
- Channel label sought.public static Channel lookupByLabel(java.lang.String label)
label
- Channel label sought.public static boolean isGloballySubscribable(Org org, Channel c)
org
- Orgc
- Channel to validate.public static void setGloballySubscribable(Org org, Channel channel, boolean value)
org
- The org containing the channelchannel
- The channel in questionvalue
- True to make the channel globally subscribable, false to make it not
globally subscribable.public static void addChannelPackage(java.lang.Long cid, java.lang.Long pid)
cid
- Channel package is being added topid
- Package id from rhnPackagepublic static Channel createChannel()
public static ContentSource createRepo()
public static SslContentSource createRepoSslSet()
public static void refreshNewestPackageCache(Channel c, java.lang.String label)
refreshNewestPackageCache(Long, String)
given a channel.c
- channel to be refreshedlabel
- the labelpublic static void refreshNewestPackageCache(java.lang.Long channelId, java.lang.String label)
channelId
- identifies the channel to be refreshedlabel
- the labelpublic static void cloneNewestPackageCache(java.lang.Long fromChannelId, java.lang.Long toChannelId)
fromChannelId
- original channel idtoChannelId
- cloned channle idpublic static boolean doesChannelLabelExist(java.lang.String label)
label
- Labelpublic static boolean doesChannelNameExist(java.lang.String name)
name
- namepublic static java.util.List<Channel> getKickstartableTreeChannels(Org org)
org
- orgpublic static java.util.List<Channel> getKickstartableChannels(Org org)
org
- orgpublic static java.util.List<Channel> listCustomBaseChannels(User user)
user
- the logged in userpublic static java.util.List<ChecksumType> listYumSupportedChecksums()
public static ChecksumType findChecksumTypeByLabel(java.lang.String checksum)
checksum
- checksum labelpublic static java.util.List<java.lang.Long> getChannelPackageWithErrata(Channel chan, java.util.Collection<java.lang.Long> eids)
chan
- the channeleids
- the errata idspublic static ChannelArch lookupArchByName(java.lang.String name)
name
- arch namepublic static ChannelArch lookupArchByLabel(java.lang.String label)
label
- arch labelpublic static java.util.List<java.lang.Long> getPackageIds(java.lang.Long cid)
cid
- the channel idpublic static int getPackageCount(Channel channel)
channel
- the Channel who's package count you are interested in.public static int getErrataCount(Channel channel)
channel
- the channelpublic static java.util.List<java.lang.Long> findOriginalPackages(Channel channel)
channel
- the channel to clone frompublic static ReleaseChannelMap lookupDefaultReleaseChannelMapForChannel(Channel channel)
channel
- Channel to lookup mapping forpublic static java.util.List<DistChannelMap> listAllDistChannelMaps()
public static java.util.List<DistChannelMap> listAllDistChannelMapsByOrg(Org org)
org
- organizationpublic static DistChannelMap lookupDistChannelMapById(java.lang.Long id)
id
- dist channel map idpublic static DistChannelMap lookupDistChannelMapByPnReleaseArch(Org org, java.lang.String productName, java.lang.String release, ChannelArch channelArch)
org
- organizationproductName
- Product name.release
- Version.channelArch
- Channel arch.public static DistChannelMap lookupDistChannelMapByOrgReleaseArch(Org org, java.lang.String release, ChannelArch channelArch)
org
- organizationrelease
- releasechannelArch
- Channel arch.public static java.util.List<DistChannelMap> listCompatibleDcmByServerInNullOrg(Server server)
server
- serverpublic static java.util.List<Channel> listCompatibleDcmForChannelSSMInNullOrg(User user, Channel channel)
user
- userchannel
- channelpublic static java.util.List<Channel> listCompatibleBasesForSSMNoBaseInNullOrg(User user)
user
- userpublic static java.util.List<Channel> listCustomBaseChannelsForSSM(User user, Channel channel)
user
- userchannel
- channelpublic static java.util.List<Channel> listCustomBaseChannelsForSSMNoBase(User user)
user
- userpublic static java.util.List<DistChannelMap> listDistChannelMaps(Channel c)
c
- Channel to lookup mapping forpublic static java.util.List<Channel> listRedHatBaseChannels()
public static java.util.List<Channel> listRedHatBaseChannels(User user)
user
- logged in userpublic static Channel lookupOriginalChannel(Channel chan)
chan
- the channel to find the original ofpublic static ProductName lookupProductNameByLabel(java.lang.String label)
label
- Product name label to search for.public static java.util.List<java.lang.String> findChannelArchLabelsSyncdChannels()
public static java.util.List<Channel> listSubscribableBaseChannels(User user)
user
- logged in user.public static java.util.List<Channel> listAllBaseChannels(User user)
user
- logged in user.public static java.util.List<Channel> listAllBaseChannels()
public static java.util.List<Channel> listAllChildrenForChannel(Channel parent)
parent
- the parent channelpublic static Package lookupPackageByFilename(Channel channel, java.lang.String fileName)
channel
- to look infileName
- to look uppublic static boolean containsDistributions(Channel ch)
ch
- the channel to check distros onpublic static void clearContentSourceFilters(java.lang.Long id)
id
- source idpublic static java.util.List<java.lang.Long> listManagerIdsForChannel(Org org, java.lang.Long channelId)
org
- given organizationchannelId
- channel idpublic static java.util.List<java.lang.Long> listSubscriberIdsForChannel(Org org, java.lang.Long channelId)
org
- given organizationchannelId
- channel idpublic static void lock(Channel c)
c
- Channel to lockpublic static void addClonedErrataToChannel(java.util.Set<java.lang.Long> eids, java.lang.Long cid)
eids
- List of eids to add mappings forcid
- channel id we're cloning into