PageRenderTime 149ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/src/mpv5/sandbox/Test.java

http://mp-rechnungs-und-kundenverwaltung.googlecode.com/
Java | 91 lines | 43 code | 15 blank | 33 comment | 9 complexity | 46717d96c1a3b8f039febc5cb11e1782 MD5 | raw file
Possible License(s): LGPL-3.0, Apache-2.0, GPL-3.0, GPL-2.0, AGPL-3.0, JSON, BSD-3-Clause
  1. /*
  2. * This file is part of MP.
  3. *
  4. * MP is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * MP is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with MP. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. package mpv5.sandbox;
  18. import ag.ion.bion.officelayer.filter.IFilter;
  19. import ag.ion.bion.officelayer.filter.PDFFilter;
  20. import java.io.IOException;
  21. import java.security.NoSuchAlgorithmException;
  22. import java.util.ArrayList;
  23. import java.util.List;
  24. import java.util.Map;
  25. import java.util.Vector;
  26. import mpv5.db.common.Context;
  27. import mpv5.db.common.QueryParameter;
  28. import mpv5.db.objects.Product;
  29. /**
  30. *
  31. */
  32. public class Test {
  33. public static void main(String... aArgs) {
  34. List<QueryParameter> ps = new ArrayList<QueryParameter>();
  35. for (Map.Entry<String, Class<?>> en : new Product().getKeySet()) {
  36. if (en.getValue().isAssignableFrom(String.class)) {
  37. ps.add(new QueryParameter(Context.getProduct(), en.getKey(), "f", QueryParameter.LIKE));
  38. } else System.out.println(en.getKey());
  39. }
  40. }
  41. /**
  42. * Separator vor list values val1, val2, val3..
  43. */
  44. public static final String LIST_SEPARATOR_CHAR = "<###>";
  45. /**
  46. *
  47. * @param values
  48. * @return
  49. */
  50. public static synchronized List<String> stringToList(String values) {
  51. String[] vals = values.split(LIST_SEPARATOR_CHAR);
  52. List<String> list = new Vector<String>();
  53. for (int i = 0; i < vals.length; i++) {
  54. String string = vals[i];
  55. list.add(string);
  56. }
  57. return list;
  58. }
  59. /**
  60. *
  61. * @param <T>
  62. * @param list
  63. * @return
  64. */
  65. public static synchronized <T extends Object> String listToString(List<T> list) {
  66. String str = new String("");
  67. if (list != null && list.size() > 0) {
  68. for (T val : list) {
  69. str += val.toString() + LIST_SEPARATOR_CHAR;
  70. }
  71. return str.substring(0, str.length() - LIST_SEPARATOR_CHAR.length());
  72. } else {
  73. return str;
  74. }
  75. }
  76. }