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 |
---|
language | js |
---|
theme | Eclipse |
---|
title | SimpleVcs |
---|
linenumbers | true |
---|
|
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):
Return:
Type | Description |
---|
Integer | The method returns the number of versions created after the script has been executed. |
Example:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | createTableSnapshot |
---|
linenumbers | true |
---|
|
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):
Return:
A .The method returns SOP file for downloading. |
Example:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | exportLocalPackVcsRecords |
---|
linenumbers | true |
---|
|
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):
Return:
String | A string containing the import resultsBoolean | The method returns true if the records are imported; otherwise, it returns false. |
Example:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | importRetrievedPack |
---|
linenumbers | true |
---|
|
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):
Return:
Type | Description |
---|
Boolean | The method returns |
'' if it finds the records; otherwise, it returns |
''Example:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | isLocalPackHasReferences |
---|
linenumbers | true |
---|
|
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):
Return:
Type | Description |
---|
Boolean | This method returns |
'' referenced references to records; otherwise, it returns |
''Example:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | isRetrievedPackHasReferences |
---|
linenumbers | true |
---|
|
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):
Name | Type | Parameter | Default Valuevalue |
---|
sysVcsRetrievedPackId | IntegerString | Y | N |
Return:
Type | Description |
---|
Boolean | This method returns 'true' if data loading was successful; otherwise, it returns 'false'. |
Example:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | loadDataFromAttachment |
---|
linenumbers | true |
---|
|
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):
Valuevalue |
---|
rowIds | Array of Strings | Y | N |
name | String | N |
'' Return:
Type | Description |
---|
String | The method returns the ID of the |
resulting merged local pack if successful; otherwise, it returns |
''Example:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | mergeLocalPacks |
---|
linenumbers | true |
---|
|
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):
Valuevalue |
---|
versionIds | Array of Strings | Y | N |
Return:
Type | Description |
---|
Boolean | This method returns |
'' if the moving was successful; otherwise, it returns |
''Example:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | moveVcsRecordsToDefault |
---|
linenumbers | true |
---|
|
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):
Return:
Type | Description |
---|
Boolean | This method returns |
'' if preview was successful; otherwise, it returns |
''Example:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | preview |
---|
linenumbers | true |
---|
|
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):
Return:
String returns 'true' if the rollback was successful; otherwise, it returns an exception Example:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | rollback |
---|
linenumbers | true |
---|
|
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):
Return:
Boolean returns 'true' if the rollback preview was successful; otherwise, it returns 'false' Example:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | rollBackPreview |
---|
linenumbers | true |
---|
|
const vcsLocalPackId = '156144163704236641';
const vcs = new SimpleVcs();
if (vcs.rollBackPreview(vcsLocalPackId)) {
ss.addInfoMessage('RollBack preview of Local Pack was successful');
} |