public abstract class ConfigActionHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CHANNEL |
static java.lang.String |
CHANNEL_ID |
static java.lang.String |
FILE |
static java.lang.String |
FILE_ID |
static java.lang.String |
REVISION |
static java.lang.String |
REVISION_ID |
Modifier and Type | Method and Description |
---|---|
static void |
clearRhnSets(User user)
Clears all of the configuration management sets.
|
static ConfigRevision |
findRevision(javax.servlet.http.HttpServletRequest req)
Find the requested REVISION.
|
static ConfigChannel |
getChannel(javax.servlet.http.HttpServletRequest request)
Finds the config channel with the identifier corresponding with the value
of the ccid request parameter.
|
static ConfigChannel |
getChannel(javax.servlet.http.HttpServletRequest request,
java.lang.String param)
Finds the config channel with the identifier corresponding with the value
of the request parameter with the given name.
|
static ConfigFile |
getFile(javax.servlet.http.HttpServletRequest request)
Finds the config file from the cfid request parameter.
|
static ConfigRevision |
getRevision(javax.servlet.http.HttpServletRequest request,
ConfigFile file)
Tries to find the revision using a request parameter.
|
static java.lang.String |
makeChannelCountsMessage(long count,
java.lang.String url)
Makes messages that look like
1 channel
2 channels
None
Very standard i18nized counts messages
used in various places in config management.
|
static java.lang.String |
makeFileCountsMessage(ConfigFileCount count,
java.lang.String url,
boolean includeAddUrlForEmpty)
Makes messages that look like
1 file and 5 directories and 0 symlinks
2 files and 1 directory and 0 symlinks
No files or directories or symlinks
Very standard i18nized counts messages
used in various places in config management.
|
static java.lang.String |
makeFileCountsMessage(ConfigFileCount count,
java.lang.String url,
boolean includeEmptyFilesAndDirs,
boolean includeAddUrlForEmpty)
Makes messages that look like
1 file and 5 directories and 0 symlinks
2 files and 1 directory and 0 symlinks
No files or directories and 0 symlinks
Very standard i18nized counts messages
used in various places in config management.
|
static void |
processParamMap(ConfigChannel cc,
java.util.Map params)
Adds the config channel info to the given map
using the identifiers of the request parameters.
|
static void |
processParamMap(javax.servlet.http.HttpServletRequest request,
java.util.Map params)
Adds the config revision, config file, and config channel to the given map
using the identifiers of the request parameters.
|
static void |
processRequestAttributes(RequestContext rctxIn)
Adds the config revision, config file, and config channel as request attributes
using the identifiers of the request parameters.
|
static void |
setupRequestAttributes(RequestContext ctx,
ConfigChannel channel)
Adds the config channel info as request attributes
when we know the channel
Used by the pages that aren't file- and/or revision-specific
|
static void |
setupRequestAttributes(RequestContext rctxIn,
ConfigFile file,
ConfigRevision cr)
Adds the config revision, config file, and config channel as request attributes
when we already know the file and rev
|
public static final java.lang.String REVISION_ID
public static final java.lang.String FILE_ID
public static final java.lang.String CHANNEL_ID
public static final java.lang.String FILE
public static final java.lang.String REVISION
public static final java.lang.String CHANNEL
public static void processRequestAttributes(RequestContext rctxIn)
rctxIn
- The request context which has the request.public static void setupRequestAttributes(RequestContext rctxIn, ConfigFile file, ConfigRevision cr)
rctxIn
- The request context which has the request.file
- known config-filecr
- known revision (null if there isn't one)public static void setupRequestAttributes(RequestContext ctx, ConfigChannel channel)
ctx
- The request context which has the request.channel
- known channelpublic static void processParamMap(ConfigChannel cc, java.util.Map params)
cc
- ConfigChannel of interestparams
- The map in which findings should be stored.public static void processParamMap(javax.servlet.http.HttpServletRequest request, java.util.Map params)
request
- The HttServletRequest to get identifiers fromparams
- The map to which findings should be stored.public static ConfigChannel getChannel(javax.servlet.http.HttpServletRequest request, java.lang.String param)
request
- The request to look in for the id (if we're creating a new channel,
it might be null)param
- The name of the id request parameter.public static ConfigChannel getChannel(javax.servlet.http.HttpServletRequest request)
request
- The request to look in for the idpublic static ConfigFile getFile(javax.servlet.http.HttpServletRequest request)
request
- The HttpServletRequest with a cfidpublic static ConfigRevision getRevision(javax.servlet.http.HttpServletRequest request, ConfigFile file)
request
- The HttpServletRequest which has a crid parameterfile
- The file this revision should belong to.public static ConfigRevision findRevision(javax.servlet.http.HttpServletRequest req)
req
- incoming requestpublic static void clearRhnSets(User user)
user
- The user for which to clear the sets.public static java.lang.String makeFileCountsMessage(ConfigFileCount count, java.lang.String url, boolean includeAddUrlForEmpty)
count
- the ConfigFileCount object,
that stores info on the number of files and directoriesurl
- the url to wrap the messages if so desiredincludeAddUrlForEmpty
- include "Add" section for emptypublic static java.lang.String makeFileCountsMessage(ConfigFileCount count, java.lang.String url, boolean includeEmptyFilesAndDirs, boolean includeAddUrlForEmpty)
count
- the ConfigFileCount object,
that stores info on the number of files and directoriesurl
- the url to wrap the messages if so desiredincludeEmptyFilesAndDirs
- force the inclusion of both
the file and directory information
even if their count is 0.
for example:
if this param == true
return "0 files and 1 directory and 0 symlinks"
else
return "1 directory"includeAddUrlForEmpty
- include "Add" section for emptypublic static java.lang.String makeChannelCountsMessage(long count, java.lang.String url)
count
- the number of config channelsurl
- the url to wrap the messages if so desired