/*
Clones the message object taking all relevant properties, converts the annotations for
numeric severity and longtext to the corresponding properties and adds it to one of the
arrays to be reported later.
@param {object} oMessage The message
489932
function addMessage(oMessage) {
			var oReportMessage = {
					code : oMessage.code,
					message : oMessage.message,
					technical : oMessage.technical
				};

			Object.keys(oMessage).forEach(function (sProperty) {
				if (sProperty[0] === '@') {
					if (sProperty.endsWith(".numericSeverity")) {
						oReportMessage.numericSeverity = oMessage[sProperty];
					} else if (sProperty.endsWith(".longtextUrl") && oError.requestUrl
							&& sResourcePath) {
						oReportMessage.longtextUrl =
							_Helper.makeAbsolute(oMessage[sProperty], oError.requestUrl);
					}
				}
			});

			if (typeof oMessage.target !== "string") {
				aUnboundMessages.push(oReportMessage);
			} else if (oMessage.target[0] === "$" || !sResourcePath) {
				// target for the bound message cannot be resolved -> report as unbound message
				oReportMessage.message = oMessage.target + ": " + oReportMessage.message;
				aUnboundMessages.push(oReportMessage);
			} else {
				oReportMessage.target = oMessage.target;
				oReportMessage.transition = true;
				aBoundMessages.push(oReportMessage);
			}
		}
934223
function(localeCode, data) {
        var localeMessages = messages[localeCode];
        var originData, newData;

        if (!localeMessages && !data) {
            throw new Error('You should set messages to map the locale code.');
        }

        newData = flattenMessageMap(data);

        if (localeMessages) {
            originData = flattenMessageMap(localeMessages);
            messageMap = _.extend(originData, newData);
        } else {
            messageMap = newData;
        }
    }
1130732
function() {
      var clonedTestElement = testElement.cloneNode(false),
          returnValue,
          innerHTML;

      clonedTestElement.innerHTML = "<p><div></div>";
      innerHTML                   = clonedTestElement.innerHTML.toLowerCase();
      returnValue                 = innerHTML === "<p></p><div></div>" || innerHTML === "<p><div></div></p>";

      // Cache result by overwriting current function
      this.autoClosesUnclosedTags = function() { return returnValue; };

      return returnValue;
    }
632356
void lazyCopy(JSMessageData original) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            JmfTr.entry(this, tc, "lazyCopy", new Object[] { original });

        synchronized (getMessageLockArtefact()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                JmfTr.debug(this, tc, "lazyCopy locked dest ", new Object[] { getMessageLockArtefact() });

            // This is the only occasion that we reach out and lock another message instance
            // but we work on the assumption that lazy copying is happening as part of
            // instantiation of a new message instance, so the potential for deadlocking
            // is nil, since no other thread knows about this instance and can not therefore
            // be concurrently supplying 'this' as the 'original' argument in another thread.
            synchronized (original.getMessageLockArtefact()) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    JmfTr.debug(this, tc, "lazyCopy locked source ", new Object[] { original.getMessageLockArtefact() });

                // Copy common fields
                indirect = original.indirect;

                // If the message is assembled (i.e. we have a contents buffer) we share both the
                // buffer and the cache between original and copy.
                // If the message is unassembled (no contents buffer) we just share the cache.
                // In either case if a change later needs to be made to the shared portion we
                // will need to copy it before changing, so the shared flags is set to
                // indicate sharing exists between unrelated parts.
                if (original.contents == null) {
                    contents = null;
                    original.sharedCache = true;
                    sharedCache = true;
                    cache = original.cache;
                }
                else {
                    original.sharedContents = true;
                    sharedContents = true;
                    contents = original.contents;
                    original.sharedCache = true;
                    sharedCache = true;
                    cache = original.cache;
                }

                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    JmfTr.debug(this, tc, "lazyCopy unlocking source ", new Object[] { original.getMessageLockArtefact() });
            }

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                JmfTr.debug(this, tc, "lazyCopy unlocking dest ", new Object[] { getMessageLockArtefact() });
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            JmfTr.exit(this, tc, "lazyCopy");
    }
121585
private static void addDigest(MessageDigest digest, Annotation []annList)
  {
    if (annList == null)
      return;

    for (Annotation ann : annList)
      addDigest(digest, ann);
  }
  
  /**
   * 
   */
  private static void addDigest(MessageDigest digest, Annotation ann)
  {
    addDigest(digest, ann.annotationType().getName());
  }
  
  /**
   * Adds the int to the digest.
   */
  private static void addDigest(MessageDigest digest, int v)
  {
    digest.update((byte) (v >> 24));
    digest.update((byte) (v >> 16));
    digest.update((byte) (v >> 8));
    digest.update((byte) v);
  }
  
  /**
   * Adds the string to the digest using a UTF8 encoding.
   */
  private static void addDigest(MessageDigest digest, String string)
  {
    if (string == null)
      return;
    
    int len = string.length();
    for (int i = 0; i < len; i++) {
      int ch = string.charAt(i);
      if (ch < 0x80)
        digest.update((byte) ch);
      else if (ch < 0x800) {
        digest.update((byte) (0xc0 + (ch >> 6)));
        digest.update((byte) (0x80 + (ch & 0x3f)));
      }
      else {
        digest.update((byte) (0xe0 + (ch >> 12)));
        digest.update((byte) (0x80 + ((ch >> 6) & 0x3f)));
        digest.update((byte) (0x80 + (ch & 0x3f)));
      }
    }
  }
  
  private String digestToBase64(byte []digest, int len)
  {
    StringBuilder cb = new StringBuilder();

    Base64Util.encode(cb, digest, 0, len);

    return cb.toString();
  }

  public boolean isEqual(Object o)
  {
    if (o == this)
      return true;
    
    if (! (o instanceof JClassDependency))
      return false;

    JClassDependency depend = (JClassDependency) o;

    return _className.equals(depend._className);
  }

  static class FieldComparator implements Comparator<Field> {
    public int compare(Field a, Field b)
    {
      if (a == b)
        return 0;
      else if (a == null)
        return -1;
      else if (b == null)
        return 1;
      else if (a.equals(b))
        return 0;

      int cmp = a.getName().compareTo(b.getName());
      if (cmp != 0)
        return cmp;
      
      cmp = a.getDeclaringClass().getName().compareTo(b.getDeclaringClass().getName());
      if (cmp != 0)
        return cmp;
      
      return a.getType().getName().compareTo(b.getType().getName());
    }
  }

  static class MethodComparator implements Comparator<Method> {
    public int compare(Method a, Method b)
    {
      if (a == b)
        return 0;
      else if (a == null)
        return -1;
      else if (b == null)
        return 1;
      else if (a.equals(b))
        return 0;

      int cmp = a.getName().compareTo(b.getName());
      if (cmp != 0)
        return cmp;

      Class []paramA = a.getParameterTypes();
      Class []paramB = b.getParameterTypes();

      if (paramA.length < paramB.length)
        return -1;
      else if (paramB.length < paramA.length)
        return 1;

      for (int i = 0; i < paramA.length; i++) {
        cmp = paramA[i].getName().compareTo(paramB[i].getName());
        if (cmp != 0)
          return cmp;
      }
      
      cmp = a.getDeclaringClass().getName().compareTo(b.getDeclaringClass().getName());
      if (cmp != 0)
        return cmp;
      
      return a.getReturnType().getName().compareTo(b.getReturnType().getName());
    }
  }
}
258012
function omit(obj, remove) {
  var result = {};
  if (typeof remove === 'string') {
    remove = [].slice.call(arguments, 1);
  }
  for (var prop in obj) {
    if (!obj.hasOwnProperty || obj.hasOwnProperty(prop)) {
      if (remove.indexOf(prop) === -1) {
        result[prop] = obj[prop];
      }
    }
  }
  return result;
}
66018
public FessMessages addErrorsDesignJspFileDoesNotExist(String property) {
        assertPropertyNotNull(property);
        add(property, new UserMessage(ERRORS_design_jsp_file_does_not_exist));
        return this;
    }
123603
function getErrorMessage(errors) {
    var fullMessage = '';
    errors.forEach(function (err) {
        var message = ajv.errorsText([err]);
        if (message.indexOf('should NOT have additional properties') < 0) {
            fullMessage += message + os.EOL;
        }
        else {
            fullMessage += message + '. Offending property : ' + err.params.additionalProperty + os.EOL;
        }
    });
    return fullMessage;
}
584730
@Override
  public NlsMessage create(NlsTemplate template, String key1, Object argument1, String key2, Object argument2, String key3, Object argument3, String key4,
      Object argument4) {

    // CHECKSTYLE:ON

    Map<String, Object> arguments = new HashMap<>();
    arguments.put(key1, argument1);
    arguments.put(key2, argument2);
    arguments.put(key3, argument3);
    arguments.put(key4, argument4);
    return create(template, arguments);
  }
556061
public void addExtendedTraceDetail(SIBusMessage message)
  {
    if (message == null)
    {
      validateAndPutProperty("MessageTTL", "");
      validateAndPutProperty("RemainingTTL", "");
      validateAndPutProperty("FRP", "");
      validateAndPutProperty("RRP", "");
      validateAndPutProperty("ReplyDiscriminator", "");
      validateAndPutProperty("ReplyPriority", "");
      validateAndPutProperty("ReplyReliability", "");
      validateAndPutProperty("ReplyTTL", "");
    }
    else
    {
      validateAndPutProperty("MessageTTL", message.getTimeToLive());
      validateAndPutProperty("RemainingTTL", new Long(message.getRemainingTimeToLive()));
      validateAndPutProperty("FRP", message.getForwardRoutingPath());
      validateAndPutProperty("RRP", message.getReverseRoutingPath());
      validateAndPutProperty("ReplyDiscriminator", message.getReplyDiscriminator());
      validateAndPutProperty("ReplyPriority", message.getReplyPriority());
      validateAndPutProperty("ReplyReliability", message.getReplyReliability());
      validateAndPutProperty("ReplyTTL", message.getReplyTimeToLive());
    }
  }
788533
@Override
    void copyTransients(JsMessageImpl copy) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "copyTransients");
        super.copyTransients(copy);

        JsJmsObjectMessageImpl other = (JsJmsObjectMessageImpl) copy;
        // Copy the real object reference, soft reference & booleans across
        other.realObject = realObject;
        other.hasRealObject = hasRealObject;
        other.hasSerializedRealObject = hasSerializedRealObject;
        other.softRefToRealObject = softRefToRealObject;

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "copyTransients");
    }
678920
function (sName, oItem) {
					if (oItem._oMessagePopoverItem.getId() === this.getId() && oItem.getMetadata().getProperty(sName)) {
						oItem.setProperty(sName, oValue);
					}
				}
1194165
function processExcelNode(node, msg) {
        node.log('ProcessExcelNode');
        // FIXME:Cleanup
        // console.log('Before Context Processing');
        // console.log(msg);
        let msgParams = processValuesFromContext(node, msg, [
            {name: 'location', type: 'locationType'},
            {name: 'sheet', type: 'sheetType'},
            {name: 'rows', type: 'rowsType'},
            {name: 'cols', type: 'colsType'},
            {name: 'region', type: 'regionType'},
            {name: 'store', type: 'storeType'},
            {name: 'name'}, {name: 'mode'}, {name: 'asis'},
            {name: 'asjson'}, {name: 'useLabel'},
            {name: 'removeEmpty'}, {name: 'actionType'},
            {name: 'contents', type: 'contentsType'},
        ]);

        // FIXME:Cleanup
        // console.log('After Context Processing');
        // console.log(msg);
        // console.log(msgParams);

        try {
            const createWorkbook = (node.actionType == 'write');
            let workbook = openOrCreateWorkbook(node, msgParams, createWorkbook);

            if (check.not.assigned(workbook)) {
                sendError(node, msg, 'Could not open Workbook: %s', msgParams.location);
                return;
            }// Check for workbook

            if (check.assigned(msgParams.sheet) || msgParams.mode === 'metadata') {
                if (msgParams.mode === 'metadata') {
                    msg.payload = workbook;
                    node.send(msg);
                    return;
                } else if (check.undefined(workbook.Sheets[msgParams.sheet])) {
                    node.log(workbook.SheetNames[0]);
                    node.log(JSON.stringify(workbook.Sheets));
                    sendError(node, msg, 'Missing Sheet [%s] in Workbook: %s', msgParams.sheet, msgParams.location);
                    return;
                } else {
                    // Sheet available for reading

                    let opts = {
                        asis: msgParams.asis === 'true',
                        useLabel: msgParams.useLabel === 'true',
                        removeEmpty: msgParams.removeEmpty === 'true',
                    };


                    let requiredSheet = workbook.Sheets[msgParams.sheet];
                    if (check.undefined(requiredSheet)) {
                        sendError(node, msg, 'Could not open sheet: %s', msgParams.sheet);
                        return;
                    }

                    let contents;
                    try {
                        msgParams.contents = check.string(msgParams.contents) ? JSON.parse(msgParams.contents) : msgParams.contents;
                    } catch (ex) {
                        sendError(node, msg, 'Content [%s] is invalid JSON', msgParams.contents);
                        return;
                    }

                    if (check.assigned(msgParams.mode)) {
                        if (msgParams.mode === 'rows') {
                            if (!(check.assigned(msgParams.rows))) {
                                sendError(node, msg, 'Required parameter rows [%s] is invalid', msgParams.rows);
                                return;
                            }
                            if (msgParams.actionType == 'write') {
                                contents = writeRows(requiredSheet, msgParams.rows, msgParams.contents, opts);
                            } else if (msgParams.actionType == 'read') {
                                contents = readRows(requiredSheet, msgParams.rows, opts);
                            }
                        } else if (msgParams.mode === 'cols') {
                            if (!(check.assigned(msgParams.cols))) {
                                sendError(node, msg, 'Required parameter cols [%s] is invalid', msgParams.cols);
                                return;
                            }
                            if (msgParams.actionType == 'write') {
                                contents = writeCols(requiredSheet, msgParams.cols, msgParams.contents, opts);
                            } else if (msgParams.actionType == 'read') {
                                contents = readCols(requiredSheet, msgParams.cols, opts);
                            }
                        } else if (msgParams.mode === 'region') {
                            if (!(check.assigned(msgParams.region))) {
                                sendError(node, msg, 'Required parameter region [%s] is invalid', msgParams.region);
                                return;
                            }
                            if (msgParams.actionType == 'write') {
                                contents = writeRegion(requiredSheet, msgParams.region, msgParams.contents, opts);
                            } else if (msgParams.actionType == 'read') {
                                contents = readRegion(requiredSheet, msgParams.region, opts);
                            }
                        } else {
                            if (msgParams.actionType == 'write') {
                                contents = xlsx.utils.aoa_to_sheet(msgParams.contents);
                            } else {
                                contents = requiredSheet;
                            }
                        }
                        if (msgParams.actionType == 'write') {
                            workbook.Sheets[msgParams.sheet] = contents;

                            try {
                                // FIXME: portability - bookSST might be needed for OSX
                                xlsx.writeFile(workbook, msgParams.location, {bookSST: false, bookType: 'xlsx'});
                            } catch (ex) {
                                sendError(node, msg, 'Could not write workbook %s', msgParams.location);
                                return;
                            }
                        } else {
                            if (node.storeType === 'msg') {
                                RED.util.setMessageProperty(msg, node.store, contents);
                            } else if (node.storeType === 'flow') {
                                node.context().flow.set(node.store, contents);
                            } else if (node.storeType === 'global') {
                                node.context().global.set(node.store, contents);
                            }

                            msg.payload = contents;
                        }

                        node.send(msg);
                        return;
                    } else {
                        msg.payload = requiredSheet;
                        node.send(msg);
                        return;
                    }
                }
            } else {
                // FIXME: Refactor-Or-Remove
            }
        } catch (error) {
            // let errMissingRegion = util.format('Required parameter region [%s] is invalid', msg.region);
            node.log('Error in ProcessExcelNode');
            node.log(JSON.stringify(error));
            sendError(node, msg, error);
            return;
        }
    }
338552
function (sString, sConfirmTextPrefix) {
			var $temp = jQuery("<textarea>");

			try {
				jQuery("body").append($temp);
				$temp.val(sString).select();
				document.execCommand("copy");
				$temp.remove();
				MessageToast.show(this._getText(sConfirmTextPrefix + ".Success"));
			} catch (oException) {
				MessageToast.show(this._getText(sConfirmTextPrefix + ".Error"));
			}
		}
734359
function(message){
			document.getElementById('messageLabel').classList.remove("errorMessage"); //$NON-NLS-0$//$NON-NLS-1$
			document.getElementById('messageContainer').classList.remove("errorMessage"); //$NON-NLS-0$ //$NON-NLS-1$
			lib.empty(document.getElementById('messageText')); //$NON-NLS-0$
			
			document.getElementById('messageText').style.width = "100%"; //$NON-NLS-0$ //$NON-NLS-1$
			document.getElementById('messageText').appendChild(WizardUtils.defaultParseMessage(message)); //$NON-NLS-0$
			
			document.getElementById('messageButton').className = ""; //$NON-NLS-0$
			document.getElementById('messageContainer').classList.add("showing"); //$NON-NLS-0$ //$NON-NLS-1$
		}
1345011
function (oAnnotations, oData, oMetaModel) {
			var aSchemas = oData.dataServices.schema;

			if (!aSchemas) {
				return;
			}
			aSchemas.forEach(function (oSchema, i) {
				var sSchemaVersion;

				// remove datajs artefact for inline annotations in $metadata
				delete oSchema.annotations;

				Utils.liftSAPData(oSchema);
				oSchema.$path = "/dataServices/schema/" + i;
				sSchemaVersion = oSchema["sap:schema-version"];
				if (sSchemaVersion) {
					oSchema["Org.Odata.Core.V1.SchemaVersion"] = {
						String : sSchemaVersion
					};
				}
				jQuery.extend(oSchema, oAnnotations[oSchema.namespace]);

				Utils.visitParents(oSchema, oAnnotations, "association",
					function (oAssociation, mChildAnnotations) {
						Utils.visitChildren(oAssociation.end, mChildAnnotations);
					});

				Utils.visitParents(oSchema, oAnnotations, "complexType",
					function (oComplexType, mChildAnnotations) {
						Utils.visitChildren(oComplexType.property, mChildAnnotations, "Property");
						Utils.addSapSemantics(oComplexType);
					});

				// visit all entity types before visiting the entity sets to ensure that V2
				// annotations are already lifted up and can be used for calculating entity
				// set annotations which are based on V2 annotations on entity properties
				Utils.visitParents(oSchema, oAnnotations, "entityType", Utils.visitEntityType);

				Utils.visitParents(oSchema, oAnnotations, "entityContainer",
					function (oEntityContainer, mChildAnnotations) {
						Utils.visitChildren(oEntityContainer.associationSet, mChildAnnotations);
						Utils.visitChildren(oEntityContainer.entitySet, mChildAnnotations,
							"EntitySet", aSchemas);
						Utils.visitChildren(oEntityContainer.functionImport, mChildAnnotations,
							"", null, Utils.visitParameters.bind(this,
								oAnnotations, oSchema, oEntityContainer));
					});
			});
			Utils.addUnitAnnotations(aSchemas, oMetaModel);
		}
629353
void copyTransients(JsMessageImpl copy) {
    super.copyTransients(copy);
    copy.setApproximateLength(approxLength);
    copy.setFluffedSize(fluffedSize);
    return;
  }