Partial deployment project file attributes are defaulted using Groovy script, but if necessary we can change behavior for customer implementationare automatically defaulted by FlexDeploy during Populate from SCM / Populate from Backend or when you Evaluate file(s) at a later time. Attributes are defaulted during populate or evaluate by FlexDeploy unless it was manually set by user at any point. If attribute was manually entered by user, you will see darker border around the component on files screen. If necessary you can change defaults behavior for your implementation using Defaults Override Script. Follow details in this document to perform specific overrides.
Step-by-step guide
Prepare SQL script as necessary and execute on FlexDeploy database.
Following example is for EBS projects, OTHER object type and TARGET_LOCATION attribute default script. Note FD_OBJECT_TYPE_OVERRIDES_EBS and OTHER_TARGET_LOCATION_DEFAULTSSCRIPT for DB Properties data. Basically FD_OBJECT_TYPE_OVERRIDES_<Project Type> and <Object Type_Code>_<Object Type Attribute Code>_DEFAULTSSCRIPT.
Other options are LISTDATA and VALIDATORSCRIPT, which also can be tweaked using same mechanism.
You can either wait for 10 minutes for changes to take effect or work with your Administrator to clear cache, see Admin Operations.
...
Once you prepare Groovy script, each ' needs to be replaced with '' (2 single quotes) in SQL statement.
...
Access object type details screen by using menu option - Administration - Customize - Object Types.
Defaults override can be done for any attribute for any object type. Find specific attribute using search controls. Then click on No or Yes in Defaults Overridden? column for attribute.
Make sure to select Yes for Defaults Overridden? and enter Defaults Override Script. Then click Save.
Here is an example of Groovy script for AOL - Type attribute default. This allows user to enter path /import/<type>/filename.ldt and second part is used for Type attribute. Filename already is used for Name attribute for AOL file type. See details on EBS Object Types Reference.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
-- By default, SQL Plus treats '&' as a special character that begins a substitution string.
-- This can cause problems when running scripts that happen to include '&' for other reasons.
set define off;
-- make sure to change DB_PROPERTIES_DATA_ID, DB_PROPERTIES_ID as appropriate.
UPDATE FD.OBJECT_ATTRIBUTE_DEF set OVERRIDE_DEFAULTS_SCRIPT='Y'
where object_type_id=(select object_type_id from fd.object_type where project_type='EBS' and object_type_code='OTHER')
and object_attribute_code='TARGET_LOCATION';
INSERT INTO FF.DB_PROPERTIES
(
DB_PROPERTIES_ID,
DB_PROPERTIES_NAME,
DB_PROPERTIES_KEY,
SEQUENCE_NUMBER,
DESCRIPTION,
IS_ACTIVE,
IS_REQUIRED,
IS_ENCRYPTED,
DATA_TYPE,
VALIDATION_SCRIPT,
VALIDATION_MESSAGE,
MIN_VALUE,
MAX_VALUE,
DISPLAY_ROWS,
DISPLAY_COLUMNS,
LIST_DATA,
CREATED_ON,
CREATED_BY,
UPDATED_ON,
UPDATED_BY,
VERSION_NUMBER
)
VALUES
(
-1,
'FD_OBJECT_TYPE_OVERRIDES_EBS',
'OTHER_TARGET_LOCATION_DEFAULTSSCRIPT',
0,
'Overriding default target location',
'Y',
'Y',
'N',
'String',
null,
null,
null,
null,
1,
1,
null,
sysdate,
user,
sysdate,
user,
1
);
INSERT INTO FF.DB_PROPERTIES_DATA
(
DB_PROPERTIES_DATA_ID,
DB_PROPERTIES_ID,
SEQUENCE_NUMBER,
DB_PROPERTIES_VALUE,
DESCRIPTION,
IS_ACTIVE,
CREATED_ON,
CREATED_BY,
UPDATED_ON,
UPDATED_BY,
VERSION_NUMBER
)
VALUES
(
-1,
-1,
0,
'dummy',
'',
'Y',
sysdate,
user,
sysdate,
user,
1
);
-- update 'dummy' value
-- this update can be run again to update the script after initial creation
BEGIN
update FF.DB_PROPERTIES_DATA
set DB_PROPERTIES_VALUE = 'APP_SHORT_NAME=FDEBS_APPLICATION_SHORT_NAME ?: FILE_PATH_PREFIX.split(''/'')[1];
TARGET_LOC=''$'' + APP_SHORT_NAME + ''_TOP/patch/115'';
VAR_EXT=FILE_EXTENSION == '''' || FILE_EXTENSION == null ? '''' : FILE_EXTENSION;
VAR_EXT=VAR_EXT.toUpperCase();
if (''''.equals(VAR_EXT) || ''EXP''.equals(VAR_EXT))
{
TARGET_LOC=''$'' + APP_SHORT_NAME + ''_TOP/Interfaces/secure/scripts'';
}
return TARGET_LOC.replace(''//'',''/'');' where
DB_PROPERTIES_DATA_ID = 8000 AND
SEQUENCE_NUMBER = 0;
END;
/
commit; | ||||||
Tip | ||||||
| ||||||
Primary keys FF.DB_PROPERTIES.DB_PROPERTIES_ID and FF.DB_PROPERTIES_DATA.DB_PROPERTIES_DATA_ID should use negative numbers, beginning at -1, to avoid collision with FlexDeploy data. Note that FF.DB_PROPERTIES_DATA.DB_PROPERTIES_ID is a foreign key to FF.DB_PROPERTIES.DB_PROPERTIES_ID// AOL customization when sourcing from EBS
// User will enter path as /import/program/abcd.ldt (import/<type>/filename.ldt)
parts=FILE_PATH.split('/');
if (parts.length >= 4 && 'EBS'.equals(SOURCE))
{
return parts[2].toUpperCase();
}
return null; |
Now let's talk little bit more about how you write such groovy script. You have access to various details about file and project properties as shown below. You can make decision based on available variables and return attribute default that makes sense, or you can return null in which case FlexDeploy will make determination based on default logic as documented in EBS Object Types Reference.
Following variables are available for use in the Groovy script along with Project Properties.
Variable Name | Example using /path1/path2/APXSOBLX_1.rtf |
FILE_PATH | /path1/path2/APXSOBLX_1.rtf |
FILE_NAME | APXSOBLX_1 |
FILE_PATH_PREFIX | /path1/path2 |
FILE_EXTENSION | rtf |
PARENT_FOLDER | path2 |
FILE_CONTENT | <content of file as |
array of Strings> (one element per line) | |
Project Properties - Code for each property can be used in script | |
PROJECT_ID | 122703 |
PROJECT_NAME | XXHR |
FOLDER_PATH | / FlexDeploy / EBS |
Tip |
---|
You can also use PROJECT_ID, PROJECT_NAME, FOLDER_PATH variables in Defaults script if you want different behavior for specific Project(s). This is possible only for 4.5 build 10/27/2017 or later. |