PageRenderTime 137ms CodeModel.GetById 60ms app.highlight 7ms RepoModel.GetById 54ms 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
 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 */
17package mpv5.sandbox;
18
19import ag.ion.bion.officelayer.filter.IFilter;
20import ag.ion.bion.officelayer.filter.PDFFilter;
21import java.io.IOException;
22import java.security.NoSuchAlgorithmException;
23import java.util.ArrayList;
24import java.util.List;
25import java.util.Map;
26import java.util.Vector;
27import mpv5.db.common.Context;
28import mpv5.db.common.QueryParameter;
29import mpv5.db.objects.Product;
30
31
32/**
33 *
34 */
35public class Test {
36
37  
38
39    public static void main(String... aArgs)  {
40
41         List<QueryParameter> ps = new ArrayList<QueryParameter>();
42            for (Map.Entry<String, Class<?>> en : new Product().getKeySet()) {
43                if (en.getValue().isAssignableFrom(String.class)) {
44                   ps.add(new QueryParameter(Context.getProduct(), en.getKey(), "f", QueryParameter.LIKE));
45                } else System.out.println(en.getKey());
46            }
47
48
49    }
50
51     /**
52     * Separator vor list values val1, val2, val3..
53     */
54    public static final String LIST_SEPARATOR_CHAR = "<###>";
55
56    /**
57     *
58     * @param values
59     * @return
60     */
61    public static synchronized List<String> stringToList(String values) {
62        String[] vals = values.split(LIST_SEPARATOR_CHAR);
63        List<String> list = new Vector<String>();
64        for (int i = 0; i < vals.length; i++) {
65            String string = vals[i];
66            list.add(string);
67        }
68
69        return list;
70    }
71
72    /**
73     *
74     * @param <T>
75     * @param list
76     * @return
77     */
78    public static synchronized <T extends Object> String listToString(List<T> list) {
79        String str = new String("");
80
81        if (list != null && list.size() > 0) {
82            for (T val : list) {
83                str += val.toString() + LIST_SEPARATOR_CHAR;
84            }
85            return str.substring(0, str.length() - LIST_SEPARATOR_CHAR.length());
86        } else {
87            return str;
88        }
89    }
90
91}