Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // *** begin for command console use only ***
- if (typeof targetEntity === 'undefined') {
- var amdQuery = ApplicationEntity.getResultSet('_IACUC Modification').query("id = #id");
- amdQuery.bind('id', '00000126-RN00_AM3');
- targetEntity = amdQuery.elements().item(1);
- } else {
- throw new Error (-1, 'targetEntity is undefined... this block should be removed');
- }
- // *** end for command console use only ***
- var modifiedStudy = targetEntity.getQualifiedAttribute("customAttributes._attribute8");
- var armSet = modifiedStudy.getQualifiedAttribute("customAttributes._animalArms");
- //var setVersionActivities;
- var activitySet;
- if (armSet) {
- armSet = armSet.elements();
- var armCount = armSet.count();
- var arm;
- var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
- xmlDoc.async = false;
- xmlDoc.setProperty("SelectionLanguage", "XPath");
- for (var i = 1; i <= armCount; i++) {
- arm = armSet.item(i);
- log('begin arm ' + arm.name);
- activitySet = arm.activities;
- if (activitySet) {
- activitySet = activitySet
- //.query("majorVersion is not null")
- .sort("activityDate", 106, true);
- //activitySet.elements().item(1).majorVersion = 0;
- //activitySet.elements().item(1).minorVersion = 1;
- forEachElement(activitySet.elements(), function (act) {
- var loggedMajor = null;
- var loggedMinor = null;
- var xml = act.getQualifiedAttribute('changeTrackingInfo.xml');
- if (xml) {
- if (!xmlDoc.loadXML(xml)) {
- var parseError = xmlDoc.parseError;
- throw new Error(-1, "Error parsing change-tracking XML: " + parseError.reason);
- }
- var majorVersionNode = xmlDoc.selectSingleNode(
- '/changeHistory/propertyChange[@propertyRealName="majorVersion"]/@newValue'
- );
- var minorVersionNode = xmlDoc.selectSingleNode(
- '/changeHistory/propertyChange[@propertyRealName="minorVersion"]/@newValue'
- );
- loggedMajor = majorVersionNode ? majorVersionNode.value : null;
- loggedMinor = minorVersionNode ? minorVersionNode.value : null;
- }
- log(JSON.stringify({
- name: act.name,
- dateCreated: act.dateCreated,
- major: act.majorVersion,
- minor: act.minorVersion,
- loggedMajor: loggedMajor,
- loggedMinor: loggedMinor
- }, null, '\t'));
- });
- }
- log('end arm ' + arm.name);
- }
- }
- function forEachElement (elems, func) {
- for (var i = 1, count = elems.count(); i <= count; i++) {
- func(elems.item(i));
- }
- }
- function log (msg) {
- if (typeof webrScriptOutput === 'undefined') {
- wom.log("*** IACUC Amendment - fixViewDifferences: " + msg);
- } else {
- webrScriptOutput += msg + "\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement