title: Splitting the string , mapping and building the sql in java
body: <p>I have some task to do and can't figure out how to reach the result.</p>
  <p>For example i have some STRING like this :</p>
  <pre><code>key1=value1&amp;key2=value2|key3=value3
  </code></pre>
  <p>This string like key=value with options AND or OR.</p>
  <p>I have also some map that contains following things:</p>
  <pre><code>key1=ke1Mapped; key2=key2Mapped; key3=key3Mapped;
  </code></pre>
  <p>I want to build some sql <code>Select * from table1 where</code>
  And insert mapped keys and its values, but also to take into account &amp; and | , i.e. AND or OR to use in sql query when it's needed.</p>
  <p>Actually, finally sql query should be:</p>
  <pre><code>Select * from table where ke1Mapped=value1 AND key2Mapped=value2 OR key3Mapped=value3
  </code></pre>
  <p>I tried to split the main string and convert to MAP and then to loop over the list of mapped values and build dynamically sql. But i don't know what is AND or OR.</p>
  <p>Tried to push it in two stacks , also were complicated.</p>
  <p>I try now to understand how to build only architecture of this flow. And can't figure out what approach is needed here.
  Anyone can suggest something?
  Thanks</p>