Class PdoGenerator

  • All Implemented Interfaces:
    org.tentackle.validate.ScopeConfigurator, org.tentackle.validate.Validateable

    public class PdoGenerator
    extends AbstractValidateableGenerator
    Generator for the PDO files.
    • Constructor Detail

      • PdoGenerator

        public PdoGenerator()
    • Method Detail

      • setStatusDir

        public void setStatusDir​(File statusDir)
        Sets the status directory.
        Parameters:
        statusDir - the status dir
      • generate

        public List<org.tentackle.validate.ValidationResult> generate()
                                                               throws IOException,
                                                                      freemarker.template.TemplateException
        Creates the PDO files.
        Returns:
        the validation results, empty if okay, never null
        Throws:
        IOException - if file creation failed
        freemarker.template.TemplateException - if code generation failed
      • isNewEntity

        public boolean isNewEntity()
        Checks whether entity name is not already used in model.
        Returns:
        true if ok
      • isNewClassId

        public boolean isNewClassId()
        Checks whether classID is not already used in model.
        Returns:
        true if ok
      • isClassIdNecessary

        public boolean isClassIdNecessary()
        Checks whether entity needs a class ID.
        Returns:
        true if class ID necessary
      • isNewTableName

        public boolean isNewTableName()
        Checks whether the tablename is not already used in model.
        Returns:
        true if ok
      • isTableNameNecessary

        public boolean isTableNameNecessary()
        Checks whether entity needs a tablename.
        Returns:
        true if tablename necessary
      • isTableNameValid

        public Boolean isTableNameValid()
        Checks whether tablename set properly by the user.
        Returns:
        true if set, false if missing
      • isInheritanceTypeValid

        public boolean isInheritanceTypeValid()
      • getProfile

        @Bindable
        @NotNull
        public PdoProfile getProfile()
      • setProfile

        @Bindable
        public void setProfile​(PdoProfile profile)
      • getEntityName

        @Bindable
        @NotNull(message="missing entity name")
        @True(value="$isNewEntity",
              scope=org.tentackle.validate.scope.InteractiveScope.class,
              message="entity already exists")
        public String getEntityName()
      • setEntityName

        @Bindable
        public void setEntityName​(String entityName)
      • getClassId

        @Bindable
        @True(value="$isNewClassId",
              scope=org.tentackle.validate.scope.InteractiveScope.class,
              message="class ID already in use")
        @Changeable(condition="$isClassIdNecessary")
        @GreaterOrEqual(value="100",
                        condition="$isClassIdNecessary",
                        message="class IDs below 100 are reserved for tentackle",
                        scope=org.tentackle.validate.scope.InteractiveScope.class)
        @NotNull(condition="$isClassIdNecessary",
                 message="missing class ID")
        public Integer getClassId()
      • setClassId

        @Bindable
        public void setClassId​(Integer classId)
      • getTableName

        @Bindable(options="lc")
        @True(value="$isNewTableName",
              scope=org.tentackle.validate.scope.InteractiveScope.class,
              message="table name already in use")
        @Changeable(condition="$isTableNameNecessary")
        @NotNull(value="$isTableNameValid",
                 condition="$isTableNameNecessary",
                 message="missing table name")
        public String getTableName()
      • setTableName

        @Bindable
        public void setTableName​(String tableName)
      • getSuperEntity

        @Bindable
        public Entity getSuperEntity()
      • setSuperEntity

        @Bindable
        public void setSuperEntity​(Entity superEntity)
      • getInheritanceType

        @Bindable
        @NotNull
        @True(value="$isInheritanceTypeValid",
              scope=org.tentackle.validate.scope.InteractiveScope.class,
              message="inheritance type does not match super entity")
        public InheritanceType getInheritanceType()
      • setInheritanceType

        @Bindable
        public void setInheritanceType​(InheritanceType inheritanceType)
      • getShortDescription

        @Bindable
        @NotNull(message="missing short description")
        public String getShortDescription()
      • setShortDescription

        @Bindable
        public void setShortDescription​(String shortDescription)
      • getLongDescription

        @Bindable
        public String getLongDescription()
      • setLongDescription

        @Bindable
        public void setLongDescription​(String longDescription)
      • getDomainInterface

        @Bindable
        @NotNull(message="missing domain interface")
        public String getDomainInterface()
      • setDomainInterface

        @Bindable
        public void setDomainInterface​(String domainInterface)
      • getPersistenceInterface

        @Bindable
        @NotNull(message="missing persistence interface")
        public String getPersistenceInterface()
      • setPersistenceInterface

        @Bindable
        public void setPersistenceInterface​(String persistenceInterface)
      • getDomainImplementation

        @Bindable
        public String getDomainImplementation()
      • setDomainImplementation

        @Bindable
        public void setDomainImplementation​(String domainImplementation)
      • getPersistenceImplementation

        @Bindable
        public String getPersistenceImplementation()
      • setPersistenceImplementation

        @Bindable
        public void setPersistenceImplementation​(String persistenceImplementation)
      • isRemoteEnabled

        @Bindable
        public boolean isRemoteEnabled()
      • setRemoteEnabled

        @Bindable
        public void setRemoteEnabled​(boolean remoteEnabled)
      • getSuperPdoInterface

        public String getSuperPdoInterface()
        Gets the name of the parent pdo interface.
        Returns:
        the super interface
      • getSuperDomainInterface

        public String getSuperDomainInterface()
        Gets the name of the parent domain interface.
        Returns:
        the super domain interface
      • getSuperPersistenceInterface

        public String getSuperPersistenceInterface()
        Gets the name of the parent persistence interface.
        Returns:
        the super persistence interface
      • getSuperDomainImplementation

        public String getSuperDomainImplementation()
        Gets the name of the parent domain class.
        Returns:
        the super domain class
      • getSuperPersistenceImplementation

        public String getSuperPersistenceImplementation()
        Gets the name of the parent persistence class.
        Returns:
        the super persistence class