Class TableSource

    • Constructor Detail

      • TableSource

        public TableSource​(org.w3c.dom.Node sourceDefinitionNode,
                           ISourceContext sourceContext)
                    throws PortalException
        Creates a tabular source.
        Parameters:
        sourceDefinitionNode - the source definition node.
        sourceContext - the source context.
        Throws:
        PortalException
        Since:
        4.0.4
    • Method Detail

      • getTableName

        public java.lang.String getTableName()
        Returns the table name for this source.
        Returns:
        the table name for this source.
        Since:
        4.0.5
      • getFilter

        public ITableSourceFilter getFilter()
        Description copied from class: Source
        Returns the filter for this source. The filter must be initialized with the appropriated parameters before each use.
        Overrides:
        getFilter in class Source<ITableSourceField>
        Returns:
        the filter or null if this source has no filter.
      • readData

        @Deprecated
        public ISourceData readData​(java.lang.String primaryKeyValue,
                                    ITransaction transaction)
                             throws PortalException
        Deprecated.
        Since 10.4.0 replaced by Source.readData(String...) and #readData(Iterable) for Source persistence API standardization. This method is no longer called and kept only for backwards compatibility.
        Reads the data with the given primary key value, and returns it.
        Parameters:
        primaryKeyValue - the primary key value of the desired data.
        transaction - the transaction for persistence access.
        Returns:
        the data with the given primary key value.
        Throws:
        PortalException
        java.lang.NullPointerException - if primaryKeyValue is null.
      • readData

        @Deprecated
        public TabularData readData​(java.lang.String[] primaryKeyValues,
                                    ITransaction transaction)
                             throws PortalException
        Deprecated.
        Since 10.4.0 replaced by Source.readData(String...) and #readData(Iterable) for Source persistence API standardization. This method is no longer called and kept only for backwards compatibility.
        Reads the data with the given primary key values, and returns it.
        Parameters:
        primaryKeyValues - the primary key values of the desired data.
        transaction - the transaction for persistence access.
        Returns:
        the data with the given primary key values.
        Throws:
        PortalException
      • readData

        public java.util.List<ISourceData> readData​(java.util.Collection<java.lang.String> itemIds)
                                             throws PortalException
        Description copied from class: Source
        Returns the data corresponding to the given itemIds.

        The implementation of this method in Source throws an UnsupportedOperationException. This method should be overridden by source implementations that provides this functionality.

        Overrides:
        readData in class Source<ITableSourceField>
        Parameters:
        itemIds - the item identifiers of the data to be returned.
        Returns:
        a list of ISourceData objects that corresponds to the given itemIds. If no data is found, an empty list is returned.
        Throws:
        PortalException
      • createQueryBuilder

        protected QueryBuilder createQueryBuilder​(IParameters parameters)
                                           throws PortalException
        Creates the query builder used by this source.
        Parameters:
        parameters - the parameters to be used by the query builder.
        Returns:
        the query builder.
        Throws:
        PortalException
        Since:
        10.4.0
      • doDeleteDataByItemIds

        protected void doDeleteDataByItemIds​(java.util.Collection<java.lang.String> itemIds)
                                      throws PortalException
        Description copied from class: Source
        Deletes the data in the persistence.

        This method is called by Source.deleteDataByItemIds(Collection) and is to be overridden by sources that supports delete operation and uses the default deleteData implementation.

        The implementation of this method in Source throws UnsupportedOperationException.

        Overrides:
        doDeleteDataByItemIds in class Source<ITableSourceField>
        Parameters:
        itemIds - the item identifiers of data to be deleted.
        Throws:
        PortalException
      • deleteRelatedData

        protected void deleteRelatedData​(java.util.Collection<java.lang.String> itemIds)
                                  throws PortalException
        Deletes all data related to the given itemIds.

        This method looks up all the relations of the data being deleted. If any of them have the attribute cascadeOnDelete set to true, the related source data is deleted.

        Parameters:
        itemIds - the item identifiers whose related data is to be deleted.
        Throws:
        PortalException
        Since:
        10.4.0