Package adams.db

Class ReportTableByDBID<R extends Report,​F extends AbstractField>

    • Constructor Detail

      • ReportTableByDBID

        public ReportTableByDBID​(AbstractDatabaseConnection dbcon,
                                 String tableName)
        Initializes the table class with the given table name.
        Parameters:
        dbcon - the database context this table is used in
        tableName - the name of the table
    • Method Detail

      • createField

        protected Field createField​(String name,
                                    String type)
                             throws Exception
        Creates a new Field object.
        Parameters:
        name - the name of the field
        type - the type of the field
        Returns:
        the generated field
        Throws:
        Exception - if the field type is not handled
      • parse

        protected Object parse​(AbstractField field,
                               String s)
        Parses the given string according to the given field's type.
        Parameters:
        field - the field that specifies the type
        s - the value to parse
        Returns:
        the parsed value
      • remove

        public boolean remove​(Report report)
        Removes the report from the database.
        Parameters:
        report - the report to delete (and obtain the parent ID from)
        Returns:
        true if successfully removed
      • store

        public boolean store​(Integer parent_id,
                             R report)
        Stores the report. Always removes an already existing report first.
        Specified by:
        store in interface ReportProvider<R extends Report,​F extends AbstractField>
        Specified by:
        store in interface ReportProviderByDBID<R extends Report>
        Parameters:
        parent_id - the parent_id of the report
        report - the report
        Returns:
        true if successfully inserted
      • store

        public boolean store​(Integer parent_id,
                             R report,
                             boolean removeExisting,
                             boolean merge,
                             Field[] overwrite)
        Stores the report. Report can be merged with already existing one or the existing one can be removed from the database first.
        Specified by:
        store in interface ReportProvider<R extends Report,​F extends AbstractField>
        Specified by:
        store in interface ReportProviderByDBID<R extends Report>
        Parameters:
        parent_id - the parent_id of the report
        report - the report
        removeExisting - whether to remove existing an already existing report before storing it (has precedence over "merge")
        merge - whether to merge the existing and the current
        overwrite - fields to overwrite if in "merge" mode
        Returns:
        true if successfully inserted/updated
      • doStore

        protected abstract boolean doStore​(Integer parent_id,
                                           R report)
        Stores the report. Either updates or inserts the fields.
        Parameters:
        parent_id - the parent_id of the report
        report - the report
        Returns:
        true if successfully inserted