Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This server-side class is necessary provides methods for using the SimpleOne version control system (VCS).

SimpleVcs()


This method instantiates Use this constructor to instantiate a new empty object of the SimpleVcs class object.

Example:

Code Block
languagejs
themeEclipse
titleSimpleVcs
linenumberstrue
const vcs = new SimpleVcs();

createTableSnapshot(tableName)


This method creates initial versions Use this method to create an up-to-date version of all the records of in the specified table.

Parameter(s):

NameTypeMandatoryDefault
Value
value
tableNameStringYN

Return:

TypeDescription
IntegerThe method returns the number of versions created after the script has been executed.

Example:

Code Block
languagejs
themeEclipse
titlecreateTableSnapshot
linenumberstrue
const tableName = 'sys_script';
const vcs = new SimpleVcs();
const versionCount = vcs.createTableSnapshot(tableName);
ss.info(versionCount); // 1

exportLocalPackVcsRecords(sysVcsLocalPackId)


This method performs Use this method to export a SOP file of the VCS records export that were are bound to the configuration pack with the a unique ID as a .SOP file. This pack must be in the Completed state.

Parameter(s):

NameTypeMandatoryDefault
Value
value
sysVcsLocalPackId
Integer
StringYN

Return:

TypeDescription
Object
A .
The method returns SOP file for downloading.

Example:

Code Block
languagejs
themeEclipse
titleexportLocalPackVcsRecords
linenumberstrue
const vcsLocalPackId = '156144163704236641';
const vcs = new SimpleVcs();
vcs.exportLocalPackVcsRecords(vcsRetrievedPackId);

importRetrievedPack(retrievedPackId)


This method imports the last containing Use this method to import the records of the retrieved pack that are uploaded in the VCS preview log Preview Log (sys_vcs_preview_log) table previewed retrieved pack to table to the VCS Record (sys_vcs_record) table.

Parameter(s):

NameTypeMandatoryDefault
Value
value
retrievedPackId
Integer
StringYN

Return:

TypeDescription
StringA string containing the import results
BooleanThe method returns true if the records are imported; otherwise, it returns false.

Example:

Code Block
languagejs
themeEclipse
titleimportRetrievedPack
linenumberstrue
const vcsRetrievedPackId = '156144163704236641';
const vcs = new SimpleVcs();
const result = vcs.importRetrievedPack(vcsRetrievedPackId);
ss.addInfoMessage(result);

isLocalPackHasReferences(localPackId)


This Use this method checks to check the record from the the VCS Local Pack (sys_vcs_local_pack table if it has referenced ) table for references to the current* records from the VCS records Record (sys_vcs_record) table.

*the current records have the is_current attribute equal to 'true'selected Is current checkbox.

Parameter(s):

NameTypeMandatoryDefault
Value
value
localPackId
Integer
StringYN

Return:

TypeDescription
BooleanThe method returns
'
true
'
if it finds the records; otherwise, it returns
'
false
'
.

Example:

Code Block
languagejs
themeEclipse
titleisLocalPackHasReferences
linenumberstrue
const vcsLocalPackId = '156144163704236641';
const vcs = new SimpleVcs();
if (vcs.isLocalPackHasReferences(vcsLocalPackId)) {
  ss.addInfoMessage('Local Pack has current VCS records');
}

isRetrievedPackHasReferences(retrievedPackId)


This Use this method checks to check the record from the VCS Retrieved pack (sys_vcs_retrieved_pack) table if it has referenced for references to the records from the VCS Records (sys_vcs_record) table.

Parameter(s):

NameTypeMandatoryDefault
Value
value
retrievedPackId
Integer
StringYN

Return:

TypeDescription
BooleanThis method returns
'
true
'
if there are any
referenced
references to records; otherwise, it returns
'
false
'
.

Example:

Code Block
languagejs
themeEclipse
titleisRetrievedPackHasReferences
linenumberstrue
const vcsRetrievedPackId = '156144163704236641';
const vcs = new SimpleVcs();
if (vcs.isRetrievedPackHasReferences(vcsRetrievedPackId)) {
  ss.addInfoMessage('Retrieved Pack has current VCS records');
}

isRetrievedPackHasAttache(vcsRetrievedPackId)



Warning

This method has been deprecated since version 1.2 and is no longer supported. Use the hasAttachment() method instead.

loadDataFromAttachment(sysVcsRetrievedPackId)


This method loads configuration pack data from the attachment provided Use this method to load data from a configuration pack that has been added to the Retrieved Records (sys_vcs_retrieved_record) table for the preview purposesrecord as a preview attachment.

Parameter(s):

NameTypeParameterDefault Valuevalue
sysVcsRetrievedPackIdIntegerStringYN

Return:

TypeDescription
BooleanThis method returns 'true' if data loading was successful; otherwise, it returns 'false'.

Example:

Code Block
languagejs
themeEclipse
titleloadDataFromAttachment
linenumberstrue
const vcs = new SimpleVcs();
const message = new SimpleMessage();
if (!vcs.loadDataFromAttachment(current.sys_id)) {
  ss.addErrorMessage('Error loading data');
  return;
}
ss.setRedirect();

mergeLocalPacks(rowIds, name, description)


This method implements merging Use this method to merge multiple local packs into one. Initial The original local packs are permanently removed irrevocably.

Parameter(s):

NameTypeMandatoryDefault
Value
value
rowIdsArray of StringsYN
nameStringN
'
merged pack
'
descriptionStringNN

Return:

TypeDescription
StringThe method returns the ID of the
resulting
merged local pack if successful; otherwise, it returns
'
null
'
.

Example:

Code Block
languagejs
themeEclipse
titlemergeLocalPacks
linenumberstrue
const vcsLocalPackId = [
  '157666651911972694',
  '157665759017038346',
  '157665742419415102'
];
const mergedName = 'Merged Pack 1';
const mergedDesc = 'Merged Pack description 1';
const vcs = new SimpleVcs();
const mergedId = vcs.mergeLocalPacks(vcsLocalPackId, mergedName, mergedDesc);
if (mergedId != null) {
  ss.info('Merged Local Pack has Id ' + mergedId);
} else {
  ss.info('Houston we have a problem with merging Packs');
}

moveVcsRecordsToDefault(versionIds)


This method allows bulk moving of the Use this method to move many VCS records to the default local pack.

Parameter(s):

Name

Type

Mandatory

Default

Value

value

versionIdsArray of StringsYN

Return:

Type

Description

BooleanThis method returns
'
true
'
if the moving was successful; otherwise, it returns
'
false
'
.

Example:

Code Block
languagejs
themeEclipse
titlemoveVcsRecordsToDefault
linenumberstrue
const vcs = new SimpleVcs();
const result = vcs.moveVcsRecordsToDefault([current.sys_id]);
ss.info(result);

preview(sysVcsRetrievedPackId)


This Use this method extracts to extract the records related to the configuration from the Retrieved Records (sys_vcs_retrieved_record) table and performs perform a pack preview.

Parameter(s):

NameTypeMandatoryDefault
Value
value
retrievedPackId
Integer
StringYN

Return:

TypeDescription
BooleanThis method returns
'
true
'
if preview was successful; otherwise, it returns
'
false
'
.

Example:

Code Block
languagejs
themeEclipse
titlepreview
linenumberstrue
const vcs = new SimpleVcs();
const message = new SimpleMessage();
if (!vcs.preview(current.sys_id)) {
    const localizedMessage = message.getMessage('Error previewing data');
    ss.addErrorMessage(localizedMessage);
    return;
}
ss.setRedirect();

rollback(packId)


This method rollbacks Use this method to roll back a local pack. The local pack can only be rollbacked only when it is in the RollBack-Previewed Rollback previewed state.

Parameter(s):

NameTypeMandatoryDefault
Value
value
packId
Integer
StringYN

Return:

TypeDescription
String
VoidThe method
returns 'true' if the rollback was successful; otherwise, it returns an exception
does not return a value.

Example:

Code Block
languagejs
themeEclipse
titlerollback
linenumberstrue
const vcsLocalPackId = '156144163704236641';
const vcs = new SimpleVcs();
if (vcs.rollBack(vcsLocalPackId)) {
  ss.addInfoMessage('RollBack of Local Pack was successful');
}

rollBackPreview(packId)


Use this method to preview the rollback results.

Parameter(s):

NameTypeMandatoryDefault
Value
value
packId
Integer
StringYN

Return:

TypeDescription
Boolean
VoidThe method
returns 'true' if the rollback preview was successful; otherwise, it returns 'false'
does not return a value.

Example:

Code Block
languagejs
themeEclipse
titlerollBackPreview
linenumberstrue
const vcsLocalPackId = '156144163704236641';
const vcs = new SimpleVcs();
if (vcs.rollBackPreview(vcsLocalPackId)) {
  ss.addInfoMessage('RollBack preview of Local Pack was successful');
}


Table of Contents
absoluteUrltrue
classfixedPosition