Class BaseArchiveService
- java.lang.Object
-
- com.avoka.fc.core.service.BaseService
-
- com.avoka.fc.core.service.CayenneService
-
- com.avoka.fc.core.service.archive.BaseArchiveService
-
- Direct Known Subclasses:
ApplicationPackageArchiveService
,ClientArchiveService
,FormVersionArchiveService
,GroupArchiveService
,LibraryArchiveService
,MetadataTagArchiveService
,PortalArchiveService
,RoleArchiveService
,SecurityManagerArchiveService
,ServiceArchiveService
,ServiceConnectionArchiveService
,TPacArchiveService
public abstract class BaseArchiveService extends CayenneService
Provides the base class for the set of archive services. Each service is responsible for exporting and importing a set of SFM entities (e.g. client or form and template versions).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
BaseArchiveService.FormData
-
Field Summary
Fields Modifier and Type Field Description protected static String
ATTRIBUTE_BUILD_NUMBER
protected static String
ATTRIBUTE_DB_VERSION
protected static String
ATTRIBUTE_ENVIRONMENT_NAME
protected static String
ATTRIBUTE_EXPORT_DATE
protected static String
ATTRIBUTE_FORM_PORTAL_ANONYMOUS
protected static String
ATTRIBUTE_FORM_PORTAL_AUTHENTICATED
protected static String
ATTRIBUTE_SFM_VERSION
protected static String
DIR_FAR
protected static String
DIR_FORM
protected static String
DIR_RECEIPT
protected static String
DIR_SCHEMA_SEED
protected static String
DIR_XML_PREFILL
protected static String
ELEMENT_APPLICATION_PACKAGE
protected static String
ELEMENT_APPLICATION_PACKAGES
protected static String
ELEMENT_AUTHENTICATION_MODE
protected static String
ELEMENT_CATEGORY_NAME
protected static String
ELEMENT_CLIENT
protected static String
ELEMENT_CLIENT_CODE
protected static String
ELEMENT_DOCUMENT_TYPE_CLIENT
protected static String
ELEMENT_DOCUMENT_TYPE_NAME
protected static String
ELEMENT_FORM_ABANDON_DELIVERY
protected static String
ELEMENT_FORM_DELIVERY_PROD
protected static String
ELEMENT_FORM_DELIVERY_TEST
protected static String
ELEMENT_FORM_FUNCTION
protected static String
ELEMENT_FORM_FUNCTIONS
protected static String
ELEMENT_FORM_GROUP
protected static String
ELEMENT_FORM_GROUPS
protected static String
ELEMENT_FORM_PORTAL
protected static String
ELEMENT_FORM_PORTAL_PORTAL_NAME
protected static String
ELEMENT_FORM_PORTALS
protected static String
ELEMENT_FORM_VALIDATION_DELIVERY
protected static String
ELEMENT_METADATA_TAG_CLIENT
protected static String
ELEMENT_METADATA_TAG_NAME
protected static String
ELEMENT_PARAMETER_PREFILL_MAPPING
protected static String
ELEMENT_PARAMETER_PREFILL_MAPPINGS
protected static String
ELEMENT_PROPERTY_PREFILL_MAPPING
protected static String
ELEMENT_PROPERTY_PREFILL_MAPPINGS
protected static String
ELEMENT_PROPERTY_TYPE_CLIENT
protected static String
ELEMENT_PROPERTY_TYPE_NAME
protected static String
ELEMENT_PROPERTY_TYPE_SCOPE
protected static String
ELEMENT_SCHEMA_CONFIG_MAPPING
protected static String
ELEMENT_SCHEMA_CONFIG_MAPPINGS
protected static String
ELEMENT_SCHEMA_EXTRACT_MAPPING
protected static String
ELEMENT_SCHEMA_EXTRACT_MAPPINGS
protected static String
ELEMENT_SCHEMA_SEED
protected static String
ELEMENT_SERVICE
protected static String
ELEMENT_SERVICE_CLIENT_CODE
protected static String
ELEMENT_SERVICE_CONNECTION
protected static String
ELEMENT_SERVICE_CONNECTIONS
protected static String
ELEMENT_SERVICE_NAME
protected static String
ELEMENT_SERVICE_PARAMETER
protected static String
ELEMENT_SERVICE_PARAMETERS
protected static String
ELEMENT_SERVICE_TYPE
protected static String
ELEMENT_SERVICE_VERSION
protected static String
ELEMENT_SERVICES
protected static String
ELEMENT_TEMPLATE_VERSION
protected static String
ELEMENT_TEMPLATE_VERSION_DEPLOYMENT
protected static String
ELEMENT_TEMPLATE_VERSION_DEPLOYMENTS
protected static String
ELEMENT_TEMPLATE_VERSIONS
protected static String
ELEMENT_VERSION_ATTACHMENT
protected static String
ELEMENT_VERSION_ATTACHMENTS
protected static String
ELEMENT_VERSION_CATEGORIES
protected static String
ELEMENT_VERSION_CATEGORY
protected static String
ELEMENT_VERSION_METADATA_VALUE
protected static String
ELEMENT_VERSION_METADATA_VALUES
protected static String
ELEMENT_VERSION_PROPERTY_VALUE
protected static String
ELEMENT_VERSION_PROPERTY_VALUES
protected static String
ELEMENT_XML_PREFILL_MAPPING
protected static String
ELEMENT_XML_PREFILL_MAPPINGS
protected static String
ELEMENT_XML_PREFILL_VERSION
static String
ENCODING
The encoding that will be used when storing the XML files contained in the archiveprotected static String
FILE_FAR_DEFAULT
protected static String
FILE_SCHEMA_SEED_DEFAULT
protected static String
FILE_XML_PREFILL_DEFAULT
protected boolean
groovySecureAPI
static String
METADATA_ENVIRONMENT_NAME
The name of the metadata value storing the TM environment namestatic String
METADATA_ENVIRONMENT_TYPE
The name of the metadata value storing the TM environment type (relevant if the value is "maestro")static String
METADATA_ENVIRONMENT_TYPE_MAESTRO
The Maestro environment type (used to drive some defaults)static String
METADATA_EXPORT_DATE
The name of the metadata value storing the date the export archive was createdstatic String
METADATA_EXPORT_DB_VERSION
The name of the metadata value storing the SFM database versionstatic String
METADATA_EXPORT_REVISION
The name of the metadata value storing the SFM build numberstatic String
METADATA_EXPORT_VERSION
The name of the metadata value storing the SFM versionstatic String
METADATA_IMPORT_ACTION
The name of the metadata value storing a string constant describing what will happen on import of this archivestatic String
METADATA_IMPORT_ACTION_CONFLICT
Indicates that the entity cannot be imported due to a conflict with existing entitiesstatic String
METADATA_IMPORT_ACTION_CREATE
Indicates that the entity being imported does not exist and will be createdstatic String
METADATA_IMPORT_ACTION_ERROR
Indicates that the entity cannot be imported due to an errorstatic String
METADATA_IMPORT_ACTION_MESSAGE
The name of the metadata value storing a message describing the action that will happen on import of this archivestatic String
METADATA_IMPORT_ACTION_UPDATE
Indicates that the entity being imported already exists and will be updatedprotected Map<Pair<Long,String>,String>
oldCurrentServiceVersions
static int
PORTAL_AUTHENTICATION_DB_VERSION
The 5.1 db version where the authentication scope was moved to the portals.protected static String
SERVICE_TYPE_CARD_PAYMENT_OBSOLETE
The old service type for credit card payment services (obsolete)protected List<Long>
updatedTemplateVersionIds
-
Constructor Summary
Constructors Constructor Description BaseArchiveService()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
addDeploymentSchedule(Form form, Element parentElement)
protected void
addForm(ZipOutputStream zos, Form form, TemplateVersion version, Element parentElement)
protected void
addFormFunctions(TemplateVersion version, ZipOutputStream zos, Element parentElement)
protected void
addFormGroups(Form form, Element parentElement)
protected void
addFormPortals(Form form, Element parentElement)
protected void
addParameterPrefillMaps(SchemaSeed schemaSeed, ZipOutputStream zos, Element parentElement)
protected void
addPropertyPrefillMaps(Form form, SchemaSeed schemaSeed, ZipOutputStream zos, Element parentElement)
protected void
addSchemaExtractMaps(SchemaSeed schemaSeed, ZipOutputStream zos, Element parentElement)
protected void
addSchemaSeed(Form form, TemplateVersion version, ZipOutputStream zos, Element parentElement)
protected void
addService(ServiceDefinition serviceDefinition, ZipOutputStream zos, Element parentElement)
protected void
addServiceConnection(ZipOutputStream zos, ServiceConnection connection, Element parentElement)
protected void
addTemplateVersion(Form form, TemplateVersion version, ZipOutputStream zos, Element parentElement)
protected void
addTemplateVersionData(TemplateVersion version, ZipOutputStream zos, Element parentElement)
protected void
addVersionAttachments(Form form, TemplateVersion version, ZipOutputStream zos, Element parentElement)
protected void
addVersionCategories(TemplateVersion version, ZipOutputStream zos, Element parentElement)
protected void
addVersionMetadataValues(Form form, TemplateVersion version, ZipOutputStream zos, Element parentElement)
protected void
addVersionPropertyValues(Form form, TemplateVersion version, ZipOutputStream zos, Element parentElement)
protected void
addXmlPrefillMaps(TemplateVersion version, SchemaSeed schemaSeed, ZipOutputStream zos, Element parentElement)
protected void
copyFromElementToEntity(Element element, BaseEntity entity, List<String> warnings)
protected void
copyFromElementToEntity(Element element, BaseEntity entity, List<String> exclusions, List<String> warnings)
Copies from an XML element to the given entity, usingEntityArchiveUtils
.protected void
createChildProperty(Element parent, String nodeName, Object source)
protected void
createChildValue(Element parent, String nodeName, String value)
protected abstract void
exportAuditLogger(Object object)
Create an entry in the audit log when an export is performed This is called before the postExport methodvoid
exportData(Object object, OutputStream outputStream)
Export the specified entity to an output stream.void
exportData(Object object, OutputStream outputStream, Map<String,String> additionalHeaders)
Export the specified entity to an output stream.byte[]
findFileInArchive(byte[] zipFileData, String name)
Find the given file in the archive and return its contentsprotected byte[]
getByteArrayForElement(Element element)
protected byte[]
getByteArrayForZipEntry(ZipEntry entry, ZipInputStream zis)
Set<? extends IJMImportOption>
getDefaultImportOptions(String metadataImportAction)
Return the immutable set of import options that make sense as a default for the given import action.protected Element
getElementForByteArray(byte[] byteData)
protected abstract String
getEntityName()
Return the name identifying the individual entity being exported (e.g.protected BaseArchiveService.FormData
getFormData(Element formElement, Form form, TemplateVersion version)
protected String
getFormVersionKey(Form form, TemplateVersion version)
Deprecated.use {@link this#getFormVersionKey(String, TemplateVersion) instead and explicitly pass the appropriate form code (generally either the archive form code during import or form.getClientFormCode() during export).protected String
getFormVersionKey(String formCode, TemplateVersion version)
Make sure to pass in the appropriate form code.abstract Map<String,String>
getImportMetadata(byte[] importData)
Retrieve the set of metadata values describing an archive that is being imported.IJMImportOption
getImportOptionEnum()
Return a value from the import option enum, if this service has import options.protected void
importApplicationPackages(Form form, Element parentElement, List<String> warnings)
protected void
importApplicationPackages(ServiceDefinition serviceDefinition, Element parentElement, List<String> warnings)
void
importArchive(ImportAction importAction, Set<? extends Enum> importOptions)
Import the archive from a input streamvoid
importArchive(ImportAction importAction, Set<? extends Enum> importOptions, Map<String,Object> parameters)
Import the archive from a input streamprotected abstract void
importAuditLogger(ImportAction object)
Create an entry in the audit log when an import is performed This is called before the postImport methodprotected void
importDeploymentPlan(Form form, Element parentElement, List<String> warnings)
protected void
importFormFunctions(TemplateVersion version, Element parentElement, List<String> warnings)
protected void
importFormGroups(Form form, Element formElement, List<String> warnings)
protected void
importFormPortals(Form form, Element formElement, List<String> warnings)
protected void
importOldSchemaConfigMaps(SchemaSeed schemaSeed, Element parentElement, List<String> warnings)
protected void
importParameterPrefillMaps(SchemaSeed schemaSeed, Element parentElement, List<String> warnings)
protected void
importPropertyPrefillMaps(SchemaSeed schemaSeed, Element parentElement, List<String> warnings)
protected void
importSchemaExtractMaps(SchemaSeed schemaSeed, Element parentElement, List<String> warnings)
protected void
importSchemaSeed(Form form, TemplateVersion version, Element formElement, Element parentElement, List<String> warnings)
protected ServiceConnection
importServiceConnection(Client client, ServiceDefinition serviceDefinition, boolean preserveServiceConnections, Element connectionElement, List<String> warnings)
protected void
importServiceDefinition(Client client, ApplicationPackage application, boolean preserveExistingServices, boolean preserveDefaultServices, boolean preserveServiceConnections, Element serviceElement, List<String> warnings)
protected void
importServiceParameters(ServiceDefinition serviceDefinition, Element parentElement, List<String> warnings)
protected void
importTemplateVersionData(Element formElement, TemplateVersion templateVersion)
protected int
importTemplateVersions(Form form, boolean importAttachments, boolean importMetadata, boolean importProperties, boolean importServices, boolean importFormDataConfiguration, boolean importCurrentVersionFlag, boolean importCategories, boolean importFormFunctions, Element formElement, List<String> warnings)
protected int
importTemplateVersions(Form form, Element formElement, List<String> warnings)
protected void
importVersionAttachments(Form form, TemplateVersion version, Element parentElement, List<String> warnings)
protected void
importVersionCategories(Form form, TemplateVersion version, Element parentElement, List<String> warnings)
protected void
importVersionMetadata(Form form, TemplateVersion version, Element parentElement, List<String> warnings)
protected void
importVersionProperties(Form form, TemplateVersion version, Element parentElement, List<String> warnings)
protected void
importXmlPrefillMaps(SchemaSeed schemaSeed, Element parentElement, List<String> warnings)
boolean
isGroovySecureAPI()
Return true if GroovySecure API is enforced.protected abstract void
performImport(ImportAction importAction, Set<? extends Enum> importOptions, Map<String,Object> parameters)
Performs the act of importing the data contained in the archive to the SFM database.protected void
postExport(Object exportObject)
Called after the export has been done, and the file created.protected void
postImport(ImportAction importAction)
Can be used to do post-import tasks such as form publishing.protected abstract void
processImportFile(String fileName, byte[] fileData)
For a given file in the imported archive, the service stores its contents as it sees fit, preserving what it will need to recreate entities later.protected ApplicationPackage
readApplicationPackageReference(Element parentElement, Client targetClient)
protected String
readClientCodeReference(Element element)
protected void
readMetadataAttributes(Element rootElement, Map<String,String> metadataMap)
Add the metadata shared by all export files to the metadata mapprotected String
readServiceName(Element serviceElement)
Return the service name of the service stored in the specified elementprotected ServiceDefinition
readServiceReference(Element serviceElement, Client client)
Read a service definition defined in a special service elementvoid
setGroovySecureAPI(boolean value)
Set whether the GroovySecureAPI is enforcedprotected void
updateUnifiedAppFlagAndDoc(TemplateVersion formTemplateVersion)
abstract void
validateImportData(byte[] importData)
Validate an archive before it is imported.protected void
writeApplicationPackageReference(Element parentElement, ApplicationPackage applicationPackage)
Creates a child element for a reference to an application packageprotected void
writeClientCodeReference(Element parentElement, String clientCode)
protected abstract void
writeExportData(Object object, ZipOutputStream zos, Map<String,String> additionalHeaders)
Does the actual export of the data without having to worry about handling errors or preparing and closing the streamprotected void
writeHeaderAttributes(Element element, Map<String,String> additionalHeaders)
protected void
writeServiceReference(Element parentElement, String childElementName, ServiceDefinition serviceDefinition)
Creates a child element for a reference to a service definition-
Methods inherited from class com.avoka.fc.core.service.CayenneService
commitChanges, deleteObject, deleteObjects, findObject, getDataContext, getDataDomain, getObjectForPK, getObjectStore, newObject, performNamedQuery, performNamedQuery, performNamedQuery, performNonSelectingQuery, performNonSelectingQuery, performNonSelectingQuery, performNonSelectingQuery, performQuery, performQuery, refetchEntity, refetchObject, registerNewObject, rollbackChanges, toMap, toMap
-
Methods inherited from class com.avoka.fc.core.service.BaseService
getLogger
-
-
-
-
Field Detail
-
ENCODING
public static final String ENCODING
The encoding that will be used when storing the XML files contained in the archive- See Also:
- Constant Field Values
-
METADATA_ENVIRONMENT_NAME
public static final String METADATA_ENVIRONMENT_NAME
The name of the metadata value storing the TM environment name- See Also:
- Constant Field Values
-
METADATA_ENVIRONMENT_TYPE
public static final String METADATA_ENVIRONMENT_TYPE
The name of the metadata value storing the TM environment type (relevant if the value is "maestro")- See Also:
- Constant Field Values
-
METADATA_EXPORT_DATE
public static final String METADATA_EXPORT_DATE
The name of the metadata value storing the date the export archive was created- See Also:
- Constant Field Values
-
METADATA_EXPORT_VERSION
public static final String METADATA_EXPORT_VERSION
The name of the metadata value storing the SFM version- See Also:
- Constant Field Values
-
METADATA_EXPORT_REVISION
public static final String METADATA_EXPORT_REVISION
The name of the metadata value storing the SFM build number- See Also:
- Constant Field Values
-
METADATA_EXPORT_DB_VERSION
public static final String METADATA_EXPORT_DB_VERSION
The name of the metadata value storing the SFM database version- See Also:
- Constant Field Values
-
METADATA_IMPORT_ACTION
public static final String METADATA_IMPORT_ACTION
The name of the metadata value storing a string constant describing what will happen on import of this archive- See Also:
- Constant Field Values
-
METADATA_IMPORT_ACTION_MESSAGE
public static final String METADATA_IMPORT_ACTION_MESSAGE
The name of the metadata value storing a message describing the action that will happen on import of this archive- See Also:
- Constant Field Values
-
METADATA_IMPORT_ACTION_CREATE
public static final String METADATA_IMPORT_ACTION_CREATE
Indicates that the entity being imported does not exist and will be created- See Also:
- Constant Field Values
-
METADATA_IMPORT_ACTION_UPDATE
public static final String METADATA_IMPORT_ACTION_UPDATE
Indicates that the entity being imported already exists and will be updated- See Also:
- Constant Field Values
-
METADATA_IMPORT_ACTION_CONFLICT
public static final String METADATA_IMPORT_ACTION_CONFLICT
Indicates that the entity cannot be imported due to a conflict with existing entities- See Also:
- Constant Field Values
-
METADATA_IMPORT_ACTION_ERROR
public static final String METADATA_IMPORT_ACTION_ERROR
Indicates that the entity cannot be imported due to an error- See Also:
- Constant Field Values
-
METADATA_ENVIRONMENT_TYPE_MAESTRO
public static final String METADATA_ENVIRONMENT_TYPE_MAESTRO
The Maestro environment type (used to drive some defaults)- See Also:
- Constant Field Values
-
PORTAL_AUTHENTICATION_DB_VERSION
public static final int PORTAL_AUTHENTICATION_DB_VERSION
The 5.1 db version where the authentication scope was moved to the portals.- See Also:
- Constant Field Values
-
ELEMENT_CLIENT
protected static final String ELEMENT_CLIENT
- See Also:
- Constant Field Values
-
ELEMENT_FORM_DELIVERY_TEST
protected static final String ELEMENT_FORM_DELIVERY_TEST
- See Also:
- Constant Field Values
-
ELEMENT_FORM_DELIVERY_PROD
protected static final String ELEMENT_FORM_DELIVERY_PROD
- See Also:
- Constant Field Values
-
ELEMENT_FORM_ABANDON_DELIVERY
protected static final String ELEMENT_FORM_ABANDON_DELIVERY
- See Also:
- Constant Field Values
-
ELEMENT_FORM_VALIDATION_DELIVERY
protected static final String ELEMENT_FORM_VALIDATION_DELIVERY
- See Also:
- Constant Field Values
-
ELEMENT_AUTHENTICATION_MODE
protected static final String ELEMENT_AUTHENTICATION_MODE
- See Also:
- Constant Field Values
-
ELEMENT_FORM_PORTALS
protected static final String ELEMENT_FORM_PORTALS
- See Also:
- Constant Field Values
-
ELEMENT_FORM_PORTAL
protected static final String ELEMENT_FORM_PORTAL
- See Also:
- Constant Field Values
-
ELEMENT_FORM_PORTAL_PORTAL_NAME
protected static final String ELEMENT_FORM_PORTAL_PORTAL_NAME
- See Also:
- Constant Field Values
-
ATTRIBUTE_FORM_PORTAL_ANONYMOUS
protected static final String ATTRIBUTE_FORM_PORTAL_ANONYMOUS
- See Also:
- Constant Field Values
-
ATTRIBUTE_FORM_PORTAL_AUTHENTICATED
protected static final String ATTRIBUTE_FORM_PORTAL_AUTHENTICATED
- See Also:
- Constant Field Values
-
ELEMENT_FORM_GROUPS
protected static final String ELEMENT_FORM_GROUPS
- See Also:
- Constant Field Values
-
ELEMENT_FORM_GROUP
protected static final String ELEMENT_FORM_GROUP
- See Also:
- Constant Field Values
-
ELEMENT_TEMPLATE_VERSIONS
protected static final String ELEMENT_TEMPLATE_VERSIONS
- See Also:
- Constant Field Values
-
ELEMENT_TEMPLATE_VERSION
protected static final String ELEMENT_TEMPLATE_VERSION
- See Also:
- Constant Field Values
-
ELEMENT_FORM_FUNCTIONS
protected static final String ELEMENT_FORM_FUNCTIONS
- See Also:
- Constant Field Values
-
ELEMENT_FORM_FUNCTION
protected static final String ELEMENT_FORM_FUNCTION
- See Also:
- Constant Field Values
-
ELEMENT_VERSION_ATTACHMENTS
protected static final String ELEMENT_VERSION_ATTACHMENTS
- See Also:
- Constant Field Values
-
ELEMENT_VERSION_ATTACHMENT
protected static final String ELEMENT_VERSION_ATTACHMENT
- See Also:
- Constant Field Values
-
ELEMENT_VERSION_METADATA_VALUES
protected static final String ELEMENT_VERSION_METADATA_VALUES
- See Also:
- Constant Field Values
-
ELEMENT_VERSION_METADATA_VALUE
protected static final String ELEMENT_VERSION_METADATA_VALUE
- See Also:
- Constant Field Values
-
ELEMENT_VERSION_PROPERTY_VALUES
protected static final String ELEMENT_VERSION_PROPERTY_VALUES
- See Also:
- Constant Field Values
-
ELEMENT_VERSION_PROPERTY_VALUE
protected static final String ELEMENT_VERSION_PROPERTY_VALUE
- See Also:
- Constant Field Values
-
ELEMENT_VERSION_CATEGORIES
protected static final String ELEMENT_VERSION_CATEGORIES
- See Also:
- Constant Field Values
-
ELEMENT_VERSION_CATEGORY
protected static final String ELEMENT_VERSION_CATEGORY
- See Also:
- Constant Field Values
-
ELEMENT_TEMPLATE_VERSION_DEPLOYMENTS
protected static final String ELEMENT_TEMPLATE_VERSION_DEPLOYMENTS
- See Also:
- Constant Field Values
-
ELEMENT_TEMPLATE_VERSION_DEPLOYMENT
protected static final String ELEMENT_TEMPLATE_VERSION_DEPLOYMENT
- See Also:
- Constant Field Values
-
ELEMENT_SCHEMA_SEED
protected static final String ELEMENT_SCHEMA_SEED
- See Also:
- Constant Field Values
-
ELEMENT_DOCUMENT_TYPE_NAME
protected static final String ELEMENT_DOCUMENT_TYPE_NAME
- See Also:
- Constant Field Values
-
ELEMENT_DOCUMENT_TYPE_CLIENT
protected static final String ELEMENT_DOCUMENT_TYPE_CLIENT
- See Also:
- Constant Field Values
-
ELEMENT_METADATA_TAG_NAME
protected static final String ELEMENT_METADATA_TAG_NAME
- See Also:
- Constant Field Values
-
ELEMENT_METADATA_TAG_CLIENT
protected static final String ELEMENT_METADATA_TAG_CLIENT
- See Also:
- Constant Field Values
-
ELEMENT_PROPERTY_TYPE_NAME
protected static final String ELEMENT_PROPERTY_TYPE_NAME
- See Also:
- Constant Field Values
-
ELEMENT_PROPERTY_TYPE_SCOPE
protected static final String ELEMENT_PROPERTY_TYPE_SCOPE
- See Also:
- Constant Field Values
-
ELEMENT_PROPERTY_TYPE_CLIENT
protected static final String ELEMENT_PROPERTY_TYPE_CLIENT
- See Also:
- Constant Field Values
-
ELEMENT_CATEGORY_NAME
protected static final String ELEMENT_CATEGORY_NAME
- See Also:
- Constant Field Values
-
ELEMENT_SCHEMA_CONFIG_MAPPINGS
protected static final String ELEMENT_SCHEMA_CONFIG_MAPPINGS
- See Also:
- Constant Field Values
-
ELEMENT_SCHEMA_CONFIG_MAPPING
protected static final String ELEMENT_SCHEMA_CONFIG_MAPPING
- See Also:
- Constant Field Values
-
ELEMENT_PROPERTY_PREFILL_MAPPINGS
protected static final String ELEMENT_PROPERTY_PREFILL_MAPPINGS
- See Also:
- Constant Field Values
-
ELEMENT_PROPERTY_PREFILL_MAPPING
protected static final String ELEMENT_PROPERTY_PREFILL_MAPPING
- See Also:
- Constant Field Values
-
ELEMENT_XML_PREFILL_VERSION
protected static final String ELEMENT_XML_PREFILL_VERSION
- See Also:
- Constant Field Values
-
ELEMENT_XML_PREFILL_MAPPINGS
protected static final String ELEMENT_XML_PREFILL_MAPPINGS
- See Also:
- Constant Field Values
-
ELEMENT_XML_PREFILL_MAPPING
protected static final String ELEMENT_XML_PREFILL_MAPPING
- See Also:
- Constant Field Values
-
ELEMENT_PARAMETER_PREFILL_MAPPINGS
protected static final String ELEMENT_PARAMETER_PREFILL_MAPPINGS
- See Also:
- Constant Field Values
-
ELEMENT_PARAMETER_PREFILL_MAPPING
protected static final String ELEMENT_PARAMETER_PREFILL_MAPPING
- See Also:
- Constant Field Values
-
ELEMENT_SCHEMA_EXTRACT_MAPPINGS
protected static final String ELEMENT_SCHEMA_EXTRACT_MAPPINGS
- See Also:
- Constant Field Values
-
ELEMENT_SCHEMA_EXTRACT_MAPPING
protected static final String ELEMENT_SCHEMA_EXTRACT_MAPPING
- See Also:
- Constant Field Values
-
ELEMENT_SERVICES
protected static final String ELEMENT_SERVICES
- See Also:
- Constant Field Values
-
ELEMENT_SERVICE
protected static final String ELEMENT_SERVICE
- See Also:
- Constant Field Values
-
ELEMENT_SERVICE_CONNECTIONS
protected static final String ELEMENT_SERVICE_CONNECTIONS
- See Also:
- Constant Field Values
-
ELEMENT_SERVICE_CONNECTION
protected static final String ELEMENT_SERVICE_CONNECTION
- See Also:
- Constant Field Values
-
ELEMENT_SERVICE_PARAMETERS
protected static final String ELEMENT_SERVICE_PARAMETERS
- See Also:
- Constant Field Values
-
ELEMENT_SERVICE_PARAMETER
protected static final String ELEMENT_SERVICE_PARAMETER
- See Also:
- Constant Field Values
-
ELEMENT_APPLICATION_PACKAGES
protected static final String ELEMENT_APPLICATION_PACKAGES
- See Also:
- Constant Field Values
-
ELEMENT_APPLICATION_PACKAGE
protected static final String ELEMENT_APPLICATION_PACKAGE
- See Also:
- Constant Field Values
-
ELEMENT_CLIENT_CODE
protected static final String ELEMENT_CLIENT_CODE
- See Also:
- Constant Field Values
-
ELEMENT_SERVICE_NAME
protected static final String ELEMENT_SERVICE_NAME
- See Also:
- Constant Field Values
-
ELEMENT_SERVICE_CLIENT_CODE
protected static final String ELEMENT_SERVICE_CLIENT_CODE
- See Also:
- Constant Field Values
-
ELEMENT_SERVICE_VERSION
protected static final String ELEMENT_SERVICE_VERSION
- See Also:
- Constant Field Values
-
ELEMENT_SERVICE_TYPE
protected static final String ELEMENT_SERVICE_TYPE
- See Also:
- Constant Field Values
-
ATTRIBUTE_EXPORT_DATE
protected static final String ATTRIBUTE_EXPORT_DATE
- See Also:
- Constant Field Values
-
ATTRIBUTE_ENVIRONMENT_NAME
protected static final String ATTRIBUTE_ENVIRONMENT_NAME
- See Also:
- Constant Field Values
-
ATTRIBUTE_SFM_VERSION
protected static final String ATTRIBUTE_SFM_VERSION
- See Also:
- Constant Field Values
-
ATTRIBUTE_BUILD_NUMBER
protected static final String ATTRIBUTE_BUILD_NUMBER
- See Also:
- Constant Field Values
-
ATTRIBUTE_DB_VERSION
protected static final String ATTRIBUTE_DB_VERSION
- See Also:
- Constant Field Values
-
DIR_FORM
protected static final String DIR_FORM
- See Also:
- Constant Field Values
-
DIR_FAR
protected static final String DIR_FAR
- See Also:
- Constant Field Values
-
DIR_RECEIPT
protected static final String DIR_RECEIPT
- See Also:
- Constant Field Values
-
DIR_SCHEMA_SEED
protected static final String DIR_SCHEMA_SEED
- See Also:
- Constant Field Values
-
DIR_XML_PREFILL
protected static final String DIR_XML_PREFILL
- See Also:
- Constant Field Values
-
FILE_FAR_DEFAULT
protected static final String FILE_FAR_DEFAULT
- See Also:
- Constant Field Values
-
FILE_SCHEMA_SEED_DEFAULT
protected static final String FILE_SCHEMA_SEED_DEFAULT
- See Also:
- Constant Field Values
-
FILE_XML_PREFILL_DEFAULT
protected static final String FILE_XML_PREFILL_DEFAULT
- See Also:
- Constant Field Values
-
SERVICE_TYPE_CARD_PAYMENT_OBSOLETE
protected static final String SERVICE_TYPE_CARD_PAYMENT_OBSOLETE
The old service type for credit card payment services (obsolete)- See Also:
- Constant Field Values
-
groovySecureAPI
protected boolean groovySecureAPI
-
-
Method Detail
-
exportData
public void exportData(Object object, OutputStream outputStream)
Export the specified entity to an output stream.- Parameters:
object
- the object to be exported (required)outputStream
- an output stream (required)
-
exportData
public void exportData(Object object, OutputStream outputStream, Map<String,String> additionalHeaders)
Export the specified entity to an output stream.- Parameters:
object
- the object to be exported (required)outputStream
- an output stream (required)additionalHeaders
- a map of parameters to add to the header metadata (optional)
-
getDefaultImportOptions
public Set<? extends IJMImportOption> getDefaultImportOptions(String metadataImportAction)
Return the immutable set of import options that make sense as a default for the given import action.- Parameters:
metadataImportAction
- the import action that will be performed (one ofMETADATA_IMPORT_ACTION_CREATE
,METADATA_IMPORT_ACTION_UPDATE
)- Returns:
- the set of default import options
- Since:
- 20.05.0
-
exportAuditLogger
protected abstract void exportAuditLogger(Object object)
Create an entry in the audit log when an export is performed This is called before the postExport method- Parameters:
object
- Object exported (Optional)- Since:
- 17.10.2
-
importAuditLogger
protected abstract void importAuditLogger(ImportAction object)
Create an entry in the audit log when an import is performed This is called before the postImport method- Parameters:
object
- ImportAction containing action performed (required)- Since:
- 17.10.2
-
validateImportData
public abstract void validateImportData(byte[] importData) throws Exception
Validate an archive before it is imported.- Parameters:
importData
- the import archive as a byte array- Throws:
Exception
- if an error occurs during validation
-
getImportMetadata
public abstract Map<String,String> getImportMetadata(byte[] importData) throws Exception
Retrieve the set of metadata values describing an archive that is being imported.- Parameters:
importData
- the import archive as a byte array- Returns:
- a map of metadata names and their values
- Throws:
Exception
- if an error occurs while the metadata is being loaded
-
importArchive
public void importArchive(ImportAction importAction, Set<? extends Enum> importOptions) throws Exception
Import the archive from a input stream- Parameters:
importAction
- the input action object related to this importimportOptions
- a set of import options- Throws:
Exception
- if an error occurs during import
-
importArchive
public void importArchive(ImportAction importAction, Set<? extends Enum> importOptions, Map<String,Object> parameters) throws Exception
Import the archive from a input stream- Parameters:
importAction
- the input action object related to this importimportOptions
- a set of import optionsparameters
- a set of optional parameters to be used during import- Throws:
Exception
- if an error occurs during import
-
findFileInArchive
public byte[] findFileInArchive(byte[] zipFileData, String name) throws IOException
Find the given file in the archive and return its contents- Parameters:
zipFileData
- the ZIP file dataname
- the name of the ZIP file entry (required)- Returns:
- the data for the entry with the given name, or null if not found
- Throws:
IOException
- if an error occurs while reading the ZIP file- Since:
- 20.05.0
-
getImportOptionEnum
public IJMImportOption getImportOptionEnum()
Return a value from the import option enum, if this service has import options. Can be used to callIJMImportOption.defaultForImportAction(String)
- Returns:
- one of the import options
-
isGroovySecureAPI
public boolean isGroovySecureAPI()
Return true if GroovySecure API is enforced.- Returns:
- true if GroovySecure API is enforced
- Since:
- 5.1.7
-
setGroovySecureAPI
public void setGroovySecureAPI(boolean value)
Set whether the GroovySecureAPI is enforced- Parameters:
value
- set whether the GroovySecureAPI is enforced- Since:
- 5.1.7
-
writeExportData
protected abstract void writeExportData(Object object, ZipOutputStream zos, Map<String,String> additionalHeaders) throws Exception
Does the actual export of the data without having to worry about handling errors or preparing and closing the stream- Parameters:
object
- the non-null object to be exportedzos
- the stream to be written toadditionalHeaders
- the map of additional headers to be included in metadata- Throws:
Exception
- if an error occurs
-
processImportFile
protected abstract void processImportFile(String fileName, byte[] fileData) throws Exception
For a given file in the imported archive, the service stores its contents as it sees fit, preserving what it will need to recreate entities later. This operation happens before the database transaction wrapping the actual import to the SFM database.- Parameters:
fileName
- the full file name of the ZIP file entry (e.g. form/TestForm.pdf)fileData
- the file data of the ZIP file entry- Throws:
Exception
- if an error occurs
-
performImport
protected abstract void performImport(ImportAction importAction, Set<? extends Enum> importOptions, Map<String,Object> parameters) throws Exception
Performs the act of importing the data contained in the archive to the SFM database. When this method will be called, the caller is expected to have established a transaction, and will also handle errors thrown by this method.- Parameters:
importAction
- the import action related to this importimportOptions
- the set of import options that should be appliedparameters
- optional parameters to be used during import- Throws:
Exception
- If an error occurs. The caller is responsible for rolling back the transaction to avoid contaminating the database.
-
postImport
protected void postImport(ImportAction importAction)
Can be used to do post-import tasks such as form publishing.
-
getEntityName
protected abstract String getEntityName()
Return the name identifying the individual entity being exported (e.g. for a client, the client's name)- Returns:
- the entity name
-
postExport
protected void postExport(Object exportObject)
Called after the export has been done, and the file created. Can be used to do service-specific activities such as logging.- Parameters:
exportObject
- the object that was passed to exportData
-
writeHeaderAttributes
protected void writeHeaderAttributes(Element element, Map<String,String> additionalHeaders)
-
readMetadataAttributes
protected void readMetadataAttributes(Element rootElement, Map<String,String> metadataMap)
Add the metadata shared by all export files to the metadata map- Parameters:
rootElement
- the root element in the export config file (required)metadataMap
- the map to add the metadata entries to
-
createChildProperty
protected void createChildProperty(Element parent, String nodeName, Object source)
-
writeServiceReference
protected void writeServiceReference(Element parentElement, String childElementName, ServiceDefinition serviceDefinition)
Creates a child element for a reference to a service definition- Parameters:
parentElement
- the parent element (required)childElementName
- the name of the child element wrapping the service data (required)serviceDefinition
- the service definition (required)
-
readServiceName
protected String readServiceName(Element serviceElement)
Return the service name of the service stored in the specified element- Parameters:
serviceElement
- the element containing the service name and type- Returns:
- the service name
-
readServiceReference
protected ServiceDefinition readServiceReference(Element serviceElement, Client client)
Read a service definition defined in a special service element- Parameters:
serviceElement
- the element holding the service type and name (generally created bywriteServiceReference(Element, String, ServiceDefinition)
client
- the target client of the import, if any- Returns:
- the service element if found, or null otherwise
- Throws:
ApplicationException
- if a service was found, but the service type was different
-
getByteArrayForZipEntry
protected byte[] getByteArrayForZipEntry(ZipEntry entry, ZipInputStream zis) throws IOException
- Throws:
IOException
-
getByteArrayForElement
protected byte[] getByteArrayForElement(Element element) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
getElementForByteArray
protected Element getElementForByteArray(byte[] byteData) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
copyFromElementToEntity
protected void copyFromElementToEntity(Element element, BaseEntity entity, List<String> warnings)
-
copyFromElementToEntity
protected void copyFromElementToEntity(Element element, BaseEntity entity, List<String> exclusions, List<String> warnings)
Copies from an XML element to the given entity, usingEntityArchiveUtils
. If an error occurs, an import warning is added, and the error is swallowed. This allows us to ignore minor schema differences without having to code exclusions for every single potential difference.- Parameters:
element
- the XML element containing the dataentity
- the entity to copy toexclusions
- the list of excluded propertieswarnings
- the list of import warnings
-
addService
protected void addService(ServiceDefinition serviceDefinition, ZipOutputStream zos, Element parentElement)
-
addServiceConnection
protected void addServiceConnection(ZipOutputStream zos, ServiceConnection connection, Element parentElement)
-
addForm
protected void addForm(ZipOutputStream zos, Form form, TemplateVersion version, Element parentElement) throws IOException
- Throws:
IOException
-
addTemplateVersion
protected void addTemplateVersion(Form form, TemplateVersion version, ZipOutputStream zos, Element parentElement) throws IOException
- Throws:
IOException
-
addTemplateVersionData
protected void addTemplateVersionData(TemplateVersion version, ZipOutputStream zos, Element parentElement) throws IOException
- Throws:
IOException
-
addFormFunctions
protected void addFormFunctions(TemplateVersion version, ZipOutputStream zos, Element parentElement)
-
addVersionAttachments
protected void addVersionAttachments(Form form, TemplateVersion version, ZipOutputStream zos, Element parentElement)
-
addVersionMetadataValues
protected void addVersionMetadataValues(Form form, TemplateVersion version, ZipOutputStream zos, Element parentElement)
-
addVersionPropertyValues
protected void addVersionPropertyValues(Form form, TemplateVersion version, ZipOutputStream zos, Element parentElement)
-
addVersionCategories
protected void addVersionCategories(TemplateVersion version, ZipOutputStream zos, Element parentElement)
-
addSchemaSeed
protected void addSchemaSeed(Form form, TemplateVersion version, ZipOutputStream zos, Element parentElement) throws IOException
- Throws:
IOException
-
addPropertyPrefillMaps
protected void addPropertyPrefillMaps(Form form, SchemaSeed schemaSeed, ZipOutputStream zos, Element parentElement)
-
addXmlPrefillMaps
protected void addXmlPrefillMaps(TemplateVersion version, SchemaSeed schemaSeed, ZipOutputStream zos, Element parentElement)
-
addParameterPrefillMaps
protected void addParameterPrefillMaps(SchemaSeed schemaSeed, ZipOutputStream zos, Element parentElement)
-
addSchemaExtractMaps
protected void addSchemaExtractMaps(SchemaSeed schemaSeed, ZipOutputStream zos, Element parentElement)
-
importFormGroups
protected void importFormGroups(Form form, Element formElement, List<String> warnings) throws ParseException
- Throws:
ParseException
-
importFormPortals
protected void importFormPortals(Form form, Element formElement, List<String> warnings)
-
importTemplateVersions
protected int importTemplateVersions(Form form, Element formElement, List<String> warnings)
-
importTemplateVersions
protected int importTemplateVersions(Form form, boolean importAttachments, boolean importMetadata, boolean importProperties, boolean importServices, boolean importFormDataConfiguration, boolean importCurrentVersionFlag, boolean importCategories, boolean importFormFunctions, Element formElement, List<String> warnings)
-
importTemplateVersionData
protected void importTemplateVersionData(Element formElement, TemplateVersion templateVersion)
-
importFormFunctions
protected void importFormFunctions(TemplateVersion version, Element parentElement, List<String> warnings)
-
importVersionAttachments
protected void importVersionAttachments(Form form, TemplateVersion version, Element parentElement, List<String> warnings)
-
importVersionMetadata
protected void importVersionMetadata(Form form, TemplateVersion version, Element parentElement, List<String> warnings)
-
importVersionProperties
protected void importVersionProperties(Form form, TemplateVersion version, Element parentElement, List<String> warnings)
-
importVersionCategories
protected void importVersionCategories(Form form, TemplateVersion version, Element parentElement, List<String> warnings)
-
importSchemaSeed
protected void importSchemaSeed(Form form, TemplateVersion version, Element formElement, Element parentElement, List<String> warnings)
-
importOldSchemaConfigMaps
protected void importOldSchemaConfigMaps(SchemaSeed schemaSeed, Element parentElement, List<String> warnings)
-
importPropertyPrefillMaps
protected void importPropertyPrefillMaps(SchemaSeed schemaSeed, Element parentElement, List<String> warnings)
-
importXmlPrefillMaps
protected void importXmlPrefillMaps(SchemaSeed schemaSeed, Element parentElement, List<String> warnings)
-
importParameterPrefillMaps
protected void importParameterPrefillMaps(SchemaSeed schemaSeed, Element parentElement, List<String> warnings)
-
importSchemaExtractMaps
protected void importSchemaExtractMaps(SchemaSeed schemaSeed, Element parentElement, List<String> warnings)
-
importDeploymentPlan
protected void importDeploymentPlan(Form form, Element parentElement, List<String> warnings)
-
importServiceDefinition
protected void importServiceDefinition(Client client, ApplicationPackage application, boolean preserveExistingServices, boolean preserveDefaultServices, boolean preserveServiceConnections, Element serviceElement, List<String> warnings)
-
importServiceConnection
protected ServiceConnection importServiceConnection(Client client, ServiceDefinition serviceDefinition, boolean preserveServiceConnections, Element connectionElement, List<String> warnings)
-
importServiceParameters
protected void importServiceParameters(ServiceDefinition serviceDefinition, Element parentElement, List<String> warnings)
-
importApplicationPackages
protected void importApplicationPackages(ServiceDefinition serviceDefinition, Element parentElement, List<String> warnings)
-
importApplicationPackages
protected void importApplicationPackages(Form form, Element parentElement, List<String> warnings)
-
readApplicationPackageReference
protected ApplicationPackage readApplicationPackageReference(Element parentElement, Client targetClient)
-
writeApplicationPackageReference
protected void writeApplicationPackageReference(Element parentElement, ApplicationPackage applicationPackage)
Creates a child element for a reference to an application package- Parameters:
parentElement
- the parent element (required)applicationPackage
- the application package (required)
-
writeClientCodeReference
protected void writeClientCodeReference(Element parentElement, String clientCode)
-
getFormData
protected BaseArchiveService.FormData getFormData(Element formElement, Form form, TemplateVersion version)
-
getFormVersionKey
@Deprecated protected String getFormVersionKey(Form form, TemplateVersion version)
Deprecated.use {@link this#getFormVersionKey(String, TemplateVersion) instead and explicitly pass the appropriate form code (generally either the archive form code during import or form.getClientFormCode() during export).
-
getFormVersionKey
protected String getFormVersionKey(String formCode, TemplateVersion version)
Make sure to pass in the appropriate form code. For example, during application package import, form codes may automatically be changed to unique ones. However, in the archive the old form codes are used as directory names, so this method must be used. Note that the form version archive service uses a different key.
-
updateUnifiedAppFlagAndDoc
protected void updateUnifiedAppFlagAndDoc(TemplateVersion formTemplateVersion)
-
-