Class DSFactory

java.lang.Object
com.caplin.transformer.module.datasrc.DSFactory

public class DSFactory extends Object

Factory for a TransformerData, or one of its subclasses.

This class contains static methods for creating new TransformerDatas with specified subjects, object types, and, optionally, data source flags.

The possible data source flags that can be set are:

These flags should be ORed together to set multiple flags (e.g. DSData.F_CREATEOBJECT|DSData.F_CREATEPARENT|DSData.F_IMAGE).

  • Method Details

    • createTransformerData

      public static TransformerData createTransformerData(String subject, ObjectType objectType)

      Creates a TransformerData for the specified subject and object type. The data source flags will default to F_CREATEOBJECT and F_CREATEPARENT.

      This is equivalent to calling createTransformerData(subject, objectType.getCode().

      Parameters:
      subject - The object name.
      objectType - The object type (e.g. page, record, news).
      Returns:
      A new TransformerData with the specified subject and object type. If the object type is a record, the returned object will be an instance of TransformerRecord.
      Throws:
      NullPointerException - If either the subject or objectType arguments are null.
    • createTransformerData

      public static TransformerData createTransformerData(String subject, ObjectType objectType, int flags)

      Creates a TransformerData for the specified subject, object type and data source flags.

      This is equivalent to calling createTransformerData(subject, objectType.getCode(), flags.

      Parameters:
      subject - The object name.
      objectType - The object type (e.g. page, record, news).
      flags - The data source flags that should be applied.
      Returns:
      A new TransformerData with the specified subject, object type and data source flags. If the object type is a record, the returned object will be an instance of TransformerRecord.
      Throws:
      NullPointerException - If either the subject or objectType arguments are null.
    • createTransformerData

      public static TransformerData createTransformerData(String subject, int type)

      Creates a TransformerData for the specified subject and object type. The data source flags will default to F_CREATEOBJECT and F_CREATEPARENT.

      This is equivalent to calling createTransformerData(subject, type, TransformerData.F_CREATEOBJECT|TransformerData.F_CREATEPARENT).

      Parameters:
      subject - The object name.
      type - The object type (e.g. page, record, news).
      Returns:
      A new TransformerData with the specified subject and object type. If the object type is a record, the returned object will be an instance of TransformerRecord.
      Throws:
      NullPointerException - If the subject argument is null.
    • createTransformerData

      public static TransformerData createTransformerData(String subject, int type, int flags)

      Creates a TransformerData for the specified subject, object type and data source flags.

      If the object type is a record, the actual object that will be created will be a TransformerRecord.

      Parameters:
      subject - The object name.
      type - The object type (e.g. page, record, news).
      flags - The data source flags that should be applied.
      Returns:
      A new TransformerData with the specified subject, object type and data source flags. If the object type is a record, the returned object will be an instance of TransformerRecord.
      Throws:
      NullPointerException - If the subject argument is null.
    • createTransformerData

      public static TransformerData createTransformerData(TransformerData transformerData)

      Returns a copy of the specified TransformerData.

      Parameters:
      transformerData - The TransformerData to be copied.
      Returns:
      A copy of the specified TransformerData.
      Throws:
      NullPointerException - If the transformerData argument is null.
    • createTransformerRecord

      public static TransformerRecord createTransformerRecord(String subject)

      Creates a TransformerRecord for the specified subject. The data source flags will default to F_CREATEOBJECT and F_CREATEPARENT.

      This is equivalent to calling createTransformerData(subject, ObjectType.RECORD.

      Parameters:
      subject - The object name.
      Returns:
      A new TransformerRecord with the specified subject.
      Throws:
      NullPointerException - If the subject argument is null.
    • createTransformerRecord

      public static TransformerRecord createTransformerRecord(String subject, int flags)

      Creates a TransformerRecord for the specified subject and data source flags.

      This is equivalent to calling createTransformerData(subject, ObjectType.RECORD, flags.

      Parameters:
      subject - The object name.
      flags - The data source flags that should be applied.
      Returns:
      A new TransformerRecord with the specified subject and data source flags.
      Throws:
      NullPointerException - If the subject argument is null.
    • createTransformerRecord

      public static TransformerRecord createTransformerRecord(TransformerRecord transformerRecord)

      Returns a copy of the specified TransformerRecord.

      Parameters:
      transformerRecord - The TransformerRecord to be copied.
      Returns:
      A copy of the specified TransformerRecord.
      Throws:
      NullPointerException - If the transformerRecord argument is null.
    • createTransformerPermission

      public static TransformerPermission createTransformerPermission(String subject)
    • createTransformerPermission

      public static TransformerPermission createTransformerPermission(String subject, int flags)
    • createGlobalTransformerPermission

      public static TransformerPermission createGlobalTransformerPermission(String subject)
    • createGlobalTransformerPermission

      public static TransformerPermission createGlobalTransformerPermission(String subject, int flags)
    • createTransformerContainer

      public static TransformerContainer createTransformerContainer(String subject)

      Creates a TransformerContainer for the specified subject. The data source flags will default to F_CREATEOBJECT and F_CREATEPARENT.

      This is equivalent to calling createTransformerData(subject, ObjectType.CONTAINER.

      Parameters:
      subject - The object name.
      Returns:
      A new TransformerContainer with the specified subject.
      Throws:
      NullPointerException - If the subject argument is null.
    • createTransformerContainer

      public static TransformerContainer createTransformerContainer(String subject, int flags)

      Creates a TransformerContainer for the specified subject and data source flags.

      This is equivalent to calling createTransformerData(subject, ObjectType.CONTAINER, flags.

      Parameters:
      subject - The object name.
      flags - The data source flags that should be applied.
      Returns:
      A new TransformerContainer with the specified subject and data source flags.
      Throws:
      NullPointerException - If the subject argument is null.