Class PrintTemplate

  • All Implemented Interfaces:
    java.io.Serializable

    public class PrintTemplate
    extends java.lang.Object
    implements java.io.Serializable
    Print template
    See Also:
    Serialized Form
    • Field Detail

      • TYPE_DEFAULT

        public static final java.lang.String TYPE_DEFAULT
        Default type HTML
        See Also:
        Constant Field Values
      • RESOURCES_TYPES

        public static final java.lang.String[] RESOURCES_TYPES
        Resource types to be substituted
    • Constructor Detail

      • PrintTemplate

        public PrintTemplate​(ObjectDB object,
                             java.lang.String name,
                             java.lang.String display,
                             java.lang.String type,
                             java.lang.String usage,
                             java.lang.String method,
                             java.lang.String template,
                             java.lang.String docId,
                             java.lang.String mimeType,
                             java.lang.String fileName,
                             boolean grantable,
                             char visible)
        Constructor
        Parameters:
        object - Object name
        name - Template name
        display - Display
        usage - Usage
        method - Method
        template - Template content
        docId - Template document ID
        mimeType - Output MIME type
        fileName - Output file name
        grantable - Public or restricted to groups
        visible - Action visibility
    • Method Detail

      • getObject

        public ObjectDB getObject()
        Get object
        Returns:
        Object
      • getName

        public java.lang.String getName()
        Get name
        Returns:
        Name
      • getDisplay

        public java.lang.String getDisplay()
        Get display lable
        Returns:
        Display label
      • getLabel

        public java.lang.String getLabel()
        Get display label (same as getDisplay)
        Returns:
        Display label
      • getType

        public java.lang.String getType()
        Get type
        Returns:
        Type (one of PrintTemplate.TYPE_*)
      • getUsage

        public java.lang.String getUsage()
        Get usage
        Returns:
        Usage (one of PrintTemplate.USAGE_*)
      • getMethod

        public java.lang.String getMethod()
      • getPrintTemplateId

        public static java.lang.String getPrintTemplateId​(java.lang.String name,
                                                          java.lang.String lang)
        Get publication template ID
        Parameters:
        name - Name
        lang - Language
        Returns:
        ID
      • isGrantable

        public boolean isGrantable()
        Is grantable?
        Returns:
        True if grantable
      • setGrantable

        public void setGrantable​(boolean b)
        Set grantable
        Parameters:
        b - Grantable?
      • getGrantedGroups

        public java.util.List<java.lang.String> getGrantedGroups()
        Get granted groups
        Returns:
        List of granted group names
      • addGrantedGroup

        public void addGrantedGroup​(java.lang.String group)
        Add granted group
        Parameters:
        group - Group name
      • removeGrantedGroup

        public void removeGrantedGroup​(java.lang.String group)
        Remove granted group
        Parameters:
        group - Group name
      • isGranted

        public boolean isGranted​(Grant g)
        Is granted?
        Parameters:
        g - Grant
        Returns:
        True if granted
      • isForUsage

        public boolean isForUsage​(char usage)
        Is for specified usage
        Parameters:
        usage - Usage (one of PrintTemplate.USAGE_*)
        Returns:
        True if for specified usage
      • isForObjectUsage

        public boolean isForObjectUsage()
        Is for object form usage
        Returns:
        True if for object form usage
      • isForListUsage

        public boolean isForListUsage()
        Is for object list usage
        Returns:
        True if for object list usage
      • isForMailingUsage

        public boolean isForMailingUsage()
        Is for mailing usage
        Returns:
        True if for mailing usage
      • isForExportUsage

        public boolean isForExportUsage()
        Is for export usage
        Returns:
        True if for export usage
      • isForOtherUsage

        public boolean isForOtherUsage()
        Is for other usage
        Returns:
        True if for other usage
      • isEnabled

        public boolean isEnabled()
        Is enabled?
        Returns:
        True if enabled
      • setEnabled

        public void setEnabled​(boolean enabled)
        Set nabled
        Parameters:
        enabled - Enabled?
      • isVisible

        public boolean isVisible()
        Is visible?
        Returns:
        True if visible
      • getVisibility

        public char getVisibility()
        Get action visibility
        Returns:
        Visibility (one of Action.ACTION_*
      • setVisible

        public void setVisible​(boolean b)
        Set visible
        Parameters:
        b - Visible (Action.ACTION_ALL) or non visible (Action.ACTION_HIDDEN)?
      • setVisible

        public void setVisible​(char vis)
        Set action visibility
        Parameters:
        vis - Visibility (one of Action.ACTION_*)
      • getDocId

        public java.lang.String getDocId()
        Get document ID
        Returns:
        Document ID
      • getDocument

        public DocumentDB getDocument​(Grant g)
        Get document
        Parameters:
        g - Grant
        Returns:
        Document
      • setDocId

        public void setDocId​(java.lang.String docId)
        Set document ID
        Parameters:
        docId - Document ID
      • getTemplate

        @Deprecated
        public java.lang.String getTemplate​(Grant g)
        Deprecated.
        Use getTemplate()
      • getTemplate

        public java.lang.String getTemplate()
        Get template
        Returns:
        Template
      • setTemplate

        public void setTemplate​(java.lang.String template)
        Set template
        Parameters:
        template - Template
      • getMimeType

        @Deprecated
        public java.lang.String getMimeType()
        Deprecated.
        Use getMIMEType
      • getMIMEType

        public java.lang.String getMIMEType()
        Get MIME type
        Returns:
        MIME type
      • setMimeType

        @Deprecated
        public void setMimeType​(java.lang.String mimeType)
        Deprecated.
        Use setMIMEType
      • setMIMEType

        public void setMIMEType​(java.lang.String mimeType)
        Set IME type
        Parameters:
        mimeType - MIME type
      • getFilename

        public java.lang.String getFilename()
        Get file name
        Returns:
        File name
      • setFilename

        public void setFilename​(java.lang.String filename)
        Set file name
        Parameters:
        filename - File name
      • generateDefaultSubTemplate

        public static java.lang.String generateDefaultSubTemplate​(ObjectDB obj)
        Generate default sub template
        Parameters:
        obj - Object
        Returns:
        Generated sub template
      • generateDefaultTemplate

        public static java.lang.String generateDefaultTemplate​(ObjectDB obj)
        Generate default template
        Parameters:
        obj - Object
        Returns:
        Generated default template
      • substituteResources

        public static java.lang.String substituteResources​(java.lang.String template,
                                                           ObjectDB obj)
        Substitute resources contents
        Parameters:
        template - Template
        obj - Object
        Returns:
        Substituted resources contents
      • substituteTexts

        public static java.lang.String substituteTexts​(java.lang.String template,
                                                       java.lang.String encoding,
                                                       Grant g)
        Substitute texts in template
        Parameters:
        template - Template
        encoding - Encoding
        g - Grant
        Returns:
        Substituted template
      • substituteLabels

        public static java.lang.String substituteLabels​(java.lang.String template,
                                                        java.lang.String encoding,
                                                        ObjectDB obj)
        Substitute labels in template
        Parameters:
        template - Template
        encoding - Encoding
        obj - Object
        Returns:
        Substituted template
      • substituteFilters

        public static java.lang.String substituteFilters​(java.lang.String template,
                                                         java.lang.String encoding,
                                                         ObjectDB obj)
        Substitute filters in template
        Parameters:
        template - Template
        encoding - Encoding
        obj - Object
        Returns:
        Substituted template
      • subsituteExprs

        public static java.lang.String subsituteExprs​(java.lang.String template,
                                                      java.lang.String encoding,
                                                      ObjectDB obj,
                                                      java.lang.String rowId)
        Substitute expressions in template
        Parameters:
        template - Template
        encoding - Encoding
        rowId - Row ID
        Returns:
        Substituted template
      • substituteFields

        public static java.lang.String substituteFields​(java.lang.String template,
                                                        java.lang.String encoding,
                                                        ObjectDB obj,
                                                        java.lang.String[] row)
        Substitute field values in template (print or alert with fields of object and action)
        Parameters:
        template - Template
        encoding - Encoding
        row - Row
        Returns:
        Substituted template
      • substituteDirectURL

        public static java.lang.String substituteDirectURL​(java.lang.String text,
                                                           ObjectDB obj)
        Substitutes direct URL statements with the direct URL to open the object update form
        Parameters:
        text - A text
        obj - Object
        Returns:
        Substituted text
      • fillTemplate

        public static java.lang.String fillTemplate​(ObjectDB obj,
                                                    java.lang.String template,
                                                    java.lang.String encoding,
                                                    java.util.List<java.lang.String[]> rows)
        Fill the template
        Parameters:
        obj - Object
        template - Template
        encoding - Encoding
        rows - Rows
        Returns:
        Publication result
      • fillTemplate

        public static java.lang.String fillTemplate​(ObjectDB obj,
                                                    java.lang.String template,
                                                    java.lang.String encoding,
                                                    java.lang.String[] row)
        Fill the template
        Parameters:
        obj - Object
        template - Template
        encoding - Encoding
        row - Row
        Returns:
        Publication result
      • getCurrentList

        public java.util.List<java.lang.String[]> getCurrentList​(ObjectDB obj)
        Get current list
        Parameters:
        obj - Object
        Returns:
        Current list rows