Class BasicDataController

java.lang.Object
com.jalios.jcms.BasicDataController
All Implemented Interfaces:
DataController, JcmsConstants, PluginComponent, JaliosConstants, Comparable
Direct Known Subclasses:
AlertController, ContentController, JPortalPortletFieldStatusController, JPortalStructureDataController, MailMessageDataController, MediaProgressionDataController, MentionController, PortletJspDataController, PortletQueryForeachDataController, PublicationFollowerController, QuotaDataController, RecentHistoryDataController, RecommendationController, SecurityAlertMemberDataController, UnzipDataController, VoteDataController, WFDataController

public class BasicDataController extends Object implements DataController, JcmsConstants, PluginComponent
This class is a neutral implementation of DataController. It is intended to be used to developp custom DataController. It avoids the sub-class to implement not used methods of DataController. It implements the Comparable interface. This interface is required since JCMS 5.5.0 ; so that DataController can be invoked in a custom order. The order can be set through the constructor. Default order is 0. When 2 BasicDataControllers are equal they are ordered according their class name, then according their hashCode.
Since:
jcms-5.0.0
Author:
Olivier Dedieu
  • Field Details

    • order

      protected int order
    • channel

      protected Channel channel
  • Constructor Details

    • BasicDataController

      public BasicDataController()
      Constructs a BasicDataController with order = 0
      Since:
      jcms-5.0.0
    • BasicDataController

      public BasicDataController(int order)
      Constructs a BasicDataController with the given order
      Parameters:
      order - the order
      Since:
      jcms-5.5.0
  • Method Details

    • init

      public boolean init(Plugin plugin)
      Description copied from interface: PluginComponent
      Initialize the component with the given plugin configuration
      Specified by:
      init in interface PluginComponent
      Parameters:
      plugin - the calling plugin
      Returns:
      true if the component has been correctly initialized.
      Since:
      jcms-5.7.1
      See Also:
    • checkIntegrity

      public ControllerStatus checkIntegrity(Data data)
      Checks if the given data respects constraints integrity
      Specified by:
      checkIntegrity in interface DataController
      Parameters:
      data - the data to be checked
      Returns:
      a ControllerStatus
      Since:
      jcms-5.0.0
    • checkWrite

      public ControllerStatus checkWrite(Data data, int op, Member mbr, boolean checkIntegrity, Map context)
      Checks if the given write operation can be performed
      Specified by:
      checkWrite in interface DataController
      Parameters:
      data - the data involved by this operation
      op - the operation (OP_CREATE, OP_UPDATE, ...)
      mbr - the member which requests the write operation
      checkIntegrity - if true, requires the constraints integrity to be checked
      context - a map which contains context parameters (may be null)
      Returns:
      a ControllerStatus
      Since:
      jcms-5.0.0
    • processFieldStatusMap

      public void processFieldStatusMap(Data data, Member mbr, Map<String,FieldStatus> map)
      This method is called to fill the map of FieldStatus for the given data. The key of the map in the name of the field.
      Specified by:
      processFieldStatusMap in interface DataController
      Parameters:
      data - the data
      mbr - the member which requests the data
      map - the map of FieldStatus
      Since:
      jcms-6.0.1
    • beforeWrite

      public void beforeWrite(Data data, int op, Member mbr, Map context)
      This method is called before the write operation is performed.
      Specified by:
      beforeWrite in interface DataController
      Parameters:
      data - the data which will be written
      op - the operation (OP_CREATE, OP_UPDATE, ...)
      mbr - the member which requests the write operation
      context - a map which contains context parameters (may be null)
      Since:
      jcms-5.0.0
    • afterWrite

      public void afterWrite(Data data, int op, Member mbr, Map context)
      This method is called once the write operation has been performed.
      Specified by:
      afterWrite in interface DataController
      Parameters:
      data - the data that was written
      op - the operation (OP_CREATE, OP_UPDATE, ...)
      mbr - the member who requested the write operation
      context - a map which contains context parameters (may be null)
      Since:
      jcms-5.0.0
    • compareTo

      public int compareTo(Object obj)
      Compare this object with the specified object for order.
      Specified by:
      compareTo in interface Comparable
      Parameters:
      obj - the Object to be compared.
      See Also:
    • equals

      public boolean equals(Object obj)
      Indicates wheter some other object is "equal to" this one. The comparison is performed with compareTo() method.
      Overrides:
      equals in class Object
      Parameters:
      obj - the Object to be compared.
    • checkFieldMLRequired

      protected ControllerStatus checkFieldMLRequired(Publication pub, String fieldName, String value, HashMap valueML)
      This convenient method checks if the given multilingual field is required.
      Parameters:
      pub - the publication
      fieldName - the name of the field
      value - the value of the field
      valueML - the ML value of the field
      Returns:
      a ControllerStatus
      Since:
      jcms-6.0.1
    • checkFieldRequired

      protected ControllerStatus checkFieldRequired(Publication pub, String fieldName, String value)
      This convenient method checks if the given field is required.
      Parameters:
      pub - the publication
      fieldName - the name of the field
      value - the value of the field
      Returns:
      a ControllerStatus
      Since:
      jcms-6.0.1
    • updateFieldStatusMap

      protected void updateFieldStatusMap(Map<String,FieldStatus> map, String fieldName, FieldStatus status)
      This convenient methods update a FieldStatus map with the given status
      Parameters:
      map - the FieldStatus map
      fieldName - the name of the field (i.e. the key of the map)
      status - the FieldStatus to be added
      Since:
      jcms-6.0.1
    • getOrder

      public int getOrder()
      Retrieve the order value used to sort BasicDataController.
      Returns:
      an integer value, default is 0
      Since:
      jcms-7.1