Class Base
- java.lang.Object
-
- net.sf.basedb.clients.web.Base
-
public final class Base extends Object
This class is used to collect some useful methods for the web client into a single place. All methods in this class are static methods.- Version:
- 2.0
- Author:
- Nicklas
- Last modified
- $Date$
-
-
Field Summary
Fields Modifier and Type Field Description private static Integer
defaultMaxRecent
private static Float
defaultScale
static String
WEBCLIENT_ID
The external ID of the web client application.
-
Constructor Summary
Constructors Constructor Description Base()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ItemContext
createDefaultContext(String sortProperty, String defaultColumns)
Create a defaultItemContext
with settings for default visible columns and sort property.static ItemContext
getAndSetCurrentContext(SessionControl sc, Item itemType, String subContext, PageContext pageContext, ItemContext defaultContext)
Same as:getAndSetCurrentContext(sc, itemType, subContext, pageContext, defaultContext, false)
.static ItemContext
getAndSetCurrentContext(SessionControl sc, Item itemType, String subContext, PageContext pageContext, ItemContext defaultContext, boolean resetTemporary)
static ItemContext
getAndSetCurrentContext(SessionControl sc, Item itemType, String subContext, ServletRequest request, ItemContext defaultContext, boolean resetTemporary)
Get the current context and update it from request information if available.static ItemContext
getAndSetCurrentContext(SessionControl sc, Item itemType, PageContext pageContext, ItemContext defaultContext)
Same as:getAndSetCurrentContext(sc, itemType, "", pageContext, defaultContext, false)
.static ItemContext
getAndSetCurrentContext(SessionControl sc, Item itemType, PageContext pageContext, ItemContext defaultContext, boolean resetTemporary)
Same as:getAndSetCurrentContext(sc, itemType, "", pageContext, defaultContext, resetTemporary)
.static ItemQuery<AnnotationType>
getAnnotationTypesQuery(AnnotatableProxy proxy)
Get a query that returns all annotation types defined for aAnnotatableProxy
item.static ItemQuery<AnnotationType>
getAnnotationTypesQuery(Item itemType)
Get a query that returns all annotation types defined for a particular item type.static ItemQuery<AnnotationType>
getAnnotationTypesQuery(Item itemType, Boolean isProtocolParameter)
Get a query that returns all annotation types defined for a particular item type and, optionally, with a specific protocol parameter setting.static ColorGenerator
getColorGenerator(SessionControl sc, Coloring coloring)
static Color[]
getConfiguredColors(SessionControl sc)
static <T extends BasicItem>
ItemQuery<T>getConfiguredQuery(DbControl dc, ItemContext cc, boolean autoLeftJoin, ItemQuery<T> query, ModeInfo mode)
Deprecated.static <T extends BasicItem>
ItemQuery<T>getConfiguredQuery(DbControl dc, ItemContext cc, ClientContext context, boolean autoLeftJoin, ItemQuery<T> query, ModeInfo mode)
Configures a query.static Cookie
getCookie(HttpServletRequest request, String name)
Get the cookie with the specified name.static String
getCookieValue(HttpServletRequest request, String name)
Get the value of the cookie with the specified name.static ItemQuery<DataFileType>
getDataFileColumns(Item itemType, String columns)
Get a query returning all data file types that are needed to display file set members for the given columns.static ItemQuery<DataFileType>
getDataFileTypes(Item itemType, FileStoreEnabled item, Platform platform, PlatformVariant variant, ItemSubtype subtype)
Get a query that returns all data file types for a specific platform/variant/subtype that can be used on a given item type.static String
getEncodedName(Nameable item, boolean denied)
Encode the name of the nameable item using theHTML.encodeTags(String)
method.static SessionControl
getExistingSessionControl(PageContext pageContext, boolean checkLoggedIn)
Get an existingSessionControl
object given aPageContext
and optionally check that a user is logged in.static SessionControl
getExistingSessionControl(PageContext pageContext, Permission permission, Item itemType)
Get an existingSessionControl
object given aPageContext
and check for generic (role-based) permission to an item type.static SessionControl
getExistingSessionControl(ServletRequest request, boolean checkLoggedIn)
Get a session control for the BASE web client "net.sf.basedb.clients.web".static SessionControl
getExistingSessionControl(ServletRequest request, String externalClientId, boolean checkLoggedIn)
Get an existingSessionControl
object given aServletRequest
object and optionally check that a user is logged in.static SessionControl
getExistingSessionControl(ServletRequest request, Permission permission, Item itemType)
Get an existingSessionControl
object given aServletRequest
and check for generic (role-based) permission to an item type.static String
getFileLinks(String ID, File file, String root)
Get view/download links for a file.static <T extends BasicItem>
TgetFirstMatching(DbControl dc, ItemQuery<T> query, String property, PropertyFilter filter)
static ItemQuery<AnnotationType>
getInheritedAnnotationColumns(String columns)
Get a query returning all annotation types that are needed to display inherited annotations for the given columns.static Enumeration<String,String>
getItemListsEnum(DbControl dc, Item memberType, Collection<Include> include)
Get available item lists as an Enumeration that is suitable to use in a column definition for a table.static Enumeration<String,String>
getItemListsEnum(DbControl dc, Item memberType, Collection<Include> include, Filter<? super ItemList> filter)
Get available item lists as an Enumeration that is suitable to use in a column definition for a table.static String
getLink(String ID, String name, Item itemType, int itemId, boolean enableEditLink)
static String
getLink(String ID, String name, Item itemType, int itemId, boolean enableEditLink, String tooltip)
static String
getLinkedFile(String ID, File file, boolean denied, boolean enableEditLink, boolean enableViewDownload, String root)
static String
getLinkedName(String ID, Nameable item, boolean denied, boolean enableEditLink)
static int
getMaxRecent(SessionControl sc)
Get the setting for the maximum number of recently used items to save.static <T extends BasicItem>
TgetOldItem(SessionControl sc, T newItem, int oldVersion)
Get the old item that is stored in theSessionControl
:s session settingitemType.item
.static String
getPropertyFilterString(PropertyFilter filter, Formatter<Date> dateFormatter)
Convert a property filter to a displayable string with operator + value.static ItemQuery<AnnotationType>
getProtocolParametersQuery(Protocol protocol)
Get a query that returns all annotation types assigned as parameters to a specific protocol.static Enumeration<String,String>
getReporterListsEnum(DbControl dc)
static float
getScale(SessionControl sc)
Get the display scale setting.static SessionControl
getSessionControl(PageContext pageContext, boolean create)
Get a new or existingSessionControl
object given aPageContext
.static SessionControl
getSessionControl(ServletRequest request, boolean create)
Get a session control for the BASE web client "net.sf.basedb.clients.web".static SessionControl
getSessionControl(ServletRequest request, String externalClientId, boolean create)
Get a new or existingSessionControl
object given aServletRequest
instance.static ItemQuery<ItemSubtype>
getSubtypesQuery(Item itemType)
Get a query that returns all subtypes for the given main item type.static ItemContext
loadContext(SessionControl sc, int contextId, ItemContext defaultContext)
private static boolean
setInclude(Set<Include> includes, String option, Include i)
Set include option if option parameter isn't null.static void
updateAnnotations(DbControl dc, Annotatable oldItem, Annotatable newItem, HttpServletRequest request)
Update annotations on an item taking concurrent modifications into account.static void
updateFiles(DbControl dc, FileStoreEnabled item, HttpServletRequest request, boolean validate, ItemContext cc, int maxRecent)
Update files that are associated with aFileStoreEnabled
item.
-
-
-
Field Detail
-
WEBCLIENT_ID
public static final String WEBCLIENT_ID
The external ID of the web client application.- Since:
- 3.9
- See Also:
- Constant Field Values
-
defaultScale
private static final Float defaultScale
-
defaultMaxRecent
private static final Integer defaultMaxRecent
-
-
Method Detail
-
getSessionControl
public static final SessionControl getSessionControl(PageContext pageContext, boolean create) throws BaseException
Get a new or existingSessionControl
object given aPageContext
. This method will get theID
parameter from the page URL and try to retrieve the corresponding object from the BASEApplication
. If noSessionControl
object exists, a new one will be created if thecreate
parameter is TRUE.- Parameters:
pageContext
- The JSPpageContext
variablecreate
- If a newSessionControl
should be created or not- Returns:
- A
SessionControl
object - Throws:
BaseException
- If there is an error
-
getSessionControl
public static final SessionControl getSessionControl(ServletRequest request, boolean create)
Get a session control for the BASE web client "net.sf.basedb.clients.web".- Since:
- 2.7
- See Also:
getSessionControl(ServletRequest, String, boolean)
-
getSessionControl
public static final SessionControl getSessionControl(ServletRequest request, String externalClientId, boolean create)
Get a new or existingSessionControl
object given aServletRequest
instance. This method will get theID
parameter from the page URL and try to retrieve the corresponding object from the BASEApplication
. If noSessionControl
object exists, a new one will be created if thecreate
parameter is TRUE.- Parameters:
request
- The Servletrequest
variableexternalClientId
- ID of the client applicationcreate
- If a newSessionControl
should be created or not- Returns:
- A
SessionControl
object - Throws:
BaseException
- If there is an error- Since:
- 3.9
-
getExistingSessionControl
public static final SessionControl getExistingSessionControl(PageContext pageContext, boolean checkLoggedIn) throws NotLoggedInException, BaseException
Get an existingSessionControl
object given aPageContext
and optionally check that a user is logged in. This method will get theID
parameter from the page URL and try to retrieve the corresponding object from theApplication
and check that a user is logged in if thecheckLoggedIn
parameter is TRUE.- Parameters:
pageContext
- The JSPpageContext
variablecheckLoggedIn
- If the method should check if a user is logged in or not- Returns:
- A
SessionControl
object - Throws:
NotLoggedInException
- If aSessionControl
object isn't found or no user is logged inBaseException
- If there is another error
-
getExistingSessionControl
public static final SessionControl getExistingSessionControl(ServletRequest request, boolean checkLoggedIn) throws NotLoggedInException, BaseException
Get a session control for the BASE web client "net.sf.basedb.clients.web".- Throws:
NotLoggedInException
BaseException
- Since:
- 2.7
- See Also:
getExistingSessionControl(ServletRequest, String, boolean)
-
getExistingSessionControl
public static final SessionControl getExistingSessionControl(ServletRequest request, String externalClientId, boolean checkLoggedIn) throws NotLoggedInException, BaseException
Get an existingSessionControl
object given aServletRequest
object and optionally check that a user is logged in. This method will get theID
parameter from the page URL and try to retrieve the corresponding object from theApplication
and check that a user is logged in if thecheckLoggedIn
parameter is TRUE.- Parameters:
request
- The Servletrequest
variableexternalClientId
- ID of the client applicationcheckLoggedIn
- If the method should check if a user is logged in or not- Returns:
- A
SessionControl
object - Throws:
NotLoggedInException
- If aSessionControl
object isn't found or no user is logged inBaseException
- If there is another error- Since:
- 3.9
-
getExistingSessionControl
public static final SessionControl getExistingSessionControl(PageContext pageContext, Permission permission, Item itemType) throws PermissionDeniedException, NotLoggedInException, BaseException
Get an existingSessionControl
object given aPageContext
and check for generic (role-based) permission to an item type. This method will get theID
parameter from the page URL and try to retrieve the corresponding object from theApplication
. Then it checks that a user is logged in and that the logged in user has the specified permission for item type. IfPermission.DENIED
is specified, this method checks that the logged in user haven't been denied acces to those items.- Parameters:
pageContext
- The JSPpageContext
variablepermission
- The permission to check for, use one of the codes defined by thePermission
classitemType
- The code for the item type to check for the permission, use one of the values defined by theItem
class- Returns:
- A
SessionControl
object - Throws:
PermissionDeniedException
- If the logged in user doesn't have the requested permissionNotLoggedInException
- If no user is logged in or aSessionControl
object not is foundBaseException
- If there is another error
-
getExistingSessionControl
public static final SessionControl getExistingSessionControl(ServletRequest request, Permission permission, Item itemType) throws PermissionDeniedException, NotLoggedInException, BaseException
Get an existingSessionControl
object given aServletRequest
and check for generic (role-based) permission to an item type. This method will get theID
parameter from the page URL and try to retrieve the corresponding object from theApplication
. Then it checks that a user is logged in and that the logged in user has the specified permission for item type. IfPermission.DENIED
is specified, this method checks that the logged in user haven't been denied acces to those items.- Parameters:
request
- The Servletrequest
variablepermission
- The permission to check for, use one of the codes defined by thePermission
classitemType
- The code for the item type to check for the permission, use one of the values defined by theItem
class- Returns:
- A
SessionControl
object - Throws:
PermissionDeniedException
- If the logged in user doesn't have the requested permissionNotLoggedInException
- If no user is logged in or aSessionControl
object not is foundBaseException
- If there is another error- Since:
- 2.7
-
getAndSetCurrentContext
public static ItemContext getAndSetCurrentContext(SessionControl sc, Item itemType, PageContext pageContext, ItemContext defaultContext)
Same as:getAndSetCurrentContext(sc, itemType, "", pageContext, defaultContext, false)
.
-
getAndSetCurrentContext
public static ItemContext getAndSetCurrentContext(SessionControl sc, Item itemType, PageContext pageContext, ItemContext defaultContext, boolean resetTemporary)
Same as:getAndSetCurrentContext(sc, itemType, "", pageContext, defaultContext, resetTemporary)
.
-
getAndSetCurrentContext
public static ItemContext getAndSetCurrentContext(SessionControl sc, Item itemType, String subContext, PageContext pageContext, ItemContext defaultContext)
Same as:getAndSetCurrentContext(sc, itemType, subContext, pageContext, defaultContext, false)
.
-
getAndSetCurrentContext
public static ItemContext getAndSetCurrentContext(SessionControl sc, Item itemType, String subContext, PageContext pageContext, ItemContext defaultContext, boolean resetTemporary)
-
getAndSetCurrentContext
public static ItemContext getAndSetCurrentContext(SessionControl sc, Item itemType, String subContext, ServletRequest request, ItemContext defaultContext, boolean resetTemporary)
Get the current context and update it from request information if available. This methods updates the following settings on the context:- If the active project has changed since last time the context
was retrieved, the
Include.IN_PROJECT
option is added toItemContext.getInclude()
- If a default context is specified, the
defaultColumns
object is copied to the current context. - The following settings are only updated if they are available in the
request parameters:
Context settings Setting Request parameter setSetting("columns") columns setRowsPerPage rowsperpage setPage page setSortProperty sortby setSortDirection direction Include.REMOVED removed Include.MINE owned Include.SHARED shared Include.IN_PROJECT inproject Include.OTHERS others If a the name of a request parameter starts with "filter:" it is interpreted as a property filter. The name is formatted as follows:
filter:TYPE:property
where TYPE is one ofEnum.name()
strings and property is the name of the property to filter on. This information is used to create a newPropertyFilter
object. The operator and value parameter is taken from the request parameters value.Operator mappings Value starts with Operator = Operator.EQ != or <> Operator.NEQ >= Operator.GTEQ > Operator.GT <= Operator.LTEQ < Operator.LT any other charcter Operator.EQ or Operator.LIKE (if value contains % sign which is wildcard match) If the name of a request parameter is a number it is interpreted as the ID of a selected itema and is added to the
ItemContext.getSelected()
set.
- Parameters:
sc
- The current session controlitemType
- The type of item to get the context forsubContext
- The name of the subcontextrequest
- AServletRequest
object to get request information from, or null if the current context shouldn't be updateddefaultContext
- A default context to copy information from if a current context doesn't existresetTemporary
- If information of temporary nature should be reset or not, for example the 'exclude' filter which is only used in popup windows- Returns:
- an updated
ItemContext
object. - Since:
- 2.7
- If the active project has changed since last time the context
was retrieved, the
-
loadContext
public static ItemContext loadContext(SessionControl sc, int contextId, ItemContext defaultContext)
-
getPropertyFilterString
public static String getPropertyFilterString(PropertyFilter filter, Formatter<Date> dateFormatter)
Convert a property filter to a displayable string with operator + value. Ie. >10000, =Nicklas- Parameters:
filter
- The property filter to convertdateFormatter
- Describing how the date is format locally. The format will be yyyy-MM-dd if this is null.- Returns:
- A displayable string (null is never returned)
-
setInclude
private static boolean setInclude(Set<Include> includes, String option, Include i)
Set include option if option parameter isn't null.- Returns:
- TRUE if the option was changed, FALSE if not
-
createDefaultContext
public static ItemContext createDefaultContext(String sortProperty, String defaultColumns)
Create a defaultItemContext
with settings for default visible columns and sort property. 'MINE' and 'SHARED' objects are set to be included.- Parameters:
sortProperty
- The property, as a String, to sort on. If it starts with a '-', the sort is made in descending order (and the minus is removed)defaultColumns
- The visible columns as a comma separated String.- Returns:
- an
ItemContext
object
-
getConfiguredQuery
@Deprecated public static <T extends BasicItem> ItemQuery<T> getConfiguredQuery(DbControl dc, ItemContext cc, boolean autoLeftJoin, ItemQuery<T> query, ModeInfo mode)
Deprecated.
-
getConfiguredQuery
public static <T extends BasicItem> ItemQuery<T> getConfiguredQuery(DbControl dc, ItemContext cc, ClientContext context, boolean autoLeftJoin, ItemQuery<T> query, ModeInfo mode)
Configures a query. This method callsItemContext.configureQuery(DbControl, EntityQuery, boolean)
and then adds the following filter:- If
ItemContext.getObject("exclude")
contains a list of comma-separated ID:s those are added to the query as a filter that excludes item with those ID:s from the query result
- Type Parameters:
T
- The kind of BasicItem this method is used with.- Parameters:
dc
- The DbControl that will be used to execute the querycc
- The current contextautoLeftJoin
- If associated items should be left joined or not when they appear in a filterquery
- The query to configuremode
- Info about the mode the page has.- Returns:
- The same query, configured according to information in the current context
- Since:
- 3.18
- If
-
getAnnotationTypesQuery
public static ItemQuery<AnnotationType> getAnnotationTypesQuery(Item itemType)
Get a query that returns all annotation types defined for a particular item type. The query will include all items owned by or shared to the logged in user or the active project.- Parameters:
itemType
- The item type- Returns:
- An
ItemQuery
object - See Also:
getAnnotationTypesQuery(Item, Boolean)
-
getAnnotationTypesQuery
public static ItemQuery<AnnotationType> getAnnotationTypesQuery(Item itemType, Boolean isProtocolParameter)
Get a query that returns all annotation types defined for a particular item type and, optionally, with a specific protocol parameter setting. The query will include all possible annotation types.- Parameters:
itemType
- The item typeisProtocolParameter
- Specify if only annotation types assigned as protocol parameters should be returned, a null value ignores the protocol parameter flag- Returns:
- An
ItemQuery
object
-
getInheritedAnnotationColumns
public static ItemQuery<AnnotationType> getInheritedAnnotationColumns(String columns)
Get a query returning all annotation types that are needed to display inherited annotations for the given columns. The columns is a string with comma-separated values that define the visible columns in a table. Columns for inherited annotations are defined by 'ia'+<id>.- Since:
- 3.5
-
getDataFileColumns
public static ItemQuery<DataFileType> getDataFileColumns(Item itemType, String columns)
Get a query returning all data file types that are needed to display file set members for the given columns. The columns is a string with comma-separated values that define the visible columns in a table. Columns for data file types annotations are defined by 'ft'+<id>.- Since:
- 3.5
-
getSubtypesQuery
public static ItemQuery<ItemSubtype> getSubtypesQuery(Item itemType)
Get a query that returns all subtypes for the given main item type.- Parameters:
itemType
- The main item type- Returns:
- An
ItemQuery
object - Since:
- 3.0
-
getAnnotationTypesQuery
public static ItemQuery<AnnotationType> getAnnotationTypesQuery(AnnotatableProxy proxy)
Get a query that returns all annotation types defined for aAnnotatableProxy
item.- Parameters:
proxy
- The annotatable proxy- Returns:
- An
ItemQuery
object
-
getProtocolParametersQuery
public static ItemQuery<AnnotationType> getProtocolParametersQuery(Protocol protocol)
Get a query that returns all annotation types assigned as parameters to a specific protocol. The query will include all possible annotation types.- Parameters:
protocol
- The protocol, or null- Returns:
- An
ItemQuery
object, or null if the protocol is null
-
getDataFileTypes
public static ItemQuery<DataFileType> getDataFileTypes(Item itemType, FileStoreEnabled item, Platform platform, PlatformVariant variant, ItemSubtype subtype)
Get a query that returns all data file types for a specific platform/variant/subtype that can be used on a given item type. If an item is specified the query will also return data file types that already are present in the item's file set even if those file types are not part of the platform / variant.- Parameters:
itemType
- The item typeitem
- An optional itemplatform
- The platform to get file types for, or nullvariant
- The platform variant to get file types for, or nullsubtype
- The item subtype to get the file types for, or null- Returns:
- An
ItemQuery
object - Since:
- 3.0
-
getReporterListsEnum
public static Enumeration<String,String> getReporterListsEnum(DbControl dc)
-
getItemListsEnum
public static Enumeration<String,String> getItemListsEnum(DbControl dc, Item memberType, Collection<Include> include)
Get available item lists as an Enumeration that is suitable to use in a column definition for a table.- Parameters:
dc
- The DbControl to usememberType
- Only load lists with this member type, or null to load all listsinclude
- Include options- Returns:
- The found lists as an enumeration, empty if no lists are found
- Since:
- 3.5
-
getItemListsEnum
public static Enumeration<String,String> getItemListsEnum(DbControl dc, Item memberType, Collection<Include> include, Filter<? super ItemList> filter)
Get available item lists as an Enumeration that is suitable to use in a column definition for a table.- Parameters:
dc
- The DbControl to usememberType
- Only load lists with this member type, or null to load all listsinclude
- Include optionsfilter
- Additional filter to select which item lists to include (optional)- Returns:
- The found lists as an enumeration, empty if no lists are found
- Since:
- 3.18
-
getScale
public static float getScale(SessionControl sc)
Get the display scale setting. For normal font the scale is 1.0, for larger fonts the scale is higher and for smaller fonts the scale is lower. The scale is used for recalculating the size of popup windows depending on the font size setting.- Parameters:
sc
- SessionControl of the active session- Returns:
- The current scale as a float.
-
getMaxRecent
public static int getMaxRecent(SessionControl sc)
Get the setting for the maximum number of recently used items to save.- Parameters:
sc
- SessionControl of the active session.- Returns:
- an int.
-
getCookie
public static final Cookie getCookie(HttpServletRequest request, String name)
Get the cookie with the specified name.- Parameters:
request
- The JSPrequest
variablename
- The name of the cookie- Returns:
- A
Cookie
object, or null if it is not found
-
getCookieValue
public static final String getCookieValue(HttpServletRequest request, String name)
Get the value of the cookie with the specified name.- Parameters:
request
- The JSPrequest
variablename
- The name of the cookie- Returns:
- The value of the cookie, or null if it is not found
-
getOldItem
public static final <T extends BasicItem> T getOldItem(SessionControl sc, T newItem, int oldVersion) throws ItemModifiedException
Get the old item that is stored in theSessionControl
:s session settingitemType.item
. If the setting is null compare thenewItem
:s version with theoldVersion
, and if the match the new item is returned as the old item. If the versions doesn't match, anItemModifiedException
is thrown.- Type Parameters:
T
- The kind of item that extends from BasicItem.- Parameters:
sc
- TheSessionControl
which keeps the old item in the session settingsnewItem
- The new itemoldVersion
- The version of the old item- Returns:
- The old item if it is found in the session setting, or the new item if the old version is the same
- Throws:
ItemModifiedException
- If the old item wasn't found in the session setting and the old version is different from the new item's version
-
updateAnnotations
public static final void updateAnnotations(DbControl dc, Annotatable oldItem, Annotatable newItem, HttpServletRequest request) throws ItemModifiedException, BaseException
Update annotations on an item taking concurrent modifications into account. The old item is the object that was used to present the annotations for the user in the web form. The new item is the object that is loaded in the submit request. The new item is used to update the annotations. While updating the annotations the version of each annotation on the old an new item is compared. If they don't match anItemModifiedException
is thrown. We do not have to compare with the values in the request, since only modified annotations are submitted.- Parameters:
dc
- ADbControl
object used to read information from the databaseoldItem
- The old annotatable item, or null if no old item existsnewItem
- The new item, or null if only an old item existsrequest
- The request object containing the modified annotations- Throws:
ItemModifiedException
- If the new and old item don't matchBaseException
- If the update fails in some way.
-
updateFiles
public static void updateFiles(DbControl dc, FileStoreEnabled item, HttpServletRequest request, boolean validate, ItemContext cc, int maxRecent)
Update files that are associated with aFileStoreEnabled
item. Therequest
parameter is checked for parameters with a name likedatafile.id
whereid
is the numeric id of aDataFileType
. The parameter value is the path of the file to associated with the data file type, or null to remove an existing association.- Parameters:
dc
- A DbControl to access the databaseitem
- The item the files should be associated withrequest
- The request object containing the selected filesvalidate
- IfFileSet.validate(DbControl)
should be called or notcc
- Save the current context information. Null is allowed.maxRecent
- The maximum of recent items to remember.- Since:
- 3.0
-
getEncodedName
public static String getEncodedName(Nameable item, boolean denied)
Encode the name of the nameable item using theHTML.encodeTags(String)
method. If the item parameter is null,- none -
or- denied -
is returned, depending on if the denied parameter is true or false.- Parameters:
item
- The nameable item or nulldenied
- TRUE if the item is null because the current use doesn't have read permission
-
getLinkedName
public static String getLinkedName(String ID, Nameable item, boolean denied, boolean enableEditLink)
-
getLink
public static String getLink(String ID, String name, Item itemType, int itemId, boolean enableEditLink)
-
getLink
public static String getLink(String ID, String name, Item itemType, int itemId, boolean enableEditLink, String tooltip)
- Since:
- 2.9
-
getLinkedFile
public static String getLinkedFile(String ID, File file, boolean denied, boolean enableEditLink, boolean enableViewDownload, String root)
-
getFileLinks
public static String getFileLinks(String ID, File file, String root)
Get view/download links for a file.- Parameters:
ID
- The session IDfile
- The file itemroot
- Relative path to root directory of the web server- Returns:
- HTML code for the links
- Since:
- 2.5
-
getFirstMatching
public static <T extends BasicItem> T getFirstMatching(DbControl dc, ItemQuery<T> query, String property, PropertyFilter filter)
-
getConfiguredColors
public static Color[] getConfiguredColors(SessionControl sc)
-
getColorGenerator
public static ColorGenerator getColorGenerator(SessionControl sc, Coloring coloring)
-
-