Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. // *** begin for command console use only ***
  2. if (typeof targetEntity === 'undefined') {
  3. var amdQuery = ApplicationEntity.getResultSet('_IACUC Modification').query("id = #id");
  4. amdQuery.bind('id', '00000126-RN00_AM3');
  5. targetEntity = amdQuery.elements().item(1);
  6. } else {
  7. throw new Error (-1, 'targetEntity is undefined... this block should be removed');
  8. }
  9. // *** end for command console use only ***
  10.  
  11. var modifiedStudy = targetEntity.getQualifiedAttribute("customAttributes._attribute8");
  12.  
  13. var armSet = modifiedStudy.getQualifiedAttribute("customAttributes._animalArms");
  14. //var setVersionActivities;
  15. var activitySet;
  16. if (armSet) {
  17. armSet = armSet.elements();
  18. var armCount = armSet.count();
  19. var arm;
  20. var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
  21. xmlDoc.async = false;
  22. xmlDoc.setProperty("SelectionLanguage", "XPath");
  23. for (var i = 1; i <= armCount; i++) {
  24. arm = armSet.item(i);
  25. log('begin arm ' + arm.name);
  26. activitySet = arm.activities;
  27. if (activitySet) {
  28. activitySet = activitySet
  29. //.query("majorVersion is not null")
  30. .sort("activityDate", 106, true);
  31. //activitySet.elements().item(1).majorVersion = 0;
  32. //activitySet.elements().item(1).minorVersion = 1;
  33. forEachElement(activitySet.elements(), function (act) {
  34. var loggedMajor = null;
  35. var loggedMinor = null;
  36. var xml = act.getQualifiedAttribute('changeTrackingInfo.xml');
  37. if (xml) {
  38. if (!xmlDoc.loadXML(xml)) {
  39. var parseError = xmlDoc.parseError;
  40. throw new Error(-1, "Error parsing change-tracking XML: " + parseError.reason);
  41. }
  42. var majorVersionNode = xmlDoc.selectSingleNode(
  43. '/changeHistory/propertyChange[@propertyRealName="majorVersion"]/@newValue'
  44. );
  45. var minorVersionNode = xmlDoc.selectSingleNode(
  46. '/changeHistory/propertyChange[@propertyRealName="minorVersion"]/@newValue'
  47. );
  48. loggedMajor = majorVersionNode ? majorVersionNode.value : null;
  49. loggedMinor = minorVersionNode ? minorVersionNode.value : null;
  50. }
  51. log(JSON.stringify({
  52. name: act.name,
  53. dateCreated: act.dateCreated,
  54. major: act.majorVersion,
  55. minor: act.minorVersion,
  56. loggedMajor: loggedMajor,
  57. loggedMinor: loggedMinor
  58. }, null, '\t'));
  59. });
  60. }
  61. log('end arm ' + arm.name);
  62. }
  63. }
  64. function forEachElement (elems, func) {
  65. for (var i = 1, count = elems.count(); i <= count; i++) {
  66. func(elems.item(i));
  67. }
  68. }
  69. function log (msg) {
  70. if (typeof webrScriptOutput === 'undefined') {
  71. wom.log("*** IACUC Amendment - fixViewDifferences: " + msg);
  72. } else {
  73. webrScriptOutput += msg + "\n";
  74. }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement