Class DerivedEntryTypeService

java.lang.Object
fr.paris.lutece.plugins.genericattributes.service.entrytype.DerivedEntryTypeService

@ApplicationScoped public class DerivedEntryTypeService extends Object
Service managing the entry types derived from another one: they use the entry type service of their parent and add a regular expression control
  • Field Details

    • MAX_LENGTH_TITLE

      public static final int MAX_LENGTH_TITLE
      See Also:
    • MAX_LENGTH_REGEX_PATTERN

      public static final int MAX_LENGTH_REGEX_PATTERN
      See Also:
    • MAX_LENGTH_REGEX_ERROR_MESSAGE

      public static final int MAX_LENGTH_REGEX_ERROR_MESSAGE
      See Also:
  • Constructor Details

    • DerivedEntryTypeService

      public DerivedEntryTypeService()
  • Method Details

    • isRegularExpressionSupported

      public boolean isRegularExpressionSupported(EntryType entryType)
      Tell whether the entry type service of an entry type checks the regular expression of its entry type
      Parameters:
      entryType - the entry type
      Returns:
      true if a regular expression can be set on a type derived from this entry type
    • validate

      Validate an entry type before saving it
      Parameters:
      entryType - the entry type
      Returns:
      the errors, empty if the entry type is valid
    • newDerivedEntryType

      public EntryType newDerivedEntryType(EntryType entryTypeParent, String strTitle, String strIconName, String strRegexPattern, String strRegexErrorMessage)
      Build an entry type derived from a parent one, not saved yet
      Parameters:
      entryTypeParent - the parent entry type
      strTitle - the title
      strIconName - the icon
      strRegexPattern - the regular expression
      strRegexErrorMessage - the error message, null for the generic one
      Returns:
      the derived entry type
    • create

      public EntryType create(EntryType entryType)
      Save a new derived entry type, last of the entry types of its plugin
      Parameters:
      entryType - the derived entry type
      Returns:
      the saved entry type
    • resolveImportedEntryType

      public EntryType resolveImportedEntryType(EntryType importedEntryType)
      Find the local entry type matching an entry type read from an export made on another instance. The ids of the derived entry types differ from one instance to the other: the entry type is matched by its entry type service and its regular expression, and a derived entry type missing here is created.
      Parameters:
      importedEntryType - the entry type of the export
      Returns:
      the local entry type, or the imported one when nothing local answers its entry type service