Add uriByProperties() with String as second parameter

Add overloaded function uriByProperties() which allows to pass
properties for search in format
   prop1=val1&prop2=val2&prop3=val3

Example:
  // return prop1=val1;prop2;val2
  def properties = tools.getBinaryBuildProperties().replaceAll(";", "&")
  // Search for an artifact with required properties
  def artifactURI = tools.uriByProperties(env.ARTIFACTORY_URL, properties)

Change-Id: I112e85309d92a37963b9bb35aa07f0c8cb897b2f
diff --git a/src/ci/mcp/Tools.groovy b/src/ci/mcp/Tools.groovy
index 46e8ffb..6f4d788 100644
--- a/src/ci/mcp/Tools.groovy
+++ b/src/ci/mcp/Tools.groovy
@@ -140,6 +140,29 @@
 }
 
 /**
+* Get URL to artifact by properties
+* Returns String with URL to found artifact or null if nothing
+*
+* @param artifactoryURL String, an URL to Artifactory
+* @param properties String, URI in format prop1=val1&prop2=val2&prop3val3
+*        which should determine artifact in Artifactory
+*/
+def uriByProperties(String artifactoryURL, String properties) {
+
+  def search_url = "${artifactoryURL}/api/search/prop?${properties}"
+
+  def result = sh(script: "bash -c \"curl -X GET \'${search_url}\'\"",
+          returnStdout: true).trim()
+  def content = new groovy.json.JsonSlurperClassic().parseText(result)
+  def uri = content.get("results")
+  if ( uri ) {
+      return uri.last().get("uri")
+  } else {
+      return null
+  }
+}
+
+/**
 * Set properties for artifact in Artifactory repo
 *
 * @param artifactUrl String, an URL to artifact in Artifactory repo