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
      • doCloneData

        protected ISourceCloneDataResult doCloneData​(ISourceData data)
                                              throws PortalException,
                                                     java.lang.IllegalArgumentException,
                                                     java.lang.UnsupportedOperationException
        Description copied from class: Source
        Returns the result of the clone operation for the given data. Typically, this method is called by the Source.cloneData(String) method.
        Overrides:
        doCloneData in class Source<ITableSourceField>
        Parameters:
        data - the data to be cloned
        Returns:
        the result of the clone operation for the given data.
        Throws:
        PortalException - If any other error occur.
        java.lang.IllegalArgumentException - If the given data is null.
        java.lang.UnsupportedOperationException - If this source does not supports data cloning.
      • getIsCloneDataSupportedDefaultValue

        protected boolean getIsCloneDataSupportedDefaultValue()
        Description copied from class: Source
        Returns the default value for \@isCloneDataSupported source attribute name.
        Overrides:
        getIsCloneDataSupportedDefaultValue in class Source<ITableSourceField>
        Returns:
        the default value for \@isCloneDataSupported source attribute name.
      • getCloneDataTitleSuffix

        protected java.lang.String getCloneDataTitleSuffix​(ISourceData data)
                                                    throws PortalException
        Gets the translated clone data suffix
        Returns:
        the translated clone data suffix
        Throws:
        PortalException
        Since:
        17.0.0