Steps to extend the Data Model in ArkCase
To extend a model with additional properties please follow the below steps:
1. First, find and select the entity class which you want to extend, must be designed/support extending. If the below design is not implemented you need to implement it.
This means your entity class must have:
2. Additional String property, which will hold the class name including full package path.
3. Three additional @annotations used to identify the entity class (@JsonTypeInfo needed for polymorphic types, used for serialization and deserialization; @DiscriminatorColumn used to set the column name which will hold the full class name into the database, it is the same column created above “cm_class_name”; @DiscriminatorValue holds the class name including the full package path, ex. “com.armedia.acm.plugins.casefile.model.CaseFile”)
5. Next, create a new entity class which extends the model and add the new properties needed for the extension. But make sure you have dependency of OOTB product in your .pom file in order to fetch the main model which you are extending.
6. Add @DiscriminatorValue with value of your class name including the full package path, ex. “gov.foia.model.FOIARequest”. This should look like the image below:
7. As a final step, on the extension project you need to create or update if present the liquibase script with changeSet to update the database with the new columns from the extended entity. The path to the script should be “src/main/resources/ddl/tables/somename.tables-1.0.xml
NOTE: If in the step 1, the entity class isn’t extensible and you made it to be (created the property for class name “cm_class_name”, added the @annotations), you should update the liquibase changeSet on Core to update the database with the new column “cm_class_name” as well.
8. As a final step, you should check in the “.arkcase/acm/datasource.properties” file, if the package prefix to your new extended entity for example “gov.foia.model” or “gov.foia.**” (** is recursive search through the package) is added for scanning for JPA entity classes.