Class TPacArchiveService
- java.lang.Object
-
- com.avoka.fc.core.service.BaseService
-
- com.avoka.fc.core.service.CayenneService
-
- com.avoka.fc.core.service.archive.BaseArchiveService
-
- com.avoka.fc.core.service.archive.TPacArchiveService
-
public class TPacArchiveService extends BaseArchiveService
Provides a service archive export and import service.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TPacArchiveService.ImportOption
Various import options controlling which entities will be imported-
Nested classes/interfaces inherited from class com.avoka.fc.core.service.archive.BaseArchiveService
BaseArchiveService.FormData
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
DIR_MAESTRO_LIB
protected static String
DIR_SERVICES
static String
METADATA_BUILD_NUMBER
TPac build numberstatic String
METADATA_BUILD_TIMESTAMP
TPac build timestampstatic String
METADATA_CLIENT_CODE
The name of the metadata value storing the organization for which services were exported (if applicable)static String
METADATA_DOC_PATH
TPac readme pathstatic String
METADATA_LIBRARIES
TPac Maestro librariesstatic String
METADATA_LIBRARY_MAESTRO_MIN_VERSION
TPac library Maestro min versionstatic String
METADATA_PACKAGE_NAME
TPac package namestatic String
METADATA_PROJECT_CODE
TPac project codestatic String
METADATA_PROJECT_NAME
TPac project namestatic String
METADATA_PROVIDER_NAME
TPac provider namestatic String
METADATA_SDK_VERSION
TPac SDK versionstatic String
METADATA_SERVICES
TPac servicesstatic String
METADATA_TM_MIN_VERSION
TPac service TM min versionstatic String
METADATA_VERSION
TPac versionstatic String
TPAC_MANIFEST_FILENAME
The TPac manifest info file namestatic String
TPAC_README_FILENAME
The TPac manifest info file name-
Fields inherited from class com.avoka.fc.core.service.archive.BaseArchiveService
ATTRIBUTE_BUILD_NUMBER, ATTRIBUTE_DB_VERSION, ATTRIBUTE_ENVIRONMENT_NAME, ATTRIBUTE_EXPORT_DATE, ATTRIBUTE_FORM_PORTAL_ANONYMOUS, ATTRIBUTE_FORM_PORTAL_AUTHENTICATED, ATTRIBUTE_SFM_VERSION, DIR_FAR, DIR_FORM, DIR_RECEIPT, DIR_SCHEMA_SEED, DIR_XML_PREFILL, ELEMENT_APPLICATION_PACKAGE, ELEMENT_APPLICATION_PACKAGES, ELEMENT_AUTHENTICATION_MODE, ELEMENT_CATEGORY_NAME, ELEMENT_CLIENT, ELEMENT_CLIENT_CODE, ELEMENT_DOCUMENT_TYPE_CLIENT, ELEMENT_DOCUMENT_TYPE_NAME, ELEMENT_FORM_ABANDON_DELIVERY, ELEMENT_FORM_DELIVERY_PROD, ELEMENT_FORM_DELIVERY_TEST, ELEMENT_FORM_FUNCTION, ELEMENT_FORM_FUNCTIONS, ELEMENT_FORM_GROUP, ELEMENT_FORM_GROUPS, ELEMENT_FORM_PORTAL, ELEMENT_FORM_PORTAL_PORTAL_NAME, ELEMENT_FORM_PORTALS, ELEMENT_FORM_VALIDATION_DELIVERY, ELEMENT_METADATA_TAG_CLIENT, ELEMENT_METADATA_TAG_NAME, ELEMENT_PARAMETER_PREFILL_MAPPING, ELEMENT_PARAMETER_PREFILL_MAPPINGS, ELEMENT_PROPERTY_PREFILL_MAPPING, ELEMENT_PROPERTY_PREFILL_MAPPINGS, ELEMENT_PROPERTY_TYPE_CLIENT, ELEMENT_PROPERTY_TYPE_NAME, ELEMENT_PROPERTY_TYPE_SCOPE, ELEMENT_SCHEMA_CONFIG_MAPPING, ELEMENT_SCHEMA_CONFIG_MAPPINGS, ELEMENT_SCHEMA_EXTRACT_MAPPING, ELEMENT_SCHEMA_EXTRACT_MAPPINGS, ELEMENT_SCHEMA_SEED, ELEMENT_SERVICE, ELEMENT_SERVICE_CLIENT_CODE, ELEMENT_SERVICE_CONNECTION, ELEMENT_SERVICE_CONNECTIONS, ELEMENT_SERVICE_NAME, ELEMENT_SERVICE_PARAMETER, ELEMENT_SERVICE_PARAMETERS, ELEMENT_SERVICE_TYPE, ELEMENT_SERVICE_VERSION, ELEMENT_SERVICES, ELEMENT_TEMPLATE_VERSION, ELEMENT_TEMPLATE_VERSION_DEPLOYMENT, ELEMENT_TEMPLATE_VERSION_DEPLOYMENTS, ELEMENT_TEMPLATE_VERSIONS, ELEMENT_VERSION_ATTACHMENT, ELEMENT_VERSION_ATTACHMENTS, ELEMENT_VERSION_CATEGORIES, ELEMENT_VERSION_CATEGORY, ELEMENT_VERSION_METADATA_VALUE, ELEMENT_VERSION_METADATA_VALUES, ELEMENT_VERSION_PROPERTY_VALUE, ELEMENT_VERSION_PROPERTY_VALUES, ELEMENT_XML_PREFILL_MAPPING, ELEMENT_XML_PREFILL_MAPPINGS, ELEMENT_XML_PREFILL_VERSION, ENCODING, FILE_FAR_DEFAULT, FILE_SCHEMA_SEED_DEFAULT, FILE_XML_PREFILL_DEFAULT, groovySecureAPI, METADATA_ENVIRONMENT_NAME, METADATA_ENVIRONMENT_TYPE, METADATA_ENVIRONMENT_TYPE_MAESTRO, METADATA_EXPORT_DATE, METADATA_EXPORT_DB_VERSION, METADATA_EXPORT_REVISION, METADATA_EXPORT_VERSION, METADATA_IMPORT_ACTION, METADATA_IMPORT_ACTION_CONFLICT, METADATA_IMPORT_ACTION_CREATE, METADATA_IMPORT_ACTION_ERROR, METADATA_IMPORT_ACTION_MESSAGE, METADATA_IMPORT_ACTION_UPDATE, oldCurrentServiceVersions, PORTAL_AUTHENTICATION_DB_VERSION, SERVICE_TYPE_CARD_PAYMENT_OBSOLETE, updatedTemplateVersionIds
-
-
Constructor Summary
Constructors Constructor Description TPacArchiveService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
exportAuditLogger(Object object)
Implement abstract method from BaseArchiveService however no action is performed as we do not export Tpacs This method should not be called as Tpacs are not exportedprotected String
getEntityName()
Return the name identifying the individual entity being exported (e.g.Map<String,String>
getImportMetadata(byte[] importData)
Retrieve the set of metadata values describing an archive that is being imported.Map<String,Object>
getImportMetadata(byte[] importData, String newClientCode)
Retrieve metadata describing the archive contents and expected import outcome.IJMImportOption
getImportOptionEnum()
Return a value from the import option enum, if this service has import options.protected void
importAuditLogger(ImportAction importAction)
Create an entry in the audit log when an import is performed This is called before the postImport methodprotected 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.void
performImport(String clientCode, ImportAction importAction, boolean override, boolean checkConflict)
perform a TPac Import.ImportAction
preparedImport(String fileName, byte[] importData, String creatorLoginName)
prepare import and generate import actionprotected 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.void
setNewClientCode(String newClientCode)
Set the client code of the import target client.void
validateImportData(byte[] importData)
Validate an archive before it is imported.protected 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 stream-
Methods inherited from class com.avoka.fc.core.service.archive.BaseArchiveService
addDeploymentSchedule, addForm, addFormFunctions, addFormGroups, addFormPortals, addParameterPrefillMaps, addPropertyPrefillMaps, addSchemaExtractMaps, addSchemaSeed, addService, addServiceConnection, addTemplateVersion, addTemplateVersionData, addVersionAttachments, addVersionCategories, addVersionMetadataValues, addVersionPropertyValues, addXmlPrefillMaps, copyFromElementToEntity, copyFromElementToEntity, createChildProperty, createChildValue, exportData, exportData, findFileInArchive, getByteArrayForElement, getByteArrayForZipEntry, getDefaultImportOptions, getElementForByteArray, getFormData, getFormVersionKey, getFormVersionKey, importApplicationPackages, importApplicationPackages, importArchive, importArchive, importDeploymentPlan, importFormFunctions, importFormGroups, importFormPortals, importOldSchemaConfigMaps, importParameterPrefillMaps, importPropertyPrefillMaps, importSchemaExtractMaps, importSchemaSeed, importServiceConnection, importServiceDefinition, importServiceParameters, importTemplateVersionData, importTemplateVersions, importTemplateVersions, importVersionAttachments, importVersionCategories, importVersionMetadata, importVersionProperties, importXmlPrefillMaps, isGroovySecureAPI, postExport, postImport, readApplicationPackageReference, readClientCodeReference, readMetadataAttributes, readServiceName, readServiceReference, setGroovySecureAPI, updateUnifiedAppFlagAndDoc, writeApplicationPackageReference, writeClientCodeReference, writeHeaderAttributes, writeServiceReference
-
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
-
TPAC_MANIFEST_FILENAME
public static final String TPAC_MANIFEST_FILENAME
The TPac manifest info file name- See Also:
- Constant Field Values
-
TPAC_README_FILENAME
public static final String TPAC_README_FILENAME
The TPac manifest info file name- See Also:
- Constant Field Values
-
METADATA_PROJECT_NAME
public static final String METADATA_PROJECT_NAME
TPac project name- See Also:
- Constant Field Values
-
METADATA_PROJECT_CODE
public static final String METADATA_PROJECT_CODE
TPac project code- See Also:
- Constant Field Values
-
METADATA_PACKAGE_NAME
public static final String METADATA_PACKAGE_NAME
TPac package name- See Also:
- Constant Field Values
-
METADATA_VERSION
public static final String METADATA_VERSION
TPac version- See Also:
- Constant Field Values
-
METADATA_BUILD_NUMBER
public static final String METADATA_BUILD_NUMBER
TPac build number- See Also:
- Constant Field Values
-
METADATA_BUILD_TIMESTAMP
public static final String METADATA_BUILD_TIMESTAMP
TPac build timestamp- See Also:
- Constant Field Values
-
METADATA_DOC_PATH
public static final String METADATA_DOC_PATH
TPac readme path- See Also:
- Constant Field Values
-
METADATA_PROVIDER_NAME
public static final String METADATA_PROVIDER_NAME
TPac provider name- See Also:
- Constant Field Values
-
METADATA_SDK_VERSION
public static final String METADATA_SDK_VERSION
TPac SDK version- See Also:
- Constant Field Values
-
METADATA_SERVICES
public static final String METADATA_SERVICES
TPac services- See Also:
- Constant Field Values
-
METADATA_LIBRARIES
public static final String METADATA_LIBRARIES
TPac Maestro libraries- See Also:
- Constant Field Values
-
METADATA_TM_MIN_VERSION
public static final String METADATA_TM_MIN_VERSION
TPac service TM min version- See Also:
- Constant Field Values
-
METADATA_LIBRARY_MAESTRO_MIN_VERSION
public static final String METADATA_LIBRARY_MAESTRO_MIN_VERSION
TPac library Maestro min version- See Also:
- Constant Field Values
-
DIR_SERVICES
protected static final String DIR_SERVICES
- See Also:
- Constant Field Values
-
DIR_MAESTRO_LIB
protected static final String DIR_MAESTRO_LIB
- See Also:
- Constant Field Values
-
METADATA_CLIENT_CODE
public static final String METADATA_CLIENT_CODE
The name of the metadata value storing the organization for which services were exported (if applicable)- See Also:
- Constant Field Values
-
-
Method Detail
-
setNewClientCode
public void setNewClientCode(String newClientCode)
Set the client code of the import target client.- Parameters:
newClientCode
- the client code (optional; if not specified, the client in the archive will be used)
-
validateImportData
public void validateImportData(byte[] importData) throws IOException, ImportValidationException
Description copied from class:BaseArchiveService
Validate an archive before it is imported.- Specified by:
validateImportData
in classBaseArchiveService
- Parameters:
importData
- the import archive as a byte array- Throws:
IOException
ImportValidationException
-
getImportMetadata
public Map<String,String> getImportMetadata(byte[] importData) throws Exception
Description copied from class:BaseArchiveService
Retrieve the set of metadata values describing an archive that is being imported.- Specified by:
getImportMetadata
in classBaseArchiveService
- 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
-
getImportMetadata
public Map<String,Object> getImportMetadata(byte[] importData, String newClientCode) throws Exception
Retrieve metadata describing the archive contents and expected import outcome.- Parameters:
importData
- the archive byte data (required)newClientCode
- the client code that the new services shall be imported to (optional)- Returns:
- a map of import metadata
- Throws:
Exception
- if an error occurs
-
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)
- Overrides:
getImportOptionEnum
in classBaseArchiveService
- Returns:
- one of the import options
-
writeExportData
protected void writeExportData(Object object, ZipOutputStream zos, Map<String,String> additionalHeaders) throws Exception
Description copied from class:BaseArchiveService
Does the actual export of the data without having to worry about handling errors or preparing and closing the stream- Specified by:
writeExportData
in classBaseArchiveService
- 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 void processImportFile(String fileName, byte[] fileData) throws Exception
Description copied from class:BaseArchiveService
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.- Specified by:
processImportFile
in classBaseArchiveService
- 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 void performImport(ImportAction importAction, Set<? extends Enum> importOptions, Map<String,Object> parameters) throws Exception
Description copied from class:BaseArchiveService
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.- Specified by:
performImport
in classBaseArchiveService
- 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.
-
getEntityName
protected String getEntityName()
Description copied from class:BaseArchiveService
Return the name identifying the individual entity being exported (e.g. for a client, the client's name)- Specified by:
getEntityName
in classBaseArchiveService
- Returns:
- the entity name
-
preparedImport
public ImportAction preparedImport(String fileName, byte[] importData, String creatorLoginName) throws IOException, ImportValidationException
prepare import and generate import action- Parameters:
fileName
- file name to importimportData
- file data to importcreatorLoginName
- creator login name- Returns:
- ImportAction object that could be used in the following call like performImport()
- Throws:
IOException
- if any IO error happensImportValidationException
- if import validation fails
-
performImport
public void performImport(String clientCode, ImportAction importAction, boolean override, boolean checkConflict) throws Exception
perform a TPac Import. Typically it needs preparedImport() to be called first to generate ImportAction passing in as parameter. if checkConflict is true, it will throw error if existing global services have same name as importing one, or has existing service in same org but override is false.- Parameters:
clientCode
- the client code that TPac goes intoimportAction
- ImportAction from preparedImport() method call earlieroverride
- override existing assetscheckConflict
- check conflict and throw exception when - there is global service name with same name in importing TPac - there is service with same name in same org and override is false- Throws:
Exception
- if an error occurs
-
exportAuditLogger
protected void exportAuditLogger(Object object)
Implement abstract method from BaseArchiveService however no action is performed as we do not export Tpacs This method should not be called as Tpacs are not exported- Specified by:
exportAuditLogger
in classBaseArchiveService
- Parameters:
object
- Object that was exported (Optional)- Since:
- 17.10.2
-
importAuditLogger
protected void importAuditLogger(ImportAction importAction)
Create an entry in the audit log when an import is performed This is called before the postImport method- Specified by:
importAuditLogger
in classBaseArchiveService
- Parameters:
object
- ImportAction containing action performed (required)- Since:
- 17.10.2
-
-