You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

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

SimpleVcs()


This method instantiates a new empty SimpleVcs class object.

Example:

SimpleVcs
const vcs = new SimpleVcs();

createTableSnapshot(tableName)


This method creates initial versions of all the records of the specified table.

Parameter(s):

NameTypeMandatoryDefault value
tableNameStringYN


Return:

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


Example:

createTableSnapshot
const tableName = 'sys_script';
const vcs = new SimpleVcs();
const versionCount = vcs.createTableSnapshot(tableName);
ss.info(versionCount); // 1

exportLocalPackVcsRecords(sysVcsLocalPackId)


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


Parameter(s):

NameTypeMandatoryDefault value
sysVcsLocalPackIdIntegerYN


Return:

TypeDescription
ObjectA .SOP file for downloading.


Example:

exportLocalPackVcsRecords
const vcsLocalPackId = '156144163704236641';
const vcs = new SimpleVcs();
vcs.exportLocalPackVcsRecords(vcsRetrievedPackId);

importRetrievedPack(retrievedPackId)


This method imports the last containing in the VCS preview log (sys_vcs_preview_log) table previewed retrieved pack to the VCS Record (sys_vcs_record) table.


Parameter(s):

NameTypeMandatoryDefault value
retrievedPackIdIntegerYN


Return:

TypeDescription
StringA string containing the import results.


Example:

importRetrievedPack
const vcsRetrievedPackId = '156144163704236641';
const vcs = new SimpleVcs();
const result = vcs.importRetrievedPack(vcsRetrievedPackId);
ss.addInfoMessage(result);

isLocalPackHasReferences(localPackId)


This method checks the record from the sys_vcs_local_pack table if it has referenced current* records from the VCS records (sys_vcs_record) table.

*the current records have the is_current attribute equal to true.


Parameter(s):

NameTypeMandatoryDefault value
localPackIdIntegerYN


Return:

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


Example:

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

isRetrievedPackHasReferences(retrievedPackId)


This method checks the record from the VCS Retrieved pack (sys_vcs_retrieved_pack) table if it has referenced records from the VCS Records (sys_vcs_record) table.


Parameter(s):

NameTypeMandatoryDefault value
retrievedPackIdIntegerYN


Return:

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


Example:

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

isRetrievedPackHasAttache(vcsRetrievedPackId)



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 to the Retrieved Records (sys_vcs_retrieved_record) table for the preview purposes.

Parameter(s):

NameTypeParameterDefault value
sysVcsRetrievedPackIdIntegerYN

Return:

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

Example:

loadDataFromAttachment
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 multiple local packs into one. Initial local packs are removed irrevocably.

Parameter(s):

NameTypeMandatoryDefault value
rowIdsArrayYN
nameStringN'merged pack'
descriptionStringNN

Return:

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

Example:

mergeLocalPacks
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 VCS records to the default local pack.

Parameter(s):

Name

Type

Mandatory

Default value

versionIdsArrayYN

Return:

Type

Description

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

Example:

moveVcsRecordsToDefault
const vcs = new SimpleVcs();
const result = vcs.moveVcsRecordsToDefault([current.sys_id]);
ss.info(result);

preview(sysVcsRetrievedPackId)


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

Parameter(s):

NameTypeMandatoryDefault value
retrievedPackIdIntegerYN

Return:

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

Example:

preview
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 a local pack. The local pack can be rollbacked only when it in the RollBack-Previewed state.

Parameter(s):

NameTypeMandatoryDefault value
packIdIntegerYN

Return:

TypeDescription
StringThe method returns true if the rollback was successful; otherwise, it returns an exception.

Example:

rollback
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
packIdIntegerYN

Return:

TypeDescription
BooleanThe method returns true if the rollback preview was successful; otherwise, it returns false.

Example:

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

  • No labels