Compare commits
1074 Commits
release/5.
...
release/5.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aec9ebb198 | ||
|
|
47723aa25d | ||
|
|
a5b7d15181 | ||
|
|
d81aa7b53a | ||
|
|
3fbe0c6115 | ||
|
|
92bdbc8bae | ||
|
|
fea02836db | ||
|
|
21abd7a0d5 | ||
|
|
19a2b0cdc6 | ||
|
|
eb8c3283b1 | ||
|
|
46ecf8ddd2 | ||
|
|
a75b149e0e | ||
|
|
ef1802eb01 | ||
|
|
9981367d33 | ||
|
|
6b376666df | ||
|
|
150d71d635 | ||
|
|
cd611f48b2 | ||
|
|
32568fface | ||
|
|
00b998f8e8 | ||
|
|
15bb3e9d9d | ||
|
|
a453a05d85 | ||
|
|
6dbe1a51e5 | ||
|
|
40499ac4dc | ||
|
|
96fd75bea7 | ||
|
|
35bc1b0259 | ||
|
|
59a67ffc31 | ||
|
|
f0b7bca93f | ||
|
|
22b0610477 | ||
|
|
d2893bd870 | ||
|
|
9676d9da04 | ||
|
|
69745e8e72 | ||
|
|
fd2963778c | ||
|
|
63fa9e505e | ||
|
|
a853e0dc11 | ||
|
|
5be0d0fbec | ||
|
|
a76412a3db | ||
|
|
5a62ea448e | ||
|
|
be5c0cfecd | ||
|
|
e3c1a2f802 | ||
|
|
dd97ab49d7 | ||
|
|
5500604d2e | ||
|
|
400294def4 | ||
|
|
f0f9ba38e6 | ||
|
|
eec72ec9ca | ||
|
|
b63d18484a | ||
|
|
e2968d2b7e | ||
|
|
eae351da33 | ||
|
|
d666d1f2c3 | ||
|
|
f4ade04b08 | ||
|
|
d450bf1d97 | ||
|
|
75f7e6c0ad | ||
|
|
faaec3e65f | ||
|
|
216d19b48b | ||
|
|
c1e820922f | ||
|
|
d4f8286818 | ||
|
|
93b15ecf15 | ||
|
|
caf43e3801 | ||
|
|
27f7f40ab1 | ||
|
|
419c64b14b | ||
|
|
9ccf8b6493 | ||
|
|
ef28f73882 | ||
|
|
c20091bd4a | ||
|
|
6de7d7e9c2 | ||
|
|
c3b1e053a6 | ||
|
|
ed068cd126 | ||
|
|
149630ba41 | ||
|
|
8aa5dbd16b | ||
|
|
4110050560 | ||
|
|
84d85418d6 | ||
|
|
06709d277d | ||
|
|
5b8fcd0e45 | ||
|
|
4b822ea7c2 | ||
|
|
dfe89e4e95 | ||
|
|
6b3047e2a0 | ||
|
|
3926f4f146 | ||
|
|
18cd1cfab0 | ||
|
|
3a73e4e2f9 | ||
|
|
ebb738ee0a | ||
|
|
5ca96fd27f | ||
|
|
1520b4f121 | ||
|
|
fe7f2bdc29 | ||
|
|
2e88c8285e | ||
|
|
068cf8e7e6 | ||
|
|
416ee00cc9 | ||
|
|
1593679275 | ||
|
|
0f0be526df | ||
|
|
1b8340da17 | ||
|
|
254a52d59f | ||
|
|
a7eccf1e1f | ||
|
|
3f3e44374a | ||
|
|
b9096f5fe0 | ||
|
|
a45070b0c3 | ||
|
|
1b02e17613 | ||
|
|
6b726b50d2 | ||
|
|
f4ac0d4857 | ||
|
|
745831e0e7 | ||
|
|
fc7393661e | ||
|
|
2bd7511afb | ||
|
|
0409932d3c | ||
|
|
29db0cd433 | ||
|
|
086156c891 | ||
|
|
d9f6016c6d | ||
|
|
935b8db6c1 | ||
|
|
73a7dbfb1f | ||
|
|
32496fa721 | ||
|
|
20cee8bcfa | ||
|
|
04f23d2bc7 | ||
|
|
09148f5699 | ||
|
|
dc2ca051cc | ||
|
|
406eb1fc84 | ||
|
|
2a024b8c08 | ||
|
|
926628b41f | ||
|
|
0e62d4efae | ||
|
|
6624c1b43b | ||
|
|
614bb9a29b | ||
|
|
61dcc0f926 | ||
|
|
56bc84c818 | ||
|
|
049e11d6b3 | ||
|
|
bcf02a2dcb | ||
|
|
756f1cdc00 | ||
|
|
7b86fe22f8 | ||
|
|
c0192c70ad | ||
|
|
204f1e3f10 | ||
|
|
bdaa5a8a9a | ||
|
|
2f87fd8bde | ||
|
|
ca223cf400 | ||
|
|
e7d7cdfd82 | ||
|
|
80a8d0236f | ||
|
|
d4847d7cc4 | ||
|
|
1d99f4026b | ||
|
|
af074bd1b8 | ||
|
|
c410f6a1ac | ||
|
|
f2e65773e1 | ||
|
|
bb558620ce | ||
|
|
d74c2fd614 | ||
|
|
b7029e3a49 | ||
|
|
7709e796bc | ||
|
|
c9332f24c7 | ||
|
|
408e65b479 | ||
|
|
870d7a703e | ||
|
|
1027c61038 | ||
|
|
c7139da44d | ||
|
|
6e37d555b4 | ||
|
|
03db0cc44a | ||
|
|
b90feb1852 | ||
|
|
4e457b3a2e | ||
|
|
cc3290cf24 | ||
|
|
ca7d5bf7f6 | ||
|
|
62f56ec52f | ||
|
|
13e9758ac4 | ||
|
|
8f936edf11 | ||
|
|
96470a5afa | ||
|
|
da6f72eeee | ||
|
|
358a7e31ac | ||
|
|
f840f42400 | ||
|
|
883b0bf0c6 | ||
|
|
49bf906cbf | ||
|
|
725512cacb | ||
|
|
e1839e0f75 | ||
|
|
cdb9fc90e6 | ||
|
|
63156e3c09 | ||
|
|
e8eff74ba5 | ||
|
|
5c900f52e9 | ||
|
|
240619de76 | ||
|
|
adbfe9c4ee | ||
|
|
3a4d78e91b | ||
|
|
823b6568bd | ||
|
|
1e85729fbf | ||
|
|
c91fa16eb6 | ||
|
|
97a44b6588 | ||
|
|
e62b4efe82 | ||
|
|
c49e762284 | ||
|
|
ae26f91cb4 | ||
|
|
d79627b91a | ||
|
|
16785bcbdf | ||
|
|
2a7f25b21b | ||
|
|
6cbfb89baf | ||
|
|
5662149cd8 | ||
|
|
3454cc9825 | ||
|
|
42a1bb3ba9 | ||
|
|
1a4d5e661f | ||
|
|
f2244dfa4a | ||
|
|
44be0ff815 | ||
|
|
2ce9b595bf | ||
|
|
018fc97902 | ||
|
|
c0e0e96de8 | ||
|
|
3d44705fca | ||
|
|
544bdcaf48 | ||
|
|
013e24ac52 | ||
|
|
aeabc70849 | ||
|
|
ab6813f33d | ||
|
|
c92efbacc7 | ||
|
|
302ddbd1ec | ||
|
|
d9bed00121 | ||
|
|
e712d37d84 | ||
|
|
dbfadacf76 | ||
|
|
2d066ea156 | ||
|
|
d39bff5bc0 | ||
|
|
8abb5cbf3d | ||
|
|
4ee1cf2ec5 | ||
|
|
93c665fee7 | ||
|
|
cf60a22c6e | ||
|
|
5c3b6b759e | ||
|
|
3b6968fa19 | ||
|
|
64fb001951 | ||
|
|
00bbc4519c | ||
|
|
ececb4224a | ||
|
|
c5a039c248 | ||
|
|
3a6581bc06 | ||
|
|
0a56c24be5 | ||
|
|
ef81b0454e | ||
|
|
7fa48af6e2 | ||
|
|
8118262e17 | ||
|
|
cc0a180a49 | ||
|
|
8ea39cd048 | ||
|
|
386f9b5bff | ||
|
|
fc384740f5 | ||
|
|
4c4a61b604 | ||
|
|
d8e030126e | ||
|
|
77877ed3e8 | ||
|
|
67e241dccf | ||
|
|
eaa30e76c9 | ||
|
|
39d77ba9f0 | ||
|
|
1c1dcf2f9d | ||
|
|
8db1040ac9 | ||
|
|
2d8ddec13a | ||
|
|
64a5a3ad3e | ||
|
|
9577e398bf | ||
|
|
5fc4fa8af2 | ||
|
|
9247379002 | ||
|
|
d1ee1bd21e | ||
|
|
b0ff60c80d | ||
|
|
78e35d661b | ||
|
|
5b7e247309 | ||
|
|
472cd19f00 | ||
|
|
8804b08bb7 | ||
|
|
0d71b088c6 | ||
|
|
3e709e8067 | ||
|
|
94473e29e1 | ||
|
|
a61d1567a4 | ||
|
|
0e82cc9a05 | ||
|
|
9b17639100 | ||
|
|
fc15539c5a | ||
|
|
d2094d3c2d | ||
|
|
610f01ab0b | ||
|
|
56ea6dc57c | ||
|
|
524530db5b | ||
|
|
90239f5c86 | ||
|
|
492771a027 | ||
|
|
2699013af4 | ||
|
|
452fc97a99 | ||
|
|
787f8b0937 | ||
|
|
633bf34bd1 | ||
|
|
8bd45968c8 | ||
|
|
ad73e1c55f | ||
|
|
fd8f8d9275 | ||
|
|
663d8d5cc4 | ||
|
|
26205ffcb9 | ||
|
|
e41fc713ac | ||
|
|
c613c4e70c | ||
|
|
5e1a1089fa | ||
|
|
96b1bb8dd7 | ||
|
|
87862875b1 | ||
|
|
8a399bd3bd | ||
|
|
1c601b666d | ||
|
|
13582c3529 | ||
|
|
6e7f416c28 | ||
|
|
48db08d91c | ||
|
|
fe2142be2b | ||
|
|
58cbd1a788 | ||
|
|
d9a9492704 | ||
|
|
ea006a97f7 | ||
|
|
b230a01deb | ||
|
|
baea7f17f4 | ||
|
|
1c884aab4d | ||
|
|
444fd96a13 | ||
|
|
fe57b3e3bf | ||
|
|
a569ad1e20 | ||
|
|
ffa9a8b5c5 | ||
|
|
784667da89 | ||
|
|
1b48313eb6 | ||
|
|
f2fbef89b1 | ||
|
|
6a5939950f | ||
|
|
2fec4484a1 | ||
|
|
dfa5d6669c | ||
|
|
f39df2dfcc | ||
|
|
1582b023fb | ||
|
|
afdc6933ee | ||
|
|
2e3a8ee813 | ||
|
|
66df38f377 | ||
|
|
69a1d2b903 | ||
|
|
5007c9708e | ||
|
|
45e2a51a3b | ||
|
|
bc58299368 | ||
|
|
66a4b777fb | ||
|
|
301c4ce701 | ||
|
|
44cb8d164f | ||
|
|
b1d9a7aad5 | ||
|
|
72052b06b2 | ||
|
|
20843f46b6 | ||
|
|
6d9f56f4bc | ||
|
|
ffe9796207 | ||
|
|
f413c33cc7 | ||
|
|
e1a381cb17 | ||
|
|
d119b01694 | ||
|
|
a62acb7eb2 | ||
|
|
797267d281 | ||
|
|
cde141fb05 | ||
|
|
dc34f77ec1 | ||
|
|
90e30c776d | ||
|
|
e3f017e5b8 | ||
|
|
3a1d73e1bb | ||
|
|
68d48336c0 | ||
|
|
d2202cf448 | ||
|
|
4fcf883dbf | ||
|
|
aceccd331f | ||
|
|
17ede3fd0c | ||
|
|
8268b0e763 | ||
|
|
e638f6471e | ||
|
|
3df9fceea6 | ||
|
|
e58dbf4b73 | ||
|
|
2bd35c82d5 | ||
|
|
79b854c62d | ||
|
|
a6e99e29b5 | ||
|
|
bacfbf31d4 | ||
|
|
95fed0a877 | ||
|
|
1e2f6d40ff | ||
|
|
cbfc7712d8 | ||
|
|
1a400a2e36 | ||
|
|
9fec8e690c | ||
|
|
cb038f3e12 | ||
|
|
789c821992 | ||
|
|
12f2cd02ee | ||
|
|
ba5f38368f | ||
|
|
191fcf2e6f | ||
|
|
293455cfd5 | ||
|
|
16db517a63 | ||
|
|
c3a326cfbd | ||
|
|
711c3ced9a | ||
|
|
c938945109 | ||
|
|
b860070f9c | ||
|
|
2588383a3c | ||
|
|
e9f8ba10d4 | ||
|
|
0db5dfbe89 | ||
|
|
79681d0e52 | ||
|
|
9088a81e87 | ||
|
|
f7f1c523ca | ||
|
|
4f3e26f480 | ||
|
|
bdf26cd734 | ||
|
|
f53fe1bd11 | ||
|
|
9f99e19518 | ||
|
|
28757ff0e4 | ||
|
|
0407febd7c | ||
|
|
44d6e33792 | ||
|
|
d8afec2d21 | ||
|
|
c5c2f981be | ||
|
|
37e9aecd70 | ||
|
|
72a0450310 | ||
|
|
6fd58cff9a | ||
|
|
ceaa8f0076 | ||
|
|
e9454712e2 | ||
|
|
c4a5a1002c | ||
|
|
5f2df56ebf | ||
|
|
86912b7d4f | ||
|
|
c6732146d4 | ||
|
|
789515057a | ||
|
|
20c09bc21c | ||
|
|
48f1044ab7 | ||
|
|
b558c9e535 | ||
|
|
a04cdc9517 | ||
|
|
b08dc1311b | ||
|
|
388814bbf2 | ||
|
|
61297ef7e2 | ||
|
|
60ec591e5d | ||
|
|
0ba5e9f05c | ||
|
|
5aec2ccedf | ||
|
|
af4e76cd87 | ||
|
|
09301acfae | ||
|
|
6ce2e91f38 | ||
|
|
d72ad3eaab | ||
|
|
294e46950b | ||
|
|
e4547aa8c1 | ||
|
|
cd9b18841c | ||
|
|
0aeb489f36 | ||
|
|
c7ccc06bad | ||
|
|
bbd784d24f | ||
|
|
14f5eabbd0 | ||
|
|
5772c0da2c | ||
|
|
ec20cb0444 | ||
|
|
77be39e793 | ||
|
|
b52effdda2 | ||
|
|
445f90c8c3 | ||
|
|
98e2496f71 | ||
|
|
81751f55f2 | ||
|
|
6a6c120f8f | ||
|
|
9cc0e9d02f | ||
|
|
a722f46b31 | ||
|
|
f56808c647 | ||
|
|
13ae2208af | ||
|
|
f7c94294a7 | ||
|
|
4c7abe10a1 | ||
|
|
34773a9d4a | ||
|
|
65a1155a1e | ||
|
|
d67b9a0f4c | ||
|
|
7816a18263 | ||
|
|
4d15996435 | ||
|
|
d82b01e4ab | ||
|
|
38a062c48d | ||
|
|
e90f42ce05 | ||
|
|
506fd90029 | ||
|
|
289f801277 | ||
|
|
db300f334b | ||
|
|
9b7947b1c2 | ||
|
|
e7d6acd111 | ||
|
|
b3ec9fc0e7 | ||
|
|
da54f25b8a | ||
|
|
04ce8f6dae | ||
|
|
91b5275fb2 | ||
|
|
e2f824e80d | ||
|
|
20c4f1fd45 | ||
|
|
e0a3cc0995 | ||
|
|
c289a84c2f | ||
|
|
c9412b8499 | ||
|
|
6e6bda1c9f | ||
|
|
3cff292280 | ||
|
|
f906576cff | ||
|
|
f714859828 | ||
|
|
528cefabd6 | ||
|
|
45eac66f86 | ||
|
|
c650e3f80e | ||
|
|
9009091601 | ||
|
|
080ffbdaed | ||
|
|
9479323fa9 | ||
|
|
9948a7e69a | ||
|
|
092204aa23 | ||
|
|
c5421952ab | ||
|
|
3bc29208de | ||
|
|
002fd692d9 | ||
|
|
a5afed8db8 | ||
|
|
76a4feeabe | ||
|
|
681979336a | ||
|
|
daefcfb01d | ||
|
|
c54cb465e5 | ||
|
|
848f1032e7 | ||
|
|
a3aca4295d | ||
|
|
095b665999 | ||
|
|
bf2ce3d2d1 | ||
|
|
16b52d284f | ||
|
|
2d3062d2ff | ||
|
|
90d16cb3ac | ||
|
|
480fe5cd4e | ||
|
|
e7d60b5a15 | ||
|
|
87bfef5365 | ||
|
|
9dd1456f84 | ||
|
|
e2841385f8 | ||
|
|
11ccf6902f | ||
|
|
db61c02c01 | ||
|
|
09ccd0abfa | ||
|
|
cf3eb65078 | ||
|
|
67f733e2ac | ||
|
|
76d9e2fba0 | ||
|
|
cef7f094fd | ||
|
|
956d97867d | ||
|
|
edacefef10 | ||
|
|
1c13f9a8b2 | ||
|
|
4ff5497182 | ||
|
|
fc58aa0a30 | ||
|
|
65ee988900 | ||
|
|
357dd35178 | ||
|
|
726a09d9ca | ||
|
|
39cb3837a6 | ||
|
|
ba26d1ac17 | ||
|
|
8ae1bfc4e0 | ||
|
|
c2f85b92f1 | ||
|
|
0dcc4e0e99 | ||
|
|
f95956787f | ||
|
|
7e83a10649 | ||
|
|
7bd7bfe524 | ||
|
|
7c7ffc167b | ||
|
|
788ea76c70 | ||
|
|
42c54a1e57 | ||
|
|
7dcd28db94 | ||
|
|
33a76efe96 | ||
|
|
d7151c86c7 | ||
|
|
8460276d9d | ||
|
|
4f12694861 | ||
|
|
397f3ba72b | ||
|
|
191fdb2247 | ||
|
|
c4259a34f2 | ||
|
|
f71046cd0b | ||
|
|
13495e6c44 | ||
|
|
5351ea224e | ||
|
|
ac3323945d | ||
|
|
efac66bfb2 | ||
|
|
0ec17e6611 | ||
|
|
94fe750adf | ||
|
|
c7767178fd | ||
|
|
5a2b7506e1 | ||
|
|
aa29b54a8d | ||
|
|
ea0fa5bbe7 | ||
|
|
43d1ab222e | ||
|
|
812a76fb60 | ||
|
|
2da6db49f0 | ||
|
|
63ec34ae42 | ||
|
|
1202307444 | ||
|
|
b6b1dd9633 | ||
|
|
a9d86d8144 | ||
|
|
9749b5c54c | ||
|
|
850e0b3037 | ||
|
|
64658f6786 | ||
|
|
5da6309897 | ||
|
|
2405604b3e | ||
|
|
95f40be489 | ||
|
|
8b2b397e88 | ||
|
|
45bba6e7e7 | ||
|
|
b43f87bdd2 | ||
|
|
4e5103741a | ||
|
|
2d66a91ea6 | ||
|
|
876dda4a95 | ||
|
|
a0a2785779 | ||
|
|
ac30f0613b | ||
|
|
68ad38f051 | ||
|
|
d70ca34410 | ||
|
|
a3e77961e4 | ||
|
|
d487284760 | ||
|
|
f8d54802c9 | ||
|
|
d7d697bfb4 | ||
|
|
e649065cf5 | ||
|
|
c48335109d | ||
|
|
7360759a84 | ||
|
|
d04acce675 | ||
|
|
7ef4854e0c | ||
|
|
c0b0cba721 | ||
|
|
9945e5d38d | ||
|
|
e1995e7bad | ||
|
|
bc741820b6 | ||
|
|
2d8726ce60 | ||
|
|
b74aa638e2 | ||
|
|
8566c60102 | ||
|
|
b59260108e | ||
|
|
b8f6d5fefd | ||
|
|
d3c3b37aa0 | ||
|
|
0d478402d0 | ||
|
|
500f93a1fe | ||
|
|
98c9703850 | ||
|
|
9ea13b7f3c | ||
|
|
938a27cfd7 | ||
|
|
e386444153 | ||
|
|
ab853ce51b | ||
|
|
6407c8c944 | ||
|
|
ef5582fb91 | ||
|
|
0265dbdc39 | ||
|
|
9e1b2c8988 | ||
|
|
e6946726d3 | ||
|
|
9bf3eed81f | ||
|
|
8814fa003a | ||
|
|
2c6633c450 | ||
|
|
f30b2bda58 | ||
|
|
fc1b5689ce | ||
|
|
d6a360c44c | ||
|
|
d3b6b1ebfa | ||
|
|
90aa8b8338 | ||
|
|
4cb0ce5b49 | ||
|
|
d2369100c8 | ||
|
|
0836f586b1 | ||
|
|
635fb31ead | ||
|
|
a3b1e0c797 | ||
|
|
454f02f0f2 | ||
|
|
f420290f27 | ||
|
|
5914cef757 | ||
|
|
1b77864598 | ||
|
|
2e5cf6f0b3 | ||
|
|
a6428772e6 | ||
|
|
ebaba8a965 | ||
|
|
cf43ecc122 | ||
|
|
abd257685e | ||
|
|
b26d4e6a28 | ||
|
|
0e6a03d7d8 | ||
|
|
b9c155c333 | ||
|
|
0a681ee6c3 | ||
|
|
cc057f68fe | ||
|
|
a62a9416e8 | ||
|
|
65b7dbe0d2 | ||
|
|
a721270fa0 | ||
|
|
6624fe2410 | ||
|
|
ee25f73998 | ||
|
|
90786a7bff | ||
|
|
6092d9c11d | ||
|
|
3ec01b36e2 | ||
|
|
bdc0f828e7 | ||
|
|
6c1d856e93 | ||
|
|
c769a55a30 | ||
|
|
e1949b2f18 | ||
|
|
3803d5006f | ||
|
|
4431a952a8 | ||
|
|
d137589047 | ||
|
|
39249820de | ||
|
|
53875bc775 | ||
|
|
ff7e5135e5 | ||
|
|
f6155f326c | ||
|
|
377d467258 | ||
|
|
f58c56477f | ||
|
|
d35d7411e2 | ||
|
|
10afc6ddfd | ||
|
|
2551519ed5 | ||
|
|
a37e16d5d1 | ||
|
|
d35f9de760 | ||
|
|
636f97249c | ||
|
|
ab17988e03 | ||
|
|
6b03bdb012 | ||
|
|
26bfb8639e | ||
|
|
946edd3021 | ||
|
|
cf2c6e8e8b | ||
|
|
e6c60c2c8e | ||
|
|
5ca1807249 | ||
|
|
38f81fc559 | ||
|
|
9ad9559436 | ||
|
|
ad20c73d47 | ||
|
|
e149df6051 | ||
|
|
9183c28b0e | ||
|
|
bc2508a441 | ||
|
|
7cae037551 | ||
|
|
fdb27576f0 | ||
|
|
c50d1c151c | ||
|
|
d240813eae | ||
|
|
c6a4bba9f9 | ||
|
|
49a4f3be11 | ||
|
|
2bc9c94d99 | ||
|
|
9ef7898f73 | ||
|
|
be5af0f38b | ||
|
|
1f6d49e9db | ||
|
|
82d71cd854 | ||
|
|
925ad74780 | ||
|
|
7ff63301ad | ||
|
|
a4c34f1593 | ||
|
|
1014cb95a5 | ||
|
|
8beef94fe9 | ||
|
|
4bebe20bf8 | ||
|
|
6b144fb05b | ||
|
|
5a002fc40f | ||
|
|
b417cfb5fc | ||
|
|
589def46ca | ||
|
|
37dbd436f9 | ||
|
|
59747f26d1 | ||
|
|
8588f04094 | ||
|
|
3fbf5699da | ||
|
|
d865116d90 | ||
|
|
2eded5e0ae | ||
|
|
94f523854f | ||
|
|
5e19847cb5 | ||
|
|
51fd8a1e93 | ||
|
|
982197d2a1 | ||
|
|
7cf6afb333 | ||
|
|
35f6971196 | ||
|
|
70b3bf4bc1 | ||
|
|
057abae441 | ||
|
|
e6e8dbd400 | ||
|
|
5d7b9b521c | ||
|
|
ba0681c106 | ||
|
|
d85511d094 | ||
|
|
023f9abba6 | ||
|
|
5c5563d6d8 | ||
|
|
512ae09e27 | ||
|
|
e73458866c | ||
|
|
f2b19beee8 | ||
|
|
2c3be8d9a2 | ||
|
|
b29d525a7f | ||
|
|
82753f558d | ||
|
|
f96b869865 | ||
|
|
c6dc62783b | ||
|
|
108ea935f6 | ||
|
|
73965e32b7 | ||
|
|
97202d500f | ||
|
|
28b4b77150 | ||
|
|
e360932cbd | ||
|
|
83e3c0491e | ||
|
|
50d19c804d | ||
|
|
c60f462923 | ||
|
|
311a8fd9fd | ||
|
|
5887ec9ac2 | ||
|
|
28207ac301 | ||
|
|
46d0076943 | ||
|
|
7345e82835 | ||
|
|
939019e514 | ||
|
|
ce434d7e07 | ||
|
|
00f86788d2 | ||
|
|
4de7009555 | ||
|
|
abe07335ca | ||
|
|
1776712d34 | ||
|
|
125df10767 | ||
|
|
9f15633433 | ||
|
|
903b72da35 | ||
|
|
649ad4e550 | ||
|
|
418a90d093 | ||
|
|
40f27afa57 | ||
|
|
7969119ec2 | ||
|
|
57bc40071e | ||
|
|
65d7e1727d | ||
|
|
552912e40c | ||
|
|
89545dd3d4 | ||
|
|
685df9ec6d | ||
|
|
3094cfeb80 | ||
|
|
4ed27f05aa | ||
|
|
95d04122ae | ||
|
|
2b2fbcddcf | ||
|
|
3d0febd31f | ||
|
|
7ff273810b | ||
|
|
43fcc03fbc | ||
|
|
8440019083 | ||
|
|
06d1192e04 | ||
|
|
ec7cba69b9 | ||
|
|
1e537505db | ||
|
|
9654d01904 | ||
|
|
c22188ee1e | ||
|
|
0e8efa318a | ||
|
|
6fb2e532db | ||
|
|
97b4692a8b | ||
|
|
c839a64ae9 | ||
|
|
2c0b4b737c | ||
|
|
d5485f166a | ||
|
|
c6c8653d0b | ||
|
|
7f485de52c | ||
|
|
3a71224387 | ||
|
|
3f19bdcf9f | ||
|
|
d604e94999 | ||
|
|
d4c605ada6 | ||
|
|
766daa41d4 | ||
|
|
b5a892674e | ||
|
|
0ce403763f | ||
|
|
a5592fb554 | ||
|
|
e639d60a98 | ||
|
|
6f51582b3c | ||
|
|
8d2cffb5a7 | ||
|
|
67852827a5 | ||
|
|
1ae7482fa9 | ||
|
|
9048db41e2 | ||
|
|
adb581ef22 | ||
|
|
deb14b8d74 | ||
|
|
ea893171b8 | ||
|
|
2707ae07d6 | ||
|
|
a8867cea2e | ||
|
|
950a23db20 | ||
|
|
e4ece21bb4 | ||
|
|
2b42af1795 | ||
|
|
789f1a8f48 | ||
|
|
4d9eeb53ee | ||
|
|
e405183dbc | ||
|
|
bbaa5a5ea6 | ||
|
|
0f9ede5848 | ||
|
|
fd3b30a7fb | ||
|
|
fe53b9df66 | ||
|
|
2732ccd5b3 | ||
|
|
2c529c6bf0 | ||
|
|
ca85f66ae0 | ||
|
|
652c5c76ef | ||
|
|
56e61750ae | ||
|
|
7c864cf5ad | ||
|
|
3a99f81526 | ||
|
|
aa1781b6fe | ||
|
|
d190196e4a | ||
|
|
ac67939aba | ||
|
|
0e3b7816b5 | ||
|
|
18898e073e | ||
|
|
01aa07b5ad | ||
|
|
580872e3bf | ||
|
|
a0502eeb3d | ||
|
|
a3f2b6957a | ||
|
|
8d07b55065 | ||
|
|
b2b1615b52 | ||
|
|
5a27f2f744 | ||
|
|
8d389ded59 | ||
|
|
31b4804a6e | ||
|
|
e0dcf37a23 | ||
|
|
40dcea51dc | ||
|
|
d525f41b11 | ||
|
|
c5674f19d0 | ||
|
|
50a1b22e73 | ||
|
|
25666f2e70 | ||
|
|
e7cdc77564 | ||
|
|
74ef7696ba | ||
|
|
8373e22251 | ||
|
|
a0c0d2a692 | ||
|
|
cb7140d97a | ||
|
|
a501a37dd7 | ||
|
|
ad9a80861c | ||
|
|
33f6be3a8b | ||
|
|
3dc428894d | ||
|
|
11bb500cbb | ||
|
|
d1e47d3e8c | ||
|
|
6f3552daa6 | ||
|
|
eda56baad8 | ||
|
|
1aad994281 | ||
|
|
6d9a88ee57 | ||
|
|
42683bc8fe | ||
|
|
ad596f25df | ||
|
|
55a4ef2e2e | ||
|
|
65bce26dcc | ||
|
|
0526291d09 | ||
|
|
93e0cd9890 | ||
|
|
1c1442b75b | ||
|
|
31086a55a4 | ||
|
|
7fb29bff05 | ||
|
|
38d21bb28a | ||
|
|
c75a5eeb85 | ||
|
|
e991857093 | ||
|
|
fb331e174a | ||
|
|
15f0773cf8 | ||
|
|
c972ff7947 | ||
|
|
32e12d34fd | ||
|
|
5d0452d186 | ||
|
|
c951a9b6ca | ||
|
|
8bf8a10079 | ||
|
|
620b5845e0 | ||
|
|
5421e767df | ||
|
|
9e49a4f606 | ||
|
|
a85ae77ece | ||
|
|
20fc42a2fc | ||
|
|
3d4b837eb1 | ||
|
|
0da51203f7 | ||
|
|
9bf97cd26e | ||
|
|
8c9d2f3ca8 | ||
|
|
76dfa25f73 | ||
|
|
34bee55eae | ||
|
|
54381f6234 | ||
|
|
95721707e7 | ||
|
|
a9cec8b34c | ||
|
|
faf8b739bf | ||
|
|
9d43554a8f | ||
|
|
54a29179c5 | ||
|
|
8bade27c69 | ||
|
|
60b4b72acd | ||
|
|
f66dba11be | ||
|
|
6d360d396d | ||
|
|
bfb083b503 | ||
|
|
5af1b4c179 | ||
|
|
8d1dc01bc8 | ||
|
|
e4571c5237 | ||
|
|
e7861f0fdd | ||
|
|
e5534ffd2a | ||
|
|
af6d0de986 | ||
|
|
85f9a27ba9 | ||
|
|
eef8ca5b37 | ||
|
|
a98603e4f9 | ||
|
|
4dabfc2496 | ||
|
|
7582702911 | ||
|
|
7fda5b767d | ||
|
|
807d334150 | ||
|
|
bf2cf3abb8 | ||
|
|
5c6c5eceda | ||
|
|
95c8f10ae5 | ||
|
|
8836356313 | ||
|
|
cb9019ce92 | ||
|
|
beacdc7a82 | ||
|
|
d54d92f273 | ||
|
|
46a0b55f0a | ||
|
|
53c07682df | ||
|
|
fcb177fa71 | ||
|
|
7767d0bbe3 | ||
|
|
7349dce3a8 | ||
|
|
22d716436f | ||
|
|
a44ecea578 | ||
|
|
fb6f141145 | ||
|
|
292a0fd638 | ||
|
|
eae42d3ce4 | ||
|
|
56ba23d550 | ||
|
|
3674b2e502 | ||
|
|
a4aa0d8468 | ||
|
|
beb1dc2528 | ||
|
|
38f9d49bef | ||
|
|
11a282cbd3 | ||
|
|
1c4e570381 | ||
|
|
d8acd45bdf | ||
|
|
212dc74195 | ||
|
|
4758ec148b | ||
|
|
f0f4cd5d1c | ||
|
|
2ca7d37f72 | ||
|
|
0bf0b75a1c | ||
|
|
8361ca5b11 | ||
|
|
620f1fa193 | ||
|
|
a435cabbe1 | ||
|
|
465089a314 | ||
|
|
3b8b491483 | ||
|
|
476b9e9e3a | ||
|
|
992e765a71 | ||
|
|
d080d825ac | ||
|
|
cdc92afa82 | ||
|
|
cba87950a8 | ||
|
|
d2771247e7 | ||
|
|
9c31bbf779 | ||
|
|
55fbd57359 | ||
|
|
4d026b66da | ||
|
|
90c3df2c80 | ||
|
|
4e08aa125e | ||
|
|
278721a8b8 | ||
|
|
0f42c893e7 | ||
|
|
2dc6870f10 | ||
|
|
52de530c1c | ||
|
|
fc4a3c85a1 | ||
|
|
a729b2decb | ||
|
|
d9e299e1b7 | ||
|
|
5a93a0c814 | ||
|
|
3ace5f728e | ||
|
|
dea4b84608 | ||
|
|
ef51d9af46 | ||
|
|
9ea85dca37 | ||
|
|
d3efc44db0 | ||
|
|
19875a88eb | ||
|
|
376ca0a78b | ||
|
|
09df424f2e | ||
|
|
cb9645b07e | ||
|
|
040c94a0dc | ||
|
|
2269729f6c | ||
|
|
676f5c6736 | ||
|
|
9a0d9c0673 | ||
|
|
1f4be59d5a | ||
|
|
53be9b685c | ||
|
|
106126e413 | ||
|
|
9d939eb401 | ||
|
|
677789103b | ||
|
|
6deff9757a | ||
|
|
80fd810c61 | ||
|
|
a09884f4a0 | ||
|
|
280276382c | ||
|
|
47a107be90 | ||
|
|
50ed367d19 | ||
|
|
c6520560a3 | ||
|
|
835371e0a9 | ||
|
|
cb27b4c914 | ||
|
|
9968a65b72 | ||
|
|
b2b8e8f443 | ||
|
|
51ec33a8f7 | ||
|
|
d36789a66f | ||
|
|
3bc8e65cff | ||
|
|
c6894218a9 | ||
|
|
45db8a0025 | ||
|
|
b550beed2a | ||
|
|
a64b5c7775 | ||
|
|
59526459b8 | ||
|
|
497eff6252 | ||
|
|
2a1b82f90f | ||
|
|
2e242f89ad | ||
|
|
033ea34e34 | ||
|
|
a15a6a9f9b | ||
|
|
8961deeff0 | ||
|
|
4a7f6fd3e1 | ||
|
|
5a503ac95f | ||
|
|
35fe47b6ec | ||
|
|
ce684c174f | ||
|
|
fce6409810 | ||
|
|
4eb04db668 | ||
|
|
46f4a5eb69 | ||
|
|
0c496deb51 | ||
|
|
f277839ece | ||
|
|
5cb60571a5 | ||
|
|
77b681d1c1 | ||
|
|
2d5090a7ba | ||
|
|
f6abb5bff2 | ||
|
|
aeca069a1c | ||
|
|
9f1ae7eb1e | ||
|
|
075d6fbfa5 | ||
|
|
56598eeb60 | ||
|
|
fc2b634f2f | ||
|
|
9a9a062270 | ||
|
|
48ee76d654 | ||
|
|
fdb9212619 | ||
|
|
259f61b476 | ||
|
|
39be3e85fb | ||
|
|
dddad5aa5c | ||
|
|
79f94a8b90 | ||
|
|
c0b066b422 | ||
|
|
229d9c7993 | ||
|
|
367802755b | ||
|
|
17ad4138ba | ||
|
|
a7dec6bdf5 | ||
|
|
d2bc0166d9 | ||
|
|
27918a4802 | ||
|
|
bd74dcd893 | ||
|
|
07c72c4635 | ||
|
|
5275b02cab | ||
|
|
483b3af716 | ||
|
|
823013f648 | ||
|
|
77b0034707 | ||
|
|
83d88be83e | ||
|
|
b6852a1fd3 | ||
|
|
7646e52072 | ||
|
|
55e0f25d7b | ||
|
|
9645fc361a | ||
|
|
b03e915393 | ||
|
|
8148d083ea | ||
|
|
029876f20f | ||
|
|
fa4bef66bb | ||
|
|
776816e4d3 | ||
|
|
b3edb1a1f2 | ||
|
|
17444b2796 | ||
|
|
c4073a22b7 | ||
|
|
232c185eac | ||
|
|
9134b07507 | ||
|
|
d98d1b2acb | ||
|
|
b191ddd5dd | ||
|
|
5b67075dd4 | ||
|
|
9e72581ea3 | ||
|
|
df7474e042 | ||
|
|
cb5a663aad | ||
|
|
911f67d21e | ||
|
|
4904af65ef | ||
|
|
1b25c6c2b6 | ||
|
|
ed93cdeb8a | ||
|
|
361a7c2640 | ||
|
|
96c875a152 | ||
|
|
201605dfde | ||
|
|
58176f54ef | ||
|
|
8532694464 | ||
|
|
9e7480c6e0 | ||
|
|
ced5418196 | ||
|
|
d2fd1627b2 | ||
|
|
f6675339d1 | ||
|
|
f26658056a | ||
|
|
b72c7bf124 | ||
|
|
9d0510c07d | ||
|
|
3c94e8bc3a | ||
|
|
81c4a2cbc0 | ||
|
|
4c6c49ab56 | ||
|
|
e0eb991974 | ||
|
|
fae1215379 | ||
|
|
2d36f1a008 | ||
|
|
3b349946e4 | ||
|
|
f41ba08470 | ||
|
|
9b2a6d3572 | ||
|
|
cbe33be50a | ||
|
|
c16a8432ac | ||
|
|
e06c12667b | ||
|
|
027c2e3fff | ||
|
|
34c2e26074 | ||
|
|
36ed9ff4e0 | ||
|
|
fd1f390081 | ||
|
|
d16e2cd408 | ||
|
|
2bbfe9e41b | ||
|
|
b2ad5147b1 | ||
|
|
d206d1a279 | ||
|
|
c259d1c2db | ||
|
|
284cb169fd | ||
|
|
4dcafefe2a | ||
|
|
d891cf3d45 | ||
|
|
20d701374a | ||
|
|
8808711fce | ||
|
|
bf57978a91 | ||
|
|
3a0194e051 | ||
|
|
07360c1d1c | ||
|
|
c5f5d20dfc | ||
|
|
7598337ea4 | ||
|
|
a4f98fc96d | ||
|
|
577d1c7622 | ||
|
|
cca5d71d90 | ||
|
|
67900f149f | ||
|
|
827b55733e | ||
|
|
131f08f4a4 | ||
|
|
b1d3956a54 | ||
|
|
6340467119 | ||
|
|
f1e749cebf | ||
|
|
6733cff041 | ||
|
|
7708a4cd9d | ||
|
|
8d6b2984f3 | ||
|
|
20a94b02e7 | ||
|
|
87582bf273 | ||
|
|
71f6b0fd91 | ||
|
|
871cd04b49 | ||
|
|
6ad6277d57 | ||
|
|
1717c45f26 | ||
|
|
cb081bf363 | ||
|
|
d1d57e5279 | ||
|
|
6b6caf741d | ||
|
|
0ddbea0b51 | ||
|
|
3d049537f1 | ||
|
|
f109dfdb7c |
@@ -740,7 +740,7 @@
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
unpack="true"/>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.jet.core"
|
||||
|
||||
@@ -38,7 +38,7 @@ ComponentProjectPreferencePage.ChooseProject=S
|
||||
WizardComponentFolderPage.ErrMSG5=La famille du composant est vide
|
||||
WizardComponentFolderPage.ErrMSG4=Le nom long du composant est vide
|
||||
AbstractXMLConfigPage.BooleanTip=Booléen (vrai ou faux)
|
||||
AbstractXMLConfigPage.Delete=Supprimer
|
||||
AbstractXMLConfigPage.Delete=DELETE
|
||||
WizardComponentFolderPage.ErrMSG3=Ce composant existe déjà
|
||||
WizardComponentFolderPage.ErrMSG2=Le nom du composant est vide
|
||||
WizardComponentFolderPage.ErrMSG1=Le langage du composant n'a pas été sélectionné
|
||||
|
||||
@@ -3,7 +3,7 @@ PushToPaletteActionProvider.PushComponentsToPalette=\u30B3\u30F3\u30DD\u30FC\u30
|
||||
EditComponentActionProvider.Edit=\u3053\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306E\u7DE8\u96C6
|
||||
ImportComponentDialog.ErrorMSG4=\u30A4\u30F3\u30DD\u30FC\u30C8\u3059\u308B\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
|
||||
ProjectSelectionDialog.SelectPath=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30D1\u30B9\u306E\u9078\u629E
|
||||
AbstractXMLConfigPage.TYPETip=\u30C7\u30FC\u30BF\u578B\u3002
|
||||
AbstractXMLConfigPage.TYPETip=\u30C7\u30FC\u30BF\u578B
|
||||
PushToPaletteActionProvider.Error2=\u30A8\u30E9\u30FC
|
||||
CopyFromPaletteActionProvider.Label2=\u30D1\u30EC\u30C3\u30C8\u304B\u3089\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306E\u30A4\u30F3\u30DD\u30FC\u30C8
|
||||
AbstractXMLConfigPage.MAXOUTPUTTip=\u6574\u6570\u5024\u3002\u3053\u306E\u63A5\u7D9A\u306E\u6700\u5927\u51FA\u529B\u6570\u3002
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
PushToPaletteActionProvider.Error2=Fout
|
||||
PushToPaletteActionProvider.Error=Fout
|
||||
NewActionProvider.New=Nieuw
|
||||
NewActionProvider.NewComponent=Nieuw Component
|
||||
AbstractXMLConfigPage.Delete=Verwijderen
|
||||
CreateComponentWizard.NewComponent=Nieuw Component
|
||||
WizardComponentFolderPage.Name=Naam
|
||||
AbstractXMLConfigPage.New=Nieuw
|
||||
@@ -1,3 +1,2 @@
|
||||
PushToPaletteActionProvider.Error2=Gre\u0161ka
|
||||
PushToPaletteActionProvider.Error=Gre\u0161ka
|
||||
AbstractXMLConfigPage.Delete=DELETE
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
ApplicationActionBarAdvisor.helpMenu=\uB3C4\uC6C0\uB9D0\uBA54\uB274
|
||||
ApplicationActionBarAdvisor.fileMenu=\uD30C\uC77C\uBA54\uB274
|
||||
ApplicationActionBarAdvisor.windowMenu=\uC708\uB3C4\uC6B0\uBA54\uB274
|
||||
ApplicationActionBarAdvisor.windowMenu=\uC708\uB3C4\uC6B0
|
||||
ApplicationWorkbenchWindowAdvisor.rcpApp=RCP \uC5B4\uD50C\uB9AC\uCF00\uC774\uC158
|
||||
|
||||
@@ -52,7 +52,7 @@ public class TreeNodeAttrCompsite extends Composite {
|
||||
gd = new GridData();
|
||||
gd.horizontalSpan = 2;
|
||||
label.setLayoutData(gd);
|
||||
final Text nodeText = new Text(this, SWT.BORDER | SWT.MULTI | SWT.WRAP);
|
||||
final Text nodeText = new Text(this, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
|
||||
gd = new GridData(GridData.FILL_BOTH);
|
||||
gd.horizontalSpan = 2;
|
||||
nodeText.setLayoutData(gd);
|
||||
|
||||
@@ -18,8 +18,10 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.ScrolledComposite;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
@@ -71,6 +73,8 @@ public abstract class AbstractXMLConfigPage extends AbstractComponentPage {
|
||||
|
||||
protected Map<String, String> attrsToolTipsMap = null;
|
||||
|
||||
private ScrolledComposite scrolledComposite;
|
||||
|
||||
/**
|
||||
* DOC rli WizardXMLConfigPage constructor comment.
|
||||
*
|
||||
@@ -95,14 +99,19 @@ public abstract class AbstractXMLConfigPage extends AbstractComponentPage {
|
||||
topComposite.setLayout(new GridLayout(2, false));
|
||||
GridData data = new GridData(GridData.FILL_BOTH);
|
||||
topComposite.setLayoutData(data);
|
||||
// topComposite.setLayout(new FillLayout());
|
||||
availableXmlTree = new Tree(topComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
|
||||
GridData treeGD = new GridData(GridData.FILL_BOTH);
|
||||
treeGD.widthHint = 110;
|
||||
treeGD.widthHint = 196;
|
||||
treeGD.grabExcessHorizontalSpace = true;
|
||||
treeGD.grabExcessVerticalSpace = true;
|
||||
availableXmlTree.setLayoutData(treeGD);
|
||||
|
||||
rightComposite = new Composite(topComposite, SWT.NONE);
|
||||
scrolledComposite = new ScrolledComposite(topComposite, SWT.V_SCROLL);
|
||||
scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
scrolledComposite.setLayout(new FillLayout());
|
||||
// rightComposite = new Composite(topComposite, SWT.NONE);
|
||||
rightComposite = new Composite(scrolledComposite, SWT.NONE);
|
||||
GridData rightPanelGd = new GridData(GridData.FILL_BOTH);
|
||||
rightPanelGd.widthHint = 180;
|
||||
rightComposite.setLayoutData(rightPanelGd);
|
||||
@@ -113,6 +122,10 @@ public abstract class AbstractXMLConfigPage extends AbstractComponentPage {
|
||||
GridData labelGd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
label.setLayoutData(labelGd);
|
||||
|
||||
scrolledComposite.setContent(rightComposite);
|
||||
scrolledComposite.setExpandHorizontal(true);
|
||||
scrolledComposite.setExpandVertical(true);
|
||||
|
||||
this.setControl(topComposite);
|
||||
}
|
||||
|
||||
@@ -182,6 +195,7 @@ public abstract class AbstractXMLConfigPage extends AbstractComponentPage {
|
||||
nodeAttrCompsite.dispose();
|
||||
}
|
||||
rebuildAttrComposite(treeNodeData);
|
||||
setComponentMinSize(treeNodeData.getTreeNode().getLabel());
|
||||
rightComposite.layout();
|
||||
}
|
||||
|
||||
@@ -189,6 +203,24 @@ public abstract class AbstractXMLConfigPage extends AbstractComponentPage {
|
||||
|
||||
}
|
||||
|
||||
private void setComponentMinSize(String label) {
|
||||
if (("HEADER").equals(label)) {
|
||||
scrolledComposite.setMinSize(0, 0);
|
||||
scrolledComposite.setMinSize(0, 750);
|
||||
} else if (("CONNECTOR").equals(label)) {
|
||||
scrolledComposite.setMinSize(0, 0);
|
||||
scrolledComposite.setMinSize(0, 500);
|
||||
} else if (("PARAMETER").equals(label)) {
|
||||
scrolledComposite.setMinSize(0, 0);
|
||||
scrolledComposite.setMinSize(0, 630);
|
||||
} else if (("RETURN").equals(label)) {
|
||||
scrolledComposite.setMinSize(0, 0);
|
||||
scrolledComposite.setMinSize(0, 150);
|
||||
} else {
|
||||
scrolledComposite.setMinSize(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
||||
@@ -4,6 +4,7 @@ prefs.configuration.LINK_STYLE.LINE=Lignes (rapide)
|
||||
prefs.configuration.LINK_STYLE.BEZIER_CURVE=Courbes
|
||||
prefs.configuration.LINK_STYLE=Affichage par défaut du lien de mapping \:
|
||||
DraggingInfosPopup.draggingEntry=Glissement de {0} entrée.
|
||||
DraggingInfosPopup.dropInvalid=\n<< Déposer invalide >>\n
|
||||
DraggingInfosPopup.draggingEntries=Glissement de {0} entrées.
|
||||
DraggingInfosPopup.overwriteMode=\ > Mode écrasement
|
||||
DraggingInfosPopup.appendMode=\ > Mode écrire après
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
prefs.configuration.LINK_STYLE.AUTO=Automatisch
|
||||
prefs.configuration.LINK_STYLE.LINE=Lijnen (snel)
|
||||
prefs.configuration.LINK_STYLE.BEZIER_CURVE=Rondingen
|
||||
@@ -0,0 +1,5 @@
|
||||
AlfrescoModelDialog.modelTable.title=Titel
|
||||
AlfrescoOutputManager.schemaError.title=Fout in schema
|
||||
AlfrescoModelDialog.add=Toevoegen
|
||||
AlfrescoModelDialog.removeModelFailed=Fout bij verwijderen model
|
||||
AlfrescoModelDialog.modelTable.name=Naam
|
||||
@@ -0,0 +1,9 @@
|
||||
AssignmentPropertySection.Name=Naam
|
||||
BusinessPaletteFactory.ActionComment=Nieuwe Aktie
|
||||
BusinessInitDiagramFileAction.Error=Fout
|
||||
AssignmentPropertySection.Comment=Opmerking
|
||||
BusinessPaletteFactory.Data=Data
|
||||
BusinessPaletteFactory.Ellipse=Elips
|
||||
BusinessPaletteFactory.Document=Document
|
||||
BusinessPaletteFactory.Action=Aktie
|
||||
BusinessPaletteFactory.DocuemntComment=Nieuw Document
|
||||
@@ -557,5 +557,16 @@
|
||||
level="20"
|
||||
name="ReadDiagramAction"/>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.core.expressions.definitions">
|
||||
<definition
|
||||
id="isActiveEditorOfBusinessModelEditor">
|
||||
<not>
|
||||
<instanceof
|
||||
value="org.talend.designer.business.model.business.diagram.part.BusinessDiagramEditor">
|
||||
</instanceof>
|
||||
</not>
|
||||
</definition>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
||||
@@ -69,6 +69,7 @@ public class OpenDiagramAction extends AContextualAction implements IIntroAction
|
||||
*
|
||||
* @see org.eclipse.jface.action.Action#run()
|
||||
*/
|
||||
@Override
|
||||
protected void doRun() {
|
||||
ISelection selection = getSelectedObject();
|
||||
if (selection == null) {
|
||||
@@ -96,10 +97,11 @@ public class OpenDiagramAction extends AContextualAction implements IIntroAction
|
||||
if (part instanceof BusinessDiagramEditor) {
|
||||
((BusinessDiagramEditor) part).setLastVersion(true);
|
||||
}
|
||||
IRepositoryView view = getViewPart();
|
||||
if (view != null) {
|
||||
view.refresh(repositoryNode);
|
||||
}
|
||||
// TDI-21143 : Studio repository view : remove all refresh call to repo view
|
||||
// IRepositoryView view = getViewPart();
|
||||
// if (view != null) {
|
||||
// view.refresh(repositoryNode);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,12 @@
|
||||
package org.talend.designer.business.diagram.custom.edit.parts;
|
||||
|
||||
import org.eclipse.draw2d.IFigure;
|
||||
import org.eclipse.draw2d.MouseEvent;
|
||||
import org.eclipse.draw2d.MouseMotionListener;
|
||||
import org.eclipse.draw2d.PositionConstants;
|
||||
import org.eclipse.emf.common.notify.Notification;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.gef.EditPart;
|
||||
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
|
||||
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
|
||||
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
|
||||
@@ -42,6 +45,8 @@ public abstract class BusinessItemShapeEditPart extends ShapeNodeEditPart {
|
||||
|
||||
private ElementHelper elementHelper;
|
||||
|
||||
private EditPart editPart;
|
||||
|
||||
/**
|
||||
* DOC mhelleboid BusinessItemShapeEditPart constructor comment.
|
||||
*
|
||||
@@ -51,6 +56,7 @@ public abstract class BusinessItemShapeEditPart extends ShapeNodeEditPart {
|
||||
super(view);
|
||||
tooltipFigure = new BusinessTooltipFigure();
|
||||
elementHelper = new ElementHelper();
|
||||
editPart = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -103,6 +109,33 @@ public abstract class BusinessItemShapeEditPart extends ShapeNodeEditPart {
|
||||
for (Object figure : shapFigure.getChildren()) {
|
||||
if (figure instanceof BusinessItemNameFigure) {
|
||||
BusinessItemNameFigure nameFigure = (BusinessItemNameFigure) figure;
|
||||
nameFigure.addMouseMotionListener(new MouseMotionListener() {
|
||||
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent me) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseHover(MouseEvent me) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent me) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent me) {
|
||||
elementHelper.updateTooltipFigure(getNodeFigure(), tooltipFigure, editPart);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent me) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
});
|
||||
EObject object = ((Node) getModel()).getElement();
|
||||
if (object instanceof BusinessItem) {
|
||||
BusinessItem item = (BusinessItem) object;
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.beans.PropertyChangeListener;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryObject;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
@@ -29,12 +30,6 @@ import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
*/
|
||||
public class BusinessDeleteListener implements PropertyChangeListener {
|
||||
|
||||
private IRepositoryObject businessObjectToDelete;
|
||||
|
||||
private boolean isDeleteBusinessLogical;
|
||||
|
||||
private boolean isDeleteBusinessPhysical;
|
||||
|
||||
private IProxyRepositoryFactory factory = null;
|
||||
|
||||
public BusinessDeleteListener() {
|
||||
@@ -46,10 +41,11 @@ public class BusinessDeleteListener implements PropertyChangeListener {
|
||||
*
|
||||
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
|
||||
*/
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent event) {
|
||||
|
||||
isDeleteBusinessLogical = event.getPropertyName().equals(ERepositoryActionName.BUSINESS_DELETE_TO_RECYCLE_BIN.getName());
|
||||
isDeleteBusinessPhysical = event.getPropertyName().equals(ERepositoryActionName.BUSINESS_DELETE_FOREVER.getName());
|
||||
boolean isDeleteBusinessLogical = event.getPropertyName().equals(ERepositoryActionName.DELETE_TO_RECYCLE_BIN.getName());
|
||||
boolean isDeleteBusinessPhysical = event.getPropertyName().equals(ERepositoryActionName.DELETE_FOREVER.getName());
|
||||
|
||||
if (!isDeleteBusinessLogical && !isDeleteBusinessPhysical) {
|
||||
return;
|
||||
@@ -58,13 +54,18 @@ public class BusinessDeleteListener implements PropertyChangeListener {
|
||||
if (!(event.getNewValue() instanceof IRepositoryObject)) {
|
||||
return;
|
||||
}
|
||||
businessObjectToDelete = (IRepositoryObject) event.getNewValue();
|
||||
IRepositoryObject object = (IRepositoryObject) event.getNewValue();
|
||||
if (object.getRepositoryObjectType() != ERepositoryObjectType.BUSINESS_PROCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (businessObjectToDelete != null) {
|
||||
object = (IRepositoryObject) event.getNewValue();
|
||||
|
||||
if (object != null) {
|
||||
|
||||
try {
|
||||
|
||||
deleteSVGObjectLogicalOrPhysical(businessObjectToDelete, isDeleteBusinessLogical);
|
||||
deleteSVGObjectLogicalOrPhysical(object, isDeleteBusinessLogical);
|
||||
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.talend.commons.ui.runtime.image.ECoreImage;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.commons.ui.runtime.image.OverlayImage;
|
||||
import org.talend.commons.ui.runtime.image.OverlayImage.EPosition;
|
||||
import org.talend.core.model.metadata.MetadataTool;
|
||||
import org.talend.core.model.metadata.MetadataToolHelper;
|
||||
import org.talend.core.model.metadata.builder.connection.MetadataTable;
|
||||
import org.talend.core.model.metadata.builder.connection.Query;
|
||||
import org.talend.core.model.metadata.builder.connection.SAPFunctionUnit;
|
||||
@@ -42,15 +42,16 @@ public class RepositoryFactoryProxyLabelProvider extends AdapterFactoryLabelProv
|
||||
if (columnIndex == 0) {
|
||||
IRepositoryViewObject lastVersion = getLastVersion(object);
|
||||
if (lastVersion == null) {
|
||||
MetadataTable table = MetadataTool.getMetadataTableFromRepository(assignment.getTalendItem().getId());
|
||||
MetadataTable table = MetadataToolHelper.getMetadataTableFromRepository(assignment.getTalendItem().getId());
|
||||
if (table != null) {
|
||||
return image;
|
||||
}
|
||||
Query query = MetadataTool.getQueryFromRepository(assignment.getTalendItem().getId());
|
||||
Query query = MetadataToolHelper.getQueryFromRepository(assignment.getTalendItem().getId());
|
||||
if (query != null) {
|
||||
return image;
|
||||
}
|
||||
SAPFunctionUnit function = MetadataTool.getSAPFunctionFromRepository(assignment.getTalendItem().getId());
|
||||
SAPFunctionUnit function = MetadataToolHelper
|
||||
.getSAPFunctionFromRepository(assignment.getTalendItem().getId());
|
||||
if (function != null) {
|
||||
return image;
|
||||
}
|
||||
@@ -97,22 +98,26 @@ public class RepositoryFactoryProxyLabelProvider extends AdapterFactoryLabelProv
|
||||
try {
|
||||
if (columnIndex == 0) {
|
||||
if (lastVersion == null) {
|
||||
MetadataTable table = MetadataTool.getMetadataTableFromRepository(assignment.getTalendItem().getId());
|
||||
MetadataTable table = MetadataToolHelper.getMetadataTableFromRepository(assignment.getTalendItem().getId());
|
||||
if (table != null) {
|
||||
if (SubItemHelper.isDeleted(table))
|
||||
if (SubItemHelper.isDeleted(table)) {
|
||||
columnText += Messages.getString("RepositoryFactoryProxyLabelProvider.Deleted"); //$NON-NLS-1$
|
||||
}
|
||||
return columnText;
|
||||
}
|
||||
Query query = MetadataTool.getQueryFromRepository(assignment.getTalendItem().getId());
|
||||
Query query = MetadataToolHelper.getQueryFromRepository(assignment.getTalendItem().getId());
|
||||
if (query != null) {
|
||||
if (SubItemHelper.isDeleted(query))
|
||||
if (SubItemHelper.isDeleted(query)) {
|
||||
columnText += Messages.getString("RepositoryFactoryProxyLabelProvider.Deleted"); //$NON-NLS-1$
|
||||
}
|
||||
return columnText;
|
||||
}
|
||||
SAPFunctionUnit function = MetadataTool.getSAPFunctionFromRepository(assignment.getTalendItem().getId());
|
||||
SAPFunctionUnit function = MetadataToolHelper
|
||||
.getSAPFunctionFromRepository(assignment.getTalendItem().getId());
|
||||
if (function != null) {
|
||||
if (SubItemHelper.isDeleted(function))
|
||||
if (SubItemHelper.isDeleted(function)) {
|
||||
columnText += Messages.getString("RepositoryFactoryProxyLabelProvider.Deleted"); //$NON-NLS-1$
|
||||
}
|
||||
return columnText;
|
||||
}
|
||||
TalendItem item = assignment.getTalendItem();
|
||||
@@ -151,8 +156,8 @@ public class RepositoryFactoryProxyLabelProvider extends AdapterFactoryLabelProv
|
||||
if (lastVersion != null) {
|
||||
String label = lastVersion.getProperty().getLabel();
|
||||
if (!label.equals(columnText)) {
|
||||
ChangeTalendItemLabelCommand command = new ChangeTalendItemLabelCommand(((BusinessAssignment) object)
|
||||
.getTalendItem(), label);
|
||||
ChangeTalendItemLabelCommand command = new ChangeTalendItemLabelCommand(
|
||||
((BusinessAssignment) object).getTalendItem(), label);
|
||||
try {
|
||||
command.execute(null, null);
|
||||
} catch (ExecutionException e) {
|
||||
|
||||
@@ -27,11 +27,11 @@ import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.ui.runtime.image.ECoreImage;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.commons.ui.runtime.image.ImageUtils;
|
||||
import org.talend.commons.ui.runtime.image.OverlayImage;
|
||||
import org.talend.commons.ui.runtime.image.ImageUtils.ICON_SIZE;
|
||||
import org.talend.commons.ui.runtime.image.OverlayImage;
|
||||
import org.talend.commons.ui.runtime.image.OverlayImage.EPosition;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.model.metadata.MetadataTool;
|
||||
import org.talend.core.model.metadata.MetadataToolHelper;
|
||||
import org.talend.core.model.metadata.builder.connection.MetadataTable;
|
||||
import org.talend.core.model.metadata.builder.connection.Query;
|
||||
import org.talend.core.model.metadata.builder.connection.SAPFunctionUnit;
|
||||
@@ -97,8 +97,8 @@ public class ElementHelper {
|
||||
if (assignment instanceof BusinessAssignment) {
|
||||
TalendItem talendItem = ((BusinessAssignment) assignment).getTalendItem();
|
||||
if (talendItem != null) {
|
||||
IRepositoryViewObject obj = CorePlugin.getDefault().getProxyRepositoryFactory().getLastVersion(
|
||||
talendItem.getId());
|
||||
IRepositoryViewObject obj = CorePlugin.getDefault().getProxyRepositoryFactory()
|
||||
.getLastVersion(talendItem.getId());
|
||||
if (obj != null) {
|
||||
ERepositoryObjectType type = obj.getRepositoryObjectType();
|
||||
Item item = obj.getProperty().getItem();
|
||||
@@ -113,13 +113,13 @@ public class ElementHelper {
|
||||
} else {
|
||||
img = CoreImageProvider.getImage(type);
|
||||
}
|
||||
label = new Label(talendItem.getLabel() + " (" + provider.getColumnText(assignment, 0) + ")", img); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
label = new Label(obj.getLabel() + " (" + provider.getColumnText(assignment, 0) + ")", img); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
labels.add(label);
|
||||
} else {
|
||||
|
||||
MetadataTable table = MetadataTool.getMetadataTableFromRepository(talendItem.getId());
|
||||
Query query = MetadataTool.getQueryFromRepository(talendItem.getId());
|
||||
SAPFunctionUnit function = MetadataTool.getSAPFunctionFromRepository(talendItem.getId());
|
||||
MetadataTable table = MetadataToolHelper.getMetadataTableFromRepository(talendItem.getId());
|
||||
Query query = MetadataToolHelper.getQueryFromRepository(talendItem.getId());
|
||||
SAPFunctionUnit function = MetadataToolHelper.getSAPFunctionFromRepository(talendItem.getId());
|
||||
if (table != null) {
|
||||
img = ImageDescriptor.createFromFile(ECoreImage.class,
|
||||
ECoreImage.METADATA_TABLE_ICON.getPath()).createImage();
|
||||
|
||||
@@ -57,7 +57,7 @@ import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.ui.swt.actions.ITreeContextualAction;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.model.business.BusinessType;
|
||||
import org.talend.core.model.metadata.MetadataTool;
|
||||
import org.talend.core.model.metadata.MetadataToolHelper;
|
||||
import org.talend.core.model.metadata.builder.connection.MetadataTable;
|
||||
import org.talend.core.model.metadata.builder.connection.SAPFunctionUnit;
|
||||
import org.talend.core.model.properties.RoutineItem;
|
||||
@@ -187,15 +187,18 @@ public class BusinessAssignmentComposite extends AbstractTabComposite {
|
||||
|
||||
tableViewer.setCellModifier(new ICellModifier() {
|
||||
|
||||
@Override
|
||||
public boolean canModify(Object element, String property) {
|
||||
return property.equals(columnProperties[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue(Object element, String property) {
|
||||
return EmfPropertyHelper.getValue(itemPropertyDescriptor, element);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify(Object element, String property, Object value) {
|
||||
if (element instanceof TableItem) {
|
||||
TableItem tableItem = (TableItem) element;
|
||||
@@ -221,6 +224,7 @@ public class BusinessAssignmentComposite extends AbstractTabComposite {
|
||||
private void createDoubleClickListener() {
|
||||
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
|
||||
|
||||
@Override
|
||||
public void doubleClick(DoubleClickEvent event) {
|
||||
|
||||
BusinessAssignment businessAssignment = getBusinessAssignment(event.getSelection());
|
||||
@@ -254,6 +258,7 @@ public class BusinessAssignmentComposite extends AbstractTabComposite {
|
||||
private void createSelectionListener() {
|
||||
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
BusinessAssignment businessAssignment = getBusinessAssignment(event.getSelection());
|
||||
if (businessAssignment != null) {
|
||||
@@ -284,7 +289,7 @@ public class BusinessAssignmentComposite extends AbstractTabComposite {
|
||||
curNode = RepositoryNodeUtilities.getRepositoryNode(lastVersion);
|
||||
select(viewer, curNode);
|
||||
} else if (item instanceof TableMetadata) {
|
||||
MetadataTable table = MetadataTool.getMetadataTableFromRepository(item.getId());
|
||||
MetadataTable table = MetadataToolHelper.getMetadataTableFromRepository(item.getId());
|
||||
if (table != null) {
|
||||
String id = item.getId().split(" - ")[0]; //$NON-NLS-1$
|
||||
|
||||
@@ -298,8 +303,8 @@ public class BusinessAssignmentComposite extends AbstractTabComposite {
|
||||
|
||||
}
|
||||
} else if (item instanceof Query) {
|
||||
org.talend.core.model.metadata.builder.connection.Query query = MetadataTool.getQueryFromRepository(item
|
||||
.getId());
|
||||
org.talend.core.model.metadata.builder.connection.Query query = MetadataToolHelper
|
||||
.getQueryFromRepository(item.getId());
|
||||
if (query != null) {
|
||||
String id = item.getId().split(" - ")[0]; //$NON-NLS-1$
|
||||
IRepositoryView view = getRepositoryView();
|
||||
@@ -309,7 +314,7 @@ public class BusinessAssignmentComposite extends AbstractTabComposite {
|
||||
}
|
||||
|
||||
} else if (item instanceof SAPFunction) {
|
||||
SAPFunctionUnit function = MetadataTool.getSAPFunctionFromRepository(item.getId());
|
||||
SAPFunctionUnit function = MetadataToolHelper.getSAPFunctionFromRepository(item.getId());
|
||||
if (function != null) {
|
||||
IRepositoryView view = getRepositoryView();
|
||||
RepositoryNode node = RepositoryNodeUtilities.getSAPFunctionFromConnection(item.getId());
|
||||
@@ -390,6 +395,7 @@ public class BusinessAssignmentComposite extends AbstractTabComposite {
|
||||
menuMgr.setRemoveAllWhenShown(true);
|
||||
menuMgr.addMenuListener(new IMenuListener() {
|
||||
|
||||
@Override
|
||||
public void menuAboutToShow(IMenuManager mgr) {
|
||||
BusinessAssignment businessAssignment = getBusinessAssignment(tableViewer.getSelection());
|
||||
if (businessAssignment != null) {
|
||||
@@ -448,18 +454,19 @@ public class BusinessAssignmentComposite extends AbstractTabComposite {
|
||||
return repositoryNode;
|
||||
}
|
||||
} else if (item instanceof TableMetadata) {
|
||||
MetadataTable table = MetadataTool.getMetadataTableFromRepository(item.getId());
|
||||
MetadataTable table = MetadataToolHelper.getMetadataTableFromRepository(item.getId());
|
||||
if (table != null) {
|
||||
return RepositoryNodeUtilities.getMetadataTableFromConnection(item.getId());
|
||||
}
|
||||
|
||||
} else if (item instanceof Query) {
|
||||
org.talend.core.model.metadata.builder.connection.Query query = MetadataTool.getQueryFromRepository(item.getId());
|
||||
org.talend.core.model.metadata.builder.connection.Query query = MetadataToolHelper.getQueryFromRepository(item
|
||||
.getId());
|
||||
if (query != null) {
|
||||
return RepositoryNodeUtilities.getQueryFromConnection(item.getId());
|
||||
}
|
||||
} else if (item instanceof SAPFunction) {
|
||||
SAPFunctionUnit function = MetadataTool.getSAPFunctionFromRepository(item.getId());
|
||||
SAPFunctionUnit function = MetadataToolHelper.getSAPFunctionFromRepository(item.getId());
|
||||
if (function != null) {
|
||||
return RepositoryNodeUtilities.getSAPFunctionFromConnection(item.getId());
|
||||
}
|
||||
@@ -518,6 +525,7 @@ public class BusinessAssignmentComposite extends AbstractTabComposite {
|
||||
private void createKeyListener(Table table) {
|
||||
table.addKeyListener(new KeyAdapter() {
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent event) {
|
||||
ISelection selection = tableViewer.getSelection();
|
||||
if (selection instanceof IStructuredSelection) {
|
||||
@@ -558,4 +566,12 @@ public class BusinessAssignmentComposite extends AbstractTabComposite {
|
||||
return new StructuredSelection(repositoryNode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
super.refresh();
|
||||
if (tableViewer != null) {
|
||||
tableViewer.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
prefs.configuration.LINK_STYLE.AUTO=Automatisch
|
||||
prefs.configuration.LINK_STYLE.BEZIER_CURVE=Rondingen
|
||||
prefs.configuration.LINK_STYLE.LINE=Lijnen (snel)
|
||||
FAMILY.Access=Toegang
|
||||
FAMILY.Connections=Verbindingen
|
||||
7
org.talend.designer.codegen.test/.classpath
Normal file
7
org.talend.designer.codegen.test/.classpath
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="output" path="class"/>
|
||||
</classpath>
|
||||
28
org.talend.designer.codegen.test/.project
Normal file
28
org.talend.designer.codegen.test/.project
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.talend.designer.codegen.test</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,7 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
8
org.talend.designer.codegen.test/META-INF/MANIFEST.MF
Normal file
8
org.talend.designer.codegen.test/META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,8 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Test
|
||||
Bundle-SymbolicName: org.talend.designer.codegen.test
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Fragment-Host: org.talend.designer.codegen;bundle-version="2.2.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Require-Bundle: org.junit4
|
||||
4
org.talend.designer.codegen.test/build.properties
Normal file
4
org.talend.designer.codegen.test/build.properties
Normal file
@@ -0,0 +1,4 @@
|
||||
source.. = src/main/java/
|
||||
output.. = class/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
@@ -0,0 +1,53 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.designer.codegen.junit;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.talend.designer.codegen.model.CodeGeneratorEmittersPoolFactory;
|
||||
|
||||
/**
|
||||
* created by nrousseau on Jul 25, 2012 Detailled comment
|
||||
*
|
||||
*/
|
||||
public class JUnitStudioStartup {
|
||||
|
||||
private static final long ONE_MINUTE_IN_MILLISEC = 60000;
|
||||
|
||||
private static final long INIT_TIMEOUT = ONE_MINUTE_IN_MILLISEC * 10;
|
||||
|
||||
private static final long INIT_PAUSE = 100;
|
||||
|
||||
private final SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd-HH:mm:ss");
|
||||
|
||||
@Test
|
||||
public void test() throws InterruptedException {
|
||||
System.out.println("|" + format.format(new Date()) + "| Wait for full generation of jet emitters");
|
||||
long startTimer = System.currentTimeMillis();
|
||||
long endTimer = startTimer;
|
||||
while ((!CodeGeneratorEmittersPoolFactory.isInitialized()) && ((endTimer - startTimer) < INIT_TIMEOUT)) {
|
||||
Thread.sleep(INIT_PAUSE);
|
||||
endTimer = System.currentTimeMillis();
|
||||
}
|
||||
if ((endTimer - startTimer) > INIT_TIMEOUT) {
|
||||
System.out.println("|" + format.format(new Date())
|
||||
+ "| Timeout when generate jet emitters (10 minutes), will just continue with standards junits");
|
||||
} else {
|
||||
System.out.println("|" + format.format(new Date())
|
||||
+ "| Jet emitters initialized successfully, will proceed to standards junits");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,8 +6,10 @@
|
||||
org.talend.core.model.process.EConnectionType
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
org.talend.core.model.utils.JavaResourcesHelper
|
||||
java.util.Vector
|
||||
java.util.List
|
||||
java.util.Map
|
||||
"
|
||||
%>
|
||||
<%
|
||||
@@ -15,63 +17,107 @@
|
||||
Vector v = (Vector) codeGenArgument.getArgument();
|
||||
IProcess process = (IProcess)v.get(0);
|
||||
|
||||
String jobFolderName = JavaResourcesHelper.getJobFolderName(process.getName(), process.getVersion());
|
||||
String packageName = codeGenArgument.getCurrentProjectName().toLowerCase() + "." + jobFolderName;
|
||||
|
||||
boolean stats = codeGenArgument.isStatistics();
|
||||
%>
|
||||
|
||||
}
|
||||
};
|
||||
getCamelContexts().get(0).addRoutes(routeBuilder);
|
||||
}
|
||||
|
||||
|
||||
protected void doStop() throws Exception {
|
||||
super.doStop();
|
||||
getCamelContexts().get(0).stop();
|
||||
}
|
||||
|
||||
protected org.apache.camel.ProducerTemplate findOrCreateCamelTemplate() {
|
||||
return getCamelContexts().get(0).createProducerTemplate();
|
||||
}
|
||||
|
||||
protected java.util.Map<String, org.apache.camel.CamelContext> getCamelContextMap() {
|
||||
java.util.Map<String, org.apache.camel.CamelContext> answer = new java.util.HashMap<String, org.apache.camel.CamelContext>();
|
||||
org.apache.camel.impl.DefaultCamelContext camelContext;
|
||||
org.apache.camel.spi.TypeConverterRegistry typeConverterRegistry;
|
||||
/**
|
||||
* create a fully configured CameContext and add into map
|
||||
* the Registry of it is #TalendRouteRegistry
|
||||
* @return
|
||||
* <code>key: <%=process.getName()%>-ctx<code>
|
||||
* <code>value: DefaultCamelContext<code>
|
||||
*
|
||||
*/
|
||||
public Map<String, CamelContext> getCamelContextMap() {
|
||||
Map<String,CamelContext> answer = new HashMap<String, CamelContext>();
|
||||
DefaultCamelContext camelContext = camelContext();
|
||||
<%
|
||||
//process cConfig components first
|
||||
List<? extends INode> camelContextNodes = process.getNodesOfType("cConfig");
|
||||
for(INode node: camelContextNodes){
|
||||
%>
|
||||
<%=ElementParameterParser.getValue(node, "__CODE__")%>
|
||||
<%
|
||||
boolean startable = false;
|
||||
for (INode node : (List< ? extends INode>)process.getGraphicalNodes()) {
|
||||
Object value = node.getPropertyValue("STARTABLE");
|
||||
startable = value == null? false:(Boolean)value;
|
||||
if(startable){
|
||||
break;
|
||||
}
|
||||
%>
|
||||
TalendRouteRegistry contextRegister = new TalendRouteRegistry(camelContext.getRegistry());
|
||||
camelContext.setRegistry(contextRegister);
|
||||
<%
|
||||
//then process cBeanRegister components
|
||||
List<? extends INode> beanRegisterNodes = process.getNodesOfType("cBeanRegister");
|
||||
if(beanRegisterNodes != null && beanRegisterNodes.size()>0){
|
||||
for(INode node: beanRegisterNodes){
|
||||
String id = ElementParameterParser.getValue(node, "__ID__");
|
||||
String isSimple = ElementParameterParser.getValue(node, "__SIMPLE_CONFIG__");
|
||||
String classQualifiedName = ElementParameterParser.getValue(node, "__CLASS_QUALIFIED_NAME__");
|
||||
String hasArguments = ElementParameterParser.getValue(node, "__SPECIFY_ARGUMENTS__");
|
||||
List<Map<String, String>> arguments = (List<Map<String, String>>) ElementParameterParser.getObjectValue(node, "__ARGUMENTS__");
|
||||
|
||||
String code = ElementParameterParser.getValue(node, "__CODE__");
|
||||
|
||||
if("true".equals(isSimple)){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if("true".equals(hasArguments)){
|
||||
for(Map<String, String> s: arguments){
|
||||
if(sb.length() == 0){
|
||||
sb.append(s.get("VALUE"));
|
||||
}else{
|
||||
sb.append(",");
|
||||
sb.append(s.get("VALUE"));
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
contextRegister.register(<%=id%>, new <%=classQualifiedName%>(<%=sb.toString()%>));
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
{
|
||||
Object beanInstance = null;
|
||||
<%=code%>
|
||||
if(beanInstance != null){
|
||||
contextRegister.register(<%=id%>, beanInstance);
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (startable) {
|
||||
%>
|
||||
if (bundleContext != null) {
|
||||
org.apache.camel.osgi.CamelContextFactory factory = new org.apache.camel.osgi.CamelContextFactory();
|
||||
factory.setBundleContext(bundleContext);
|
||||
camelContext = factory.createContext();
|
||||
bundleContext.registerService(org.apache.camel.CamelContext.class.getName(), camelContext, null);
|
||||
} else {
|
||||
camelContext = new org.apache.camel.impl.DefaultCamelContext();
|
||||
//after, process cDataset
|
||||
List<? extends INode> datasetNodes = process.getNodesOfType("cDataset");
|
||||
for(INode n: datasetNodes){
|
||||
String beanID = ElementParameterParser.getValue(n, "__DATASET_NAME__");
|
||||
String registerNewBean = ElementParameterParser.getValue(n, "__REGISTER_DATASET_BEAN__");
|
||||
if(!"true".equals(registerNewBean)){
|
||||
continue;
|
||||
}
|
||||
String beanClass = ElementParameterParser.getValue(n, "__BEAN_CLASS__");
|
||||
List<Map<String, String>> beanArguments = (List<Map<String, String>>) ElementParameterParser.getObjectValue(n, "__BEAN_ARGUMENTS__");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if(beanArguments != null){
|
||||
for(Map<String,String> map: beanArguments){
|
||||
if(sb.length() == 0){
|
||||
sb.append(map.get("VALUE"));
|
||||
}else{
|
||||
sb.append(",");
|
||||
sb.append(map.get("VALUE"));
|
||||
}
|
||||
}
|
||||
}
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
camelContext = new org.apache.camel.impl.DefaultCamelContext();
|
||||
contextRegister.register(<%=beanID%>, new <%=beanClass%>(<%=sb.toString()%>));
|
||||
<%
|
||||
}
|
||||
%>
|
||||
typeConverterRegistry = camelContext.getTypeConverterRegistry();
|
||||
<%
|
||||
//cJMSConnectionFactory http://jira.talendforge.org/browse/TESB-4860
|
||||
List<? extends INode> jmsCFNodes = process.getNodesOfType("cJMSConnectionFactory");
|
||||
if(jmsCFNodes.size()>0){
|
||||
%>
|
||||
javax.jms.ConnectionFactory jmsConnectionFactory = null;
|
||||
<% }
|
||||
for(INode node: jmsCFNodes){
|
||||
//Use transaction http://jira.talendforge.org/browse/TESB-5160 By LiXiaopeng
|
||||
String useTransaction = ElementParameterParser.getValue(node, "__USE_TRANSACTION__");
|
||||
@@ -94,7 +140,8 @@
|
||||
String amqUri = ElementParameterParser.getValue(node, "__AMQ_BROKER_URI__").trim();
|
||||
|
||||
%>
|
||||
jmsConnectionFactory = new org.apache.activemq.ActiveMQConnectionFactory(<%=amqUri%>);
|
||||
{
|
||||
javax.jms.ConnectionFactory jmsConnectionFactory = new org.apache.activemq.ActiveMQConnectionFactory(<%=amqUri%>);
|
||||
<%
|
||||
String amqPool = ElementParameterParser.getValue(node, "__AMQ_POOL__").trim();
|
||||
if("true".equals(amqPool)){
|
||||
@@ -131,7 +178,7 @@
|
||||
org.apache.activemq.pool.PooledConnectionFactory pooledConnectionFactory_<%=node.getUniqueName()%>
|
||||
= new org.apache.activemq.pool.PooledConnectionFactory();
|
||||
pooledConnectionFactory_<%=node.getUniqueName()%>.setConnectionFactory(jmsConnectionFactory);
|
||||
pooledConnectionFactory_<%=node.getUniqueName()%>.setExpiryTimeout(<%=amq_pool_expiry_timeout%>);
|
||||
pooledConnectionFactory_<%=node.getUniqueName()%>.setExpiryTimeout(<%=amq_pool_expiry_timeout%>L);
|
||||
pooledConnectionFactory_<%=node.getUniqueName()%>.setIdleTimeout(<%=amq_pool_idle_timeout%>);
|
||||
pooledConnectionFactory_<%=node.getUniqueName()%>.setMaxConnections(<%=amq_pool_max_connections%>);
|
||||
pooledConnectionFactory_<%=node.getUniqueName()%>.setMaximumActive(<%=amq_pool_max_active%>);
|
||||
@@ -145,6 +192,9 @@
|
||||
org.apache.camel.component.jms.JmsComponent.jmsComponent<%=transactedMethodStr%>(jmsConnectionFactory));
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
}else if("WebSphere MQ".equals(mqType)){
|
||||
String wmqServer = ElementParameterParser.getValue(node, "__WQM_SEVER__");
|
||||
String wmqPort = ElementParameterParser.getValue(node, "__WMQ_PORT__");
|
||||
@@ -170,7 +220,8 @@
|
||||
}
|
||||
|
||||
%>
|
||||
jmsConnectionFactory = new com.ibm.mq.jms.MQQueueConnectionFactory();
|
||||
{
|
||||
javax.jms.ConnectionFactory jmsConnectionFactory = new com.ibm.mq.jms.MQQueueConnectionFactory();
|
||||
((com.ibm.mq.jms.MQConnectionFactory) jmsConnectionFactory).setHostName(<%=wmqServer%>);
|
||||
try {
|
||||
((com.ibm.mq.jms.MQConnectionFactory) jmsConnectionFactory).setPort(<%=wmqPort%>);
|
||||
@@ -197,23 +248,22 @@
|
||||
org.apache.camel.component.jms.JmsComponent.jmsComponent<%=transactedMethodStr%>(connectionFactoryAdapter<%=node.getUniqueName()%>));
|
||||
<%
|
||||
}
|
||||
|
||||
%>
|
||||
}
|
||||
<%
|
||||
}else if("Other".equals(mqType)){
|
||||
%>
|
||||
<%=ElementParameterParser.getValue(node, "__OTHER_CODE__")%>
|
||||
camelContext.addComponent(<%=name%>,
|
||||
org.apache.camel.component.jms.JmsComponent.jmsComponent<%=transactedMethodStr%>(jmsConnectionFactory));
|
||||
{
|
||||
javax.jms.ConnectionFactory jmsConnectionFactory;
|
||||
<%=ElementParameterParser.getValue(node, "__OTHER_CODE__")%>
|
||||
camelContext.addComponent(<%=name%>,
|
||||
org.apache.camel.component.jms.JmsComponent.jmsComponent<%=transactedMethodStr%>(jmsConnectionFactory));
|
||||
}
|
||||
<%
|
||||
}
|
||||
|
||||
}
|
||||
//cConfig
|
||||
List<? extends INode> camelContextNodes = process.getNodesOfType("cConfig");
|
||||
for(INode node: camelContextNodes){
|
||||
%>
|
||||
<%=ElementParameterParser.getValue(node, "__CODE__")%>
|
||||
<%
|
||||
}
|
||||
|
||||
//http://jira.talendforge.org/browse/TESB-4087: Change CamelContext name
|
||||
%>
|
||||
//using Route name as CamelContext ID
|
||||
@@ -221,36 +271,40 @@
|
||||
camelContext.setName("<%=process.getName() + "-ctx"%>");
|
||||
return answer;
|
||||
}
|
||||
|
||||
protected org.apache.camel.view.ModelFileGenerator createModelFileGenerator()
|
||||
throws javax.xml.bind.JAXBException {
|
||||
return null;
|
||||
|
||||
/**
|
||||
* create a simple DefaultCamelContext
|
||||
* please use #getCamelContextMap() to get a fully configured CamelContext
|
||||
* @return DefaultCamelContext
|
||||
*/
|
||||
public DefaultCamelContext camelContext() {
|
||||
DefaultCamelContext camelContext;
|
||||
<%
|
||||
boolean startable = false;
|
||||
for (INode node : (List< ? extends INode>)process.getGraphicalNodes()) {
|
||||
Object value = node.getPropertyValue("STARTABLE");
|
||||
startable = value == null? false:(Boolean)value;
|
||||
if(startable){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (startable) {
|
||||
%>
|
||||
if (bundleContext != null) {
|
||||
CamelContextFactory factory = new CamelContextFactory();
|
||||
factory.setBundleContext(bundleContext);
|
||||
camelContext = factory.createContext();
|
||||
bundleContext.registerService(CamelContext.class.getName(), camelContext, null);
|
||||
} else {
|
||||
camelContext = new DefaultCamelContext();
|
||||
}
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
camelContext = new DefaultCamelContext();
|
||||
<%
|
||||
}
|
||||
%>
|
||||
return camelContext;
|
||||
}
|
||||
}
|
||||
|
||||
final CamelImpl camelImplementation = new CamelImpl();
|
||||
if(start){
|
||||
stopDelegate = new TalendESBRoute() {
|
||||
|
||||
public int runJobInTOS(String[] args) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String[][] runJob(String[] args) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void stop() throws Exception {
|
||||
camelImplementation.stop();
|
||||
}
|
||||
|
||||
public void shutdown() throws Exception {
|
||||
camelImplementation.shutdown();
|
||||
}
|
||||
};
|
||||
camelImplementation.enableHangupSupport();
|
||||
camelImplementation.run();
|
||||
}
|
||||
return routeBuilder;
|
||||
|
||||
}
|
||||
@@ -42,101 +42,21 @@
|
||||
|
||||
List< ? extends INode> processNodes = (List< ? extends INode>)process.getGeneratingNodes();
|
||||
%>
|
||||
|
||||
class CamelImpl extends org.apache.camel.impl.MainSupport {
|
||||
protected CamelImpl instance;
|
||||
|
||||
public CamelImpl() {
|
||||
try {
|
||||
postProcessContext();
|
||||
initRoute();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the currently executing main
|
||||
*
|
||||
* @return the current running instance
|
||||
*/
|
||||
public CamelImpl getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
protected void doStart() throws Exception {
|
||||
super.doStart();
|
||||
|
||||
org.apache.camel.management.JmxNotificationEventNotifier notifier = new org.apache.camel.management.JmxNotificationEventNotifier();
|
||||
notifier.setSource("MyCamel");
|
||||
notifier.setIgnoreCamelContextEvents(true);
|
||||
notifier.setIgnoreRouteEvents(true);
|
||||
notifier.setIgnoreServiceEvents(true);
|
||||
|
||||
getCamelContexts().get(0).getManagementStrategy().addEventNotifier(notifier);
|
||||
|
||||
java.net.URLClassLoader sysloader = (java.net.URLClassLoader) ClassLoader.getSystemClassLoader();
|
||||
java.lang.reflect.Method method = java.net.URLClassLoader.class.getDeclaredMethod("addURL", new Class[] { java.net.URL.class });
|
||||
method.setAccessible(true);
|
||||
String[] libPaths = new String[] {
|
||||
|
||||
|
||||
<%
|
||||
for (INode node : processNodes) {
|
||||
if (node.isActivate()) {
|
||||
if (node.getComponent().getName().equals("cMessagingEndpoint")) {
|
||||
List<Map<String, String>> dependencies = (List<Map<String,String>>) ElementParameterParser.getObjectValue(node, "__HOTLIBS__");
|
||||
for(Map<String, String> dependencie : dependencies){
|
||||
String librarieJar = dependencie.get("LIBPATH"); %>
|
||||
"<%=librarieJar %>",
|
||||
<% }
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
};
|
||||
for (String lib : libPaths) {
|
||||
String separator = System.getProperty("path.separator");
|
||||
String[] jarFiles = lib.split(separator);
|
||||
for (String jarFile : jarFiles) {
|
||||
method.invoke(sysloader, new Object[] { new java.io.File(jarFile).toURL() });
|
||||
}
|
||||
}
|
||||
|
||||
getCamelContexts().get(0).start();
|
||||
|
||||
|
||||
<% if(stats) { %>
|
||||
|
||||
CamelStat runStat = new CamelStat(getCamelContexts().get(0));
|
||||
|
||||
runStat.setParams();
|
||||
|
||||
runStat.openSocket(true);
|
||||
runStat.setAllPID(rootPid, fatherPid, pid, jobName);
|
||||
runStat.startThreadStat(clientHost, portStats);
|
||||
runStat.updateStatOnJob(RunStat.JOBSTART, "");
|
||||
|
||||
MyStatThread statsThread = new MyStatThread(runStat);
|
||||
statsThread.run();
|
||||
<% } //if stats %>
|
||||
|
||||
}
|
||||
|
||||
public void initRoute() throws Exception {
|
||||
routeBuilder = new org.apache.camel.builder.RouteBuilder() {
|
||||
return new RouteBuilder() {
|
||||
public void configure() throws Exception {
|
||||
<%
|
||||
for (INode node : processNodes) {
|
||||
if (node.getComponent().getName().equals("cCXF")) {
|
||||
IElementParameter param = node.getElementParameter("LABEL");
|
||||
String cid = "";
|
||||
if (param != null && !"__UNIQUE_NAME__".equals(param.getValue())) {
|
||||
cid = (String)param.getValue();
|
||||
} else {
|
||||
cid = node.getUniqueName();
|
||||
String cid = node.getUniqueName();
|
||||
// http://jira.talendforge.org/browse/TESB-5241
|
||||
/*
|
||||
* change to use label + unique to make it unique but readable
|
||||
*/
|
||||
if(param != null && !"__UNIQUE_NAME__".equals(param.getValue())){
|
||||
cid = (String)param.getValue()+"_"+cid;
|
||||
}
|
||||
String endpointVar = "endpoint" + cid;
|
||||
String endpointVar = "endpoint_" + node.getUniqueName();
|
||||
String uriRef = "uriMap.get(\"" + cid + "\")";
|
||||
%>
|
||||
// CXF endpoint for <%=cid%>
|
||||
@@ -180,7 +100,7 @@ for (INode node : processNodes) {
|
||||
}
|
||||
//http://jira.talendforge.org/browse/TESB-3850
|
||||
String formatType = ElementParameterParser.getValue(node, "__DATAFORMAT__");
|
||||
if ("true".equals(useSAM) && !"MESSAGE".equals(formatType)) {
|
||||
if ("true".equals(useSAM) && !"RAW".equals(formatType)) {
|
||||
%>
|
||||
// Add Service Activity Monitor Service to <%=endpointVar%>
|
||||
if (eventFeature != null) {
|
||||
|
||||
@@ -32,9 +32,19 @@ INode node = (INode) codeGenArgument.getArgument();
|
||||
List< ? extends IConnection> connsIf = node.getIncomingConnections();
|
||||
if(connsIf.size()>0) {
|
||||
if(connsIf.get(0).getLineStyle()==EConnectionType.ROUTE_WHEN) {
|
||||
INode sourceNode = connsIf.get(0).getSource();
|
||||
String languageType = connsIf.get(0).getRouteConnectionType();
|
||||
String condition = connsIf.get(0).getCondition();
|
||||
String expression = "none".equals(languageType)?condition:languageType+"("+condition+")";
|
||||
if("cIntercept".equals(sourceNode.getComponent().getName())){
|
||||
%>
|
||||
.when().<%=connsIf.get(0).getRouteConnectionType()%>(<%=connsIf.get(0).getCondition()%>)
|
||||
.when(<%=expression%>)
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
.when().<%=expression%>
|
||||
<%
|
||||
}
|
||||
} else if(connsIf.get(0).getLineStyle()==EConnectionType.ROUTE_OTHER) {
|
||||
%>
|
||||
.otherwise()
|
||||
|
||||
@@ -144,9 +144,14 @@ currentComponent="<%=node.getUniqueName() %>";
|
||||
if ((codePart.equals(ECodePart.BEGIN))&&(stat)&&connSet.size()>0) {
|
||||
for(IConnection con:connSet){
|
||||
%>
|
||||
if(execStat){
|
||||
runStat.updateStatOnConnection("<%=con.getUniqueName() %>"+iterateId,0, 0);
|
||||
}
|
||||
|
||||
if (execStat) {
|
||||
java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_<%=con.getUniqueName() %> = (java.util.concurrent.ConcurrentHashMap) globalMap.get("concurrentHashMap");
|
||||
concurrentHashMap_<%=con.getUniqueName() %>.putIfAbsent("<%=con.getUniqueName() %>" + iterateLoop,new java.util.concurrent.atomic.AtomicInteger(0));
|
||||
java.util.concurrent.atomic.AtomicInteger stats_<%=con.getUniqueName() %> = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_<%=con.getUniqueName() %>.get("<%=con.getUniqueName() %>" + iterateLoop);
|
||||
runStat.updateStatOnConnection("<%=con.getUniqueName() %>" + iterateId, stats_<%=con.getUniqueName() %>.incrementAndGet()<=1?0:1, 0);
|
||||
}
|
||||
|
||||
<% }
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@ import org.talend.core.model.process.INode;
|
||||
|
||||
public class CLASS
|
||||
{
|
||||
private static String end_multiThread = "((java.util.Map) threadLocal.get()).put(\"status\", \"end\");";
|
||||
private static String end_multiThread = "if ( !\"failure\".equals(((java.util.Map)threadLocal.get()).get(\"status\")) ) {\n((java.util.Map) threadLocal.get()).put(\"status\", \"end\");\n}";
|
||||
private static String end_singleThread = "if(!\"failure\".equals(status)) { status = \"end\"; }";
|
||||
private static String failure_multiThread = "((java.util.Map) threadLocal.get()).put(\"status\", \"failure\");";
|
||||
private static String failure_singleThread = "status = \"failure\";";
|
||||
@@ -29,11 +29,11 @@ public class CLASS
|
||||
|
||||
toReturn += "\n}catch (TalendException e_" + rootNode.getUniqueName() + ") {\n";
|
||||
|
||||
if(isMultiThread) {
|
||||
toReturn += failure_multiThread;
|
||||
}else{
|
||||
toReturn += failure_singleThread;
|
||||
}
|
||||
// if(isMultiThread) {
|
||||
// toReturn += failure_multiThread;
|
||||
// }else{
|
||||
// toReturn += failure_singleThread;
|
||||
// }
|
||||
|
||||
toReturn += "\ne_" + rootNode.getUniqueName() + ".printStackTrace();\n";
|
||||
|
||||
@@ -45,7 +45,12 @@ public class CLASS
|
||||
// toReturn += createCallProcess(conn.getTarget(), className, isMultiThread);
|
||||
// }
|
||||
//}
|
||||
toReturn += "\n}finally {\n}";
|
||||
if(isMultiThread){
|
||||
toReturn += "\n}catch (Error e_" + rootNode.getUniqueName() + ") {\n";
|
||||
toReturn += "\ne_" + rootNode.getUniqueName() + ".printStackTrace();\n";
|
||||
toReturn += "globalMap.put(\""+rootNode.getUniqueName()+ "_SUBPROCESS_STATE\", -1);\n";
|
||||
}
|
||||
toReturn += "\n}";
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,20 +2,14 @@
|
||||
package="org.talend.designer.codegen.translators"
|
||||
imports="
|
||||
org.talend.core.model.process.IProcess
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
org.talend.core.CorePlugin
|
||||
org.talend.core.model.process.EConnectionType
|
||||
org.talend.core.model.process.IConnection
|
||||
org.talend.core.model.metadata.IMetadataTable
|
||||
org.talend.core.model.metadata.IMetadataColumn
|
||||
java.util.Vector
|
||||
java.util.List
|
||||
java.util.ArrayList
|
||||
org.talend.core.model.process.IContextParameter
|
||||
org.talend.core.model.metadata.types.JavaTypesManager
|
||||
org.talend.core.model.metadata.types.JavaType
|
||||
org.talend.core.model.utils.JavaResourcesHelper
|
||||
java.util.Map
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
"
|
||||
class="Footer"
|
||||
@@ -25,7 +19,8 @@
|
||||
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
|
||||
Vector v = (Vector) codeGenArgument.getArgument();
|
||||
IProcess process = (IProcess)v.get(0);
|
||||
|
||||
|
||||
List<? extends INode> processNodes = (List<? extends INode>) process.getGeneratingNodes();
|
||||
List<IContextParameter> params = new ArrayList<IContextParameter>();
|
||||
params=process.getContextManager().getDefaultContext().getContextParameterList();
|
||||
String jobFolderName = JavaResourcesHelper.getJobFolderName(process.getName(), process.getVersion());
|
||||
@@ -33,6 +28,195 @@
|
||||
boolean stats = codeGenArgument.isStatistics();
|
||||
|
||||
%>
|
||||
|
||||
protected void doStart() throws Exception {
|
||||
// init uriMap first
|
||||
initUriMap();
|
||||
|
||||
//add route
|
||||
addRouteBuilder(route());
|
||||
|
||||
//prepare camel contexts
|
||||
super.doStart();
|
||||
postProcessContext();
|
||||
|
||||
//add jmx notification
|
||||
JmxNotificationEventNotifier notifier = new JmxNotificationEventNotifier();
|
||||
notifier.setSource("MyCamel");
|
||||
notifier.setIgnoreCamelContextEvents(true);
|
||||
notifier.setIgnoreRouteEvents(true);
|
||||
notifier.setIgnoreServiceEvents(true);
|
||||
|
||||
getCamelContexts().get(0).getManagementStrategy().addEventNotifier(notifier);
|
||||
|
||||
<%
|
||||
StringBuilder librariesSb = new StringBuilder();
|
||||
for (INode node : processNodes) {
|
||||
if (node.isActivate()) {
|
||||
if (node.getComponent().getName().equals("cMessagingEndpoint")) {
|
||||
List<Map<String, String>> dependencies = (List<Map<String,String>>) ElementParameterParser.getObjectValue(node, "__HOTLIBS__");
|
||||
for(Map<String, String> dependencie : dependencies){
|
||||
String librarieJar = dependencie.get("LIBPATH");
|
||||
librariesSb.append("\"");
|
||||
librariesSb.append(librarieJar);
|
||||
librariesSb.append("\",");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(librariesSb.length()>0){
|
||||
%>
|
||||
// add external libraries
|
||||
java.net.URLClassLoader sysloader = (java.net.URLClassLoader) ClassLoader.getSystemClassLoader();
|
||||
java.lang.reflect.Method method = java.net.URLClassLoader.class.getDeclaredMethod("addURL", new Class[] { java.net.URL.class });
|
||||
method.setAccessible(true);
|
||||
String[] libPaths = new String[] {<%=librariesSb.toString()%>};
|
||||
for (String lib : libPaths) {
|
||||
String separator = System.getProperty("path.separator");
|
||||
String[] jarFiles = lib.split(separator);
|
||||
for (String jarFile : jarFiles) {
|
||||
method.invoke(sysloader, new Object[] { new java.io.File(jarFile).toURL() });
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
//start camel context
|
||||
getCamelContexts().get(0).start();
|
||||
|
||||
|
||||
<% if(stats) { %>
|
||||
|
||||
// add statistics which shows on the connection
|
||||
routines.system.CamelStat runStat = new routines.system.CamelStat(getCamelContexts().get(0));
|
||||
|
||||
runStat.setParams();
|
||||
|
||||
runStat.openSocket(true);
|
||||
runStat.setAllPID(rootPid, fatherPid, pid, jobName);
|
||||
runStat.startThreadStat(clientHost, portStats);
|
||||
runStat.updateStatOnJob(routines.system.RunStat.JOBSTART, "");
|
||||
|
||||
new Thread(new MyStatThread(runStat)).start();
|
||||
<% } //if stats %>
|
||||
|
||||
}
|
||||
|
||||
protected void doStop() throws Exception {
|
||||
super.doStop();
|
||||
getCamelContexts().get(0).stop();
|
||||
}
|
||||
|
||||
protected ProducerTemplate findOrCreateCamelTemplate() {
|
||||
return getCamelContexts().get(0).createProducerTemplate();
|
||||
}
|
||||
|
||||
public void stop() throws Exception {
|
||||
super.stop();
|
||||
}
|
||||
|
||||
public void shutdown() throws Exception {
|
||||
super.shutdown();
|
||||
}
|
||||
|
||||
protected ModelFileGenerator createModelFileGenerator()
|
||||
throws JAXBException {
|
||||
return null;
|
||||
}
|
||||
<% if(stats) { %>
|
||||
|
||||
class MyStatThread implements Runnable {
|
||||
|
||||
routines.system.CamelStat stats;
|
||||
boolean isFinished;
|
||||
|
||||
public MyStatThread(routines.system.CamelStat stats) {
|
||||
this.stats = stats;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
while (true) {
|
||||
try {
|
||||
<%
|
||||
for (INode node : processNodes) {
|
||||
if (node.isActivate()) {
|
||||
for(int i=0; i<node.getIncomingConnections().size(); i++) {
|
||||
%>
|
||||
stats.updateStatOnConnection("<%=node.getIncomingConnections().get(i).getUniqueName()%>", 1, "<%=node.getUniqueName()%>");
|
||||
<%
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
Thread.sleep(1000);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
<% } //if stats %>
|
||||
|
||||
|
||||
private Properties defaultProps = new Properties();
|
||||
|
||||
public class ContextProperties extends Properties {
|
||||
|
||||
public ContextProperties(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
public ContextProperties() {
|
||||
super();
|
||||
}
|
||||
|
||||
public void synchronizeContext() {
|
||||
<% for (IContextParameter ctxParam : params){
|
||||
String cParaName = ctxParam.getName(); %>
|
||||
if(<%=cParaName %> != null){
|
||||
<% if(ctxParam.getType().equals("id_Date")){ %>
|
||||
String pattern_<%=cParaName %> = "yyyy-MM-dd HH:mm:ss";
|
||||
String value_<%=cParaName %> = "<%=ctxParam.getValue() %>";
|
||||
String[] parts_<%=cParaName %> = value_<%=cParaName %>.split(";");
|
||||
if (parts_<%=cParaName %>.length > 1) {
|
||||
pattern_<%=cParaName %> = parts_<%=cParaName %>[0];
|
||||
this.setProperty("<%=cParaName %>", pattern_<%=cParaName %> + ";" + FormatterUtils.format_Date(<%=cParaName %>, pattern_<%=cParaName %>));
|
||||
} else {
|
||||
this.setProperty("<%=cParaName %>", FormatterUtils.format_Date(<%=cParaName %>, pattern_<%=cParaName %>));
|
||||
}
|
||||
<% } else { %>
|
||||
this.setProperty("<%=cParaName %>", <%=cParaName %>.toString());
|
||||
<% } %>
|
||||
}
|
||||
<% } %>
|
||||
}
|
||||
|
||||
<%
|
||||
for (IContextParameter ctxParam : params) {
|
||||
if(ctxParam.getType().equals("id_List Of Value") || ctxParam.getType().equals("id_File") || ctxParam.getType().equals("id_Directory")) { %>
|
||||
public String <%=ctxParam.getName()%>;
|
||||
public String get<%=Character.toUpperCase(ctxParam.getName().charAt(0)) + ctxParam.getName().substring(1)%>() {
|
||||
return this.<%=ctxParam.getName()%>;
|
||||
}
|
||||
<% } else { %>
|
||||
public <%=JavaTypesManager.getTypeToGenerate(ctxParam.getType(),true)%> <%=ctxParam.getName()%>;
|
||||
public <%=JavaTypesManager.getTypeToGenerate(ctxParam.getType(),true)%> get<%=Character.toUpperCase(ctxParam.getName().charAt(0)) + ctxParam.getName().substring(1)%>() {
|
||||
return this.<%=ctxParam.getName()%>;
|
||||
}
|
||||
<% }
|
||||
}
|
||||
%>
|
||||
}
|
||||
|
||||
private ContextProperties context = new ContextProperties();
|
||||
public ContextProperties getContext() {
|
||||
return this.context;
|
||||
}
|
||||
|
||||
private final String jobVersion = "<%=process.getVersion() %>";
|
||||
private final String jobName = "<%=codeGenArgument.getJobName() %>";
|
||||
private final String projectName = "<%=codeGenArgument.getCurrentProjectName() %>";
|
||||
|
||||
public Integer errorCode = null;
|
||||
public String resuming_logs_dir_path = null;
|
||||
public String resuming_checkpoint_path = null;
|
||||
public String parent_part_launcher = null;
|
||||
@@ -56,8 +240,8 @@
|
||||
|
||||
private boolean execStat = true;
|
||||
|
||||
private java.util.Properties context_param = new java.util.Properties();
|
||||
public java.util.Map<String, Object> parentContextMap = new java.util.HashMap<String, Object>();
|
||||
private Properties context_param = new Properties();
|
||||
public Map<String, Object> parentContextMap = new HashMap<String, Object>();
|
||||
|
||||
public static void main(String[] args){
|
||||
final <%=process.getName() %> <%=process.getName() %>Class = new <%=process.getName() %>();
|
||||
@@ -123,10 +307,27 @@
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
//read context values
|
||||
readContextValues(contextStr);
|
||||
|
||||
try {
|
||||
java.io.InputStream inContext = <%=process.getName()%>.class.getClassLoader().getResourceAsStream("<%=codeGenArgument.getCurrentProjectName().toLowerCase() %>/<%=jobFolderName %>/contexts/"+contextStr+".properties");
|
||||
run();
|
||||
} catch (Exception e) {
|
||||
System.err.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* read context values from specified context
|
||||
* @parameter contextName : the name of context while will be used
|
||||
*/
|
||||
public void readContextValues(String contextName){
|
||||
|
||||
try {
|
||||
java.io.InputStream inContext = <%=process.getName()%>.class.getClassLoader().getResourceAsStream("<%=codeGenArgument.getCurrentProjectName().toLowerCase() %>/<%=jobFolderName %>/contexts/"+contextName+".properties");
|
||||
|
||||
if (inContext!=null) {
|
||||
//defaultProps is in order to keep the original context value
|
||||
@@ -135,22 +336,21 @@
|
||||
context = new ContextProperties(defaultProps);
|
||||
}else{
|
||||
//print info and job continue to run, for case: context_param is not empty.
|
||||
System.err.println("Could not find the context " + contextStr);
|
||||
System.err.println("Could not find the context " + contextName);
|
||||
}
|
||||
|
||||
if(!context_param.isEmpty()) {
|
||||
context.putAll(context_param);
|
||||
}
|
||||
<%
|
||||
for (IContextParameter ctxParam :params)
|
||||
{
|
||||
//for bug TDI-22398
|
||||
for (IContextParameter ctxParam :params){ //start for
|
||||
String typeToGenerate ="String";
|
||||
if( !(ctxParam.getType().equals("id_File") || ctxParam.getType().equals("id_Directory") ||ctxParam.getType().equals("id_List Of Value")))
|
||||
{
|
||||
typeToGenerate=JavaTypesManager.getTypeToGenerate(ctxParam.getType(),true);
|
||||
}
|
||||
if(typeToGenerate.equals("java.util.Date"))
|
||||
{
|
||||
if(typeToGenerate.equals("java.util.Date")){ // start if
|
||||
|
||||
%>
|
||||
try{
|
||||
@@ -171,50 +371,28 @@
|
||||
{
|
||||
context.<%=ctxParam.getName()%>=null;
|
||||
}
|
||||
<%
|
||||
}else if(typeToGenerate.equals("Object")||typeToGenerate.equals("String")||typeToGenerate.equals("java.lang.String") ){
|
||||
%>
|
||||
}else if(typeToGenerate.equals("Integer"))
|
||||
{
|
||||
context.<%=ctxParam.getName()%>=(<%=typeToGenerate%>) context.getProperty("<%=ctxParam.getName()%>");
|
||||
<%
|
||||
}else if(typeToGenerate.equals("Character")&&ctxParam.getName()!=null){
|
||||
%>
|
||||
context.<%=ctxParam.getName()%>= new java.text.StringCharacterIterator(context.getProperty("<%=ctxParam.getName()%>")).first();
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
try{
|
||||
context.<%=ctxParam.getName()%>=Integer.parseInt(context.getProperty("<%=ctxParam.getName()%>"));
|
||||
}catch(NumberFormatException e){
|
||||
context.<%=ctxParam.getName()%>=null;
|
||||
}
|
||||
try{
|
||||
context.<%=ctxParam.getName()%>=routines.system.ParserUtils.parseTo_<%=typeToGenerate%> (context.getProperty("<%=ctxParam.getName()%>"));
|
||||
}catch(NumberFormatException e){
|
||||
context.<%=ctxParam.getName()%>=null;
|
||||
}
|
||||
<%
|
||||
}else if(typeToGenerate.equals("Object")||typeToGenerate.equals("String")||typeToGenerate.equals("java.lang.String") )
|
||||
{
|
||||
%>
|
||||
context.<%=ctxParam.getName()%>=(<%=typeToGenerate%>) context.getProperty("<%=ctxParam.getName()%>");
|
||||
<%
|
||||
}else if(typeToGenerate.equals("Character")&&ctxParam.getName()!=null)
|
||||
{
|
||||
%>
|
||||
context.<%=ctxParam.getName()%>= new java.text.StringCharacterIterator(context.getProperty("<%=ctxParam.getName()%>")).first();
|
||||
<%
|
||||
} else if(typeToGenerate.equals("BigDecimal"))
|
||||
{
|
||||
%>
|
||||
try{
|
||||
context.<%=ctxParam.getName()%>= new <%=typeToGenerate%>(context.getProperty("<%=ctxParam.getName()%>"));
|
||||
}catch(NumberFormatException e){
|
||||
context.<%=ctxParam.getName()%>=null;
|
||||
}
|
||||
<%
|
||||
}
|
||||
else
|
||||
{
|
||||
%>
|
||||
try{
|
||||
context.<%=ctxParam.getName()%>=<%=typeToGenerate%>.parse<%=typeToGenerate%> (context.getProperty("<%=ctxParam.getName()%>"));
|
||||
}catch(NumberFormatException e){
|
||||
context.<%=ctxParam.getName()%>=null;
|
||||
}
|
||||
<%
|
||||
}
|
||||
}
|
||||
} //end if
|
||||
} //end for
|
||||
%>
|
||||
} catch (java.io.IOException ie) {
|
||||
System.err.println("Could not load context "+contextStr);
|
||||
System.err.println("Could not load context "+contextName);
|
||||
ie.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -237,15 +415,6 @@
|
||||
}
|
||||
%>
|
||||
}
|
||||
try {
|
||||
initUriMap();
|
||||
Route(true);
|
||||
} catch (Exception e) {
|
||||
System.err.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void evalParam(String arg) {
|
||||
@@ -284,4 +453,64 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class TalendRouteRegistry implements Registry {
|
||||
|
||||
private Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
private Registry wrapped = null;
|
||||
|
||||
public TalendRouteRegistry() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public TalendRouteRegistry(Registry wrapped) {
|
||||
this.wrapped = wrapped;
|
||||
}
|
||||
|
||||
public Object lookup(String name) {
|
||||
Object obj = null;
|
||||
if (wrapped != null) {
|
||||
obj = wrapped.lookup(name);
|
||||
}
|
||||
if (obj == null) {
|
||||
obj = map.get(name);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
public <T> T lookup(String name, Class<T> type) {
|
||||
T t = null;
|
||||
if (wrapped != null) {
|
||||
t = wrapped.lookup(name, type);
|
||||
}
|
||||
if (t == null) {
|
||||
t = (T) map.get(name);
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
public <T> Map<String, T> lookupByType(Class<T> type) {
|
||||
Map<String, T> result = null;
|
||||
if (wrapped != null) {
|
||||
result = wrapped.lookupByType(type);
|
||||
}
|
||||
if (result == null) {
|
||||
result = new HashMap<String, T>();
|
||||
}
|
||||
if (result.isEmpty()) {
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
if (type.isInstance(entry.getValue())) {
|
||||
result.put(entry.getKey(), type.cast(entry.getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void register(String name, Object instance) {
|
||||
map.put(name, instance);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -99,8 +99,8 @@ import java.util.Comparator;
|
||||
String talendJobInterfaces = "TalendJob";
|
||||
|
||||
boolean talendMdmJob = !process.getNodesOfType("tMDMTriggerInput").isEmpty() || !process.getNodesOfType("tMDMTriggerOutput").isEmpty();
|
||||
boolean talendEsbJob = !process.getNodesOfType("tESBProviderRequest").isEmpty() || !process.getNodesOfType("tESBConsumer").isEmpty();
|
||||
boolean talendEsbJobFactory = !process.getNodesOfType("tESBProviderRequest").isEmpty();
|
||||
boolean talendEsbJob = !process.getNodesOfType("tESBProviderRequest").isEmpty() || !process.getNodesOfType("tESBConsumer").isEmpty() || !process.getNodesOfType("tRouteInput").isEmpty();
|
||||
boolean talendEsbJobFactory = !process.getNodesOfType("tESBProviderRequest").isEmpty() || !process.getNodesOfType("tRouteInput").isEmpty();
|
||||
|
||||
if (talendMdmJob) {
|
||||
talendJobInterfaces += ", TalendMDMJob"; // Talend MDM job
|
||||
@@ -116,7 +116,19 @@ public class <%=process.getName()%> implements <%=talendJobInterfaces%> {
|
||||
|
||||
<% if (talendEsbJobFactory) { %>
|
||||
public TalendESBJob newTalendESBJob() {
|
||||
return new <%=process.getName()%>();
|
||||
<%=process.getName()%> talendESBJob = new <%=process.getName()%>();
|
||||
java.util.Map<String, routines.system.TalendDataSource> talendDataSources =
|
||||
(java.util.Map<String, routines.system.TalendDataSource>) globalMap.get(KEY_DB_DATASOURCES);
|
||||
if (null != talendDataSources) {
|
||||
java.util.Map<String, javax.sql.DataSource> dataSources = new java.util.HashMap<String, javax.sql.DataSource>();
|
||||
for (java.util.Map.Entry<String, routines.system.TalendDataSource> talendDataSourceEntry : talendDataSources.entrySet()) {
|
||||
dataSources.put(talendDataSourceEntry.getKey(), talendDataSourceEntry.getValue().getRawDataSource());
|
||||
}
|
||||
talendESBJob.setDataSources(dataSources);
|
||||
}
|
||||
// fix for TESB-7714
|
||||
talendESBJob.setEndpointRegistry(registry);
|
||||
return talendESBJob;
|
||||
}
|
||||
<% } %>
|
||||
|
||||
@@ -247,6 +259,17 @@ private RunTrace runTrace = new RunTrace();
|
||||
|
||||
public boolean isExportedAsOSGI = <%=exportAsOSGI%>;
|
||||
|
||||
// OSGi DataSource
|
||||
private final static String KEY_DB_DATASOURCES = "KEY_DB_DATASOURCES";
|
||||
|
||||
public void setDataSources(java.util.Map<String, javax.sql.DataSource> dataSources) {
|
||||
java.util.Map<String, routines.system.TalendDataSource> talendDataSources = new java.util.HashMap<String, routines.system.TalendDataSource>();
|
||||
for (java.util.Map.Entry<String, javax.sql.DataSource> dataSourceEntry : dataSources.entrySet()) {
|
||||
talendDataSources.put(dataSourceEntry.getKey(), new routines.system.TalendDataSource(dataSourceEntry.getValue()));
|
||||
}
|
||||
globalMap.put(KEY_DB_DATASOURCES, talendDataSources);
|
||||
}
|
||||
|
||||
<%
|
||||
for (INode logCatcher : process.getNodesOfType("tLogCatcher")) {
|
||||
%>
|
||||
@@ -306,6 +329,14 @@ private class TalendException extends Exception {
|
||||
this.globalMap = globalMap;
|
||||
this.e = e;
|
||||
}
|
||||
|
||||
public Exception getException() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public String getCurrentComponent() {
|
||||
return this.currentComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printStackTrace() {
|
||||
@@ -426,6 +457,17 @@ private class TalendException extends Exception {
|
||||
}
|
||||
}
|
||||
%>
|
||||
} else {
|
||||
<%
|
||||
if (isRunInMultiThread ) {
|
||||
%>
|
||||
((java.util.Map)threadLocal.get()).put("status", "failure");
|
||||
<%
|
||||
} else {%>
|
||||
status = "failure";
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -466,9 +508,11 @@ private class TalendException extends Exception {
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean isExistOnCompErrorLink = false;
|
||||
List< ? extends IConnection> conns = node.getOutgoingConnections();
|
||||
for (IConnection conn : conns) {
|
||||
if (conn.getLineStyle().equals(EConnectionType.ON_COMPONENT_ERROR)) {
|
||||
isExistOnCompErrorLink = true;
|
||||
%>
|
||||
try {
|
||||
<%if (stats) {%>
|
||||
@@ -480,14 +524,18 @@ private class TalendException extends Exception {
|
||||
if (isRunInMultiThread ) {
|
||||
%>
|
||||
((java.util.Map)threadLocal.get()).put("errorCode", null);
|
||||
((java.util.Map)threadLocal.get()).put("status", "failure");
|
||||
<%=conn.getTarget().getUniqueName() %>Process(globalMap);
|
||||
if ( !"failure".equals(((java.util.Map)threadLocal.get()).get("status")) ) {
|
||||
((java.util.Map)threadLocal.get()).put("status", "end");
|
||||
}
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
errorCode = null;
|
||||
status = "failure";
|
||||
<%=conn.getTarget().getUniqueName() %>Process(globalMap);
|
||||
if (!"failure".equals(status)) {
|
||||
status = "end";
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
@@ -498,9 +546,34 @@ private class TalendException extends Exception {
|
||||
<%
|
||||
}
|
||||
}
|
||||
boolean isSubjobHasOnSubJobError = false;
|
||||
if (!isExistOnCompErrorLink) {
|
||||
INode subJobStartNode = node.getDesignSubjobStartNode();
|
||||
if (subJobStartNode != null) {
|
||||
List< ? extends IConnection> tempConns = subJobStartNode.getOutgoingConnections();
|
||||
for (IConnection conn : tempConns) {
|
||||
if (conn.getLineStyle().equals(EConnectionType.ON_SUBJOB_ERROR)) {
|
||||
isSubjobHasOnSubJobError = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isSubjobHasOnSubJobError && !isExistOnCompErrorLink) { // when there is no subjoberror and no onComponentError
|
||||
if (isRunInMultiThread ) {
|
||||
%>
|
||||
((java.util.Map)threadLocal.get()).put("status", "failure");
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
status = "failure";
|
||||
<%
|
||||
}
|
||||
}
|
||||
// when use parallelize will add virtual components(tAsyncIn and tAsyncOut) but in graphical these is visable=false
|
||||
if ("true".equals(ElementParameterParser.getValue(node, "__PARALLELIZE__"))) {
|
||||
for (INode gNode :node.getProcess().getGraphicalNodes()) {
|
||||
for (INode gNode :node.getProcess().getGeneratingNodes()) {
|
||||
if (gNode.getUniqueName().equals(node.getUniqueName())) {
|
||||
if (gNode.getIncomingConnections(EConnectionType.FLOW_MAIN).size()!= 0) {
|
||||
INode gSourceNode = gNode.getIncomingConnections(EConnectionType.FLOW_MAIN).get(0).getSource();
|
||||
@@ -510,9 +583,27 @@ private class TalendException extends Exception {
|
||||
}
|
||||
}
|
||||
//end
|
||||
|
||||
/*
|
||||
This part of code has been added in order to call the correct onComponentError and onSubjobError for the specific components (like tWriteXMLField, tWriteJSONField, tMDMOutput, tBRMS, ...).
|
||||
*/
|
||||
INode subjob_start_node = node;
|
||||
boolean hasBeenChanged = true;
|
||||
|
||||
while(subjob_start_node.getDesignSubjobStartNode().isVirtualGenerateNode() && hasBeenChanged) {
|
||||
hasBeenChanged = false;
|
||||
if(subjob_start_node.getDesignSubjobStartNode().getIncomingConnections(EConnectionType.ON_COMPONENT_OK) != null) {
|
||||
if(subjob_start_node.getDesignSubjobStartNode().getIncomingConnections(EConnectionType.ON_COMPONENT_OK).size() >0) {
|
||||
if(subjob_start_node.getDesignSubjobStartNode().getIncomingConnections(EConnectionType.ON_COMPONENT_OK).get(0).getSource().getVirtualLinkTo()==EConnectionType.ON_COMPONENT_OK) {
|
||||
subjob_start_node = subjob_start_node.getDesignSubjobStartNode().getIncomingConnections(EConnectionType.ON_COMPONENT_OK).get(0).getSource();
|
||||
hasBeenChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%>
|
||||
<%=node.getDesignSubjobStartNode().getUniqueName() %>_onSubJobError(exception, errorComponent, globalMap);
|
||||
|
||||
<%=subjob_start_node.getDesignSubjobStartNode().getUniqueName() %>_onSubJobError(exception, errorComponent, globalMap);
|
||||
}
|
||||
<%
|
||||
}
|
||||
@@ -555,14 +646,18 @@ resumeUtil.addLog("SYSTEM_LOG", "NODE:"+ errorComponent, "", Thread.currentThrea
|
||||
if(isRunInMultiThread ){
|
||||
%>
|
||||
((java.util.Map)threadLocal.get()).put("errorCode", null);
|
||||
((java.util.Map)threadLocal.get()).put("status", "failure");
|
||||
<%=conn.getTarget().getUniqueName() %>Process(globalMap);
|
||||
if ( !"failure".equals(((java.util.Map)threadLocal.get()).get("status")) ) {
|
||||
((java.util.Map)threadLocal.get()).put("status", "end");
|
||||
}
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
errorCode = null;
|
||||
status = "failure";
|
||||
<%=conn.getTarget().getUniqueName() %>Process(globalMap);
|
||||
if (!"failure".equals(status)) {
|
||||
status = "end";
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
org.talend.designer.codegen.ITalendSynchronizer
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
org.talend.designer.runprocess.CodeGeneratorRoutine
|
||||
org.talend.core.model.process.EParameterFieldType
|
||||
"
|
||||
class="Header"
|
||||
%>
|
||||
@@ -55,43 +56,76 @@ if (service instanceof AbstractBrandingService) {
|
||||
package <%= packageName %>;
|
||||
|
||||
<%
|
||||
for (String routine : CodeGeneratorRoutine.getRequiredRoutineName(process)) {
|
||||
if (!routine.equals(ITalendSynchronizer.TEMPLATE)) {
|
||||
%>
|
||||
import routines.<%=routine%>;
|
||||
<%
|
||||
java.util.Set<String> importsSet = new java.util.TreeSet<String>();
|
||||
/* for (String routine : CodeGeneratorRoutine.getRequiredRoutineName(process)) {
|
||||
if (!routine.equals(ITalendSynchronizer.TEMPLATE)) {
|
||||
importsSet.add("import routines."+routine);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
importsSet.add("import java.util.HashMap");
|
||||
importsSet.add("import java.util.Map");
|
||||
importsSet.add("import javax.xml.bind.JAXBException");
|
||||
importsSet.add("import org.apache.camel.ProducerTemplate");
|
||||
importsSet.add("import org.apache.camel.builder.RouteBuilder");
|
||||
importsSet.add("import org.apache.camel.impl.DefaultCamelContext");
|
||||
importsSet.add("import org.apache.camel.main.MainSupport");
|
||||
importsSet.add("import routines.TalendString");
|
||||
importsSet.add("import routines.system.api.TalendESBRoute");
|
||||
importsSet.add("import org.apache.camel.view.ModelFileGenerator");
|
||||
importsSet.add("import org.apache.camel.spi.Registry");
|
||||
importsSet.add("import org.apache.camel.impl.DefaultCamelContext");
|
||||
importsSet.add("import org.apache.camel.osgi.CamelContextFactory");
|
||||
importsSet.add("import org.apache.camel.CamelContext");
|
||||
importsSet.add("import java.util.Properties");
|
||||
importsSet.add("import org.apache.camel.management.JmxNotificationEventNotifier");
|
||||
|
||||
String headerImports = ElementParameterParser.getValue(process, "__HEADER_IMPORT__");
|
||||
if(headerImports!=null && !"".equals(headerImports.trim())){
|
||||
String[] imports = headerImports.split(";");
|
||||
for(String s: imports){
|
||||
if(s!=null && !"".equals(s.trim())){
|
||||
importsSet.add(s.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
String footerImports = ElementParameterParser.getValue(process, "__FOOTER_IMPORT__");
|
||||
if(footerImports!=null && !"".equals(footerImports.trim())){
|
||||
String[] imports = footerImports.split(";");
|
||||
for(String s: imports){
|
||||
if(s!=null && !"".equals(s.trim())){
|
||||
importsSet.add(s.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<? extends INode> generatingNodes = process.getGeneratingNodes();
|
||||
for(INode n: generatingNodes){
|
||||
List<? extends IElementParameter> elementParameters = n.getElementParameters();
|
||||
for(IElementParameter p: elementParameters){
|
||||
if(p.getShowIf() != null && !p.isShow(elementParameters)){
|
||||
continue;
|
||||
}
|
||||
if(EParameterFieldType.MEMO_IMPORT == p.getFieldType()){
|
||||
Object value = p.getValue();
|
||||
if(value == null || !(value instanceof String) || "".equals(((String)value).trim())){
|
||||
continue;
|
||||
}
|
||||
String[] imports = ((String)value).trim().split(";");
|
||||
for(String s: imports){
|
||||
if(s!=null && !"".equals(s.trim())){
|
||||
importsSet.add(s.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for(String s: importsSet){
|
||||
%>
|
||||
import routines.system.*;
|
||||
import routines.system.api.*;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Comparator;
|
||||
|
||||
<%=ElementParameterParser.getValue(process, "__HEADER_IMPORT__") %>
|
||||
<%=ElementParameterParser.getValue(process, "__FOOTER_IMPORT__") %>
|
||||
|
||||
|
||||
<%=s%> ;
|
||||
<%
|
||||
List<INode> nodesWithImport = process.getNodesWithImport();
|
||||
if (nodesWithImport != null) {
|
||||
for (INode node:nodesWithImport) {
|
||||
%>
|
||||
//the import part of <%=node.getUniqueName() %>
|
||||
<%=ElementParameterParser.getValue(node, "__IMPORT__") %>
|
||||
|
||||
<% }
|
||||
}
|
||||
%>
|
||||
|
||||
@@ -102,25 +136,9 @@ import java.util.Comparator;
|
||||
* @version <%=version %>
|
||||
* @status <%=ElementParameterParser.getValue(process, "__STATUS__") %>
|
||||
*/
|
||||
public class <%=process.getName()%> implements TalendESBRoute {
|
||||
|
||||
private final String jobVersion = "<%=process.getVersion() %>";
|
||||
private final String jobName = "<%=codeGenArgument.getJobName() %>";
|
||||
private final String projectName = "<%=codeGenArgument.getCurrentProjectName() %>";
|
||||
public Integer errorCode = null;
|
||||
private String currentComponent = "";
|
||||
public TalendESBRoute stopDelegate = null;
|
||||
public class <%=process.getName()%> extends MainSupport implements TalendESBRoute {
|
||||
|
||||
public <%=process.getName()%>(){
|
||||
initUriMap();
|
||||
}
|
||||
|
||||
public void stop() throws Exception {
|
||||
if (stopDelegate != null) stopDelegate.stop();
|
||||
}
|
||||
|
||||
public void shutdown() throws Exception {
|
||||
if (stopDelegate != null) stopDelegate.shutdown();
|
||||
}
|
||||
|
||||
<%
|
||||
@@ -139,7 +157,9 @@ import java.util.Comparator;
|
||||
|
||||
<%
|
||||
for (INode node : graphicalNodes) {
|
||||
if("cCXF".equals(node.getComponent().getName())) { %>
|
||||
if("cCXF".equals(node.getComponent().getName())
|
||||
&& "true".equals(ElementParameterParser.getValue(node, "__ENABLE_SAM__"))
|
||||
&& !"RAW".equals(ElementParameterParser.getValue(node, "__DATAFORMAT__"))) { %>
|
||||
//ESB Service Activity Monitor Feature
|
||||
private org.apache.cxf.feature.AbstractFeature eventFeature;
|
||||
|
||||
@@ -151,40 +171,158 @@ import java.util.Comparator;
|
||||
}
|
||||
%>
|
||||
|
||||
private org.apache.camel.builder.RouteBuilder routeBuilder;
|
||||
private Map<String, String> uriMap;
|
||||
|
||||
private java.util.Map<String, String> uriMap;
|
||||
|
||||
public java.util.Map<String,String> getUriMap() {
|
||||
public Map<String,String> getUriMap() {
|
||||
return this.uriMap;
|
||||
}
|
||||
|
||||
public void loadCustomUriMap(java.util.Map<String,String> newMap) {
|
||||
public void loadCustomUriMap(Map<String,String> newMap) {
|
||||
if(newMap == null) {
|
||||
return;
|
||||
}
|
||||
for(java.util.Map.Entry<String, String> entry: newMap.entrySet()) {
|
||||
for(Map.Entry<String, String> entry: newMap.entrySet()) {
|
||||
uriMap.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
protected void initUriMap() {
|
||||
uriMap = new java.util.HashMap<String, String>();
|
||||
/*
|
||||
* the readContextValues(contextName) may have to invoked first before this
|
||||
*/
|
||||
public void initUriMap() {
|
||||
uriMap = new HashMap<String, String>();
|
||||
<%
|
||||
String cid = "";
|
||||
String componentName = "";
|
||||
String uri = "";
|
||||
for (INode node : graphicalNodes) {
|
||||
IElementParameter param = node.getElementParameter("LABEL");
|
||||
if (param != null && !"__UNIQUE_NAME__".equals(param.getValue())) {
|
||||
cid = (String) param.getValue();
|
||||
} else {
|
||||
cid = node.getUniqueName();
|
||||
if(!node.isActivate()){
|
||||
continue;
|
||||
}
|
||||
cid = node.getUniqueName();
|
||||
// http://jira.talendforge.org/browse/TESB-5241
|
||||
/*
|
||||
* change to use label + unique to make it unique but readable
|
||||
*/
|
||||
IElementParameter param = node.getElementParameter("LABEL");
|
||||
if(param != null && !"__UNIQUE_NAME__".equals(param.getValue())){
|
||||
cid = (String)param.getValue()+"_"+cid;
|
||||
}
|
||||
|
||||
componentName = node.getComponent().getName();
|
||||
uri = "";
|
||||
if ("cMessagingEndpoint".equals(componentName)) {
|
||||
uri = ElementParameterParser.getValue(node, "__URI__");
|
||||
}else if("cTimer".equals(componentName)){
|
||||
uri = "\"timer:\"+\""+node.getUniqueName()+"\"";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String period = ElementParameterParser.getValue(node, "__PERIOD__");
|
||||
if(period!=null && !period.trim().equals("") && !"1000".equals(period)){
|
||||
sb.append("+\"?period=\"+");
|
||||
sb.append(period);
|
||||
}
|
||||
String repeat = ElementParameterParser.getValue(node, "__REPEATCOUNT__");
|
||||
if(repeat!=null && !repeat.trim().equals("") && !"0".equals(repeat)){
|
||||
if(sb.length()==0){
|
||||
sb.append("+\"?repeatCount=\"+");
|
||||
sb.append(repeat);
|
||||
}else{
|
||||
sb.append("+\"&repeatCount=\"+");
|
||||
sb.append(repeat);
|
||||
}
|
||||
}
|
||||
String delay = ElementParameterParser.getValue(node, "__DELAY__");
|
||||
if(delay!=null && !delay.trim().equals("") && !"1000".equals(delay)){
|
||||
if(sb.length()==0){
|
||||
sb.append("+\"?delay=\"+");
|
||||
sb.append(delay);
|
||||
}else{
|
||||
sb.append("+\"&delay=\"+");
|
||||
sb.append(delay);
|
||||
}
|
||||
}
|
||||
String fixedRate = ElementParameterParser.getValue(node, "__FIXEDRATE__");
|
||||
if("true".equals(fixedRate)){
|
||||
if(sb.length()==0){
|
||||
sb.append("+\"?fixedRate=true\"");
|
||||
}else{
|
||||
sb.append("+\"&fixedRate=true\"");
|
||||
}
|
||||
}
|
||||
String daemon = ElementParameterParser.getValue(node, "__DAEMON__");
|
||||
if("false".equals(daemon)){
|
||||
if(sb.length()==0){
|
||||
sb.append("+\"?daemon=false\"");
|
||||
}else{
|
||||
sb.append("+\"&daemon=false\"");
|
||||
}
|
||||
}
|
||||
String setTime = ElementParameterParser.getValue(node, "__SET_TIME__");
|
||||
if("true".equals(setTime)){
|
||||
String time = ElementParameterParser.getValue(node, "__TIME__");
|
||||
if(sb.length()==0){
|
||||
sb.append("+\"?time=\"+");
|
||||
sb.append(time);
|
||||
}else{
|
||||
sb.append("+\"&time=\"+");
|
||||
sb.append(time);
|
||||
}
|
||||
}
|
||||
if(sb.length()>0){
|
||||
uri = uri + sb.toString();
|
||||
}
|
||||
}else if("cDataset".equals(componentName)){
|
||||
uri = "\"dataset:\"+"+ElementParameterParser.getValue(node, "__DATASET_NAME__");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String produceDelay = ElementParameterParser.getValue(node, "__PRODUCE_DELAY__");
|
||||
if(produceDelay!=null && !produceDelay.trim().equals("") && !"3".equals(produceDelay)){
|
||||
sb.append("+\"?produceDelay=\"+");
|
||||
sb.append(produceDelay);
|
||||
}
|
||||
String consumeDelay = ElementParameterParser.getValue(node, "__CONSUME_DELAY__");
|
||||
if(consumeDelay!=null && !consumeDelay.trim().equals("") && !"0".equals(consumeDelay)){
|
||||
if(sb.length()==0){
|
||||
sb.append("+\"?consumeDelay=\"+");
|
||||
sb.append(consumeDelay);
|
||||
}else{
|
||||
sb.append("+\"&consumeDelay=\"+");
|
||||
sb.append(consumeDelay);
|
||||
}
|
||||
}
|
||||
String preloadSize = ElementParameterParser.getValue(node, "__PRELOAD_SIZE__");
|
||||
if(preloadSize!=null && !preloadSize.trim().equals("") && !"0".equals(preloadSize)){
|
||||
if(sb.length()==0){
|
||||
sb.append("+\"?preloadSize=\"+");
|
||||
sb.append(preloadSize);
|
||||
}else{
|
||||
sb.append("+\"&preloadSize=\"+");
|
||||
sb.append(preloadSize);
|
||||
}
|
||||
}
|
||||
String initialDelay = ElementParameterParser.getValue(node, "__INITIAL_DELAY__");
|
||||
if(initialDelay!=null && !initialDelay.trim().equals("") && !"1000".equals(initialDelay)){
|
||||
if(sb.length()==0){
|
||||
sb.append("+\"?initialDelay=\"+");
|
||||
sb.append(initialDelay);
|
||||
}else{
|
||||
sb.append("+\"&initialDelay=\"+");
|
||||
sb.append(initialDelay);
|
||||
}
|
||||
}
|
||||
String minRate = ElementParameterParser.getValue(node, "__MIN_RATE__");
|
||||
if(minRate!=null && !minRate.trim().equals("") && !"0".equals(minRate)){
|
||||
if(sb.length()==0){
|
||||
sb.append("+\"?minRate=\"+");
|
||||
sb.append(minRate);
|
||||
}else{
|
||||
sb.append("+\"&minRate=\"+");
|
||||
sb.append(minRate);
|
||||
}
|
||||
}
|
||||
|
||||
if(sb.length()>0){
|
||||
uri = uri + sb.toString();
|
||||
}
|
||||
} else if ("cFile".equals(componentName)) {
|
||||
String filePath = ElementParameterParser.getValue(node, "__URI__");
|
||||
String noop = ElementParameterParser.getValue(node, "__NOOP__");
|
||||
@@ -196,7 +334,7 @@ for (INode node : graphicalNodes) {
|
||||
|
||||
StringBuffer arguments = new StringBuffer();
|
||||
|
||||
uri = "\"file:///\"+" + filePath;
|
||||
uri = "\"file://\"+" + filePath;
|
||||
|
||||
if ("true".equals(noop)) {
|
||||
arguments.append("\"noop=true\"+");
|
||||
@@ -258,7 +396,17 @@ for (INode node : graphicalNodes) {
|
||||
sb.append("\"cxf://\"+").append(url).append("+\"?" + serviceType + "=\"");
|
||||
|
||||
if ("wsdlURL".equals(serviceType)) {
|
||||
String filePath = ElementParameterParser.getValue(node, "__WSDL_FILE__");
|
||||
|
||||
//http://jira.talendforge.org/browse/TESB-6226
|
||||
String filePath = "";
|
||||
|
||||
String wsdlType = ElementParameterParser.getValue(node, "__WSDL_TYPE__");
|
||||
if("file".equals(wsdlType)){
|
||||
filePath = ElementParameterParser.getValue(node, "__WSDL_FILE__");
|
||||
}else{
|
||||
filePath = ElementParameterParser.getValue(node, "__ROUTE_RESOURCE_TYPE_RES_URI__");
|
||||
filePath = "\"classpath:" + filePath + "\"";
|
||||
}
|
||||
filePath.replaceAll("\\\\","/");
|
||||
sb.append("+").append(filePath);
|
||||
} else {
|
||||
@@ -329,10 +477,11 @@ for (INode node : graphicalNodes) {
|
||||
|
||||
} else if("cJMS".equals(componentName)) {
|
||||
//http://jira.talendforge.org/browse/TESB-4861
|
||||
String name = ElementParameterParser.getValue(node, "__CONNECTION_FACOTRY__");
|
||||
String name = ElementParameterParser.getValue(node, "__ROUTE_COMPONENT_TYPE_ID__");
|
||||
if (name == null || name.equals("")) {
|
||||
name = "jms";
|
||||
}
|
||||
name = name.replace("_", "");
|
||||
name = "\"" + name + "\"";
|
||||
//String name = ElementParameterParser.getValue(node, "__NAME__").trim();
|
||||
//Remove unnecessary subfix
|
||||
@@ -526,10 +675,10 @@ for (INode node : graphicalNodes) {
|
||||
String resourceUri = ElementParameterParser.getValue(node, "__URI__");
|
||||
sb.append(resourceUri);
|
||||
|
||||
boolean hasParam = false;
|
||||
boolean hasParam = resourceUri==null?false:resourceUri.contains("?");
|
||||
|
||||
String method = ElementParameterParser.getValue(node, "__METHOD__");
|
||||
if("GET".equals(method)||"HEAD".equals(method)){
|
||||
if("GET".equals(method)||"HEAD".equals(method) || "DELETE".equals(method)){
|
||||
List<Map<String, String>> parameters = (List<Map<String, String>>) ElementParameterParser.getObjectValue(node, "__PARAMETERS__");
|
||||
String encodeCharset = ElementParameterParser.getValue(node, "__ENCODER_CHARSET__");
|
||||
|
||||
@@ -571,93 +720,3 @@ for (INode node : graphicalNodes) {
|
||||
}
|
||||
%>
|
||||
}
|
||||
|
||||
private java.util.Properties defaultProps = new java.util.Properties();
|
||||
|
||||
public class ContextProperties extends java.util.Properties {
|
||||
|
||||
public ContextProperties(java.util.Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
public ContextProperties() {
|
||||
super();
|
||||
}
|
||||
|
||||
public void synchronizeContext() {
|
||||
<% for (IContextParameter ctxParam : params){
|
||||
String cParaName = ctxParam.getName(); %>
|
||||
if(<%=cParaName %> != null){
|
||||
<% if(ctxParam.getType().equals("id_Date")){ %>
|
||||
String pattern_<%=cParaName %> = "yyyy-MM-dd HH:mm:ss";
|
||||
String value_<%=cParaName %> = "<%=ctxParam.getValue() %>";
|
||||
String[] parts_<%=cParaName %> = value_<%=cParaName %>.split(";");
|
||||
if (parts_<%=cParaName %>.length > 1) {
|
||||
pattern_<%=cParaName %> = parts_<%=cParaName %>[0];
|
||||
this.setProperty("<%=cParaName %>", pattern_<%=cParaName %> + ";" + FormatterUtils.format_Date(<%=cParaName %>, pattern_<%=cParaName %>));
|
||||
} else {
|
||||
this.setProperty("<%=cParaName %>", FormatterUtils.format_Date(<%=cParaName %>, pattern_<%=cParaName %>));
|
||||
}
|
||||
<% } else { %>
|
||||
this.setProperty("<%=cParaName %>", <%=cParaName %>.toString());
|
||||
<% } %>
|
||||
}
|
||||
<% } %>
|
||||
}
|
||||
|
||||
<%
|
||||
for (IContextParameter ctxParam : params) {
|
||||
if(ctxParam.getType().equals("id_List Of Value") || ctxParam.getType().equals("id_File") || ctxParam.getType().equals("id_Directory")) { %>
|
||||
public String <%=ctxParam.getName()%>;
|
||||
public String get<%=Character.toUpperCase(ctxParam.getName().charAt(0)) + ctxParam.getName().substring(1)%>() {
|
||||
return this.<%=ctxParam.getName()%>;
|
||||
}
|
||||
<% } else { %>
|
||||
public <%=JavaTypesManager.getTypeToGenerate(ctxParam.getType(),true)%> <%=ctxParam.getName()%>;
|
||||
public <%=JavaTypesManager.getTypeToGenerate(ctxParam.getType(),true)%> get<%=Character.toUpperCase(ctxParam.getName().charAt(0)) + ctxParam.getName().substring(1)%>() {
|
||||
return this.<%=ctxParam.getName()%>;
|
||||
}
|
||||
<% }
|
||||
}
|
||||
%>
|
||||
}
|
||||
|
||||
private ContextProperties context = new ContextProperties();
|
||||
public ContextProperties getContext() {
|
||||
return this.context;
|
||||
}
|
||||
|
||||
|
||||
|
||||
<% if(stats) { %>
|
||||
|
||||
class MyStatThread implements Runnable {
|
||||
|
||||
CamelStat stats;
|
||||
boolean isFinished;
|
||||
|
||||
public MyStatThread(CamelStat stats) {
|
||||
this.stats = stats;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
while (true) {
|
||||
try {
|
||||
<%
|
||||
for (INode node : processNodes) {
|
||||
if (node.isActivate()) {
|
||||
for(int i=0; i<node.getIncomingConnections().size(); i++) {
|
||||
%>
|
||||
stats.updateStatOnConnection("<%=node.getIncomingConnections().get(i).getUniqueName()%>", 1, "<%=node.getUniqueName()%>");
|
||||
<%
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
Thread.sleep(1000);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
<% } //if stats %>
|
||||
|
||||
@@ -53,6 +53,7 @@ for (IConnection iterateConn : iterateConnSet) { //1
|
||||
|
||||
%>
|
||||
NB_ITERATE_<%=iterateNodeName %>++;
|
||||
iterateLoop++;
|
||||
<%
|
||||
|
||||
parallelIterate = "true".equals(ElementParameterParser.getValue(iterateConn, "__ENABLE_PARALLEL__"));
|
||||
@@ -92,6 +93,7 @@ for (IConnection iterateConn : iterateConnSet) { //1
|
||||
private java.util.Map<String, Object> globalMap = null;
|
||||
boolean isRunning = false;
|
||||
String iterateId = "";
|
||||
int iterateLoop = 0;
|
||||
<%
|
||||
if(!subTree.isMergeSubTree()) {
|
||||
List< ? extends IConnection> rootConns = subTree.getRootNode().getOutgoingConnections();
|
||||
@@ -155,6 +157,7 @@ for (IConnection iterateConn : iterateConnSet) { //1
|
||||
<%}%>
|
||||
}
|
||||
iterateId = "." + threadID;
|
||||
iterateLoop++;
|
||||
<%if(isRunJob) {%>
|
||||
//bug21906 copy context to local for mutilthread
|
||||
context.synchronizeContext();
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
|
||||
//only for the lookup branch of the tJoin
|
||||
boolean isLookOftJoin = false;
|
||||
boolean isLookOftRecordMatching = true;
|
||||
boolean isLookOftRecordMatching = false;
|
||||
if(conn.getLineStyle().equals(EConnectionType.FLOW_REF)){
|
||||
IProcess process = conn.getTarget().getProcess();
|
||||
for (INode tjoinNode : process.getNodesOfType("tJoin")) {
|
||||
@@ -113,8 +113,8 @@
|
||||
%>
|
||||
|
||||
public static class <%=conn.getName() %>Struct<%=templateOrigin %> implements routines.system.<%= isLookup ? "IPersistableComparableLookupRow<"+conn.getName()+"Struct>" : "IPersistableRow<"+conn.getName()+"Struct"+ templateOrigin + ">" %> {
|
||||
final static byte[] commonByteArrayLock = new byte[0];
|
||||
static byte[] commonByteArray = new byte[0];
|
||||
final static byte[] commonByteArrayLock_<%=codeGenArgument.getCurrentProjectName() %>_<%=codeGenArgument.getJobName() %> = new byte[0];
|
||||
static byte[] commonByteArray_<%=codeGenArgument.getCurrentProjectName() %>_<%=codeGenArgument.getJobName() %> = new byte[0];
|
||||
<%
|
||||
if(hasAtLeastOneKey) {
|
||||
%>
|
||||
@@ -307,15 +307,15 @@ public static class <%=conn.getName() %>Struct<%=templateOrigin %> implements ro
|
||||
if (length == -1) {
|
||||
strReturn = null;
|
||||
} else {
|
||||
if(length > commonByteArray.length) {
|
||||
if(length < 1024 && commonByteArray.length == 0) {
|
||||
commonByteArray = new byte[1024];
|
||||
if(length > commonByteArray_<%=codeGenArgument.getCurrentProjectName() %>_<%=codeGenArgument.getJobName() %>.length) {
|
||||
if(length < 1024 && commonByteArray_<%=codeGenArgument.getCurrentProjectName() %>_<%=codeGenArgument.getJobName() %>.length == 0) {
|
||||
commonByteArray_<%=codeGenArgument.getCurrentProjectName() %>_<%=codeGenArgument.getJobName() %> = new byte[1024];
|
||||
} else {
|
||||
commonByteArray = new byte[2 * length];
|
||||
commonByteArray_<%=codeGenArgument.getCurrentProjectName() %>_<%=codeGenArgument.getJobName() %> = new byte[2 * length];
|
||||
}
|
||||
}
|
||||
dis.readFully(commonByteArray, 0, length);
|
||||
strReturn = new String(commonByteArray, 0, length, utf8Charset);
|
||||
dis.readFully(commonByteArray_<%=codeGenArgument.getCurrentProjectName() %>_<%=codeGenArgument.getJobName() %>, 0, length);
|
||||
strReturn = new String(commonByteArray_<%=codeGenArgument.getCurrentProjectName() %>_<%=codeGenArgument.getJobName() %>, 0, length, utf8Charset);
|
||||
}
|
||||
return strReturn;
|
||||
}
|
||||
@@ -526,7 +526,7 @@ public static class <%=conn.getName() %>Struct<%=templateOrigin %> implements ro
|
||||
|
||||
public void <%= isLookup ? "readKeys" : "read" %>Data(ObjectInputStream dis) {
|
||||
|
||||
synchronized(commonByteArrayLock) {
|
||||
synchronized(commonByteArrayLock_<%=codeGenArgument.getCurrentProjectName() %>_<%=codeGenArgument.getJobName() %>) {
|
||||
|
||||
try {
|
||||
|
||||
@@ -983,6 +983,7 @@ public void <%=subTree.getName() %>Process(final java.util.Map<String, Object> g
|
||||
}
|
||||
boolean isRunning = false;
|
||||
String iterateId = "";
|
||||
int iterateLoop = 0;
|
||||
|
||||
public void run() {
|
||||
java.util.Map threadRunResultMap = new java.util.HashMap();
|
||||
@@ -999,6 +1000,7 @@ public void <%=subTree.getName() %>Process(final java.util.Map<String, Object> g
|
||||
%>
|
||||
|
||||
String iterateId = "";
|
||||
int iterateLoop = 0;
|
||||
String currentComponent = "";
|
||||
|
||||
try {
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
boolean stat = codeGenArgument.isStatistics();
|
||||
%>
|
||||
|
||||
public org.apache.camel.builder.RouteBuilder Route(final boolean start) throws Exception {
|
||||
|
||||
String iterateId = "";
|
||||
String currentComponent = "";
|
||||
|
||||
/**
|
||||
* please initial uri map first before using the returned RouteBuilder
|
||||
* @return RouteBuilder
|
||||
*/
|
||||
public RouteBuilder route() {
|
||||
|
||||
@@ -669,8 +669,14 @@ public class CodeGenerator implements ICodeGenerator {
|
||||
label = (String) parameter.getValue();
|
||||
}
|
||||
|
||||
/*
|
||||
* Fix https://jira.talendforge.org/browse/TESB-6685
|
||||
* label + uniqueName to make it unique
|
||||
*/
|
||||
if (label == null) {
|
||||
label = node.getUniqueName();
|
||||
}else{
|
||||
label += "_"+node.getUniqueName();
|
||||
}
|
||||
List<? extends IConnection> inConnections = node
|
||||
.getIncomingConnections();
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ILibraryManagerService;
|
||||
import org.talend.core.language.ECodeLanguage;
|
||||
import org.talend.core.language.LanguageManager;
|
||||
import org.talend.core.model.components.ComponentCompilations;
|
||||
import org.talend.core.model.process.IProcess;
|
||||
import org.talend.designer.codegen.i18n.Messages;
|
||||
import org.talend.designer.codegen.model.CodeGeneratorEmittersPoolFactory;
|
||||
@@ -118,17 +119,19 @@ public class CodeGeneratorService implements ICodeGeneratorService {
|
||||
*
|
||||
* @see org.talend.designer.codegen.ICodeGeneratorService#refreshTemplates()
|
||||
*/
|
||||
public void refreshTemplates() {
|
||||
public Job refreshTemplates() {
|
||||
// this will force to refresh all components libs when install run ctrl+f3
|
||||
ILibraryManagerService librairesManagerService = (ILibraryManagerService) GlobalServiceRegister.getDefault().getService(
|
||||
ILibraryManagerService.class);
|
||||
librairesManagerService.clearCache();
|
||||
|
||||
ComponentCompilations.deleteMarkers();
|
||||
ComponentsFactoryProvider.getInstance().resetCache();
|
||||
CodeGeneratorEmittersPoolFactory.initialize();
|
||||
Job job = CodeGeneratorEmittersPoolFactory.initialize();
|
||||
CorePlugin.getDefault().getLibrariesService().syncLibraries();
|
||||
IDesignerCoreService designerCoreService = (IDesignerCoreService) GlobalServiceRegister.getDefault().getService(
|
||||
IDesignerCoreService.class);
|
||||
designerCoreService.getLastGeneratedJobsDateMap().clear();
|
||||
|
||||
return job;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ package org.talend.designer.codegen;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.components.ComponentCompilations;
|
||||
import org.talend.designer.codegen.model.CodeGeneratorEmittersPoolFactory;
|
||||
import org.talend.designer.core.IDesignerCoreService;
|
||||
import org.talend.repository.model.ComponentsFactoryProvider;
|
||||
@@ -39,6 +40,7 @@ public class RefreshTemplatesAction extends Action {
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
ComponentCompilations.deleteMarkers();
|
||||
ComponentsFactoryProvider.getInstance().resetCache();
|
||||
CodeGeneratorEmittersPoolFactory.initialize();
|
||||
CorePlugin.getDefault().getLibrariesService().syncLibraries();
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
@@ -68,7 +69,7 @@ import org.talend.core.model.components.IComponentsFactory;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.properties.ComponentSetting;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
import org.talend.core.utils.BrandingChecker;
|
||||
import org.talend.core.utils.TalendCacheUtils;
|
||||
import org.talend.designer.codegen.CodeGeneratorActivator;
|
||||
import org.talend.designer.codegen.i18n.Messages;
|
||||
import org.talend.designer.core.ITisLocalProviderService;
|
||||
@@ -144,7 +145,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
// generation indirectly.
|
||||
// tFileInputFullRow + tSocketOutput : needed for DataViewer
|
||||
private static final String[] COMPONENTS_ALWAYS_NEEDED = { "tPrejob", "tPostjob", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"tJava", "tLibraryLoad", "tFileInputFullRow", "tSocketOutput", "tFilterRow" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
"tJava", "tLibraryLoad", "tFileInputFullRow", "tSocketOutput", "tFilterRow", "tELTMysqlMap" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
|
||||
public ComponentsFactory() {
|
||||
if (!INCLUDEFILEINJET_SUFFIX.equals(".inc.javajet")) { //$NON-NLS-1$
|
||||
@@ -158,10 +159,10 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
Project currentProject = ProjectManager.getInstance().getCurrentProject();
|
||||
if (currentProject != null && currentProject.getEmfProject() != null) {
|
||||
|
||||
List<ComponentSetting> components = (List<ComponentSetting>) currentProject.getEmfProject().getComponentsSettings();
|
||||
List<ComponentSetting> components = currentProject.getEmfProject().getComponentsSettings();
|
||||
return components;
|
||||
}
|
||||
return null;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private boolean isComponentVisible(String componentName) {
|
||||
@@ -230,8 +231,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
ProjectManager manager = ProjectManager.getInstance();
|
||||
List<Project> referencedProjects = manager.getReferencedProjects();
|
||||
for (Project curProject : referencedProjects) {
|
||||
List<ComponentSetting> componentsSettings = (List<ComponentSetting>) curProject.getEmfProject()
|
||||
.getComponentsSettings();
|
||||
List<ComponentSetting> componentsSettings = curProject.getEmfProject().getComponentsSettings();
|
||||
for (ComponentSetting setting : componentsSettings) {
|
||||
if (setting.isHidden() && setting.getName().equals(settingInMain.getName())
|
||||
&& setting.getFamily().equals(settingInMain.getFamily())) {
|
||||
@@ -261,7 +261,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
skeletonList = new ArrayList<String>();
|
||||
String installLocation = new Path(Platform.getConfigurationLocation().getURL().getPath()).toFile().getAbsolutePath();
|
||||
componentToProviderMap = new HashMap<IComponent, AbstractComponentsProvider>();
|
||||
boolean isNeedClean = cleanComponentCache();
|
||||
boolean isNeedClean = TalendCacheUtils.cleanComponentCache();
|
||||
isCreated = hasComponentFile(installLocation) && !isNeedClean;
|
||||
if (isReset) {
|
||||
isCreated = false;
|
||||
@@ -288,18 +288,22 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
|
||||
XsdValidationCacheManager.getInstance().load();
|
||||
// 1.Load Component from extension point: components_provider
|
||||
if (isCreated) {
|
||||
try {
|
||||
reloadComponentsFromCache();
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
// if any exception happen, reset all cache
|
||||
cache.getComponentEntryMap().clear();
|
||||
isCreated = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCreated) {
|
||||
loadComponentsFromComponentsProviderExtension();
|
||||
}
|
||||
|
||||
// TimeMeasure.step("initComponents", "loadComponentsFromProvider");
|
||||
if (isCreated) {
|
||||
try {
|
||||
reloadComponentsFromCache();
|
||||
} catch (BusinessException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
// 2.Load Component from extension point: component_definition
|
||||
loadComponentsFromExtensions();
|
||||
// TimeMeasure.step("initComponents", "loadComponentsFromExtension[joblets?]");
|
||||
@@ -343,6 +347,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
|
||||
FileFilter fileFilter = new FileFilter() {
|
||||
|
||||
@Override
|
||||
public boolean accept(final File file) {
|
||||
return file.isDirectory() && file.getName().charAt(0) != '.'
|
||||
&& !file.getName().equals(IComponentsFactory.EXTERNAL_COMPONENTS_INNER_FOLDER)
|
||||
@@ -477,11 +482,6 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
return file.exists();
|
||||
}
|
||||
|
||||
private boolean cleanComponentCache() {
|
||||
return ArrayUtils.contains(Platform.getApplicationArgs(), "--clean_component_cache")
|
||||
|| ArrayUtils.contains(Platform.getApplicationArgs(), "-clean") || BrandingChecker.isBrandingChanged();
|
||||
}
|
||||
|
||||
private void loadComponentsFromComponentsProviderExtension() {
|
||||
ComponentsProviderManager componentsProviderManager = ComponentsProviderManager.getInstance();
|
||||
for (AbstractComponentsProvider componentsProvider : componentsProviderManager.getProviders()) {
|
||||
@@ -512,6 +512,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUserComponentsFromComponentsProviderExtension() {
|
||||
ComponentsProviderManager.getInstance().getProviders();
|
||||
ComponentsProviderManager componentsProviderManager = ComponentsProviderManager.getInstance();
|
||||
@@ -582,6 +583,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
|
||||
FileFilter fileFilter = new FileFilter() {
|
||||
|
||||
@Override
|
||||
public boolean accept(final File file) {
|
||||
return file.isDirectory() && file.getName().charAt(0) != '.'
|
||||
&& !file.getName().equals(IComponentsFactory.EXTERNAL_COMPONENTS_INNER_FOLDER)
|
||||
@@ -602,6 +604,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
|
||||
FileFilter skeletonFilter = new FileFilter() {
|
||||
|
||||
@Override
|
||||
public boolean accept(final File file) {
|
||||
String fileName = file.getName();
|
||||
return file.isFile() && fileName.charAt(0) != '.'
|
||||
@@ -908,6 +911,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
component.setImageRegistry(componentsImageRegistry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
if (componentList == null) {
|
||||
init(false);
|
||||
@@ -915,6 +919,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
return componentList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IComponent get(String name) {
|
||||
if (componentList == null) {
|
||||
init(false);
|
||||
@@ -928,6 +933,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeComponents(IProgressMonitor monitor) {
|
||||
this.monitor = monitor;
|
||||
if (componentList == null) {
|
||||
@@ -937,6 +943,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
this.subMonitor = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeComponents(IProgressMonitor monitor, boolean duringLogon) {
|
||||
this.monitor = monitor;
|
||||
if (componentList == null) {
|
||||
@@ -951,6 +958,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
*
|
||||
* @see org.talend.core.model.components.IComponentsFactory#getComponents()
|
||||
*/
|
||||
@Override
|
||||
public Set<IComponent> getComponents() {
|
||||
if (componentList == null) {
|
||||
init(false);
|
||||
@@ -958,6 +966,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
return componentList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IComponent> getCustomComponents() {
|
||||
if (customComponentList == null) {
|
||||
init(false);
|
||||
@@ -970,6 +979,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
*
|
||||
* @see org.talend.core.model.components.IComponentsFactory#getComponentPath()
|
||||
*/
|
||||
@Override
|
||||
public URL getComponentPath() throws IOException {
|
||||
String componentsPath = IComponentsFactory.COMPONENTS_LOCATION;
|
||||
IBrandingService breaningService = (IBrandingService) GlobalServiceRegister.getDefault().getService(
|
||||
@@ -987,6 +997,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
*
|
||||
* @see org.talend.core.model.components.IComponentsFactory#getSkeletons()
|
||||
*/
|
||||
@Override
|
||||
public List<String> getSkeletons() {
|
||||
if (skeletonList == null) {
|
||||
init(false);
|
||||
@@ -994,6 +1005,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
return skeletonList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
componentsImageRegistry.clear();
|
||||
componentList = null;
|
||||
@@ -1003,6 +1015,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetCache() {
|
||||
componentsImageRegistry.clear();
|
||||
componentList = null;
|
||||
@@ -1021,6 +1034,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
* @see org.talend.core.model.components.IComponentsFactory#getFamilyTranslation(IComponent component,
|
||||
* java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public String getFamilyTranslation(Object component, String text) {
|
||||
String translated = Messages.getString(text);
|
||||
|
||||
@@ -1051,6 +1065,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
*
|
||||
* @see org.talend.core.model.components.IComponentsFactory#getAllComponentsCanBeProvided()
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> getAllComponentsCanBeProvided() {
|
||||
List source = new ArrayList();
|
||||
if (allComponents == null) {
|
||||
@@ -1075,6 +1090,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
|
||||
FileFilter fileFilter = new FileFilter() {
|
||||
|
||||
@Override
|
||||
public boolean accept(final File file) {
|
||||
return file.isDirectory() && file.getName().charAt(0) != '.'
|
||||
&& !file.getName().equals(IComponentsFactory.EXTERNAL_COMPONENTS_INNER_FOLDER);
|
||||
@@ -1133,14 +1149,17 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
analyseur = fabrique.newDocumentBuilder();
|
||||
analyseur.setErrorHandler(new ErrorHandler() {
|
||||
|
||||
@Override
|
||||
public void error(final SAXParseException exception) throws SAXException {
|
||||
throw exception;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatalError(final SAXParseException exception) throws SAXException {
|
||||
throw exception;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warning(final SAXParseException exception) throws SAXException {
|
||||
throw exception;
|
||||
}
|
||||
@@ -1192,10 +1211,12 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
*
|
||||
* @see org.talend.core.model.components.IComponentsFactory#resetSpecificComponents()
|
||||
*/
|
||||
@Override
|
||||
public void resetSpecificComponents() {
|
||||
loadComponentsFromExtensions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, File> getComponentsProvidersFolder() {
|
||||
Map<String, File> list = new HashMap<String, File>();
|
||||
|
||||
@@ -1212,6 +1233,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ImageDescriptor> getComponentsImageRegistry() {
|
||||
return componentsImageRegistry;
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ public class UserComponentsProvider extends AbstractComponentsProvider {
|
||||
public UserComponentsProvider() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected File getExternalComponentsLocation() {
|
||||
IPreferenceStore prefStore = CodeGeneratorActivator.getDefault().getPreferenceStore();
|
||||
String path = prefStore.getString(IComponentPreferenceConstant.USER_COMPONENTS_FOLDER);
|
||||
@@ -75,6 +76,7 @@ public class UserComponentsProvider extends AbstractComponentsProvider {
|
||||
return path.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preComponentsLoad() throws IOException {
|
||||
File installationFolder = getInstallationFolder();
|
||||
if (installationFolder.exists()) {
|
||||
@@ -83,8 +85,9 @@ public class UserComponentsProvider extends AbstractComponentsProvider {
|
||||
FilesUtils.createFoldersIfNotExists(installationFolder.getAbsolutePath(), false);
|
||||
FileFilter ff = new FileFilter() {
|
||||
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
if (pathname.getName().equals(".svn")) {
|
||||
if (FilesUtils.isSVNFolder(pathname)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -95,15 +98,18 @@ public class UserComponentsProvider extends AbstractComponentsProvider {
|
||||
// synchroniz shared custom component
|
||||
if (PluginChecker.isSVNProviderPluginLoaded()) {
|
||||
Project currentProject = ProjectManager.getInstance().getCurrentProject();
|
||||
String projectLabel = currentProject.getTechnicalLabel();
|
||||
String sourcePath = new Path(Platform.getInstanceLocation().getURL().getPath()).toFile().getPath()
|
||||
+ File.separatorChar + projectLabel + File.separatorChar
|
||||
+ ERepositoryObjectType.getFolderName(ERepositoryObjectType.COMPONENTS);
|
||||
File source = new File(sourcePath);
|
||||
if (source.exists()) {
|
||||
for (File file : source.listFiles(ff)) {
|
||||
FilesUtils.copyFolder(file, new File(installationFolder.getAbsolutePath() + File.separator + file.getName()),
|
||||
true, ff, null, true, false);
|
||||
if (currentProject != null) {
|
||||
String projectLabel = currentProject.getTechnicalLabel();
|
||||
String sourcePath = new Path(Platform.getInstanceLocation().getURL().getPath()).toFile().getPath()
|
||||
+ File.separatorChar + projectLabel + File.separatorChar
|
||||
+ ERepositoryObjectType.getFolderName(ERepositoryObjectType.COMPONENTS);
|
||||
File source = new File(sourcePath);
|
||||
if (source.exists()) {
|
||||
for (File file : source.listFiles(ff)) {
|
||||
FilesUtils.copyFolder(file,
|
||||
new File(installationFolder.getAbsolutePath() + File.separator + file.getName()), true, ff, null,
|
||||
true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,20 +80,14 @@ public class XsdValidationCacheManager {
|
||||
|
||||
public boolean needCheck(java.io.File file, long currentCRC) {
|
||||
String path = file.getAbsolutePath();
|
||||
if (forceXSDAlreadyChecked) {
|
||||
alreadyCheckedXsd.put(path, currentCRC);
|
||||
return false;
|
||||
} else {
|
||||
Long lastCheckedCRC = alreadyCheckedXsd.get(path);
|
||||
Long lastCheckedCRC = alreadyCheckedXsd.get(path);
|
||||
|
||||
if (lastCheckedCRC == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean isChanged = currentCRC != lastCheckedCRC;
|
||||
|
||||
return isChanged;
|
||||
if (lastCheckedCRC == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean isChanged = currentCRC != lastCheckedCRC;
|
||||
return isChanged;
|
||||
}
|
||||
|
||||
public void setChecked(File file, long currentCRC) {
|
||||
|
||||
@@ -14,6 +14,7 @@ package org.talend.designer.codegen.config;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -25,8 +26,8 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
@@ -51,7 +52,6 @@ import org.eclipse.emf.common.util.Monitor;
|
||||
import org.eclipse.jdt.core.IClasspathEntry;
|
||||
import org.eclipse.jdt.core.IJavaModel;
|
||||
import org.eclipse.jdt.core.IJavaProject;
|
||||
import org.eclipse.jdt.core.IPackageFragmentRoot;
|
||||
import org.eclipse.jdt.core.JavaCore;
|
||||
import org.eclipse.jdt.core.JavaModelException;
|
||||
import org.talend.commons.debug.TalendDebugHandler;
|
||||
@@ -190,8 +190,11 @@ public class TalendJetEmitter extends JETEmitter {
|
||||
} else {
|
||||
project.open(new SubProgressMonitor(progressMonitor, 5));
|
||||
IProjectDescription description = project.getDescription();
|
||||
description.setNatureIds(new String[] { JavaCore.NATURE_ID });
|
||||
project.setDescription(description, new SubProgressMonitor(progressMonitor, 1));
|
||||
// only in case it's one old workspace and got no nature defined.
|
||||
if (!ArrayUtils.contains(description.getNatureIds(), JavaCore.NATURE_ID)) {
|
||||
description.setNatureIds(new String[] { JavaCore.NATURE_ID });
|
||||
project.setDescription(description, new SubProgressMonitor(progressMonitor, 1));
|
||||
}
|
||||
}
|
||||
|
||||
javaProject = JavaCore.create(project);
|
||||
@@ -217,18 +220,14 @@ public class TalendJetEmitter extends JETEmitter {
|
||||
runtimeFolder.create(false, true, new SubProgressMonitor(progressMonitor, 1));
|
||||
}
|
||||
|
||||
if (classpathEntryMissing(javaProject, classpath)) {
|
||||
if (isClasspathDifferent(javaProject, classpath)) {
|
||||
IClasspathEntry[] classpathEntryArray = classpath.toArray(new IClasspathEntry[classpath.size()]);
|
||||
javaProject.setRawClasspath(classpathEntryArray, new SubProgressMonitor(progressMonitor, 1));
|
||||
}
|
||||
javaProject.setOutputLocation(new Path("/" + project.getName() + "/runtime"), new SubProgressMonitor( //$NON-NLS-1$ //$NON-NLS-2$
|
||||
progressMonitor, 1));
|
||||
|
||||
if (rebuild) {
|
||||
javaProject.setOutputLocation(new Path("/" + project.getName() + "/runtime"), new SubProgressMonitor( //$NON-NLS-1$ //$NON-NLS-2$
|
||||
progressMonitor, 1));
|
||||
javaProject.getProject().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new NullProgressMonitor());
|
||||
}
|
||||
|
||||
javaProject.close();
|
||||
progressMonitor.done();
|
||||
} catch (CoreException exception) {
|
||||
throw new JETException(exception);
|
||||
@@ -239,7 +238,7 @@ public class TalendJetEmitter extends JETEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean classpathEntryMissing(IJavaProject javaProject, Set<IClasspathEntry> newClasspath) {
|
||||
private boolean isClasspathDifferent(IJavaProject javaProject, Set<IClasspathEntry> newClasspath) {
|
||||
IClasspathEntry[] rawClasspath;
|
||||
try {
|
||||
rawClasspath = javaProject.getRawClasspath();
|
||||
@@ -252,12 +251,19 @@ public class TalendJetEmitter extends JETEmitter {
|
||||
settedClasspath.add(classpathEntry);
|
||||
}
|
||||
|
||||
// source and target classpath must be the same
|
||||
for (IClasspathEntry classpathEntry : newClasspath) {
|
||||
if (!settedClasspath.contains(classpathEntry)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (IClasspathEntry classpathEntry : settedClasspath) {
|
||||
if (!newClasspath.contains(classpathEntry)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -292,90 +298,107 @@ public class TalendJetEmitter extends JETEmitter {
|
||||
|
||||
progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETOpeningJavaProject_message", //$NON-NLS-1$
|
||||
new Object[] { project.getName() }));
|
||||
javaProject.open(new SubProgressMonitor(progressMonitor, 1));
|
||||
|
||||
IPackageFragmentRoot[] packageFragmentRoots = javaProject.getPackageFragmentRoots();
|
||||
IPackageFragmentRoot sourcePackageFragmentRoot = null;
|
||||
for (int j = 0; j < packageFragmentRoots.length; ++j) {
|
||||
IPackageFragmentRoot packageFragmentRoot = packageFragmentRoots[j];
|
||||
if (packageFragmentRoot.getKind() == IPackageFragmentRoot.K_SOURCE) {
|
||||
sourcePackageFragmentRoot = packageFragmentRoot;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
String packageName = jetCompiler.getSkeleton().getPackageName();
|
||||
StringTokenizer stringTokenizer = new StringTokenizer(packageName, "."); //$NON-NLS-1$
|
||||
IProgressMonitor subProgressMonitor = new SubProgressMonitor(progressMonitor, 1);
|
||||
subProgressMonitor.beginTask("", stringTokenizer.countTokens() + 4); //$NON-NLS-1$
|
||||
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_CreateTargetFile_message")); //$NON-NLS-1$
|
||||
IContainer sourceContainer = (IContainer) sourcePackageFragmentRoot.getCorrespondingResource();
|
||||
IFolder sourceContainer = project.getFolder("src");
|
||||
|
||||
while (stringTokenizer.hasMoreElements()) {
|
||||
String folderName = stringTokenizer.nextToken();
|
||||
sourceContainer = sourceContainer.getFolder(new Path(folderName));
|
||||
if (!sourceContainer.exists()) {
|
||||
try {
|
||||
((IFolder) sourceContainer).create(true, true, new SubProgressMonitor(subProgressMonitor, 1));
|
||||
sourceContainer.create(true, true, new SubProgressMonitor(subProgressMonitor, 1));
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean needRebuild = true;
|
||||
IFile targetFile = sourceContainer.getFile(new Path(jetCompiler.getSkeleton().getClassName() + ".java")); //$NON-NLS-1$
|
||||
if (!targetFile.exists()) {
|
||||
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETCreating_message", //$NON-NLS-1$
|
||||
new Object[] { targetFile.getFullPath() }));
|
||||
targetFile.create(contents, true, new SubProgressMonitor(subProgressMonitor, 1));
|
||||
} else {
|
||||
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETUpdating_message", //$NON-NLS-1$
|
||||
new Object[] { targetFile.getFullPath() }));
|
||||
targetFile.setContents(contents, true, true, new SubProgressMonitor(subProgressMonitor, 1));
|
||||
}
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETBuilding_message", //$NON-NLS-1$
|
||||
new Object[] { project.getName() }));
|
||||
project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new SubProgressMonitor(subProgressMonitor, 1));
|
||||
DataInputStream dis = new DataInputStream(targetFile.getContents());
|
||||
int len = 0;
|
||||
byte[] buf = new byte[1024];
|
||||
while (((len = dis.read(buf))) != -1) {
|
||||
baos.write(buf, 0, len);
|
||||
}
|
||||
dis.close();
|
||||
|
||||
IMarker[] markers = targetFile.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
|
||||
boolean errors = false;
|
||||
for (int i = 0; i < markers.length; ++i) {
|
||||
IMarker marker = markers[i];
|
||||
if (marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO) == IMarker.SEVERITY_ERROR) {
|
||||
errors = true;
|
||||
subProgressMonitor.subTask(marker.getAttribute(IMarker.MESSAGE) + " : " //$NON-NLS-1$
|
||||
+ (CodeGenPlugin.getPlugin().getString("jet.mark.file.line", new Object[] { //$NON-NLS-1$
|
||||
targetFile.getLocation(), marker.getAttribute(IMarker.LINE_NUMBER) })));
|
||||
log.error(jetEmitter.templateURI.substring(jetEmitter.templateURI.lastIndexOf("/") + 1) //$NON-NLS-1$
|
||||
+ Messages.getString(
|
||||
"TalendJetEmitter.compileFail", //$NON-NLS-1$
|
||||
marker.getAttribute(IMarker.MESSAGE),
|
||||
(CodeGenPlugin.getPlugin().getString("jet.mark.file.line", new Object[] { //$NON-NLS-1$
|
||||
targetFile.getLocation(), marker.getAttribute(IMarker.LINE_NUMBER) }))));
|
||||
String currentContent = baos.toString();
|
||||
String newContent = outputStream.toString();
|
||||
// since the build is done on linux, if use windows, it will use different rules for \r + \n
|
||||
// so compare without \r, at least to see if original string is the same
|
||||
// if yes, consider all is ok, no need to replace the content and recompile
|
||||
currentContent = currentContent.replace("\r", ""); //$NON-NLS-1$//$NON-NLS-2$
|
||||
newContent = newContent.replace("\r", ""); //$NON-NLS-1$//$NON-NLS-2$
|
||||
if (!newContent.equals(currentContent)) {
|
||||
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETUpdating_message", //$NON-NLS-1$
|
||||
new Object[] { targetFile.getFullPath() }));
|
||||
targetFile.setContents(contents, true, true, new SubProgressMonitor(subProgressMonitor, 1));
|
||||
} else {
|
||||
needRebuild = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!errors) {
|
||||
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETLoadingClass_message", //$NON-NLS-1$
|
||||
new Object[] { jetCompiler.getSkeleton().getClassName() + ".class" })); //$NON-NLS-1$
|
||||
// if jetEmitter.getMethod() == null, means the class file doesn't exist anymore
|
||||
// it should be impossible to have only the class file deleted and the .java never modified, but still
|
||||
// handle this case.
|
||||
if (needRebuild || jetEmitter.getMethod() == null) {
|
||||
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETBuilding_message", //$NON-NLS-1$
|
||||
new Object[] { project.getName() }));
|
||||
|
||||
// Construct a proper URL for relative lookup.
|
||||
//
|
||||
URL url = new File(project.getLocation() + "/" + javaProject.getOutputLocation().removeFirstSegments(1) + "/") //$NON-NLS-1$ //$NON-NLS-2$
|
||||
.toURL();
|
||||
URLClassLoader theClassLoader = new URLClassLoader(new URL[] { url }, jetEmitter.classLoader);
|
||||
Class theClass = theClassLoader.loadClass((packageName.length() == 0 ? "" : packageName + ".") //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ jetCompiler.getSkeleton().getClassName());
|
||||
String methodName = jetCompiler.getSkeleton().getMethodName();
|
||||
Method[] methods = theClass.getDeclaredMethods();
|
||||
for (int i = 0; i < methods.length; ++i) {
|
||||
if (methods[i].getName().equals(methodName)) {
|
||||
jetEmitter.setMethod(methods[i]);
|
||||
break;
|
||||
project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new SubProgressMonitor(subProgressMonitor, 1));
|
||||
|
||||
IMarker[] markers = targetFile.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
|
||||
boolean errors = false;
|
||||
for (int i = 0; i < markers.length; ++i) {
|
||||
IMarker marker = markers[i];
|
||||
if (marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO) == IMarker.SEVERITY_ERROR) {
|
||||
errors = true;
|
||||
subProgressMonitor.subTask(marker.getAttribute(IMarker.MESSAGE) + " : " //$NON-NLS-1$
|
||||
+ (CodeGenPlugin.getPlugin().getString("jet.mark.file.line", new Object[] { //$NON-NLS-1$
|
||||
targetFile.getLocation(), marker.getAttribute(IMarker.LINE_NUMBER) })));
|
||||
log.error(jetEmitter.templateURI.substring(jetEmitter.templateURI.lastIndexOf("/") + 1) //$NON-NLS-1$
|
||||
+ Messages.getString(
|
||||
"TalendJetEmitter.compileFail", //$NON-NLS-1$
|
||||
marker.getAttribute(IMarker.MESSAGE),
|
||||
(CodeGenPlugin.getPlugin().getString("jet.mark.file.line", new Object[] { //$NON-NLS-1$
|
||||
targetFile.getLocation(), marker.getAttribute(IMarker.LINE_NUMBER) }))));
|
||||
}
|
||||
}
|
||||
|
||||
if (!errors) {
|
||||
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETLoadingClass_message", //$NON-NLS-1$
|
||||
new Object[] { jetCompiler.getSkeleton().getClassName() + ".class" })); //$NON-NLS-1$
|
||||
|
||||
// Construct a proper URL for relative lookup.
|
||||
//
|
||||
URL url = new File(project.getLocation()
|
||||
+ "/" + javaProject.getOutputLocation().removeFirstSegments(1) + "/") //$NON-NLS-1$ //$NON-NLS-2$
|
||||
.toURL();
|
||||
URLClassLoader theClassLoader = new URLClassLoader(new URL[] { url }, jetEmitter.classLoader);
|
||||
Class theClass = theClassLoader.loadClass((packageName.length() == 0 ? "" : packageName + ".") //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ jetCompiler.getSkeleton().getClassName());
|
||||
String methodName = jetCompiler.getSkeleton().getMethodName();
|
||||
Method[] methods = theClass.getDeclaredMethods();
|
||||
for (int i = 0; i < methods.length; ++i) {
|
||||
if (methods[i].getName().equals(methodName)) {
|
||||
jetEmitter.setMethod(methods[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
subProgressMonitor.done();
|
||||
} catch (CoreException exception) {
|
||||
TalendDebugHandler.debug(exception);
|
||||
|
||||
@@ -48,11 +48,11 @@ import org.talend.commons.exception.BusinessException;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.StringUtils;
|
||||
import org.talend.commons.utils.io.IOUtils;
|
||||
import org.talend.commons.utils.time.TimeMeasure;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.context.Context;
|
||||
import org.talend.core.context.RepositoryContext;
|
||||
import org.talend.core.language.ECodeLanguage;
|
||||
import org.talend.core.language.LanguageManager;
|
||||
import org.talend.core.model.components.ComponentCompilations;
|
||||
import org.talend.core.model.components.ComponentUtilities;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
@@ -120,7 +120,11 @@ public final class CodeGeneratorEmittersPoolFactory {
|
||||
|
||||
public IStatus doRun() {
|
||||
try {
|
||||
TimeMeasure.display = CommonsPlugin.isDebugMode();
|
||||
TimeMeasure.displaySteps = CommonsPlugin.isDebugMode();
|
||||
TimeMeasure.measureActive = CommonsPlugin.isDebugMode();
|
||||
|
||||
TimeMeasure.begin("initialize Jet Emitters");
|
||||
ComponentsFactoryProvider.saveComponentVisibilityStatus();
|
||||
|
||||
jetFilesCompileFail.clear();
|
||||
@@ -131,9 +135,7 @@ public final class CodeGeneratorEmittersPoolFactory {
|
||||
} else {
|
||||
monitorWrap = new NullProgressMonitor();
|
||||
}
|
||||
RepositoryContext repositoryContext = (RepositoryContext) CorePlugin.getContext().getProperty(
|
||||
Context.REPOSITORY_CONTEXT_KEY);
|
||||
ECodeLanguage codeLanguage = repositoryContext.getProject().getLanguage();
|
||||
ECodeLanguage codeLanguage = LanguageManager.getCurrentLanguage();
|
||||
|
||||
CodeGeneratorInternalTemplatesFactory templatesFactory = CodeGeneratorInternalTemplatesFactoryProvider
|
||||
.getInstance();
|
||||
@@ -203,12 +205,15 @@ public final class CodeGeneratorEmittersPoolFactory {
|
||||
"CodeGeneratorEmittersPoolFactory.componentCompiled", (System.currentTimeMillis() - startTime))); //$NON-NLS-1$
|
||||
initialized = true;
|
||||
|
||||
// remove compilations markers
|
||||
ComponentCompilations.deleteMarkers();
|
||||
ComponentCompilations.addMarkers();
|
||||
initializeStart = false;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(Messages.getString("CodeGeneratorEmittersPoolFactory.initialException"), e); //$NON-NLS-1$
|
||||
TimeMeasure.end("initialize Jet Emitters");
|
||||
TimeMeasure.display = false;
|
||||
TimeMeasure.displaySteps = false;
|
||||
TimeMeasure.measureActive = false;
|
||||
return new Status(IStatus.ERROR, CodeGeneratorActivator.PLUGIN_ID,
|
||||
Messages.getString("CodeGeneratorEmittersPoolFactory.initialException"), e); //$NON-NLS-1$
|
||||
} finally {
|
||||
@@ -220,6 +225,10 @@ public final class CodeGeneratorEmittersPoolFactory {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
TimeMeasure.end("initialize Jet Emitters");
|
||||
TimeMeasure.display = false;
|
||||
TimeMeasure.displaySteps = false;
|
||||
TimeMeasure.measureActive = false;
|
||||
if (jetFilesCompileFail.size() > 0) {
|
||||
StringBuilder message = new StringBuilder();
|
||||
for (JetBean tmpJetBean : jetFilesCompileFail) {
|
||||
@@ -418,39 +427,13 @@ public final class CodeGeneratorEmittersPoolFactory {
|
||||
// error already loggued
|
||||
emitterPool = new HashMap<JetBean, JETEmitter>();
|
||||
}
|
||||
} else {
|
||||
ComponentCompilations.deleteMarkers();
|
||||
}
|
||||
|
||||
// for (JetBean jetBean : components) {
|
||||
// if (!emitterPool.containsKey(jetBean)) {
|
||||
// // System.out.println("The new file is not in JetPersistence* cache:" +
|
||||
// // jetBean.getTemplateFullUri());
|
||||
// TalendJetEmitter emitter = new TalendJetEmitter(jetBean.getTemplateFullUri(), jetBean.getClassLoader(),
|
||||
// jetBean
|
||||
// .getFamily(), jetBean.getClassName(), jetBean.getLanguage(), jetBean.getCodePart(), dummyEmitter
|
||||
// .getTalendEclipseHelper());
|
||||
// emitter.initialize(sub);
|
||||
//
|
||||
// if (emitter.getMethod() != null) {
|
||||
// jetBean.setMethod(emitter.getMethod());
|
||||
// jetBean.setClassName(emitter.getMethod().getDeclaringClass().getName());
|
||||
// alreadyCompiledEmitters.add(jetBean);
|
||||
// } else {
|
||||
// jetFilesCompileFail.add(jetBean);
|
||||
// }
|
||||
// emitterPool.put(jetBean, emitter);
|
||||
// monitorBuffer++;
|
||||
// if (monitorBuffer % 100 == 0) {
|
||||
// monitorWrap.worked(100);
|
||||
// monitorBuffer = 0;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
synchronizedComponent(components, sub, alreadyCompiledEmitters, dummyEmitter, monitorBuffer, monitorWrap);
|
||||
|
||||
monitorWrap.worked(monitorBuffer);
|
||||
// } catch (JETException e) {
|
||||
// log.error(Messages.getString("CodeGeneratorEmittersPoolFactory.jetEmitterInitialException") + e.getMessage(), e); //$NON-NLS-1$
|
||||
// }
|
||||
try {
|
||||
EmfEmittersPersistenceFactory.getInstance(codeLanguage).saveEmittersPool(
|
||||
extractEmfPersistenData(alreadyCompiledEmitters));
|
||||
@@ -468,6 +451,8 @@ public final class CodeGeneratorEmittersPoolFactory {
|
||||
List<JetBean> alreadyCompiledEmitters, TalendJetEmitter dummyEmitter, int monitorBuffer, IProgressMonitor monitorWrap) {
|
||||
for (JetBean jetBean : components) {
|
||||
if (!emitterPool.containsKey(jetBean)) {
|
||||
ComponentCompilations.deleteMarkers();
|
||||
|
||||
// System.out.println("The new file is not in JetPersistence* cache:" + getFullTemplatePath(jetBean));
|
||||
TalendJetEmitter emitter = new TalendJetEmitter(getFullTemplatePath(jetBean), jetBean.getClassLoader(),
|
||||
jetBean.getFamily(), jetBean.getClassName(), jetBean.getLanguage(), jetBean.getCodePart(),
|
||||
@@ -635,11 +620,16 @@ public final class CodeGeneratorEmittersPoolFactory {
|
||||
} catch (Error e) {
|
||||
throw new ClassNotFoundException(e.getMessage(), e);
|
||||
}
|
||||
Method[] methods = theClass.getDeclaredMethods();
|
||||
for (int i = 0; i < methods.length; ++i) {
|
||||
if (methods[i].getName().equals(methodName)) {
|
||||
return methods[i];
|
||||
// TDI-23079
|
||||
try {
|
||||
Method[] methods = theClass.getDeclaredMethods();
|
||||
for (int i = 0; i < methods.length; ++i) {
|
||||
if (methods[i].getName().equals(methodName)) {
|
||||
return methods[i];
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
RefreshComponenentsAction.Label=Componentenlijst verversen
|
||||
@@ -1,6 +1,7 @@
|
||||
ExchangeView.Exchange=Exchange
|
||||
AvailableExtensionsComposite.ExtensionName=Nom de l'extension
|
||||
AvailableExtensionsComposite.Version=Version
|
||||
AvailableExtensionsComposite.Rating=Note
|
||||
AvailableExtensionsComposite.Author=Auteur
|
||||
AvailableExtensionsComposite.ViewDetail.installOperateStatus=Installer
|
||||
AvailableExtensionsComposite.ViewDetail.WriteReview=Donnez votre avis
|
||||
@@ -9,16 +10,18 @@ DownloadedExtensionsComposite.DownloadedVersion=Version t
|
||||
DownloadedExtensionsComposite.DownloadDate=Date de téléchargement
|
||||
DownloadedExtensionsComposite.installedOperateStatus=Installé
|
||||
DownloadedExtensionsComposite.updateOperateStatus=Mettre à jour
|
||||
MyExtensionsComposite.Version=Version
|
||||
MyExtensionsComposite.UploadDate=Date du chargement
|
||||
MyExtensionsComposite.AddNewExtensionTitle=Ajouter une nouvelle extension
|
||||
MyExtensionsComposite.UpLoadNewVersionOperateStatus=Charger une nouvelle version
|
||||
MyExtensionsComposite.ModifyOperateStatus=Modifier
|
||||
MyExtensionsComposite.DeleteOperateStatus=Supprimer
|
||||
MyExtensionsComposite.DeleteOperateStatus=DELETE
|
||||
MyExtensionsComposite.Form.Return=Retourner
|
||||
MyExtensionsComposite.Form.ExtensionTitle=Titre de l'extension
|
||||
MyExtensionsComposite.Form.InitialVersion=Version initiale
|
||||
MyExtensionsComposite.Form.Compatibility=Compatibilité
|
||||
MyExtensionsComposite.Form.Compatibility.AllVersions=Toutes les versions
|
||||
MyExtensionsComposite.Form.Compatibility.Version=Version
|
||||
MyExtensionsComposite.Form.Compatibility.AllVersionsExcept=Toutes les versions sauf :
|
||||
MyExtensionsComposite.Form.Compatibility.OnlyTheseVersions=Uniquement ces versions :
|
||||
MyExtensionsComposite.Form.Description=Description
|
||||
@@ -43,6 +46,8 @@ DeleteExtensionJob.DeleteExtensionJob.Title=Supprimer une extension...
|
||||
DeleteExtensionJob.DeleteFailure=Echec de la connexion.
|
||||
ModifyExtensionJob.Title=Modifier une extension...
|
||||
ModifyExtensionJob.ModifyFailure=Echec de la modification
|
||||
InstalledExtensionJob.Title=Installation de l'extension...
|
||||
InsertionExtensionAction.InstalledFailure=Echec de l'installation
|
||||
UploadRevisionJob.Title=Chargement de la révision...
|
||||
UploadRevisionAction.InstalledFailure=Echec du chargement de la révision.
|
||||
DownloadComponenentsAction.installExchange=Installer les composants Exchange
|
||||
@@ -74,3 +79,4 @@ ImportExchangeDialog.REFRESH_BUTTON=Rafra
|
||||
ImportExchangeDialog.REFRESHING_PROGRESSBAR=Rafraîchissement, veuillez patienter..
|
||||
ImportExchangeDialog.NOT_SELECT_BUTTON=Merci de d'abord sélectionner un choix
|
||||
ImportExchangeDialog.OPERATION_CANCELLED=L'opération a été annulée
|
||||
Exchange.logon.error=L'utilisateur de l'Exchange n'est pas enregistré. Enregistrez-vous via les Préférences.
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
DownloadedExtensionsComposite.updateOperateStatus=Update
|
||||
MyExtensionsComposite.UpdateOperateStatus=Update
|
||||
MyExtensionsComposite.ModifyOperateStatus=Wijzigen
|
||||
MyExtensionsComposite.DeleteOperateStatus=Verwijderen
|
||||
MyExtensionsComposite.Form.Upload.Browse=Blader...
|
||||
RefreshJob.FindExtensions.Title=Beschikbare extensies zoeken
|
||||
RefreshJob.FindExtensions.Message=Extensies zoeken op Exchange...
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
DownloadedExtensionsComposite.updateOperateStatus=UPDATE
|
||||
MyExtensionsComposite.UpdateOperateStatus=UPDATE
|
||||
MyExtensionsComposite.DeleteOperateStatus=DELETE
|
||||
ImportExchangeDialog.TEMPLATES_BUTTON=SQL \u0161abloni
|
||||
ImportExchangeDialog.REFRESH_BUTTON=Osve\u017Eavanje
|
||||
|
||||
@@ -75,14 +75,16 @@ public class ExchangeComponentsProvider extends AbstractComponentsProvider {
|
||||
private void copyFolder(File externalComponentsLocation, File installFolder) throws IOException {
|
||||
FileFilter folderFilter = new FileFilter() {
|
||||
|
||||
@Override
|
||||
public boolean accept(File file) {
|
||||
return file.isDirectory();
|
||||
}
|
||||
};
|
||||
FileFilter ff = new FileFilter() {
|
||||
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
if (pathname.getName().equals(".svn")) {
|
||||
if (FilesUtils.isSVNFolder(pathname)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -1,185 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.designer.components.exchange.jobs;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.designer.components.exchange.util.ExchangeWebService;
|
||||
|
||||
import us.monoid.json.JSONObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC hcyi class global comment. Detailled comment
|
||||
*/
|
||||
public class ComponentDownloader {
|
||||
|
||||
private List<DownloadListener> fListeners = new ArrayList<DownloadListener>();
|
||||
|
||||
private boolean fCancel = false;
|
||||
|
||||
private static final int BUFFER_SIZE = 8192;
|
||||
|
||||
/**
|
||||
* Download file from specific url to local folder.
|
||||
*
|
||||
* @param componentUrl The file url to download
|
||||
* @param targetFolder Local folder to store downloaded file
|
||||
* @throws Exception
|
||||
*/
|
||||
public void download(String componentUrl, String targetFolder) throws Exception {
|
||||
String fileName = componentUrl.substring(componentUrl.lastIndexOf('/'));
|
||||
File destination = new File(targetFolder + fileName);
|
||||
URL url = new URL(componentUrl);
|
||||
|
||||
download(url, destination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Download file from specific url.
|
||||
*
|
||||
* @param componentUrl The file url to download
|
||||
* @param destination The local file to be saved
|
||||
* @throws Exception
|
||||
*/
|
||||
public void download(URL componentUrl, File destination) throws Exception {
|
||||
BufferedInputStream bis = null;
|
||||
BufferedOutputStream bos = null;
|
||||
try {
|
||||
|
||||
URLConnection connection = componentUrl.openConnection();
|
||||
|
||||
bis = new BufferedInputStream(connection.getInputStream());
|
||||
bos = new BufferedOutputStream(new FileOutputStream(destination));
|
||||
fireDownloadStart(connection.getContentLength());
|
||||
|
||||
byte[] buf = new byte[BUFFER_SIZE];
|
||||
int bytesDownloaded = 0;
|
||||
int bytesRead = -1;
|
||||
while ((bytesRead = bis.read(buf)) != -1) {
|
||||
bos.write(buf, 0, bytesRead);
|
||||
bytesDownloaded += bytesRead;
|
||||
|
||||
fireDownloadProgress(bytesRead);
|
||||
if (fCancel) {
|
||||
// cacel download process
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bos.flush();
|
||||
// System.out.println(bytesDownloaded);
|
||||
fireDownloadComplete();
|
||||
} finally {
|
||||
Exception e = null;
|
||||
if (bis != null) {
|
||||
try {
|
||||
bis.close();
|
||||
} catch (IOException ioe) {
|
||||
e = ioe;
|
||||
}
|
||||
}
|
||||
if (bos != null) {
|
||||
try {
|
||||
bos.close();
|
||||
} catch (IOException ioe) {
|
||||
e = ioe;
|
||||
}
|
||||
}
|
||||
if (e != null) {
|
||||
// rethrow the exception to caller
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the user cancel download process.
|
||||
*
|
||||
* @return the cancel
|
||||
*/
|
||||
public boolean isCancel() {
|
||||
return fCancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set true if the user cacel download process.
|
||||
*
|
||||
* @param cancel the cancel to set
|
||||
*/
|
||||
public void setCancel(boolean cancel) {
|
||||
fCancel = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify listeners about progress.
|
||||
*
|
||||
* @param bytesRead
|
||||
*/
|
||||
private void fireDownloadProgress(int bytesRead) {
|
||||
for (DownloadListener listener : fListeners) {
|
||||
listener.downloadProgress(this, bytesRead);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify listeners at the end of download process.
|
||||
*/
|
||||
private void fireDownloadComplete() {
|
||||
for (DownloadListener listener : fListeners) {
|
||||
listener.downloadComplete();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify listeners at the begining of download process.
|
||||
*/
|
||||
private void fireDownloadStart(int contentLength) {
|
||||
for (DownloadListener listener : fListeners) {
|
||||
listener.downloadStart(contentLength);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add listener to observe the download process.
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
public void addDownloadListener(DownloadListener listener) {
|
||||
fListeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeDownloadListener(DownloadListener listener) {
|
||||
fListeners.remove(listener);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
new ComponentDownloader().download("http://talendforge.org/ext/upload/extension-33/revision-45/tFileOutputPDF.zip", //$NON-NLS-1$
|
||||
"d:/temp"); //$NON-NLS-1$
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.designer.components.exchange.jobs;
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC hcyi class global comment. Detailled comment
|
||||
*/
|
||||
public interface DownloadListener {
|
||||
|
||||
/**
|
||||
* Notify before download start.
|
||||
*
|
||||
* @param totalSize The size of file.
|
||||
*/
|
||||
void downloadStart(int totalSize);
|
||||
|
||||
/**
|
||||
* Notify when download progress. DOC hcw Comment method "downloadProgress".
|
||||
*
|
||||
* @param downloader The source that trigger this event.
|
||||
* @param bytesDownloaded The number of bytes that have readed just now.
|
||||
*/
|
||||
void downloadProgress(ComponentDownloader downloader, int bytesDownloaded);
|
||||
|
||||
/**
|
||||
* Notify after download complete.
|
||||
*/
|
||||
void downloadComplete();
|
||||
|
||||
}
|
||||
@@ -42,6 +42,8 @@ import org.eclipse.ui.intro.config.IIntroAction;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.download.DownloadHelper;
|
||||
import org.talend.core.download.DownloadListener;
|
||||
import org.talend.core.language.ECodeLanguage;
|
||||
import org.talend.core.language.LanguageManager;
|
||||
import org.talend.core.model.components.ComponentUtilities;
|
||||
@@ -51,9 +53,7 @@ import org.talend.designer.codegen.ICodeGeneratorService;
|
||||
import org.talend.designer.components.exchange.ExchangeComponentsProvider;
|
||||
import org.talend.designer.components.exchange.ExchangeConstants;
|
||||
import org.talend.designer.components.exchange.i18n.Messages;
|
||||
import org.talend.designer.components.exchange.jobs.ComponentDownloader;
|
||||
import org.talend.designer.components.exchange.jobs.ComponentInstaller;
|
||||
import org.talend.designer.components.exchange.jobs.DownloadListener;
|
||||
import org.talend.designer.components.exchange.model.ComponentExtension;
|
||||
import org.talend.designer.components.exchange.ui.htmlcontent.ContentConstants;
|
||||
import org.talend.designer.components.exchange.ui.views.ExchangeManager;
|
||||
@@ -116,7 +116,7 @@ public class DownloadComponenentsAction extends Action implements IIntroAction {
|
||||
// Start Code Generation Init
|
||||
ICodeGeneratorService codeGenService = (ICodeGeneratorService) GlobalServiceRegister.getDefault().getService(
|
||||
ICodeGeneratorService.class);
|
||||
Job job = codeGenService.initializeTemplates();
|
||||
Job job = codeGenService.refreshTemplates();
|
||||
job.addJobChangeListener(new JobChangeAdapter() {
|
||||
|
||||
@Override
|
||||
@@ -288,7 +288,7 @@ public class DownloadComponenentsAction extends Action implements IIntroAction {
|
||||
URL url = new URL(downloadUrl);
|
||||
|
||||
monitor.setTaskName(ExchangeConstants.getDownloadTaskNameLable() + url.toString());
|
||||
ComponentDownloader downloader = new ComponentDownloader();
|
||||
DownloadHelper downloader = new DownloadHelper();
|
||||
downloader.addDownloadListener(this);
|
||||
// block until download complete
|
||||
downloader.download(url, localZipFile);
|
||||
@@ -339,7 +339,7 @@ public class DownloadComponenentsAction extends Action implements IIntroAction {
|
||||
public void downloadComplete() {
|
||||
}
|
||||
|
||||
public void downloadProgress(ComponentDownloader downloader, int bytesRead) {
|
||||
public void downloadProgress(DownloadHelper downloader, int bytesRead) {
|
||||
if (fMonitor.isCanceled()) {
|
||||
// cancel download
|
||||
downloader.setCancel(true);
|
||||
|
||||
@@ -50,9 +50,9 @@ import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.ui.runtime.image.EImage;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.core.download.DownloadHelper;
|
||||
import org.talend.designer.components.exchange.ExchangePlugin;
|
||||
import org.talend.designer.components.exchange.i18n.Messages;
|
||||
import org.talend.designer.components.exchange.jobs.ComponentDownloader;
|
||||
import org.talend.designer.components.exchange.jobs.ComponentSearcher;
|
||||
import org.talend.designer.components.exchange.model.ComponentExtension;
|
||||
import org.talend.designer.components.exchange.model.VersionRevision;
|
||||
@@ -182,7 +182,7 @@ public class ImportExchangeDialog extends Dialog {
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
new ComponentDownloader().download(url, tempFile);
|
||||
new DownloadHelper().download(url, tempFile);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="org.talend.designer.components.libs" default="process" basedir=".">
|
||||
|
||||
<property name="component.plugin.home" value="../../../org.talend.designer.components.localprovider/components" />
|
||||
|
||||
<!-- #################################################### -->
|
||||
|
||||
<!-- modification 1: config -->
|
||||
<property name="jar.name" value="cobolX.jar" />
|
||||
<property name="component.name" value="tFileInputEBCDIC" />
|
||||
<property name="author.name" value="jjzhou" />
|
||||
|
||||
<!-- modification 2: compile classpath -->
|
||||
<path id="compile.classpath">
|
||||
</path>
|
||||
|
||||
<!-- #################################################### -->
|
||||
|
||||
|
||||
<!-- sourcecode and final jar path -->
|
||||
<property name="source.home" value="." />
|
||||
<property name="jar.home" value="${component.plugin.home}/${component.name}/${jar.name}" />
|
||||
|
||||
<!-- temp dir for clasee files -->
|
||||
<property name="build.dir" value="../../build" />
|
||||
|
||||
<!-- compile option -->
|
||||
<property name="compile.debug" value="true" />
|
||||
<property name="compile.deprecation" value="false" />
|
||||
<property name="compile.optimize" value="true" />
|
||||
|
||||
|
||||
<target name="process" description="prepare a temp dir">
|
||||
<antcall target="prepare" />
|
||||
<antcall target="compile" />
|
||||
<antcall target="clean" />
|
||||
</target>
|
||||
|
||||
<target name="prepare" description="prepare a temp dir">
|
||||
<delete dir="${build.dir}" />
|
||||
<mkdir dir="${build.dir}" />
|
||||
<mkdir dir="${build.dir}/classes" />
|
||||
</target>
|
||||
|
||||
<target name="compile" description="Compile Java sources">
|
||||
|
||||
<!-- compile -->
|
||||
<javac srcdir="${source.home}" destdir="${build.dir}/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}">
|
||||
<classpath refid="compile.classpath" />
|
||||
</javac>
|
||||
|
||||
<!-- include source code -->
|
||||
<copy todir="${build.dir}/classes">
|
||||
<fileset dir="${source.home}">
|
||||
<exclude name="build.xml" />
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<!-- make jar -->
|
||||
<tstamp>
|
||||
<format property="date" pattern="yyyy-MM-dd HH:mm:ss" />
|
||||
</tstamp>
|
||||
|
||||
<jar destfile="${build.dir}/${jar.name}" basedir="${build.dir}/classes">
|
||||
<manifest>
|
||||
<!-- who -->
|
||||
<attribute name="Built-By" value="${author.name}" />
|
||||
<!-- when -->
|
||||
<attribute name="Built-Date" value="${date}"/>
|
||||
<!-- JDK version -->
|
||||
<attribute name="Created-By" value="${java.version} (${java.vendor})" />
|
||||
<!-- Information about the program itself -->
|
||||
<attribute name="Implementation-Vendor" value="Talend SA" />
|
||||
<attribute name="Implementation-Title" value="${jar.name}" />
|
||||
<attribute name="Implementation-Version" value="1.0" />
|
||||
</manifest>
|
||||
</jar>
|
||||
|
||||
<!-- move jar -->
|
||||
<move file="${build.dir}/${jar.name}" tofile="${jar.home}" />
|
||||
|
||||
</target>
|
||||
|
||||
<target name="clean" description="clean the temp dir">
|
||||
<delete dir="${build.dir}" />
|
||||
<mkdir dir="${build.dir}" />
|
||||
</target>
|
||||
</project>
|
||||
@@ -0,0 +1,57 @@
|
||||
package cobolConversion;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
public enum CharSetEnum {
|
||||
// define data table for using
|
||||
Cp037("Cp037", "{ABCDEFGHI", "}JKLMNOPQR"), Cp273("Cp273", "äABCDEFGHI",
|
||||
"üJKLMNOPQR"), Cp277("Cp277", "æABCDEFGHI", "åJKLMNOPQR"), Cp278(
|
||||
"Cp278", "äABCDEFGHI", "åJKLMNOPQR"), Cp280("Cp280", "àABCDEFGHI",
|
||||
"èJKLMNOPQR"), Cp284("Cp284", "{ABCDEFGHI", "}JKLMNOPQR"), Cp285(
|
||||
"Cp285", "{ABCDEFGHI", "}JKLMNOPQR"), Cp297("Cp297", "éABCDEFGHI",
|
||||
"èJKLMNOPQR"), Cp420("Cp420", "{ABCDEFGHI", "}JKLMNOPQR"), Cp424(
|
||||
"Cp424", "{ABCDEFGHI", "}JKLMNOPQR"), Cp500("Cp500", "{ABCDEFGHI",
|
||||
"}JKLMNOPQR"), Cp870("Cp870", "{ABCDEFGHI", "}JKLMNOPQR"), Cp871(
|
||||
"Cp871", "þABCDEFGHI", "æJKLMNOPQR"), Cp875("Cp875", "{ABCDEFGHI",
|
||||
"}JKLMNOPQR"), Cp1025("Cp1025", "{ABCDEFGHI", "}JKLMNOPQR"), Cp1026(
|
||||
"Cp1026", "çABCDEFGHI", "ğJKLMNOPQR"), Cp1047("Cp1047",
|
||||
"{ABCDEFGHI", "}JKLMNOPQR"), Cp1112("Cp1112", "{ABCDEFGHI",
|
||||
"}JKLMNOPQR"), Cp1122("Cp1122", "äABCDEFGHI", "ğJKLMNOPQR"), Cp1123(
|
||||
"Cp1123", "{ABCDEFGHI", "}JKLMNOPQR"), Cp1140("Cp1140",
|
||||
"{ABCDEFGHI", "}JKLMNOPQR"), Cp1141("Cp1141", "äABCDEFGHI",
|
||||
"üJKLMNOPQR"), Cp1142("Cp1142", "æABCDEFGHI", "åJKLMNOPQR"), Cp1143(
|
||||
"Cp1143", "äABCDEFGHI", "åJKLMNOPQR"), Cp1144("Cp1144",
|
||||
"àABCDEFGHI", "èJKLMNOPQR"), Cp1145("Cp1145", "{ABCDEFGHI",
|
||||
"}JKLMNOPQR"), Cp1146("Cp1146", "{ABCDEFGHI", "}JKLMNOPQR"), Cp1147(
|
||||
"Cp1147", "éABCDEFGHI", "èJKLMNOPQR"), Cp1148("Cp1148",
|
||||
"{ABCDEFGHI", "}JKLMNOPQR"), Cp1149("Cp1149", "þABCDEFGHI",
|
||||
"æJKLMNOPQR");
|
||||
|
||||
String charSet;
|
||||
String failoverpositives;
|
||||
String failovernegatives;
|
||||
|
||||
//default construct
|
||||
CharSetEnum(String charSet, String failoverpositives,
|
||||
String failovernegatives) {
|
||||
this.charSet = charSet;
|
||||
this.failoverpositives = failoverpositives;
|
||||
this.failovernegatives = failovernegatives;
|
||||
}
|
||||
|
||||
public String getCharSet() {
|
||||
return charSet;
|
||||
}
|
||||
|
||||
public static void main(String[] a) {
|
||||
String charset = "Cp037";
|
||||
System.out.println(Charset.defaultCharset());
|
||||
for (CharSetEnum charsetEnum : CharSetEnum.values()) {
|
||||
if (charset.equals(charsetEnum.getCharSet())) {
|
||||
System.out.println(charsetEnum.failoverpositives);
|
||||
System.out.println(charsetEnum.failovernegatives);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package cobolConversion;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.apache.commons.lang.mutable.MutableInt;
|
||||
|
||||
public class EBCDICType3 {
|
||||
|
||||
public static BigDecimal readType3Value(byte[] byteValue, int decimal,
|
||||
boolean isImpliedDecimal) throws Exception {
|
||||
int len = byteValue.length;
|
||||
StringBuffer strbuf = new StringBuffer();
|
||||
int tmp;
|
||||
int tmp1;
|
||||
int tmp2;
|
||||
for (int i = 0; i < len; i++) {
|
||||
tmp = byteValue[i];
|
||||
tmp1 = tmp & 0xF0;
|
||||
tmp2 = tmp1 >> 4;
|
||||
strbuf.append(tmp2);
|
||||
|
||||
if (i < (len - 1)) {
|
||||
tmp = byteValue[i];
|
||||
tmp1 = tmp & 0x0F;
|
||||
strbuf.append(tmp1);
|
||||
}
|
||||
}
|
||||
|
||||
if ((decimal > 0) && isImpliedDecimal) {
|
||||
strbuf.insert(strbuf.length() - decimal, '.');
|
||||
}
|
||||
|
||||
BigDecimal retVal;
|
||||
|
||||
try {
|
||||
retVal = new BigDecimal(strbuf.toString());
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
tmp = byteValue[len - 1];
|
||||
tmp1 = tmp & 0x0F;
|
||||
|
||||
if ((tmp1 == 0x0F) || (tmp1 == 0x0C)) {
|
||||
return retVal;
|
||||
} else if (tmp1 == 0x0D) {
|
||||
return retVal.negate();
|
||||
} else {
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] writeType3Value(int length, int decimal,
|
||||
BigDecimal value, boolean isSigned) throws Exception {
|
||||
|
||||
if (decimal != value.scale()) {
|
||||
BigDecimal tmp = value.setScale(decimal, BigDecimal.ROUND_FLOOR);
|
||||
value = tmp;
|
||||
}
|
||||
|
||||
String str = value.toPlainString();
|
||||
int len = str.length();
|
||||
byte[] buf = new byte[length];
|
||||
MutableInt k = new MutableInt(len);
|
||||
byte even; // left and right nibble ( we go from right to left )
|
||||
byte odd;
|
||||
|
||||
for (int i = length - 1; i >= 0; i--) {
|
||||
// Last byte needs sign nibble
|
||||
if (i == (length - 1)) {
|
||||
even = getNextByte(str, k);
|
||||
|
||||
if (isSigned) {
|
||||
if (value.signum() >= 0) {
|
||||
odd = 0x0C;
|
||||
} else {
|
||||
odd = 0x0D;
|
||||
}
|
||||
} else {
|
||||
odd = (byte) 0x0F;
|
||||
}
|
||||
} else {
|
||||
// Packing rest of the digits...
|
||||
// Get even digit if exist or zero
|
||||
odd = getNextByte(str, k);
|
||||
even = getNextByte(str, k);
|
||||
}
|
||||
|
||||
buf[i] = (byte) ((even << 4) | odd);
|
||||
}
|
||||
|
||||
// TODO: Check if str ">" buf and eventually throw an Exc.
|
||||
return buf;
|
||||
}
|
||||
|
||||
private static byte getNextByte(String number, MutableInt recentlyReturned) {
|
||||
MutableInt zero = new MutableInt(0);
|
||||
recentlyReturned.decrement();
|
||||
|
||||
if (recentlyReturned.compareTo(zero) >= 0) {
|
||||
while (!"0123456789".contains(String.valueOf(number
|
||||
.charAt(recentlyReturned.intValue())))) {
|
||||
recentlyReturned.decrement();
|
||||
|
||||
if (recentlyReturned.compareTo(zero) < 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return (byte) (Character.getNumericValue(number
|
||||
.charAt(recentlyReturned.intValue())));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package cobolConversion;
|
||||
import java.math.BigDecimal;
|
||||
import cobolConversion.CharSetEnum;
|
||||
|
||||
public class EBCDICType9 {
|
||||
|
||||
public static byte[] writeType9Value(int length, int decimal, BigDecimal value,
|
||||
boolean isSigned, boolean isImpliedDecimal,String charset) throws Exception {
|
||||
|
||||
byte[] reValue = null;
|
||||
String failoverpositives = "{ABCDEFGHI";
|
||||
String failovernegatives = "}JKLMNOPQR";
|
||||
if (decimal != value.scale()) {
|
||||
BigDecimal tmp = value.setScale(decimal, BigDecimal.ROUND_FLOOR);
|
||||
value = tmp;
|
||||
}
|
||||
|
||||
String str = value.toPlainString();
|
||||
StringBuffer buf = new StringBuffer(str);
|
||||
|
||||
// Modify byte with sign ...
|
||||
if (isSigned) {
|
||||
int lastidx = buf.length() - 1;
|
||||
char lastbyte = buf.charAt(lastidx);
|
||||
char repl;
|
||||
for (CharSetEnum charsetEnum : CharSetEnum.values()){
|
||||
if(charset.equals(charsetEnum.getCharSet())){
|
||||
failoverpositives = charsetEnum.failoverpositives;
|
||||
failovernegatives = charsetEnum.failovernegatives;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (value.signum() >= 0) {
|
||||
repl = failoverpositives.charAt(Integer.parseInt(String
|
||||
.valueOf(lastbyte)));
|
||||
} else {
|
||||
repl = failovernegatives.charAt(Integer.parseInt(String
|
||||
.valueOf(lastbyte)));
|
||||
}
|
||||
|
||||
buf.setCharAt(lastidx, repl);
|
||||
|
||||
// Delete sign char
|
||||
String tmp = buf.toString();
|
||||
String tmp2 = tmp.replace("-", "");
|
||||
buf = new StringBuffer(tmp2);
|
||||
}
|
||||
|
||||
// Delete decimal point...
|
||||
if (isImpliedDecimal) {
|
||||
String tmp = buf.toString();
|
||||
String tmp2 = tmp.replace(".", "");
|
||||
buf = new StringBuffer(tmp2);
|
||||
}
|
||||
|
||||
// Adding some leading zeros ...
|
||||
while (length > buf.length()) {
|
||||
buf.insert(0, "0");
|
||||
}
|
||||
reValue = buf.toString().getBytes(charset);
|
||||
return reValue;
|
||||
}
|
||||
|
||||
|
||||
public static BigDecimal readType9Value(byte[] byteValue,int decimal,boolean isImpliedDecimal,String charset) throws Exception{
|
||||
|
||||
byte[] b = byteValue;
|
||||
String failoverpositives = "{ABCDEFGHI";
|
||||
String failovernegatives = "}JKLMNOPQR";
|
||||
int idx;
|
||||
char[] pos = { 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9 };
|
||||
char[] neg = { 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9 };
|
||||
String IBMpositives = new String(pos);
|
||||
String IBMnegatives = new String(neg);
|
||||
String MFnegatives = "pqrstuvwxy";
|
||||
String CAnegatives = " !\"#$%&'()";
|
||||
for (CharSetEnum charsetEnum : CharSetEnum.values()){
|
||||
if(charset.equals(charsetEnum.getCharSet())){
|
||||
failoverpositives = charsetEnum.failoverpositives;
|
||||
failovernegatives = charsetEnum.failovernegatives;
|
||||
break;
|
||||
}
|
||||
}
|
||||
StringBuffer buf = new StringBuffer(new String(b, charset));
|
||||
int lastidx = buf.length() - 1;
|
||||
char lastbyte = buf.charAt(lastidx);
|
||||
boolean positive = true;
|
||||
|
||||
idx = IBMpositives.indexOf(lastbyte);
|
||||
if (idx > -1) {
|
||||
buf.replace(lastidx, lastidx + 1, new Integer(idx).toString());
|
||||
positive = true;
|
||||
}
|
||||
|
||||
idx = IBMnegatives.indexOf(lastbyte);
|
||||
if (idx > -1) {
|
||||
buf.replace(lastidx, lastidx + 1, new Integer(idx).toString());
|
||||
positive = false;
|
||||
}
|
||||
|
||||
idx = failoverpositives.indexOf(lastbyte);
|
||||
if (idx > -1) {
|
||||
buf.replace(lastidx, lastidx + 1, new Integer(idx).toString());
|
||||
positive = true;
|
||||
}
|
||||
|
||||
idx = failovernegatives.indexOf(lastbyte);
|
||||
if (idx > -1) {
|
||||
buf.replace(lastidx, lastidx + 1, new Integer(idx).toString());
|
||||
positive = false;
|
||||
|
||||
}
|
||||
|
||||
idx = MFnegatives.indexOf(lastbyte);
|
||||
if (idx > -1) {
|
||||
buf.replace(lastidx, lastidx + 1, new Integer(idx).toString());
|
||||
positive = false;
|
||||
}
|
||||
|
||||
idx = CAnegatives.indexOf(lastbyte);
|
||||
if (idx > -1) {
|
||||
buf.replace(lastidx, lastidx + 1, new Integer(idx).toString());
|
||||
positive = false;
|
||||
}
|
||||
|
||||
if ((decimal > 0) && isImpliedDecimal) {
|
||||
buf.insert(buf.length() - decimal, '.');
|
||||
}
|
||||
|
||||
BigDecimal retVal;
|
||||
|
||||
try {
|
||||
retVal = new BigDecimal(buf.toString());
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
if (!positive) {
|
||||
retVal = retVal.negate();
|
||||
}
|
||||
|
||||
return retVal;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
package org.talend.datastewardship.server.ws;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlSchemaType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Java class for deleteTasks complex type.
|
||||
*
|
||||
* <p>
|
||||
* The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="deleteTasks">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="typeId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
|
||||
* <element name="owner" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="tagLabel" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="createTimeLowerBound" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
|
||||
* <element name="createTimeUpperBound" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
|
||||
* <element name="starNum" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
|
||||
* <element name="limit" type="{http://www.w3.org/2001/XMLSchema}int"/>
|
||||
* <element name="status" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "deleteTasks", propOrder = { "typeId", "owner", "tagLabel", "createTimeLowerBound", "createTimeUpperBound",
|
||||
"starNum", "limit", "status" })
|
||||
public class DeleteTasks {
|
||||
|
||||
protected Integer typeId;
|
||||
|
||||
protected String owner;
|
||||
|
||||
protected String tagLabel;
|
||||
|
||||
@XmlSchemaType(name = "dateTime")
|
||||
protected XMLGregorianCalendar createTimeLowerBound;
|
||||
|
||||
@XmlSchemaType(name = "dateTime")
|
||||
protected XMLGregorianCalendar createTimeUpperBound;
|
||||
|
||||
protected Integer starNum;
|
||||
|
||||
protected int limit;
|
||||
|
||||
protected String status;
|
||||
|
||||
/**
|
||||
* Gets the value of the typeId property.
|
||||
*
|
||||
* @return possible object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public Integer getTypeId() {
|
||||
return typeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the typeId property.
|
||||
*
|
||||
* @param value allowed object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public void setTypeId(Integer value) {
|
||||
this.typeId = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the owner property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the owner property.
|
||||
*
|
||||
* @param value allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setOwner(String value) {
|
||||
this.owner = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the tagLabel property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getTagLabel() {
|
||||
return tagLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the tagLabel property.
|
||||
*
|
||||
* @param value allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setTagLabel(String value) {
|
||||
this.tagLabel = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the createTimeLowerBound property.
|
||||
*
|
||||
* @return possible object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public XMLGregorianCalendar getCreateTimeLowerBound() {
|
||||
return createTimeLowerBound;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the createTimeLowerBound property.
|
||||
*
|
||||
* @param value allowed object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public void setCreateTimeLowerBound(XMLGregorianCalendar value) {
|
||||
this.createTimeLowerBound = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the createTimeUpperBound property.
|
||||
*
|
||||
* @return possible object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public XMLGregorianCalendar getCreateTimeUpperBound() {
|
||||
return createTimeUpperBound;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the createTimeUpperBound property.
|
||||
*
|
||||
* @param value allowed object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public void setCreateTimeUpperBound(XMLGregorianCalendar value) {
|
||||
this.createTimeUpperBound = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the starNum property.
|
||||
*
|
||||
* @return possible object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public Integer getStarNum() {
|
||||
return starNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the starNum property.
|
||||
*
|
||||
* @param value allowed object is {@link Integer }
|
||||
*
|
||||
*/
|
||||
public void setStarNum(Integer value) {
|
||||
this.starNum = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the limit property.
|
||||
*
|
||||
*/
|
||||
public int getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the limit property.
|
||||
*
|
||||
*/
|
||||
public void setLimit(int value) {
|
||||
this.limit = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the status property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the status property.
|
||||
*
|
||||
* @param value allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setStatus(String value) {
|
||||
this.status = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package org.talend.datastewardship.server.ws;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Java class for deleteTasksResponse complex type.
|
||||
*
|
||||
* <p>
|
||||
* The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="deleteTasksResponse">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="return" type="{http://jaxb.dev.java.net/array}int" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "deleteTasksResponse", propOrder = { "_return" })
|
||||
public class DeleteTasksResponse {
|
||||
|
||||
@XmlElement(name = "return")
|
||||
protected int _return;
|
||||
|
||||
/**
|
||||
* Gets the value of the return property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to
|
||||
* the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> method for
|
||||
* the return property.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public int getReturn() {
|
||||
return _return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the return property.
|
||||
*
|
||||
*/
|
||||
public void setReturn(int value) {
|
||||
this._return = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,8 +27,10 @@ public class ObjectFactory {
|
||||
private final static QName _GetTgtRecord_QNAME = new QName("http://ws.server.datastewardship.talend.org/", "getTgtRecord");
|
||||
private final static QName _Echo_QNAME = new QName("http://ws.server.datastewardship.talend.org/", "echo");
|
||||
private final static QName _EchoResponse_QNAME = new QName("http://ws.server.datastewardship.talend.org/", "echoResponse");
|
||||
private final static QName _DeleteTasksResponse_QNAME = new QName("http://ws.server.datastewardship.talend.org/","deleteTasksResponse");
|
||||
private final static QName _GetSrcRecord_QNAME = new QName("http://ws.server.datastewardship.talend.org/", "getSrcRecord");
|
||||
private final static QName _GetTgtRecordResponse_QNAME = new QName("http://ws.server.datastewardship.talend.org/", "getTgtRecordResponse");
|
||||
private final static QName _DeleteTasks_QNAME = new QName("http://ws.server.datastewardship.talend.org/", "deleteTasks");
|
||||
private final static QName _SearchTasks_QNAME = new QName("http://ws.server.datastewardship.talend.org/", "searchTasks");
|
||||
private final static QName _GetSrcRecordResponse_QNAME = new QName("http://ws.server.datastewardship.talend.org/", "getSrcRecordResponse");
|
||||
private final static QName _SearchTasksResponse_QNAME = new QName("http://ws.server.datastewardship.talend.org/", "searchTasksResponse");
|
||||
@@ -147,6 +149,15 @@ public class ObjectFactory {
|
||||
return new JAXBElement<EchoResponse>(_EchoResponse_QNAME, EchoResponse.class, null, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link JAXBElement }{@code <}{@link DeleteTasksResponse }{@code >}
|
||||
*
|
||||
*/
|
||||
@XmlElementDecl(namespace = "http://ws.server.datastewardship.talend.org/", name = "deleteTasksResponse")
|
||||
public JAXBElement<DeleteTasksResponse> createDeleteTasksResponse(DeleteTasksResponse value) {
|
||||
return new JAXBElement<DeleteTasksResponse>(_DeleteTasksResponse_QNAME, DeleteTasksResponse.class, null, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link JAXBElement }{@code <}{@link GetSrcRecord }{@code >}}
|
||||
*
|
||||
@@ -174,6 +185,15 @@ public class ObjectFactory {
|
||||
return new JAXBElement<SearchTasks>(_SearchTasks_QNAME, SearchTasks.class, null, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link JAXBElement }{@code <}{@link DeleteTasks }{@code >}
|
||||
*
|
||||
*/
|
||||
@XmlElementDecl(namespace = "http://ws.server.datastewardship.talend.org/", name = "deleteTasks")
|
||||
public JAXBElement<DeleteTasks> createDeleteTasks(DeleteTasks value) {
|
||||
return new JAXBElement<DeleteTasks>(_DeleteTasks_QNAME, DeleteTasks.class, null, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link JAXBElement }{@code <}{@link GetSrcRecordResponse }{@code >}}
|
||||
*
|
||||
|
||||
@@ -68,4 +68,27 @@ public interface TDSCWS {
|
||||
@WebParam(name = "taskID", targetNamespace = "")
|
||||
java.lang.String taskID
|
||||
);
|
||||
|
||||
@WebResult(name = "return", targetNamespace = "")
|
||||
@RequestWrapper(localName = "deleteTasks", targetNamespace = "http://ws.server.datastewardship.talend.org/", className = "org.talend.datastewardship.server.ws.DeleteTasks")
|
||||
@WebMethod
|
||||
@ResponseWrapper(localName = "deleteTasksResponse", targetNamespace = "http://ws.server.datastewardship.talend.org/", className = "org.talend.datastewardship.server.ws.DeleteTasksResponse")
|
||||
public int deleteTasks(
|
||||
@WebParam(name = "typeId", targetNamespace = "")
|
||||
java.lang.Integer typeId,
|
||||
@WebParam(name = "owner", targetNamespace = "")
|
||||
java.lang.String owner,
|
||||
@WebParam(name = "tagLabel", targetNamespace = "")
|
||||
java.lang.String tagLabel,
|
||||
@WebParam(name = "createTimeLowerBound", targetNamespace = "")
|
||||
javax.xml.datatype.XMLGregorianCalendar createTimeLowerBound,
|
||||
@WebParam(name = "createTimeUpperBound", targetNamespace = "")
|
||||
javax.xml.datatype.XMLGregorianCalendar createTimeUpperBound,
|
||||
@WebParam(name = "starNum", targetNamespace = "")
|
||||
java.lang.Integer starNum,
|
||||
@WebParam(name = "limit", targetNamespace = "")
|
||||
int limit,
|
||||
@WebParam(name = "status", targetNamespace = "")
|
||||
java.lang.String status
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.talend.xml.sax;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@@ -11,12 +12,6 @@ import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
import org.talend.xml.sax.FunctionRegister;
|
||||
import org.talend.xml.sax.LoopEntry;
|
||||
import org.talend.xml.sax.SAXLoopCompositeHandler;
|
||||
import org.talend.xml.sax.SAXLoopHandler;
|
||||
import org.talend.xml.sax.SAXLoopIterator;
|
||||
import org.talend.xml.sax.SAXMultiLoopIterator;
|
||||
import org.talend.xml.sax.commons.ISAXLooper;
|
||||
import org.talend.xml.sax.function.inter.Function;
|
||||
import org.talend.xml.sax.io.UnicodeReader;
|
||||
@@ -142,6 +137,7 @@ public class ComplexSAXLooper implements ISAXLooper {
|
||||
*/
|
||||
public void parse(String fileURL, String charset) {
|
||||
this.charset = charset;
|
||||
Reader reader = null;
|
||||
try {
|
||||
DefaultHandler hd = null;
|
||||
SAXParser saxParser = null;
|
||||
@@ -158,9 +154,8 @@ public class ComplexSAXLooper implements ISAXLooper {
|
||||
hd = newHandler2();
|
||||
}
|
||||
saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", hd);
|
||||
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(
|
||||
new UnicodeReader(new java.io.FileInputStream(fileURL),this.charset));
|
||||
// inSource.setEncoding(this.charset);
|
||||
reader = new UnicodeReader(new java.io.FileInputStream(fileURL),this.charset);
|
||||
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader);
|
||||
saxParser.parse(inSource, hd);
|
||||
|
||||
} catch (ParserConfigurationException e) {
|
||||
@@ -169,6 +164,14 @@ public class ComplexSAXLooper implements ISAXLooper {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(reader!=null) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,6 +182,7 @@ public class ComplexSAXLooper implements ISAXLooper {
|
||||
*/
|
||||
public void parse(java.io.InputStream is, String charset) {
|
||||
this.charset = charset;
|
||||
Reader reader = null;
|
||||
try {
|
||||
DefaultHandler hd = null;
|
||||
SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
|
||||
@@ -189,9 +193,9 @@ public class ComplexSAXLooper implements ISAXLooper {
|
||||
}
|
||||
saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", hd);
|
||||
// routines.system.UnicodeReader.java is used to ignore the BOM of the source file.
|
||||
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(new UnicodeReader(is,this.charset));
|
||||
// inSource.setEncoding(this.charset);
|
||||
saxParser.parse(is, hd);
|
||||
reader = new UnicodeReader(is,this.charset);
|
||||
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader);
|
||||
saxParser.parse(inSource, hd);
|
||||
|
||||
} catch (ParserConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
@@ -199,6 +203,14 @@ public class ComplexSAXLooper implements ISAXLooper {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(reader!=null) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
// ============================================================================
|
||||
package org.talend.xml.sax.simpleparser;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
@@ -113,6 +114,7 @@ public class SimpleSAXLooper implements ISAXLooper,Callable {
|
||||
}
|
||||
|
||||
public Object call() throws Exception {
|
||||
Reader reader = null;
|
||||
try {
|
||||
DefaultHandler hd = new SimpleSAXLoopHandler(nodes, bcache);
|
||||
SAXParser saxParser = null;
|
||||
@@ -126,17 +128,22 @@ public class SimpleSAXLooper implements ISAXLooper,Callable {
|
||||
saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", hd);
|
||||
if (fileURL != null) {
|
||||
// routines.system.UnicodeReader.java is used to ignore the BOM of the source file.
|
||||
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(
|
||||
new UnicodeReader(new java.io.FileInputStream(fileURL),this.charset));
|
||||
// inSource.setEncoding(this.charset);
|
||||
reader = new UnicodeReader(new java.io.FileInputStream(fileURL),this.charset);
|
||||
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader);
|
||||
saxParser.parse(inSource, hd);
|
||||
} else {
|
||||
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(new UnicodeReader(is,this.charset));
|
||||
// inSource.setEncoding(this.charset);
|
||||
saxParser.parse(is, hd);
|
||||
reader = new UnicodeReader(is,this.charset);
|
||||
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader);
|
||||
saxParser.parse(inSource, hd);
|
||||
}
|
||||
} finally {
|
||||
bcache.notifyErrorOccurred();
|
||||
try {
|
||||
if(reader!=null) {
|
||||
reader.close();
|
||||
}
|
||||
} finally {
|
||||
bcache.notifyErrorOccurred();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,9 @@ public class FileCopy {
|
||||
|
||||
public static void copyFile(String srcFileName, String desFileName, boolean delSrc) throws Exception {
|
||||
|
||||
FileInputStream srcInputStream = new FileInputStream(srcFileName);
|
||||
FileInputStream srcInputStream = null;
|
||||
try{
|
||||
srcInputStream = new FileInputStream(srcFileName);
|
||||
long lastModified = new File(srcFileName).lastModified();
|
||||
int available = srcInputStream.available();
|
||||
if (available > L_SIZE) {// X > 100M
|
||||
@@ -47,6 +49,11 @@ public class FileCopy {
|
||||
}
|
||||
// keep modification_time
|
||||
new File(desFileName).setLastModified(lastModified);
|
||||
}finally{
|
||||
if(srcInputStream!=null){
|
||||
srcInputStream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void copyFileS(String srcFileName, FileInputStream srcInputStream, String desFileName, boolean delSrc)
|
||||
@@ -93,8 +100,13 @@ public class FileCopy {
|
||||
try {
|
||||
in = srcInputStream.getChannel();
|
||||
out = new FileOutputStream(dest).getChannel();
|
||||
|
||||
in.transferTo(0, in.size(), out);
|
||||
|
||||
int maxCount = (32 * 1024 * 1024) - (28 * 1024);
|
||||
long size = in.size();
|
||||
long position = 0;
|
||||
while (position < size) {
|
||||
position += in.transferTo(position, maxCount, out);
|
||||
}
|
||||
|
||||
in.close();
|
||||
out.close();
|
||||
|
||||
@@ -1,622 +0,0 @@
|
||||
/*
|
||||
* Java CSV is a stream based library for reading and writing
|
||||
* CSV and other delimited data.
|
||||
*
|
||||
* Copyright (C) Bruce Dunwiddie bruce@csvreader.com
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
package com.csvreader;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Writer;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/**
|
||||
* A stream based writer for writing delimited text data to a file or a stream.
|
||||
* So far, it is only used for tMysqlOutputBulk
|
||||
*/
|
||||
public class CsvWriter2 {
|
||||
private PrintWriter outputStream = null;
|
||||
|
||||
private String fileName = null;
|
||||
|
||||
private boolean firstColumn = true;
|
||||
|
||||
private boolean useCustomRecordDelimiter = false;
|
||||
|
||||
private Charset charset = null;
|
||||
|
||||
// this holds all the values for switches that the user is allowed to set
|
||||
private UserSettings userSettings = new UserSettings();
|
||||
|
||||
private boolean initialized = false;
|
||||
|
||||
private boolean closed = false;
|
||||
|
||||
private boolean useCRLFRecordDelimiter;
|
||||
|
||||
private static final String CRLF = "\r\n";
|
||||
|
||||
/**
|
||||
* Double up the text qualifier to represent an occurance of the text
|
||||
* qualifier.
|
||||
*/
|
||||
public static final int ESCAPE_MODE_DOUBLED = 1;
|
||||
|
||||
/**
|
||||
* Use a backslash character before the text qualifier to represent an
|
||||
* occurance of the text qualifier.
|
||||
*/
|
||||
public static final int ESCAPE_MODE_BACKSLASH = 2;
|
||||
|
||||
/**
|
||||
* Creates a {@link com.csvreader.CsvWriter2 CsvWriter} object using a file
|
||||
* as the data destination.
|
||||
*
|
||||
* @param fileName
|
||||
* The path to the file to output the data.
|
||||
* @param delimiter
|
||||
* The character to use as the column delimiter.
|
||||
* @param charset
|
||||
* The {@link java.nio.charset.Charset Charset} to use while
|
||||
* writing the data.
|
||||
*/
|
||||
public CsvWriter2(String fileName, String delimiter, Charset charset) {
|
||||
if (fileName == null) {
|
||||
throw new IllegalArgumentException("Parameter fileName can not be null.");
|
||||
}
|
||||
|
||||
if (charset == null) {
|
||||
throw new IllegalArgumentException("Parameter charset can not be null.");
|
||||
}
|
||||
|
||||
this.fileName = fileName;
|
||||
userSettings.Delimiter = delimiter;
|
||||
this.charset = charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link com.csvreader.CsvWriter2 CsvWriter} object using a file
|
||||
* as the data destination. Uses a comma as the column delimiter and
|
||||
* ISO-8859-1 as the {@link java.nio.charset.Charset Charset}.
|
||||
*
|
||||
* @param fileName
|
||||
* The path to the file to output the data.
|
||||
*/
|
||||
public CsvWriter2(String fileName) {
|
||||
this(fileName, Letters.COMMA, Charset.forName("ISO-8859-1"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link com.csvreader.CsvWriter2 CsvWriter} object using a Writer
|
||||
* to write data to.
|
||||
*
|
||||
* @param outputStream
|
||||
* The stream to write the column delimited data to.
|
||||
* @param delimiter
|
||||
* The character to use as the column delimiter.
|
||||
*/
|
||||
public CsvWriter2(Writer outputStream, String delimiter) {
|
||||
if (outputStream == null) {
|
||||
throw new IllegalArgumentException("Parameter outputStream can not be null.");
|
||||
}
|
||||
|
||||
this.outputStream = new PrintWriter(outputStream);
|
||||
userSettings.Delimiter = delimiter;
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link com.csvreader.CsvWriter2 CsvWriter} object using an
|
||||
* OutputStream to write data to.
|
||||
*
|
||||
* @param outputStream
|
||||
* The stream to write the column delimited data to.
|
||||
* @param delimiter
|
||||
* The character to use as the column delimiter.
|
||||
* @param charset
|
||||
* The {@link java.nio.charset.Charset Charset} to use while
|
||||
* writing the data.
|
||||
*/
|
||||
public CsvWriter2(OutputStream outputStream, String delimiter, Charset charset) {
|
||||
this(new OutputStreamWriter(outputStream, charset), delimiter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the character being used as the column delimiter.
|
||||
*
|
||||
* @return The character being used as the column delimiter.
|
||||
*/
|
||||
public String getDelimiter() {
|
||||
return userSettings.Delimiter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the character to use as the column delimiter.
|
||||
*
|
||||
* @param delimiter
|
||||
* The character to use as the column delimiter.
|
||||
*/
|
||||
public void setDelimiter(String delimiter) {
|
||||
userSettings.Delimiter = delimiter;
|
||||
}
|
||||
|
||||
public String getRecordDelimiter() {
|
||||
return userSettings.RecordDelimiter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the character to use as the record delimiter.
|
||||
*
|
||||
* @param recordDelimiter
|
||||
* The character to use as the record delimiter. Default is
|
||||
* combination of standard end of line characters for Windows,
|
||||
* Unix, or Mac.
|
||||
*/
|
||||
public void setRecordDelimiter(String recordDelimiter) {
|
||||
useCustomRecordDelimiter = true;
|
||||
userSettings.RecordDelimiter = recordDelimiter;
|
||||
}
|
||||
|
||||
/**
|
||||
* set CRLF(window line separator) as record separator
|
||||
* for the contexts:Mac or Unix JVM create csv using Window row separator
|
||||
* @param recordDelimiter
|
||||
*/
|
||||
public void useCRLFRecordDelimiter(boolean useCRLFRecordDelimiter) {
|
||||
this.useCRLFRecordDelimiter = useCRLFRecordDelimiter;
|
||||
|
||||
if(useCRLFRecordDelimiter) {
|
||||
useCustomRecordDelimiter = false;
|
||||
userSettings.RecordDelimiter = Letters.NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the character to use as a text qualifier in the data.
|
||||
*
|
||||
* @return The character to use as a text qualifier in the data.
|
||||
*/
|
||||
public char getTextQualifier() {
|
||||
return userSettings.TextQualifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the character to use as a text qualifier in the data.
|
||||
*
|
||||
* @param textQualifier
|
||||
* The character to use as a text qualifier in the data.
|
||||
*/
|
||||
public void setTextQualifier(char textQualifier) {
|
||||
userSettings.TextQualifier = textQualifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether text qualifiers will be used while writing data or not.
|
||||
*
|
||||
* @return Whether text qualifiers will be used while writing data or not.
|
||||
*/
|
||||
public boolean getUseTextQualifier() {
|
||||
return userSettings.UseTextQualifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether text qualifiers will be used while writing data or not.
|
||||
*
|
||||
* @param useTextQualifier
|
||||
* Whether to use a text qualifier while writing data or not.
|
||||
*/
|
||||
public void setUseTextQualifier(boolean useTextQualifier) {
|
||||
userSettings.UseTextQualifier = useTextQualifier;
|
||||
}
|
||||
|
||||
public int getEscapeMode() {
|
||||
return userSettings.EscapeMode;
|
||||
}
|
||||
|
||||
public void setEscapeMode(int escapeMode) {
|
||||
userSettings.EscapeMode = escapeMode;
|
||||
}
|
||||
|
||||
public void setComment(char comment) {
|
||||
userSettings.Comment = comment;
|
||||
}
|
||||
|
||||
public char getComment() {
|
||||
return userSettings.Comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether fields will be surrounded by the text qualifier even if the
|
||||
* qualifier is not necessarily needed to escape this field.
|
||||
*
|
||||
* @return Whether fields will be forced to be qualified or not.
|
||||
*/
|
||||
public boolean getForceQualifier() {
|
||||
return userSettings.ForceQualifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this to force all fields to be surrounded by the text qualifier even
|
||||
* if the qualifier is not necessarily needed to escape this field. Default
|
||||
* is false.
|
||||
*
|
||||
* @param forceQualifier
|
||||
* Whether to force the fields to be qualified or not.
|
||||
*/
|
||||
public void setForceQualifier(boolean forceQualifier) {
|
||||
userSettings.ForceQualifier = forceQualifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes another column of data to this record.
|
||||
*
|
||||
* @param content
|
||||
* The data for the new column.
|
||||
* @param preserveSpaces
|
||||
* Whether to preserve leading and trailing whitespace in this
|
||||
* column of data.
|
||||
* @exception IOException
|
||||
* Thrown if an error occurs while writing data to the
|
||||
* destination stream.
|
||||
*/
|
||||
public void write(String content, boolean preserveSpaces)
|
||||
throws IOException {
|
||||
checkClosed();
|
||||
|
||||
checkInit();
|
||||
|
||||
if (content == null) {
|
||||
content = "";
|
||||
}
|
||||
|
||||
if (!firstColumn) {
|
||||
outputStream.write(userSettings.Delimiter);
|
||||
}
|
||||
|
||||
boolean textQualify = userSettings.ForceQualifier;
|
||||
|
||||
if (!preserveSpaces && content.length() > 0) {
|
||||
content = content.trim();
|
||||
}
|
||||
|
||||
if (!textQualify
|
||||
&& userSettings.UseTextQualifier
|
||||
&& (content.indexOf(userSettings.TextQualifier) > -1
|
||||
|| content.indexOf(userSettings.Delimiter) > -1
|
||||
|| (!useCustomRecordDelimiter && (content
|
||||
.indexOf(Letters.LF) > -1 || content
|
||||
.indexOf(Letters.CR) > -1))
|
||||
|| (useCustomRecordDelimiter && content
|
||||
.indexOf(userSettings.RecordDelimiter) > -1)
|
||||
|| (firstColumn && content.length() > 0 && content
|
||||
.charAt(0) == userSettings.Comment) ||
|
||||
// check for empty first column, which if on its own line must
|
||||
// be qualified or the line will be skipped
|
||||
(firstColumn && content.length() == 0))) {
|
||||
textQualify = true;
|
||||
}
|
||||
|
||||
if (userSettings.UseTextQualifier && !textQualify
|
||||
&& content.length() > 0 && preserveSpaces) {
|
||||
char firstLetter = content.charAt(0);
|
||||
|
||||
if (firstLetter == Letters.SPACE || firstLetter == Letters.TAB) {
|
||||
textQualify = true;
|
||||
}
|
||||
|
||||
if (!textQualify && content.length() > 1) {
|
||||
char lastLetter = content.charAt(content.length() - 1);
|
||||
|
||||
if (lastLetter == Letters.SPACE || lastLetter == Letters.TAB) {
|
||||
textQualify = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (textQualify) {
|
||||
outputStream.write(userSettings.TextQualifier);
|
||||
|
||||
if (userSettings.EscapeMode == ESCAPE_MODE_BACKSLASH) {
|
||||
content = replace(content, "" + Letters.BACKSLASH, ""
|
||||
+ Letters.BACKSLASH + Letters.BACKSLASH);
|
||||
content = replace(content, "" + userSettings.TextQualifier, ""
|
||||
+ Letters.BACKSLASH + userSettings.TextQualifier);
|
||||
} else {
|
||||
content = replace(content, "" + userSettings.TextQualifier, ""
|
||||
+ userSettings.TextQualifier
|
||||
+ userSettings.TextQualifier);
|
||||
}
|
||||
} else if (userSettings.EscapeMode == ESCAPE_MODE_BACKSLASH) {
|
||||
content = replace(content, "" + Letters.BACKSLASH, ""
|
||||
+ Letters.BACKSLASH + Letters.BACKSLASH);
|
||||
content = replace(content, "" + userSettings.Delimiter, ""
|
||||
+ Letters.BACKSLASH + userSettings.Delimiter);
|
||||
|
||||
if (useCustomRecordDelimiter) {
|
||||
content = replace(content, "" + userSettings.RecordDelimiter,
|
||||
"" + Letters.BACKSLASH + userSettings.RecordDelimiter);
|
||||
} else {
|
||||
content = replace(content, "" + Letters.CR, ""
|
||||
+ Letters.BACKSLASH + Letters.CR);
|
||||
content = replace(content, "" + Letters.LF, ""
|
||||
+ Letters.BACKSLASH + Letters.LF);
|
||||
}
|
||||
|
||||
if (firstColumn && content.length() > 0
|
||||
&& content.charAt(0) == userSettings.Comment) {
|
||||
if (content.length() > 1) {
|
||||
content = "" + Letters.BACKSLASH + userSettings.Comment
|
||||
+ content.substring(1);
|
||||
} else {
|
||||
content = "" + Letters.BACKSLASH + userSettings.Comment;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
outputStream.write(content);
|
||||
|
||||
if (textQualify) {
|
||||
outputStream.write(userSettings.TextQualifier);
|
||||
}
|
||||
|
||||
firstColumn = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes another column of data to this record. Does not preserve
|
||||
* leading and trailing whitespace in this column of data.
|
||||
*
|
||||
* @param content
|
||||
* The data for the new column.
|
||||
* @exception IOException
|
||||
* Thrown if an error occurs while writing data to the
|
||||
* destination stream.
|
||||
*/
|
||||
public void write(String content) throws IOException {
|
||||
write(content, true);
|
||||
}
|
||||
|
||||
public void writeComment(String commentText) throws IOException {
|
||||
checkClosed();
|
||||
|
||||
checkInit();
|
||||
|
||||
outputStream.write(userSettings.Comment);
|
||||
|
||||
outputStream.write(commentText);
|
||||
|
||||
if (useCustomRecordDelimiter) {
|
||||
outputStream.write(userSettings.RecordDelimiter);
|
||||
} else if(useCRLFRecordDelimiter) {
|
||||
outputStream.print(CRLF);
|
||||
} else {
|
||||
outputStream.println();
|
||||
}
|
||||
|
||||
firstColumn = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a new record using the passed in array of values.
|
||||
*
|
||||
* @param values
|
||||
* Values to be written.
|
||||
*
|
||||
* @param preserveSpaces
|
||||
* Whether to preserver leading and trailing spaces in columns
|
||||
* while writing out to the record or not.
|
||||
*
|
||||
* @throws IOException
|
||||
* Thrown if an error occurs while writing data to the
|
||||
* destination stream.
|
||||
*/
|
||||
public void writeRecord(String[] values, boolean preserveSpaces)
|
||||
throws IOException {
|
||||
if (values != null && values.length > 0) {
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
write(values[i], preserveSpaces);
|
||||
}
|
||||
|
||||
endRecord();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a new record using the passed in array of values.
|
||||
*
|
||||
* @param values
|
||||
* Values to be written.
|
||||
*
|
||||
* @throws IOException
|
||||
* Thrown if an error occurs while writing data to the
|
||||
* destination stream.
|
||||
*/
|
||||
public void writeRecord(String[] values) throws IOException {
|
||||
writeRecord(values, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ends the current record by sending the record delimiter.
|
||||
*
|
||||
* @exception IOException
|
||||
* Thrown if an error occurs while writing data to the
|
||||
* destination stream.
|
||||
*/
|
||||
public void endRecord() throws IOException {
|
||||
checkClosed();
|
||||
|
||||
checkInit();
|
||||
|
||||
if (useCustomRecordDelimiter) {
|
||||
outputStream.write(userSettings.RecordDelimiter);
|
||||
} else if(useCRLFRecordDelimiter) {
|
||||
outputStream.print(CRLF);
|
||||
} else {
|
||||
outputStream.println();
|
||||
}
|
||||
|
||||
firstColumn = true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void checkInit() throws IOException {
|
||||
if (!initialized) {
|
||||
if (fileName != null) {
|
||||
outputStream = new PrintWriter(new OutputStreamWriter(
|
||||
new FileOutputStream(fileName), charset));
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all buffers for the current writer and causes any buffered data to
|
||||
* be written to the underlying device.
|
||||
*/
|
||||
public void flush() {
|
||||
outputStream.flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes and releases all related resources.
|
||||
*/
|
||||
public void close() {
|
||||
if (!closed) {
|
||||
close(true);
|
||||
|
||||
closed = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void close(boolean closing) {
|
||||
if (!closed) {
|
||||
if (closing) {
|
||||
charset = null;
|
||||
}
|
||||
|
||||
try {
|
||||
if (initialized) {
|
||||
outputStream.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// just eat the exception
|
||||
}
|
||||
|
||||
outputStream = null;
|
||||
|
||||
closed = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void checkClosed() throws IOException {
|
||||
if (closed) {
|
||||
throw new IOException(
|
||||
"This instance of the CsvWriter class has already been closed.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected void finalize() {
|
||||
close(false);
|
||||
}
|
||||
|
||||
private class Letters {
|
||||
public static final char LF = '\n';
|
||||
|
||||
public static final char CR = '\r';
|
||||
|
||||
public static final char QUOTE = '"';
|
||||
|
||||
public static final String COMMA = ",";
|
||||
|
||||
public static final char SPACE = ' ';
|
||||
|
||||
public static final char TAB = '\t';
|
||||
|
||||
public static final char POUND = '#';
|
||||
|
||||
public static final char BACKSLASH = '\\';
|
||||
|
||||
public static final String NULL = "\0";
|
||||
}
|
||||
|
||||
private class UserSettings {
|
||||
// having these as publicly accessible members will prevent
|
||||
// the overhead of the method call that exists on properties
|
||||
public char TextQualifier;
|
||||
|
||||
public boolean UseTextQualifier;
|
||||
|
||||
public String Delimiter;
|
||||
|
||||
public String RecordDelimiter;
|
||||
|
||||
public char Comment;
|
||||
|
||||
public int EscapeMode;
|
||||
|
||||
public boolean ForceQualifier;
|
||||
|
||||
public UserSettings() {
|
||||
TextQualifier = Letters.QUOTE;
|
||||
UseTextQualifier = true;
|
||||
Delimiter = Letters.COMMA;
|
||||
RecordDelimiter = Letters.NULL;
|
||||
Comment = Letters.POUND;
|
||||
EscapeMode = ESCAPE_MODE_DOUBLED;
|
||||
ForceQualifier = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static String replace(String original, String pattern, String replace) {
|
||||
final int len = pattern.length();
|
||||
int found = original.indexOf(pattern);
|
||||
|
||||
if (found > -1) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
int start = 0;
|
||||
|
||||
while (found != -1) {
|
||||
sb.append(original.substring(start, found));
|
||||
sb.append(replace);
|
||||
start = found + len;
|
||||
found = original.indexOf(pattern, start);
|
||||
}
|
||||
|
||||
sb.append(original.substring(start));
|
||||
|
||||
return sb.toString();
|
||||
} else {
|
||||
return original;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +1,55 @@
|
||||
package org.talend.mdm.bulkload.client;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.io.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class BulkloadClient {
|
||||
String url;
|
||||
String username;
|
||||
String password;
|
||||
String universe;
|
||||
String cluster;
|
||||
String concept;
|
||||
String datamodel;
|
||||
BulkloadOptions options=new BulkloadOptions();
|
||||
|
||||
public BulkloadClient(String url, String username,String password,String universe,String cluster,String concept,String datamodel) {
|
||||
|
||||
private String url;
|
||||
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
|
||||
private String universe;
|
||||
|
||||
private String cluster;
|
||||
|
||||
private String concept;
|
||||
|
||||
private String dataModel;
|
||||
|
||||
private BulkloadOptions options = new BulkloadOptions();
|
||||
|
||||
private static final AtomicInteger startedBulkloadCount = new AtomicInteger(0);
|
||||
|
||||
public BulkloadClient(String url, String username, String password, String universe, String cluster, String concept, String dataModel) {
|
||||
this.url=url;
|
||||
this.username=username;
|
||||
this.password=password;
|
||||
this.universe=universe;
|
||||
this.cluster=cluster;
|
||||
this.concept=concept;
|
||||
this.datamodel=datamodel;
|
||||
this.dataModel = dataModel;
|
||||
}
|
||||
|
||||
public void startThreadCount(){
|
||||
// Kept for compatibility with tMDMBulkload.
|
||||
}
|
||||
|
||||
public void waitForEndOfQueue() {
|
||||
try {
|
||||
synchronized (startedBulkloadCount) {
|
||||
while (startedBulkloadCount.get() > 0) {
|
||||
System.out.println(startedBulkloadCount.get() + " remaining.");
|
||||
startedBulkloadCount.wait();
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
@@ -76,11 +99,11 @@ public class BulkloadClient {
|
||||
}
|
||||
|
||||
public String getDatamodel() {
|
||||
return datamodel;
|
||||
return dataModel;
|
||||
}
|
||||
|
||||
public void setDatamodel(String datamodel) {
|
||||
this.datamodel = datamodel;
|
||||
public void setDatamodel(String dataModel) {
|
||||
this.dataModel = dataModel;
|
||||
}
|
||||
|
||||
public BulkloadOptions getOptions() {
|
||||
@@ -90,93 +113,75 @@ public class BulkloadClient {
|
||||
public void setOptions(BulkloadOptions options) {
|
||||
this.options = options;
|
||||
}
|
||||
public void load(List<String > items) {
|
||||
doLoad(items);
|
||||
}
|
||||
/**
|
||||
|
||||
/**
|
||||
* load from a huge xml string
|
||||
* @param xmlString
|
||||
* @param xmlString A full xml document.
|
||||
* @throws Exception Thrown in case of bulk load error.
|
||||
*/
|
||||
public void load(String xmlString)throws Exception {
|
||||
List<String > items=BulkloadClientUtil.getItemXmls(xmlString);
|
||||
doLoad(items);
|
||||
}
|
||||
|
||||
private void doLoad(List<String> items) {
|
||||
if(items.size()>options.getArraySize()) {
|
||||
int loop=items.size()/options.getArraySize();
|
||||
int left=items.size()-options.getArraySize()*loop;
|
||||
for(int i=0; i<loop; i++) {
|
||||
List<String> subItems=items.subList(i*options.getArraySize(), (i+1)*options.getArraySize());
|
||||
try {
|
||||
BulkloadClientUtil.bulkload(url, cluster, concept, datamodel, options.isValidate(), options.isSmartpk(), subItems, username, password,universe);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if(left>0) {
|
||||
List<String> subItems=items.subList(loop*options.getArraySize(), loop*options.getArraySize()+left);
|
||||
try {
|
||||
BulkloadClientUtil.bulkload(url, cluster, concept, datamodel, options.isValidate(), options.isSmartpk(), subItems, username, password,universe);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
BulkloadClientUtil.bulkload(url, cluster, concept, datamodel, options.isValidate(), options.isSmartpk(), items, username, password,universe);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* load from File
|
||||
* @param inputXmlFile
|
||||
*/
|
||||
public void load(Reader inputXmlFile) {
|
||||
BufferedReader reader=null;
|
||||
try {
|
||||
reader=new BufferedReader(inputXmlFile);
|
||||
StringBuffer sb=new StringBuffer();
|
||||
String line=reader.readLine();
|
||||
while(line!=null) {
|
||||
sb=sb.append(line);
|
||||
line=reader.readLine();
|
||||
}
|
||||
List<String > items=BulkloadClientUtil.getItemXmls(sb.toString());
|
||||
doLoad(items);
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
if(reader!=null)
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
//test
|
||||
//FileReader reader=new FileReader(file)
|
||||
URL url=BulkloadClient.class.getResource("test.xml");
|
||||
try {
|
||||
BufferedInputStream in=((BufferedInputStream)url.getContent());
|
||||
byte[] buf=new byte[in.available()];
|
||||
in.read(buf);
|
||||
String xml=new String(buf);
|
||||
BulkloadClient client=new BulkloadClient("http://localhost:8080/datamanager/loadServlet","admin","talend",null,"Order","Country","Order");
|
||||
client.setOptions(new BulkloadOptions());
|
||||
client.load(xml);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
public void load(String xmlString) throws Exception {
|
||||
load(new ByteArrayInputStream(xmlString.getBytes("UTF-8")));
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Loads XML documents in MDM using an InputStream. All documents should follow each other.
|
||||
* For instance this InputStream can be used with this method.
|
||||
* </p>
|
||||
*
|
||||
* <code>
|
||||
* InputStream is = new ByteArrayInputStream("<doc></doc><doc></doc><doc></doc>".getBytes());
|
||||
* </code>
|
||||
*
|
||||
* <p>
|
||||
* This method blocks until all documents in <code>xmlDocuments</code> are read. For non blocking use cases
|
||||
* see {@link #load()}.
|
||||
* </p>
|
||||
*
|
||||
* @param xmlDocuments A stream that contains several XML documents.
|
||||
* @throws Exception Thrown in case of bulk load error
|
||||
*/
|
||||
public void load(InputStream xmlDocuments) throws Exception {
|
||||
BulkloadClientUtil.bulkload(url,
|
||||
cluster,
|
||||
concept,
|
||||
dataModel,
|
||||
options.isValidate(),
|
||||
options.isSmartpk(),
|
||||
xmlDocuments,
|
||||
username,
|
||||
password,
|
||||
universe);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Loads XML documents in MDM using an InputStream created for the load. This method creates a {@link Thread} that
|
||||
* wait for {@link InputStreamMerger#push(java.io.InputStream)} to get called.
|
||||
* </p>
|
||||
*
|
||||
* <code>
|
||||
* BulkloadClient client = ...<br/>
|
||||
* InputStreamMerger is = client.load();<br/>
|
||||
* for(...) {<br/>
|
||||
* is.push(new ByteArrayInputStream("...".getBytes());<br/>
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* @throws Exception Thrown in case of communication error
|
||||
* @see InputStreamMerger
|
||||
* @return A {@link InputStreamMerger} that allow asynchronous push to bulkload client.
|
||||
*/
|
||||
public InputStreamMerger load() throws Exception {
|
||||
return BulkloadClientUtil.bulkload(url,
|
||||
cluster,
|
||||
concept,
|
||||
dataModel,
|
||||
options.isValidate(),
|
||||
options.isSmartpk(),
|
||||
username,
|
||||
password,
|
||||
universe,
|
||||
startedBulkloadCount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,189 +1,131 @@
|
||||
package org.talend.mdm.bulkload.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import java.io.InputStream;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.apache.commons.httpclient.HostConfiguration;
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.HttpException;
|
||||
import org.apache.commons.httpclient.NameValuePair;
|
||||
import org.apache.commons.httpclient.URI;
|
||||
import org.apache.commons.httpclient.UsernamePasswordCredentials;
|
||||
import org.apache.commons.httpclient.auth.AuthScope;
|
||||
import org.apache.commons.httpclient.methods.PostMethod;
|
||||
import org.apache.commons.httpclient.cookie.CookiePolicy;
|
||||
import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
|
||||
import org.apache.commons.httpclient.methods.PutMethod;
|
||||
import org.apache.commons.httpclient.params.HttpClientParams;
|
||||
import org.apache.commons.httpclient.params.HttpMethodParams;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Bulkload amount items client
|
||||
* @author achen
|
||||
*
|
||||
*/
|
||||
public class BulkloadClientUtil {
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args)throws Exception {
|
||||
if((!args[0].startsWith("http://") && args.length>0) && (args.length != 9 || args.length!=7 || args.length!=6)) {
|
||||
usage();
|
||||
return;
|
||||
}
|
||||
String url= args[0];
|
||||
String username=args[1];
|
||||
String password=args[2];
|
||||
String cluster= args[3];
|
||||
String concept= args[4];
|
||||
String datamodel= args[5];
|
||||
boolean validate= false;
|
||||
boolean smartpk= false;
|
||||
List<String> itemdata= new ArrayList<String>();
|
||||
if(args.length==9) {
|
||||
validate= Boolean.valueOf(args[6]);
|
||||
smartpk= Boolean.valueOf(args[7]);
|
||||
itemdata=getItemXmls(args[8]);
|
||||
}
|
||||
if(args.length==7) {
|
||||
itemdata=getItemXmls(args[6]);
|
||||
}
|
||||
if(args.length==6) {//get itemdata from System.in
|
||||
byte[] buf=new byte[System.in.available()];
|
||||
System.in.read(buf);
|
||||
itemdata=getItemXmls(new String(buf));
|
||||
}
|
||||
try {
|
||||
bulkload(url,cluster, concept,datamodel, validate, smartpk, itemdata,username,password,null);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static List<String> getItemXmls(String itemdata)throws Exception {
|
||||
Element root=parse(itemdata).getDocumentElement();
|
||||
List<String> items=new ArrayList<String>();
|
||||
for(int i=0; i<root.getChildNodes().getLength(); i++) {
|
||||
Node node=root.getChildNodes().item(i);
|
||||
if(node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
items.add(nodeToString(node, true));
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
private static String nodeToString(Node n, boolean omitXMLDeclaration) throws TransformerException{
|
||||
StringWriter sw = new StringWriter();
|
||||
Transformer transformer = TransformerFactory.newInstance().newTransformer();
|
||||
if (omitXMLDeclaration)
|
||||
transformer.setOutputProperty("omit-xml-declaration","yes");
|
||||
else
|
||||
transformer.setOutputProperty("omit-xml-declaration","no");
|
||||
transformer.setOutputProperty("indent","yes");
|
||||
transformer.transform(
|
||||
new DOMSource(n),
|
||||
new StreamResult(sw)
|
||||
);
|
||||
if (sw==null) return null;
|
||||
return sw.toString().replaceAll("\r\n", "\n");
|
||||
}
|
||||
|
||||
private static Document parse(String xmlString) throws ParserConfigurationException,IOException, SAXException{
|
||||
//parse
|
||||
Document d=null;
|
||||
public static void bulkload(String url, String cluster, String concept, String datamodel, boolean validate, boolean smartpk, InputStream itemdata,
|
||||
String username, String password, String universe) throws Exception {
|
||||
HostConfiguration config = new HostConfiguration();
|
||||
URI uri = new URI(url, false, "UTF-8"); //$NON-NLS-1$
|
||||
config.setHost(uri);
|
||||
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
//Schema validation based on schemaURL
|
||||
factory.setNamespaceAware(true);
|
||||
factory.setAttribute(
|
||||
"http://java.sun.com/xml/jaxp/properties/schemaLanguage",
|
||||
"http://www.w3.org/2001/XMLSchema");
|
||||
DocumentBuilder builder;
|
||||
builder = factory.newDocumentBuilder();
|
||||
NameValuePair[] parameters = {new NameValuePair("cluster", cluster), //$NON-NLS-1$
|
||||
new NameValuePair("concept", concept), //$NON-NLS-1$
|
||||
new NameValuePair("datamodel", datamodel), //$NON-NLS-1$
|
||||
new NameValuePair("validate", String.valueOf(validate)), //$NON-NLS-1$
|
||||
new NameValuePair("action", "load"), //$NON-NLS-1$ //$NON-NLS-2$
|
||||
new NameValuePair("smartpk", String.valueOf(smartpk))}; //$NON-NLS-1$
|
||||
|
||||
d = builder.parse(new InputSource(new StringReader(xmlString)));
|
||||
HttpClient client = new HttpClient();
|
||||
String user = universe == null || universe.trim().length() == 0 ? username : universe + "/" + username; //$NON-NLS-1$
|
||||
client.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(user, password));
|
||||
HttpClientParams clientParams = client.getParams();
|
||||
clientParams.setAuthenticationPreemptive(true);
|
||||
clientParams.setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
|
||||
|
||||
return d;
|
||||
}
|
||||
private static void usage() {
|
||||
String usage="Usage:\n"+
|
||||
"\t java -jar bulkloadclient.jar <url> <username> <password> <datacontainer> <concept> <datamodel> [validate] [smartpk] [itemdata] \n"+
|
||||
"\t example1: java -jar bulkloadclient.jar http://localhost:8080/datamanager/loadServlet admin talend Order Country Order <itemdata><Country><isoCode>zh</isoCode><label>china</label><Continent>Asia</Continent></Country></itemdata>"+
|
||||
"\t example2(on linux): cat myfile.xml|java -jar bulkloadclient.jar http://localhost:8080/datamanager/loadServlet admin talend Order Country Order";
|
||||
|
||||
System.out.println(usage);
|
||||
}
|
||||
|
||||
|
||||
public static boolean bulkload(String URL, String cluster,String concept,String datamodel, boolean validate, boolean smartpk, List<String> itemdata,
|
||||
String username, String password,String universe) throws Exception {
|
||||
HttpClient client = new HttpClient();
|
||||
HttpClientParams params = new HttpClientParams();
|
||||
// params.setSoTimeout(1000);
|
||||
// params.setConnectionManagerTimeout(200);
|
||||
client.setParams(params);
|
||||
String user=universe==null||universe.trim().length()==0?username:universe+"/"+username;
|
||||
client.getState().setCredentials(AuthScope.ANY,
|
||||
new UsernamePasswordCredentials(user, password));
|
||||
PutMethod putMethod = new PutMethod();
|
||||
// This setPath call is *really* important (if not set, request will be sent to the JBoss root '/')
|
||||
putMethod.setPath(url);
|
||||
String responseBody;
|
||||
try {
|
||||
// Configuration
|
||||
putMethod.setRequestHeader("Content-Type", "text/xml; charset=utf8"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
putMethod.setQueryString(parameters);
|
||||
putMethod.setContentChunked(true);
|
||||
// Set the content of the PUT request
|
||||
putMethod.setRequestEntity(new InputStreamRequestEntity(itemdata));
|
||||
|
||||
URI uri = new URI(URL, false, "utf-8");
|
||||
HostConfiguration config = new HostConfiguration();
|
||||
config.setHost(uri);
|
||||
client.executeMethod(config, putMethod);
|
||||
responseBody = putMethod.getResponseBodyAsString();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
putMethod.releaseConnection();
|
||||
}
|
||||
|
||||
PostMethod postMethod = new PostMethod(URL);
|
||||
HttpMethodParams reqParams = postMethod.getParams();
|
||||
reqParams.setContentCharset("UTF-8");
|
||||
List<NameValuePair> list=new ArrayList<NameValuePair>();
|
||||
NameValuePair[] data = { new NameValuePair("cluster", cluster),
|
||||
new NameValuePair("concept", concept),
|
||||
new NameValuePair("datamodel", datamodel),
|
||||
new NameValuePair("validate", String.valueOf(validate)),
|
||||
new NameValuePair("smartpk", String.valueOf(smartpk))};
|
||||
list.addAll(Arrays.asList(data));
|
||||
for(int i=0; i<itemdata.size(); i++) {
|
||||
list.add(new NameValuePair("itemdata"+i, itemdata.get(i)));
|
||||
}
|
||||
postMethod.setRequestBody((NameValuePair[])list.toArray(new NameValuePair[list.size()]));
|
||||
// post method
|
||||
int statusCode = 0;
|
||||
try {
|
||||
statusCode = client.executeMethod(config,postMethod);
|
||||
} catch (HttpException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
int statusCode = putMethod.getStatusCode();
|
||||
if (statusCode >= 400) {
|
||||
throw new BulkloadException(responseBody);
|
||||
}
|
||||
}
|
||||
|
||||
if (statusCode >= 400)
|
||||
return false;
|
||||
String str = "";
|
||||
try {
|
||||
str = postMethod.getResponseBodyAsString();
|
||||
} catch (IOException e) {
|
||||
public static InputStreamMerger bulkload(String url, String cluster, String concept, String dataModel, boolean validate, boolean smartPK, String username, String password, String universe, AtomicInteger startedBulkloadCount) {
|
||||
InputStreamMerger merger = new InputStreamMerger();
|
||||
|
||||
}
|
||||
System.out.println(str);
|
||||
Runnable loadRunnable = new AsyncLoadRunnable(url, cluster, concept, dataModel, validate, smartPK, merger, username, password, universe, startedBulkloadCount);
|
||||
Thread loadThread = new Thread(loadRunnable);
|
||||
loadThread.start();
|
||||
|
||||
postMethod.releaseConnection();
|
||||
return true;
|
||||
}
|
||||
return merger;
|
||||
}
|
||||
|
||||
private static class AsyncLoadRunnable implements Runnable {
|
||||
|
||||
private final String url;
|
||||
|
||||
private final String cluster;
|
||||
|
||||
private final String concept;
|
||||
|
||||
private final String dataModel;
|
||||
|
||||
private final boolean validate;
|
||||
|
||||
private final boolean smartPK;
|
||||
|
||||
private final InputStreamMerger inputStream;
|
||||
|
||||
private final String userName;
|
||||
|
||||
private final String password;
|
||||
|
||||
private final String universe;
|
||||
|
||||
private final AtomicInteger startedBulkloadCount;
|
||||
|
||||
public AsyncLoadRunnable(String url, String cluster, String concept, String dataModel, boolean validate, boolean smartPK, InputStreamMerger inputStream, String userName, String password, String universe, AtomicInteger startedBulkloadCount) {
|
||||
this.url = url;
|
||||
this.cluster = cluster;
|
||||
this.concept = concept;
|
||||
this.dataModel = dataModel;
|
||||
this.validate = validate;
|
||||
this.smartPK = smartPK;
|
||||
this.inputStream = inputStream;
|
||||
this.userName = userName;
|
||||
this.password = password;
|
||||
this.universe = universe;
|
||||
this.startedBulkloadCount = startedBulkloadCount;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
startedBulkloadCount.incrementAndGet();
|
||||
bulkload(url, cluster, concept, dataModel, validate, smartPK, inputStream, userName, password, universe);
|
||||
} catch (Throwable e) {
|
||||
inputStream.reportFailure(e);
|
||||
} finally {
|
||||
startedBulkloadCount.decrementAndGet();
|
||||
synchronized (startedBulkloadCount) {
|
||||
startedBulkloadCount.notifyAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
*
|
||||
* This source code is available under agreement available at
|
||||
* %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
*
|
||||
* You should have received a copy of the agreement
|
||||
* along with this program; if not, write to Talend SA
|
||||
* 9 rue Pages 92150 Suresnes, France
|
||||
*/
|
||||
|
||||
package org.talend.mdm.bulkload.client;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class BulkloadException extends RuntimeException {
|
||||
|
||||
private static final String SERVER_EXCEPTION_SEPARATOR = "== SERVER EXCEPTION ==";
|
||||
|
||||
private static final String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$
|
||||
|
||||
private final String serverException;
|
||||
|
||||
public BulkloadException(String serverException) {
|
||||
super("An exception happened during bulk load on MDM server.");
|
||||
this.serverException = serverException;
|
||||
}
|
||||
|
||||
public String getServerException() {
|
||||
return serverException;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printStackTrace(PrintStream s) {
|
||||
super.printStackTrace(s);
|
||||
s.append(LINE_SEPARATOR);
|
||||
s.append(SERVER_EXCEPTION_SEPARATOR);
|
||||
s.append(LINE_SEPARATOR);
|
||||
s.append(serverException);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printStackTrace(PrintWriter s) {
|
||||
super.printStackTrace(s);
|
||||
s.println(SERVER_EXCEPTION_SEPARATOR);
|
||||
s.println(serverException);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
* Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
*
|
||||
* This source code is available under agreement available at
|
||||
* %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
*
|
||||
* You should have received a copy of the agreement
|
||||
* along with this program; if not, write to Talend SA
|
||||
* 9 rue Pages 92150 Suresnes, France
|
||||
*/
|
||||
|
||||
package org.talend.mdm.bulkload.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class InputStreamMerger extends InputStream {
|
||||
|
||||
private static final Logger log = Logger.getLogger(InputStreamMerger.class.getName());
|
||||
|
||||
private final Queue<InputStream> inputStreamBuffer = new ConcurrentLinkedQueue<InputStream>();
|
||||
|
||||
private final Object readLock = new Object();
|
||||
|
||||
private final Object exhaustLock = new Object();
|
||||
|
||||
private boolean isClosed;
|
||||
|
||||
private InputStream currentStream;
|
||||
|
||||
private boolean hasFinishedRead;
|
||||
|
||||
private Throwable lastFailure;
|
||||
|
||||
public void push(InputStream inputStream) throws IOException {
|
||||
if (inputStream == null) {
|
||||
throw new IllegalArgumentException("Input stream can not be null.");
|
||||
}
|
||||
if (isClosed) {
|
||||
throw new IOException("Stream is closed");
|
||||
}
|
||||
inputStreamBuffer.add(inputStream);
|
||||
debug("Added a new input stream (buffer now has " + inputStreamBuffer.size() + " streams)");
|
||||
}
|
||||
|
||||
public void reportFailure(Throwable e) {
|
||||
debug("Exception occurred in consumer thread: " + e.getMessage());
|
||||
lastFailure = e;
|
||||
synchronized (exhaustLock) {
|
||||
exhaustLock.notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int available() throws IOException {
|
||||
return 4096;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean markSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p> Read block the current thread until data is pushed to this stream (using {@link #push(java.io.InputStream)}
|
||||
* or if {@link #close()} is called. </p>
|
||||
*
|
||||
* @return the next byte of data, or <code>-1</code> if the end of the stream is reached <b>or</b> if stream is
|
||||
* closed.
|
||||
* @throws IOException
|
||||
* @see java.io.InputStream#read()
|
||||
*/
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
int read = -1;
|
||||
if (currentStream != null) {
|
||||
read = currentStream.read();
|
||||
} else {
|
||||
moveToNextInputStream();
|
||||
if (currentStream != null) {
|
||||
read = currentStream.read();
|
||||
}
|
||||
}
|
||||
if (read < 0) {
|
||||
moveToNextInputStream();
|
||||
if (currentStream != null) {
|
||||
read = currentStream.read();
|
||||
}
|
||||
}
|
||||
if (read < 0) {
|
||||
synchronized (exhaustLock) {
|
||||
debug("Notify exhaust lock");
|
||||
exhaustLock.notifyAll();
|
||||
}
|
||||
}
|
||||
// Throw any exception that might have occurred during last record processing.
|
||||
throwLastFailure();
|
||||
return read;
|
||||
}
|
||||
|
||||
private void throwLastFailure() throws IOException {
|
||||
if (lastFailure != null) {
|
||||
debug("Report last failure exception to producer.");
|
||||
throw new IOException("An exception occurred while processing last record.", lastFailure);
|
||||
}
|
||||
}
|
||||
|
||||
private void moveToNextInputStream() throws IOException {
|
||||
// Throw any exception that might have occurred during previous records
|
||||
throwLastFailure();
|
||||
// Check the isClosed flag in case we've got waken up by a close()
|
||||
while (inputStreamBuffer.isEmpty() && !isClosed) {
|
||||
synchronized (readLock) {
|
||||
try {
|
||||
debug("Wait for more input...");
|
||||
readLock.wait();
|
||||
debug("Wait for more input done.");
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!inputStreamBuffer.isEmpty()) {
|
||||
if (currentStream != null) {
|
||||
currentStream.close();
|
||||
}
|
||||
currentStream = inputStreamBuffer.poll();
|
||||
} else {
|
||||
currentStream = null;
|
||||
hasFinishedRead = true;
|
||||
}
|
||||
debug("Remaining buffers : " + inputStreamBuffer.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* <p> Close this stream and perform some checks: <ul> <li>Mark this stream as closed (no more calls to {@link
|
||||
* #push(java.io.InputStream)} are allowed)</li> <li>Closes any remaining stream pushed to this stream</li> </ul>
|
||||
* </p> <p> Calling this method wakes up any thread blocked on {@link #read()} </p> <p> Wait till all streams pushed
|
||||
* to this stream (and stored in <code>inputStreamBuffer</code>) are processed by a reader. </p> <p> When this
|
||||
* method exits, the buffer is empty and the last stream in buffer is fully read (i.e. until read() returns -1).
|
||||
* </p>
|
||||
*
|
||||
* @throws IOException In case at least one stream in buffer hasn't been read.
|
||||
* @see java.io.InputStream#close()
|
||||
*/
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
super.close();
|
||||
isClosed = true;
|
||||
synchronized (readLock) {
|
||||
readLock.notifyAll();
|
||||
}
|
||||
debug("Input stream buffer size: " + +inputStreamBuffer.size());
|
||||
debug("Has finished read: " + hasFinishedRead);
|
||||
debug("Stop condition: " + (!inputStreamBuffer.isEmpty() && !hasFinishedRead));
|
||||
while (!inputStreamBuffer.isEmpty() && !hasFinishedRead) {
|
||||
try {
|
||||
debug("Waiting for exhaust... (" + inputStreamBuffer.size() + " remaining)");
|
||||
synchronized (exhaustLock) {
|
||||
exhaustLock.wait();
|
||||
}
|
||||
// In case we got woken up due to a failure
|
||||
throwLastFailure();
|
||||
debug("Waiting for exhaust done.");
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
// In case failure happened on very last read.
|
||||
throwLastFailure();
|
||||
debug("Close completed.");
|
||||
}
|
||||
|
||||
private static void debug(String message) {
|
||||
Level debugLevel = Level.FINEST;
|
||||
if (log.isLoggable(debugLevel)) {
|
||||
log.log(debugLevel, "[" + Thread.currentThread() + "] " + message);
|
||||
}
|
||||
}
|
||||
|
||||
public Throwable getLastReportedFailure() {
|
||||
return lastFailure;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
BIN
org.talend.designer.components.libs/libs_src/msmq/MsmqJava.dll
Normal file
BIN
org.talend.designer.components.libs/libs_src/msmq/MsmqJava.dll
Normal file
Binary file not shown.
@@ -1,37 +1,331 @@
|
||||
// Message.java
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2006-2010 Dino Chiesa.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This code module is part of MsmqJava, a JNI library that provides
|
||||
// access to MSMQ for Java on Windows.
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// This code is licensed under the Microsoft Public License.
|
||||
// See the file License.txt for the license details.
|
||||
// More info on: http://dotnetzip.codeplex.com
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// last saved (in emacs):
|
||||
// Time-stamp: <2010-March-28 15:17:56>
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// This module represents a Message object.
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
package ionic.Msmq;
|
||||
|
||||
public class Message {
|
||||
String _message ;
|
||||
|
||||
/**
|
||||
* <p>The Message class models a message that is sent to or receive from an
|
||||
* MSMQ queue. It exposes several properties that are known to MSMQ,
|
||||
* including the message label, the message correlationId, and the
|
||||
* message body.</p>
|
||||
*
|
||||
* <p>The maximum size for an MSMQ 4.0 message is slightly less than 4
|
||||
* MB. If you try to send a message that exceeds the maximum size, you
|
||||
* will receive a MessageQueueException, with hr =
|
||||
* MQ_ERROR_INSUFFICIENT_RESOURCES (0xC00E0027).</p>
|
||||
*
|
||||
*/
|
||||
public class Message {
|
||||
private static String _encoding = "UTF-16LE";
|
||||
private static String _utf8 = "UTF-8";
|
||||
byte[] _messageBody ;
|
||||
String _label ;
|
||||
String _correlationId ;
|
||||
int _transactionFlag;
|
||||
// int _status;
|
||||
byte[] _correlationId ; // up to PROPID_M_CORRELATIONID_SIZE bytes
|
||||
boolean _highPriority;
|
||||
|
||||
public void setMessage(String value) { _message= value; }
|
||||
public String getMessage() { return _message; }
|
||||
|
||||
public void setLabel(String value) { _label= value; }
|
||||
public String getLabel() { return _label; }
|
||||
/**
|
||||
* <p>Sets the message body, as a string.</p>
|
||||
*
|
||||
* <p>The string will be encoded as UTF-16LE, with no byte-order-mark.
|
||||
* This information may be useful if you use different libraries on the
|
||||
* the receiving and sending side. </p>
|
||||
*
|
||||
* @param value the string to use for the Message body
|
||||
* @see #setBody(byte[])
|
||||
*/
|
||||
public void setBodyAsString(String value)
|
||||
throws java.io.UnsupportedEncodingException
|
||||
{ _messageBody= value.getBytes(_encoding); }
|
||||
|
||||
public void setCorrelationId(String value) {_correlationId= value;}
|
||||
public String getCorrelationId() {return _correlationId; }
|
||||
|
||||
public void setTransactionFlag(int value) { _transactionFlag= value;}
|
||||
public int getTransactionFlag() {return _transactionFlag;}
|
||||
/**
|
||||
* <p>Gets the message body, as a string.</p>
|
||||
*
|
||||
* <p>The string will be decoded as UTF-16LE, with no byte-order-mark.
|
||||
* This is mostly useful after receiving a message. </p>
|
||||
*
|
||||
* <p>If the message body is not a legal UTF-16LE bytestream, then this
|
||||
* method will return a rubbish string.</p>
|
||||
*
|
||||
* @return the message body, as a string.
|
||||
* @see #getBody()
|
||||
*/
|
||||
public String getBodyAsString()
|
||||
throws java.io.UnsupportedEncodingException
|
||||
{ return new String(_messageBody, _encoding); }
|
||||
|
||||
// public int getStatus() {return _status;}
|
||||
|
||||
public Message(String message, String label, String correlationId, int transactionFlag) {
|
||||
_message=message;
|
||||
_label= label;
|
||||
_correlationId= correlationId;
|
||||
_transactionFlag= transactionFlag;
|
||||
/**
|
||||
* <p>Sets the correlation Id on the message. </p>
|
||||
*
|
||||
* <p>MSMQ specifies that the ID should be a byte array, of 20 bytes
|
||||
* in length. But callers can use this convenience method to use a
|
||||
* string as a correlationId. It will be encoded as UTF-8, and
|
||||
* limited to 20 bytes.</p>
|
||||
*
|
||||
* @param value the string to use as the correlation ID on the message.
|
||||
*/
|
||||
|
||||
public void setCorrelationIdAsString(String value)
|
||||
throws java.io.UnsupportedEncodingException
|
||||
{ _correlationId= value.getBytes(_utf8); }
|
||||
|
||||
|
||||
/**
|
||||
* <p>Gets the correlation Id on the message, in the form of a string. </p>
|
||||
*
|
||||
* <p>The behavior is undefined if the correlation ID is not a
|
||||
* UTF-8 bytestream.</p>
|
||||
*
|
||||
* @return the correlation ID on the message, as a string.
|
||||
*/
|
||||
public String getCorrelationIdAsString()
|
||||
throws java.io.UnsupportedEncodingException
|
||||
{ return new String(_correlationId, _utf8); }
|
||||
|
||||
|
||||
/**
|
||||
* Sets the message body.
|
||||
*
|
||||
* @param value the byte array to use for the Message body
|
||||
* @see #getBody()
|
||||
* @see #setBodyAsString(String)
|
||||
*/
|
||||
public void setBody(byte[] value) { _messageBody= value; }
|
||||
|
||||
/**
|
||||
* Gets the message body.
|
||||
*
|
||||
* @return the message body, as a byte array.
|
||||
*/
|
||||
public byte[] getBody() { return _messageBody; }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the message label.
|
||||
*
|
||||
* @param value the string to use as the label on the message.
|
||||
*/
|
||||
public void setLabel(String value) { _label= value; }
|
||||
|
||||
/**
|
||||
* Gets the message body.
|
||||
*
|
||||
* @return the message label.
|
||||
*/
|
||||
public String getLabel() { return _label; }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Sets the correlation Id on the message. </p>
|
||||
*
|
||||
* <p> The ID should be a byte array, a maximum of 20 bytes.</p>
|
||||
*
|
||||
* @param value the byte array to use as the correlation ID on the
|
||||
* message.
|
||||
*/
|
||||
public void setCorrelationId(byte[] value) { _correlationId= value; }
|
||||
|
||||
/**
|
||||
* <p>Gets the correlation Id on the message. </p>
|
||||
*
|
||||
* <p>The ID will be a byte array, of length 20.</p>
|
||||
*
|
||||
* @return the correlation ID on the message.
|
||||
*/
|
||||
public byte[] getCorrelationId() { return _correlationId; }
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether the message should be trated as high priority or not.
|
||||
*
|
||||
* @param value true if the message should be delivered with high
|
||||
* priority.
|
||||
*/
|
||||
public void setHighPriority(boolean value) { _highPriority= value; }
|
||||
|
||||
|
||||
/**
|
||||
* <p>Gets whether the message will be treated with high priority.</p>
|
||||
*
|
||||
* <p>This only makes sense for outgoing messages.</p>
|
||||
*
|
||||
* @return true if the message will be trated with high priority.
|
||||
*/
|
||||
public boolean getHighPriority() { return _highPriority; }
|
||||
|
||||
|
||||
Message() { }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Creates a Message instance, using a string argument for the
|
||||
* contents of the body, and empty values for the label and
|
||||
* correlation ID.</p>
|
||||
*
|
||||
* @param body the string to use for the Message body
|
||||
*/
|
||||
public Message(String body)
|
||||
throws java.io.UnsupportedEncodingException
|
||||
{
|
||||
this(body, "", "");
|
||||
}
|
||||
// public Message(String message, String label, String correlationId, int transactionFlag, int status) {
|
||||
// _message=message;
|
||||
// _label= label;
|
||||
// _correlationId= correlationId;
|
||||
// _transactionFlag= transactionFlag;
|
||||
// _status= status;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>Creates a Message instance, using string arguments for the
|
||||
* contents.</p>
|
||||
*
|
||||
* <p>A Message contains byte array data in the body and correlation
|
||||
* Id. This constructor allows the specification of those items as
|
||||
* strings. The actual values of the body and correlation Id are
|
||||
* set to the encoded form of the strings, using UTF-16LE for
|
||||
* encoding. </p>
|
||||
*
|
||||
* <p>If you use ASCII strings for the body and correlationId,
|
||||
* the encoding will be very inefficient. Each character in the input
|
||||
* will result in two bytes in output, one of which will be a zero.
|
||||
* Therefore, if you're concerned about efficiency, consider encoding
|
||||
* strings separately, before creating the Message instance. </p>
|
||||
*
|
||||
*
|
||||
* @param body the string to use for the Message body.
|
||||
* @param label the string to use for the Message label. The maximum
|
||||
* length of a message label is 250 bytes.
|
||||
* @param correlationId the string to use for the Message correlation Id
|
||||
*/
|
||||
public Message(String body, String label, String correlationId)
|
||||
throws java.io.UnsupportedEncodingException
|
||||
{
|
||||
this(body.getBytes(Message._encoding),
|
||||
label,
|
||||
correlationId.getBytes(Message._encoding));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>Creates a Message instance, using a string for the
|
||||
* body and label, and a byte array for the correlation ID.</p>
|
||||
*
|
||||
* <p>A Message contains byte array data in the body and correlation
|
||||
* Id. This constructor allows the specification of the body as a
|
||||
* string, and the correlation Id as a byte array. The actual value
|
||||
* of the body will be set to the encoded form of the body string,
|
||||
* using UTF-16LE. </p>
|
||||
*
|
||||
* <p>Only the first 20 bytes of the correlationId will be used.</p>
|
||||
*
|
||||
* @param body the string to use for the Message body
|
||||
* @param label the string to use for the Message label
|
||||
* @param correlationId the byte array to use for the Message correlation Id
|
||||
*
|
||||
*/
|
||||
public Message(String body, String label, byte[] correlationId)
|
||||
throws java.io.UnsupportedEncodingException
|
||||
{
|
||||
this(body.getBytes(_encoding),
|
||||
label,
|
||||
correlationId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>Creates a Message instance, using a byte array for the
|
||||
* message body, and empty values for the label and correlation ID.</p>
|
||||
*
|
||||
* <p>A Message contains byte array data in the body and
|
||||
* correlation Id. This constructor allows the specification of the
|
||||
* body as a byte array. The label and correlation ID of the
|
||||
* Message are set to empty values. </p>
|
||||
*
|
||||
* @param body the string to use for the Message body
|
||||
*
|
||||
*/
|
||||
public Message(byte[] body)
|
||||
throws java.io.UnsupportedEncodingException
|
||||
{
|
||||
this(body, "", "");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Creates a Message instance, using a byte array for the
|
||||
* body, and a string for the label and correlation ID.</p>
|
||||
*
|
||||
* <p>A Message contains byte array data in the body and correlation
|
||||
* Id. This constructor allows the specification of the body as a
|
||||
* byte array, and the correlation Id as a string. The actual value
|
||||
* of the correlation Id will be the encoded form of the body
|
||||
* string, using UTF-16LE. </p>
|
||||
*
|
||||
* <p>Only the first 20 bytes of the correlationId will be used.</p>
|
||||
*
|
||||
* @param body the string to use for the Message body
|
||||
* @param label the string to use for the Message label
|
||||
* @param correlationId the byte array to use for the Message correlation Id
|
||||
*
|
||||
*/
|
||||
public Message(byte[] body, String label, String correlationId)
|
||||
throws java.io.UnsupportedEncodingException
|
||||
{
|
||||
this(body,
|
||||
label,
|
||||
correlationId.getBytes(_encoding));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Creates a Message instance, using a byte array for the
|
||||
* body the correlation ID, and a string for the label.</p>
|
||||
*
|
||||
* <p>A Message contains byte array data in the body and correlation
|
||||
* Id. This constructor allows the specification of the body and
|
||||
* correlation ID as byte arrays. Applications may wish to use this
|
||||
* constructor when close control of the contents of the message is
|
||||
* desired. </p>
|
||||
*
|
||||
* <p>Only the first 20 bytes of the correlationId will be used.</p>
|
||||
*
|
||||
* @param body the string to use for the Message body
|
||||
* @param label the string to use for the Message label
|
||||
* @param correlationId the byte array to use for the Message correlation Id
|
||||
*
|
||||
*/
|
||||
public Message(byte[] body, String label, byte[] correlationId)
|
||||
{
|
||||
_messageBody = body;
|
||||
_label= label;
|
||||
_correlationId= correlationId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,63 +1,113 @@
|
||||
package ionic.Msmq ;
|
||||
//
|
||||
// MessageQueueException.java
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2006-2010 Dino Chiesa.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This code module is part of MsmqJava, a JNI library that provides
|
||||
// access to MSMQ for Java on Windows.
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// This code is licensed under the Microsoft Public License.
|
||||
// See the file License.txt for the license details.
|
||||
// More info on: http://dotnetzip.codeplex.com
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// last saved (in emacs):
|
||||
// Time-stamp: <2010-March-28 15:50:20>
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// This class models an exception that may occur when interacting with
|
||||
// MSMQ through the JNI library.
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
package ionic.Msmq ;
|
||||
|
||||
/**
|
||||
* An exception type to wrap any problems that occur during MSMQ operations.
|
||||
*
|
||||
**/
|
||||
public class MessageQueueException extends java.lang.Exception {
|
||||
|
||||
public int hresult;
|
||||
public int hresult;
|
||||
|
||||
public MessageQueueException(int HRESULT) {
|
||||
super();
|
||||
hresult= HRESULT;
|
||||
}
|
||||
public MessageQueueException(int HRESULT) {
|
||||
super();
|
||||
hresult= HRESULT;
|
||||
}
|
||||
|
||||
public MessageQueueException(String message, int HRESULT) {
|
||||
super(message);
|
||||
hresult= HRESULT;
|
||||
}
|
||||
public MessageQueueException(String message, int HRESULT) {
|
||||
super(message);
|
||||
hresult= HRESULT;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String msg = getLocalizedMessage();
|
||||
String hr= "hr=" + HrToString(hresult) ;
|
||||
return msg + " (" + hr + ")";
|
||||
}
|
||||
/**
|
||||
* <p>Produce the string version for the given exception, including the
|
||||
* string mnemonic for the HR wrapped by the exception.</p>
|
||||
*
|
||||
* <p>Example:</p>
|
||||
*
|
||||
* <blockquote class='code'><pre>
|
||||
* try {
|
||||
* String label="testmessage";
|
||||
* String body= "....";
|
||||
* Message msg= new Message(body, label, null);
|
||||
* queue.send(msg);
|
||||
* }
|
||||
* catch (MessageQueueException ex1) {
|
||||
* System.out.println("Put failure: " + ex1.toString());
|
||||
* }
|
||||
* </pre></blockquote>
|
||||
*
|
||||
*/
|
||||
public String toString() {
|
||||
String msg = getLocalizedMessage();
|
||||
String hr= "hr=" + HrToString(hresult) ;
|
||||
return msg + " (" + hr + ")";
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------
|
||||
public static String HrToString(int hr) {
|
||||
if (hr== 0)
|
||||
return "SUCCESS";
|
||||
if (hr==0xC00E0002)
|
||||
return "MQ_ERROR_PROPERTY";
|
||||
if (hr== 0xC00E0003)
|
||||
return "MQ_ERROR_QUEUE_NOT_FOUND";
|
||||
if (hr==0xC00E0005)
|
||||
return "MQ_ERROR_QUEUE_EXISTS";
|
||||
if (hr==0xC00E0006)
|
||||
return "MQ_ERROR_INVALID_PARAMETER";
|
||||
if (hr==0xC00E0007)
|
||||
return "MQ_ERROR_INVALID_HANDLE";
|
||||
if (hr==0xC00E005A)
|
||||
return "MQ_ERROR_QUEUE_DELETED";
|
||||
if (hr==0xC00E000B)
|
||||
return "MQ_ERROR_SERVICE_NOT_AVAILABLE";
|
||||
if (hr==0xC00E001B)
|
||||
return "MQ_ERROR_IO_TIMEOUT";
|
||||
if (hr==0xC00E001E)
|
||||
return "MQ_ERROR_ILLEGAL_FORMATNAME";
|
||||
if (hr== 0xC00E0025)
|
||||
return "MQ_ERROR_ACCESS_DENIED";
|
||||
if (hr==0xC00E0013)
|
||||
return "MQ_ERROR_NO_DS";
|
||||
if (hr==0xC00E003F)
|
||||
return "MQ_ERROR_INSUFFICIENT_PROPERTIES";
|
||||
if (hr==0xC00E0014)
|
||||
return "MQ_ERROR_ILLEGAL_QUEUE_PATHNAME";
|
||||
if (hr==0xC00E0044)
|
||||
return "MQ_ERROR_INVALID_OWNER";
|
||||
if (hr==0xC00E0045)
|
||||
return "MQ_ERROR_UNSUPPORTED_ACCESS_MODE";
|
||||
if (hr== 0xC00E0069)
|
||||
return "MQ_ERROR_REMOTE_MACHINE_NOT_AVAILABLE";
|
||||
private static String HrToString(int hr) {
|
||||
if (hr== 0)
|
||||
return "SUCCESS";
|
||||
if (hr==0xC00E0002)
|
||||
return "MQ_ERROR_PROPERTY";
|
||||
if (hr== 0xC00E0003)
|
||||
return "MQ_ERROR_QUEUE_NOT_FOUND";
|
||||
if (hr==0xC00E0005)
|
||||
return "MQ_ERROR_QUEUE_EXISTS";
|
||||
if (hr==0xC00E0006)
|
||||
return "MQ_ERROR_INVALID_PARAMETER";
|
||||
if (hr==0xC00E0007)
|
||||
return "MQ_ERROR_INVALID_HANDLE";
|
||||
if (hr==0xC00E005A)
|
||||
return "MQ_ERROR_QUEUE_DELETED";
|
||||
if (hr==0xC00E000B)
|
||||
return "MQ_ERROR_SERVICE_NOT_AVAILABLE";
|
||||
if (hr==0xC00E001B)
|
||||
return "MQ_ERROR_IO_TIMEOUT";
|
||||
if (hr==0xC00E001E)
|
||||
return "MQ_ERROR_ILLEGAL_FORMATNAME";
|
||||
if (hr== 0xC00E0025)
|
||||
return "MQ_ERROR_ACCESS_DENIED";
|
||||
if (hr==0xC00E0013)
|
||||
return "MQ_ERROR_NO_DS";
|
||||
if (hr==0xC00E003F)
|
||||
return "MQ_ERROR_INSUFFICIENT_PROPERTIES";
|
||||
if (hr==0xC00E0014)
|
||||
return "MQ_ERROR_ILLEGAL_QUEUE_PATHNAME";
|
||||
if (hr==0xC00E0044)
|
||||
return "MQ_ERROR_INVALID_OWNER";
|
||||
if (hr==0xC00E0045)
|
||||
return "MQ_ERROR_UNSUPPORTED_ACCESS_MODE";
|
||||
if (hr== 0xC00E0069)
|
||||
return "MQ_ERROR_REMOTE_MACHINE_NOT_AVAILABLE";
|
||||
|
||||
return "unknown hr (" + hr + ")";
|
||||
}
|
||||
return "unknown hr (" + hr + ")";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,184 +1,463 @@
|
||||
//
|
||||
// Queue.java
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2006-2010 Dino Chiesa.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This code module is part of MsmqJava, a JNI library that provides
|
||||
// access to MSMQ for Java on Windows.
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// This code is licensed under the Microsoft Public License.
|
||||
// See the file License.txt for the license details.
|
||||
// More info on: http://dotnetzip.codeplex.com
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// last saved (in emacs):
|
||||
// Time-stamp: <2010-March-28 15:51:58>
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// This module provides the Java Queue object, representing an MSMQ Queue.
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
package ionic.Msmq;
|
||||
|
||||
public class Queue {
|
||||
|
||||
public Queue(String queueName) throws MessageQueueException {
|
||||
_init(queueName, 0x03); // open with both SEND and RECEIVE access
|
||||
|
||||
/**
|
||||
* The Queue class represents a message queue in MSMQ.
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
* Applications can instantiate a Queue, then perform send and receive
|
||||
* operations on the queue, using instances of the Message type.
|
||||
*
|
||||
* </p>
|
||||
* <p>
|
||||
*
|
||||
* Queue also exposes several static methods for Queue management, to
|
||||
* support creation and deletion of message queues.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public class Queue
|
||||
{
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The Queue.Access enum provides options for access to the MSMQ
|
||||
* Queue: Either Receive, Send, or both. Specify this when opening a
|
||||
* queue.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
* Applications may wish to open queues for only the access they
|
||||
* need, in order to save resources and memory.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public enum Access
|
||||
{
|
||||
/**
|
||||
* The queue will be accessible for Receive or READ (or GET)
|
||||
* operations.
|
||||
*
|
||||
**/
|
||||
RECEIVE(1),
|
||||
|
||||
/**
|
||||
* The queue will be accessible for Send or WRITE (or PUT)
|
||||
* operations.
|
||||
*
|
||||
**/
|
||||
SEND(2),
|
||||
|
||||
/**
|
||||
* The queue will be accessible for both Send ad Receive
|
||||
* operations.
|
||||
*
|
||||
**/
|
||||
SEND_AND_RECEIVE(3);
|
||||
|
||||
int _accessFlag;
|
||||
|
||||
Access(int value)
|
||||
{
|
||||
_accessFlag = value;
|
||||
}
|
||||
|
||||
int getValue() { return _accessFlag; }
|
||||
}
|
||||
|
||||
public Queue(String queueName, int access) throws MessageQueueException {
|
||||
_init(queueName, access);
|
||||
|
||||
/**
|
||||
* <p>Call this constructor to open a queue by name for SEND and
|
||||
* RECEIVE operations.</p>
|
||||
*
|
||||
* <p>Here's an example of how to use it, to send a simple message:</p>
|
||||
*
|
||||
* <blockquote class='code'><pre>
|
||||
* Queue queue= new Queue(fullname);
|
||||
* String body = "Hello, World!";
|
||||
* String label = "Greeting";
|
||||
* String correlationId= "L:none";
|
||||
* Message msg= new Message(body, label, correlationId);
|
||||
* queue.send(msg);
|
||||
* </pre></blockquote>
|
||||
*
|
||||
**/
|
||||
public Queue(String queueName)
|
||||
throws MessageQueueException
|
||||
{
|
||||
_init(queueName, 0x03); // open with both SEND and RECEIVE access
|
||||
}
|
||||
|
||||
void _init(String queueName, int access) throws MessageQueueException {
|
||||
|
||||
/**
|
||||
* Call this constructor to open a queue with the specified access
|
||||
*
|
||||
**/
|
||||
public Queue(String queueName, Queue.Access access)
|
||||
throws MessageQueueException
|
||||
{
|
||||
_init(queueName, access.getValue());
|
||||
}
|
||||
|
||||
|
||||
private void _init(String queueName, int access)
|
||||
throws MessageQueueException
|
||||
{
|
||||
// the openQueue native method causes the _queueSlot to be set.
|
||||
int rc = 0;
|
||||
if (access == 0x01) // RECEIVE
|
||||
{
|
||||
rc = nativeOpenQueueForReceive(queueName);
|
||||
} else if (access == 0x02) // SEND
|
||||
{
|
||||
rc = nativeOpenQueueForSend(queueName);
|
||||
} else if (access == 0x03) // SEND+RECEIVE
|
||||
{
|
||||
rc = nativeOpenQueue(queueName);
|
||||
} else {
|
||||
rc = 0xC00E0006; /* MQ_INVALID_PARAMETER */
|
||||
rc= nativeOpenQueueForReceive(queueName);
|
||||
}
|
||||
else if (access == 0x02) // SEND
|
||||
{
|
||||
rc= nativeOpenQueueForSend(queueName);
|
||||
}
|
||||
else if (access == 0x03) // SEND+RECEIVE
|
||||
{
|
||||
rc= nativeOpenQueue(queueName);
|
||||
}
|
||||
else { rc= 0xC00E0006; /* MQ_INVALID_PARAMETER */ }
|
||||
|
||||
if (rc != 0)
|
||||
throw new MessageQueueException("Cannot open queue.", rc);
|
||||
if (rc!=0) throw new MessageQueueException("Cannot open queue.", rc);
|
||||
|
||||
_name = queueName;
|
||||
_formatName = "unknown";
|
||||
_label = "need to set this";
|
||||
_isTransactional = false; // TODO: get actual value in "openQueue"
|
||||
_name= queueName;
|
||||
_formatName= "unknown";
|
||||
_label= "need to set this";
|
||||
_isTransactional= false; // TODO: get actual value in "openQueue"
|
||||
}
|
||||
|
||||
public static Queue create(String queuePath, String queueLabel, boolean isTransactional) throws MessageQueueException {
|
||||
int rc = nativeCreateQueue(queuePath, queueLabel, (isTransactional) ? 1 : 0);
|
||||
if (rc != 0)
|
||||
throw new MessageQueueException("Cannot create queue.", rc);
|
||||
// DIRECT=OS ? or DIRECT=TCP ?
|
||||
String a1 = "OS";
|
||||
char[] c = queuePath.toCharArray();
|
||||
if ((c[0] >= '1') && (c[0] <= '9'))
|
||||
a1 = "TCP"; // assume ip address
|
||||
|
||||
Queue q = new Queue("DIRECT=" + a1 + ":" + queuePath);
|
||||
q._name = queuePath;
|
||||
// q._formatName=queueFormatName;
|
||||
q._label = queueLabel;
|
||||
q._isTransactional = isTransactional;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Create a queue by name, with the given queue label and transactional access.
|
||||
* </p>
|
||||
*
|
||||
* <p>Example:</p>
|
||||
*
|
||||
* <blockquote class='code'><pre>
|
||||
* String fullname= ".\\private$\\" + qname;
|
||||
* String qLabel="Created by " + this.getClass().getName() + ".java";
|
||||
* boolean transactional= false; // should the queue be transactional
|
||||
* queue= Queue.create(fullname, qLabel, transactional);
|
||||
* </pre></blockquote>
|
||||
**/
|
||||
public static Queue create(String queuePath, String queueLabel, boolean isTransactional)
|
||||
throws MessageQueueException
|
||||
{
|
||||
int rc= nativeCreateQueue( queuePath, queueLabel, (isTransactional)?1:0);
|
||||
if (rc!=0)
|
||||
throw new MessageQueueException("Cannot create queue.", rc);
|
||||
// DIRECT=OS ? or DIRECT=TCP ?
|
||||
String a1= "OS";
|
||||
char[] c= queuePath.toCharArray();
|
||||
if ((c[0]>='1')
|
||||
&& (c[0]<='9')) a1= "TCP"; // assume ip address
|
||||
|
||||
Queue q= new Queue("DIRECT=" + a1 + ":" + queuePath);
|
||||
q._name= queuePath;
|
||||
// q._formatName=queueFormatName;
|
||||
q._label=queueLabel;
|
||||
q._isTransactional= isTransactional;
|
||||
return q;
|
||||
}
|
||||
|
||||
public static void delete(String queuePath) throws MessageQueueException {
|
||||
int rc = nativeDeleteQueue(queuePath);
|
||||
if (rc != 0)
|
||||
throw new MessageQueueException("Cannot delete queue.", rc);
|
||||
|
||||
/**
|
||||
* Delete a queue by the given name.
|
||||
*
|
||||
**/
|
||||
public static void delete(String queuePath)
|
||||
throws MessageQueueException
|
||||
{
|
||||
int rc= nativeDeleteQueue( queuePath );
|
||||
if (rc!=0)
|
||||
throw new MessageQueueException("Cannot delete queue.", rc);
|
||||
}
|
||||
|
||||
public void send(Message msg) throws MessageQueueException {
|
||||
int rc = nativeSend(msg.getMessage(), msg.getMessage().length(), msg.getLabel(), msg.getCorrelationId(), msg
|
||||
.getTransactionFlag());
|
||||
if (rc != 0)
|
||||
|
||||
// -------------------------------------------------------
|
||||
// Sending methods
|
||||
// -------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Send a Message, with the given transaction type, and with the
|
||||
* given setting for high priority.
|
||||
**/
|
||||
public void send(Message msg, boolean highPriority, TransactionType t)
|
||||
throws MessageQueueException
|
||||
{
|
||||
int rc= nativeSendBytes(msg.getBody(),
|
||||
msg.getLabel(),
|
||||
msg.getCorrelationId(),
|
||||
t.getValue(),
|
||||
highPriority
|
||||
);
|
||||
if (rc!=0)
|
||||
throw new MessageQueueException("Cannot send.", rc);
|
||||
}
|
||||
|
||||
public void send(String s) throws MessageQueueException {
|
||||
int rc = nativeSend(s, s.length(), "", // empty label
|
||||
"", // empty correlationId
|
||||
0 // outside any transaction
|
||||
);
|
||||
if (rc != 0)
|
||||
|
||||
/**
|
||||
* Send a Message, with the given transaction type.
|
||||
*
|
||||
**/
|
||||
public void send(Message msg, TransactionType t)
|
||||
throws MessageQueueException
|
||||
{
|
||||
send(msg, false, t);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Message, with the given value for high priority.
|
||||
*
|
||||
**/
|
||||
public void send(Message msg, boolean highPriority)
|
||||
throws MessageQueueException
|
||||
{
|
||||
send(msg, highPriority, TransactionType.None);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send a Message on the queue.
|
||||
*
|
||||
**/
|
||||
public void send(Message msg)
|
||||
throws MessageQueueException
|
||||
{
|
||||
send(msg, false, TransactionType.None);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send a string as a Message, using UTF-8 encoding.
|
||||
* The label used will be blank, and the correlationId
|
||||
* will be null (none).
|
||||
*
|
||||
**/
|
||||
public void send(String s)
|
||||
throws MessageQueueException, java.io.UnsupportedEncodingException
|
||||
|
||||
{
|
||||
int rc= nativeSendBytes(s.getBytes("UTF-8"), // bytes of string
|
||||
"", // empty label
|
||||
null, // empty correlationId
|
||||
0, // outside any transaction
|
||||
false // false = not high priority
|
||||
);
|
||||
if (rc!=0)
|
||||
throw new MessageQueueException("Cannot send.", rc);
|
||||
}
|
||||
|
||||
// TODO: add sendMessage() methods for other types: byte[]? object?
|
||||
|
||||
private ionic.Msmq.Message receiveEx(int timeout, int ReadOrPeek) throws MessageQueueException {
|
||||
int rc = nativeReceive(128, timeout, ReadOrPeek);
|
||||
/**
|
||||
* Send a byte array as a Message.
|
||||
* The label used will be blank, and the correlationId
|
||||
* will be null (none).
|
||||
*
|
||||
**/
|
||||
public void send(byte[] b)
|
||||
throws MessageQueueException
|
||||
{
|
||||
int rc= nativeSendBytes(b,
|
||||
"", // empty label
|
||||
null, // empty correlationId
|
||||
0, // outside any transaction
|
||||
false // false = not high priority
|
||||
);
|
||||
if (rc!=0)
|
||||
throw new MessageQueueException("Cannot send.", rc);
|
||||
}
|
||||
|
||||
if (rc != 0)
|
||||
|
||||
// -------------------------------------------------------
|
||||
// Receiving methods
|
||||
// -------------------------------------------------------
|
||||
private ionic.Msmq.Message _internal_receive(int timeout, int ReadOrPeek)
|
||||
throws MessageQueueException
|
||||
{
|
||||
Message msg = new Message();
|
||||
|
||||
int rc = nativeReceiveBytes(msg, timeout, ReadOrPeek);
|
||||
//int rc = nativeReceiveBytes(timeout, ReadOrPeek);
|
||||
|
||||
if (rc!=0)
|
||||
throw new MessageQueueException("Cannot receive.", rc);
|
||||
|
||||
return new Message(_lastMessageRetrieved_MessageString, _lastMessageRetrieved_MessageLabel,
|
||||
_lastMessageRetrieved_CorrelationId, 0);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
public ionic.Msmq.Message receive(int timeout) throws MessageQueueException {
|
||||
return receiveEx(timeout, 1);
|
||||
/**
|
||||
* Poll the queue to receive one message, with the given timeout.
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
* If the timeout expires before a message becomes available,
|
||||
* the method will throw an exception.
|
||||
**/
|
||||
public ionic.Msmq.Message receive(int timeout)
|
||||
throws MessageQueueException
|
||||
{
|
||||
return _internal_receive(timeout, 1);
|
||||
}
|
||||
|
||||
public ionic.Msmq.Message receive() throws MessageQueueException {
|
||||
return receiveEx(0, 1); // infinite timeout
|
||||
|
||||
/**
|
||||
* Poll the queue to receive one message, with an infinite timeout.
|
||||
*
|
||||
**/
|
||||
public ionic.Msmq.Message receive()
|
||||
throws MessageQueueException
|
||||
{
|
||||
return _internal_receive(0,1); // infinite timeout
|
||||
}
|
||||
|
||||
public ionic.Msmq.Message peek() throws MessageQueueException {
|
||||
return receiveEx(0, 0); // infinite timeout
|
||||
/**
|
||||
* Peek at the queue and return a message without dequeueing it.
|
||||
*
|
||||
**/
|
||||
public ionic.Msmq.Message peek()
|
||||
throws MessageQueueException
|
||||
{
|
||||
return _internal_receive(0,0); // infinite timeout
|
||||
}
|
||||
|
||||
public ionic.Msmq.Message peek(int timeout) throws MessageQueueException {
|
||||
return receiveEx(timeout, 0);
|
||||
/**
|
||||
* Peek at the queue and return a message without dequeueing it,
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
* If the timeout expires before a message becomes available,
|
||||
* the method will throw an exception.
|
||||
**/
|
||||
public ionic.Msmq.Message peek(int timeout)
|
||||
throws MessageQueueException
|
||||
{
|
||||
return _internal_receive(timeout,0);
|
||||
}
|
||||
|
||||
public void close() throws MessageQueueException {
|
||||
|
||||
int rc = nativeClose();
|
||||
if (rc != 0)
|
||||
|
||||
|
||||
/**
|
||||
* Close the queue.
|
||||
*
|
||||
**/
|
||||
public void close()
|
||||
throws MessageQueueException
|
||||
{
|
||||
|
||||
int rc=nativeClose();
|
||||
if (rc!=0)
|
||||
throw new MessageQueueException("Cannot close.", rc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------
|
||||
// getters on the Queue properties
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return _label;
|
||||
}
|
||||
|
||||
public String getFormatName() {
|
||||
return _formatName;
|
||||
}
|
||||
/**
|
||||
* Gets the name of the queue.
|
||||
*
|
||||
* @return the name of the queue.
|
||||
*/
|
||||
public String getName(){ return _name; }
|
||||
|
||||
|
||||
/**
|
||||
* Gets the label on the queue.
|
||||
*
|
||||
* @return the label on the queue.
|
||||
*/
|
||||
public String getLabel(){ return _label; }
|
||||
|
||||
|
||||
/**
|
||||
* Gets the formatname on the queue.
|
||||
*
|
||||
* @return the formatname of the queue.
|
||||
*/
|
||||
public String getFormatName(){ return _formatName; }
|
||||
|
||||
|
||||
/**
|
||||
* Gets the transactional setting for the queue.
|
||||
*
|
||||
* @return the transactional setting for the queue.
|
||||
*/
|
||||
public boolean isTransactional(){ return _isTransactional; }
|
||||
|
||||
|
||||
public boolean isTransactional() {
|
||||
return _isTransactional;
|
||||
}
|
||||
|
||||
// --------------------------------------------
|
||||
// native methods
|
||||
private static native int nativeInit();
|
||||
|
||||
private static native int nativeCreateQueue(String queuePath, String queueLabel, int isTransactional);
|
||||
|
||||
private static native int nativeDeleteQueue(String queuePath);
|
||||
|
||||
private native int nativeOpenQueue(String queueString);
|
||||
|
||||
private native int nativeOpenQueueForSend(String queueString);
|
||||
|
||||
private native int nativeOpenQueueForReceive(String queueString);
|
||||
|
||||
private native int nativeReceive(int length, int timeout, int ReadOrPeek);
|
||||
|
||||
private native int nativeSend(String messageString, int length, String label, String correlationString, int transactionFlag);
|
||||
|
||||
private native int nativeSend(String messageString, int length, String label, String correlationId, int transactionFlag);
|
||||
//private native int nativeReceiveBytes(int timeout, int ReadOrPeek);
|
||||
private native int nativeReceiveBytes(Message msg, int timeout, int ReadOrPeek);
|
||||
private native int nativeSendBytes(byte [] messageBytes, String label, byte[] correlationId, int tflag, boolean priority );
|
||||
private native int nativeClose();
|
||||
|
||||
|
||||
// --------------------------------------------
|
||||
// private members
|
||||
int _queueSlot = 0;
|
||||
|
||||
int _queueSlot = 0;
|
||||
String _name;
|
||||
|
||||
String _formatName;
|
||||
|
||||
String _label;
|
||||
|
||||
boolean _isTransactional;
|
||||
|
||||
String _lastMessageRetrieved_MessageString;
|
||||
|
||||
String _lastMessageRetrieved_MessageLabel;
|
||||
|
||||
String _lastMessageRetrieved_CorrelationId;
|
||||
|
||||
// --------------------------------------------
|
||||
// static initializer
|
||||
static {
|
||||
// System.loadLibrary("JNIMSMQ");
|
||||
loadLib();
|
||||
//System.loadLibrary("MsmqJava");
|
||||
loadLib();
|
||||
nativeInit();
|
||||
}
|
||||
|
||||
|
||||
/* Try extracting and loading library from jar */
|
||||
|
||||
|
||||
private static void loadLib() {
|
||||
String dllName = "JNIMSMQ.dll";
|
||||
String dllName = "MsmqJava.dll";
|
||||
String TMP_HOME = System.getProperty("java.io.tmpdir");
|
||||
// TMP_HOME = "d:";
|
||||
String SEPARATOR = System.getProperty("file.separator");
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
//
|
||||
// TransactionType.java
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2006-2010 Dino Chiesa.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This code module is part of MsmqJava, a JNI library that provides
|
||||
// access to MSMQ for Java on Windows.
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// This code is licensed under the Microsoft Public License.
|
||||
// See the file License.txt for the license details.
|
||||
// More info on: http://dotnetzip.codeplex.com
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// last saved (in emacs):
|
||||
// Time-stamp: <2010-March-28 15:43:23>
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// This module provides the various transaction types for MQ.
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
package ionic.Msmq;
|
||||
|
||||
/**
|
||||
* Specifies the transaction type to use when enqueuing messages into a
|
||||
* transactional queue.
|
||||
*
|
||||
*/
|
||||
|
||||
public enum TransactionType {
|
||||
|
||||
// transactionFlag:
|
||||
// MQ_NO_TRANSACTION,
|
||||
// MQ_MTS_TRANSACTION,
|
||||
// MQ_XA_TRANSACTION, or
|
||||
// MQ_SINGLE_MESSAGE
|
||||
// see mq.h for details...
|
||||
|
||||
|
||||
/**
|
||||
* <p>Specifies that the call is not part of a transaction. This
|
||||
* transaction type cannot be used to send a message to a transactional
|
||||
* queue.</p>
|
||||
*
|
||||
* <p>Equivalent to MSMQ's MQ_NO_TRANSACTION.</p>
|
||||
*
|
||||
*/
|
||||
None(0),
|
||||
|
||||
/**
|
||||
* <p>If the application is
|
||||
* running in the context of a COM+ (Component Services)
|
||||
* transaction, the message is sent within the current COM+
|
||||
* transaction. Otherwise, the message is sent outside of a
|
||||
* transaction.</p>
|
||||
*
|
||||
* <p>Equivalent to MSMQ's MQ_MTS_TRANSACTION.</p>
|
||||
*
|
||||
*/
|
||||
MTS(1),
|
||||
|
||||
/**
|
||||
* Specifies that the call is part of an externally coordinated,
|
||||
* XA-compliant transaction.
|
||||
*
|
||||
*/
|
||||
XA(2),
|
||||
|
||||
/**
|
||||
* Specifies that the message is sent in a single-message
|
||||
* transaction. Messages sent in a single-message transaction must
|
||||
* be sent to a transactional queue.
|
||||
*
|
||||
* <p>Equivalent to MSMQ's MQ_SINGLE_MESSAGE.</p>
|
||||
*
|
||||
*/
|
||||
SINGLE_MESSAGE(3);
|
||||
|
||||
int _transactionFlag;
|
||||
|
||||
TransactionType(int value)
|
||||
{
|
||||
_transactionFlag = value;
|
||||
}
|
||||
|
||||
public int getValue() { return _transactionFlag; }
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
package org.talend.msmq;
|
||||
|
||||
public class CharacterSetToolkit {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
String str = "abc";
|
||||
str = toUnicode(str, false);
|
||||
System.out.println(str);
|
||||
str ="\u4F60\u597D";
|
||||
str = fromUnicode(str);
|
||||
System.out.println(str);
|
||||
}
|
||||
|
||||
public CharacterSetToolkit() {
|
||||
}
|
||||
|
||||
private static final char[] hexDigit = {
|
||||
'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
|
||||
};
|
||||
|
||||
private static char toHex(int nibble) {
|
||||
return hexDigit[(nibble & 0xF)];
|
||||
}
|
||||
|
||||
/*
|
||||
* Converts unicodes to encoded \uxxxx and escapes
|
||||
* special characters with a preceding slash
|
||||
*/
|
||||
public static String toUnicode(String theString, boolean escapeSpace) {
|
||||
int len = theString.length();
|
||||
int bufLen = len * 2;
|
||||
if (bufLen < 0) {
|
||||
bufLen = Integer.MAX_VALUE;
|
||||
}
|
||||
StringBuffer outBuffer = new StringBuffer(bufLen);
|
||||
|
||||
for(int x=0; x<len; x++) {
|
||||
char aChar = theString.charAt(x);
|
||||
// Handle common case first, selecting largest block that
|
||||
// avoids the specials below
|
||||
if ((aChar > 61) && (aChar < 127)) {
|
||||
if (aChar == '\\') {
|
||||
outBuffer.append('\\'); outBuffer.append('\\');
|
||||
continue;
|
||||
}
|
||||
outBuffer.append(aChar);
|
||||
continue;
|
||||
}
|
||||
switch(aChar) {
|
||||
case ' ':
|
||||
if (x == 0 || escapeSpace)
|
||||
outBuffer.append('\\');
|
||||
outBuffer.append(' ');
|
||||
break;
|
||||
case '\t':outBuffer.append('\\'); outBuffer.append('t');
|
||||
break;
|
||||
case '\n':outBuffer.append('\\'); outBuffer.append('n');
|
||||
break;
|
||||
case '\r':outBuffer.append('\\'); outBuffer.append('r');
|
||||
break;
|
||||
case '\f':outBuffer.append('\\'); outBuffer.append('f');
|
||||
break;
|
||||
case '=': // Fall through
|
||||
case ':': // Fall through
|
||||
case '#': // Fall through
|
||||
case '!':
|
||||
outBuffer.append('\\'); outBuffer.append(aChar);
|
||||
break;
|
||||
default:
|
||||
if ((aChar < 0x0020) || (aChar > 0x007e)) {
|
||||
outBuffer.append('\\');
|
||||
outBuffer.append('u');
|
||||
outBuffer.append(toHex((aChar >> 12) & 0xF));
|
||||
outBuffer.append(toHex((aChar >> 8) & 0xF));
|
||||
outBuffer.append(toHex((aChar >> 4) & 0xF));
|
||||
outBuffer.append(toHex( aChar & 0xF));
|
||||
} else {
|
||||
outBuffer.append(aChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
return outBuffer.toString();
|
||||
}
|
||||
|
||||
public static String fromUnicode(String str) {
|
||||
return fromUnicode(str.toCharArray(), 0, str.length(), new char[1024]);
|
||||
}
|
||||
/*
|
||||
* Converts encoded \uxxxx to unicode chars
|
||||
* and changes special saved chars to their original forms
|
||||
*/
|
||||
public static String fromUnicode(char[] in, int off, int len, char[] convtBuf) {
|
||||
if (convtBuf.length < len) {
|
||||
int newLen = len * 2;
|
||||
if (newLen < 0) {
|
||||
newLen = Integer.MAX_VALUE;
|
||||
}
|
||||
convtBuf = new char[newLen];
|
||||
}
|
||||
char aChar;
|
||||
char[] out = convtBuf;
|
||||
int outLen = 0;
|
||||
int end = off + len;
|
||||
|
||||
while (off < end) {
|
||||
aChar = in[off++];
|
||||
if (aChar == '\\') {
|
||||
aChar = in[off++];
|
||||
if (aChar == 'u') {
|
||||
// Read the xxxx
|
||||
int value = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
aChar = in[off++];
|
||||
switch (aChar) {
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
value = (value << 4) + aChar - '0';
|
||||
break;
|
||||
case 'a':
|
||||
case 'b':
|
||||
case 'c':
|
||||
case 'd':
|
||||
case 'e':
|
||||
case 'f':
|
||||
value = (value << 4) + 10 + aChar - 'a';
|
||||
break;
|
||||
case 'A':
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'D':
|
||||
case 'E':
|
||||
case 'F':
|
||||
value = (value << 4) + 10 + aChar - 'A';
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException(
|
||||
"Malformed \\uxxxx encoding.");
|
||||
}
|
||||
}
|
||||
out[outLen++] = (char) value;
|
||||
} else {
|
||||
if (aChar == 't') {
|
||||
aChar = '\t';
|
||||
} else if (aChar == 'r') {
|
||||
aChar = '\r';
|
||||
} else if (aChar == 'n') {
|
||||
aChar = '\n';
|
||||
} else if (aChar == 'f') {
|
||||
aChar = '\f';
|
||||
}
|
||||
out[outLen++] = aChar;
|
||||
}
|
||||
} else {
|
||||
out[outLen++] = (char) aChar;
|
||||
}
|
||||
}
|
||||
return new String(out, 0, outLen);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
package org.talend.msmq;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import ionic.Msmq.Message;
|
||||
import ionic.Msmq.MessageQueueException;
|
||||
import ionic.Msmq.Queue;
|
||||
import ionic.Msmq.TransactionType;
|
||||
|
||||
public class MsmqUtil {
|
||||
|
||||
@@ -35,7 +38,7 @@ public class MsmqUtil {
|
||||
msgu.setQueue("ytao4");
|
||||
msgu.createIfNotExists(true);
|
||||
msgu.open();
|
||||
String str = "ÊǵÄabc";
|
||||
String str = "<EFBFBD>ǵ<EFBFBD>abc";
|
||||
// str = CharacterSetToolkit.toUnicode(str, true);
|
||||
// System.out.println(str);
|
||||
msgu.setMsg(str);
|
||||
@@ -54,11 +57,13 @@ public class MsmqUtil {
|
||||
checkOpen();
|
||||
System.out.println("peek");
|
||||
Message msg = msmqHandle.peek(2000); // timeout= 2000 ms
|
||||
System.out.println(" ==> message: " + msg.getMessage());
|
||||
System.out.println(" ==> message: " + msg.getBodyAsString());
|
||||
System.out.println(" label: " + msg.getLabel());
|
||||
} catch (MessageQueueException ex1) {
|
||||
System.out.println("Peek failure: " + ex1);
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// close an open queue
|
||||
@@ -109,11 +114,13 @@ public class MsmqUtil {
|
||||
int transactionFlag = 0; // 0 = NO TRANSACTION, 1= MTS, 2= XA, 3= SINGLE_MESSAGE
|
||||
String mLabel = "inserted by " + this.getClass().getName() + ".java";
|
||||
String correlationID = "L:none";
|
||||
Message msg = new Message(msgContent, mLabel, correlationID, transactionFlag);
|
||||
Message msg = new Message(msgContent, mLabel, correlationID);
|
||||
msmqHandle.send(msg);
|
||||
} catch (MessageQueueException ex1) {
|
||||
System.out.println("Send failure: " + ex1);
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public String receive() {
|
||||
@@ -123,10 +130,12 @@ public class MsmqUtil {
|
||||
Message msg = msmqHandle.receive(2000); // timeout= 2000 ms
|
||||
// System.out.println(" ==> message: " + msg.getMessage());
|
||||
// System.out.println(" label: " + msg.getLabel());
|
||||
return CharacterSetToolkit.fromUnicode(msg.getMessage());
|
||||
return msg.getBodyAsString();
|
||||
} catch (MessageQueueException ex1) {
|
||||
System.out.println("Receive failure: " + ex1);
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -175,7 +184,7 @@ public class MsmqUtil {
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msgContent = CharacterSetToolkit.toUnicode(msg, true);
|
||||
this.msgContent = msg;
|
||||
}
|
||||
|
||||
public void createIfNotExists(boolean bool) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<pathelement location="lib/httpclient-4.0.1.jar"/>
|
||||
<pathelement location="lib/httpcore-4.0.1.jar"/>
|
||||
<pathelement location="lib/httpmime-4.0.1.jar"/>
|
||||
<pathelement location="lib/javacsv-2.0.jar"/>
|
||||
<pathelement location="lib/talendcsv.jar"/>
|
||||
</path>
|
||||
<target name="init">
|
||||
<mkdir dir="bin"/>
|
||||
|
||||
@@ -1,131 +1,138 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
|
||||
import org.apache.http.*;
|
||||
import org.apache.http.client.methods.*;
|
||||
import org.apache.http.client.utils.*;
|
||||
import org.apache.http.conn.*;
|
||||
import org.apache.http.conn.scheme.*;
|
||||
import org.apache.http.impl.client.*;
|
||||
import org.apache.http.impl.conn.tsccm.*;
|
||||
import org.apache.http.message.*;
|
||||
import org.apache.http.params.*;
|
||||
|
||||
//import java.math.BigInteger;
|
||||
//import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
import java.net.URI;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.csvreader.*;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.HttpVersion;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.utils.URIUtils;
|
||||
import org.apache.http.client.utils.URLEncodedUtils;
|
||||
import org.apache.http.conn.ClientConnectionManager;
|
||||
import org.apache.http.conn.scheme.PlainSocketFactory;
|
||||
import org.apache.http.conn.scheme.Scheme;
|
||||
import org.apache.http.conn.scheme.SchemeRegistry;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.apache.http.params.BasicHttpParams;
|
||||
import org.apache.http.params.HttpParams;
|
||||
import org.apache.http.params.HttpProtocolParams;
|
||||
|
||||
import com.talend.csv.CSVReader;
|
||||
|
||||
public class paloconnection {
|
||||
|
||||
private HttpHost paloTargetHost;
|
||||
private DefaultHttpClient paloHttpClient;
|
||||
|
||||
private String strToken = "";
|
||||
private int iSessionTimeOut=0;
|
||||
private String strUserName = "";
|
||||
private String strUserPW = "";
|
||||
private String strServer = "";
|
||||
private String strPort = "";
|
||||
|
||||
public paloconnection(String strUserName, String strUserPW, String strServer, String strPort) throws paloexception{
|
||||
|
||||
super();
|
||||
this.strUserName = strUserName;
|
||||
this.strUserPW = strUserPW;
|
||||
this.strServer = strServer;
|
||||
this.strPort = strPort;
|
||||
|
||||
initConnection();
|
||||
|
||||
private HttpHost paloTargetHost;
|
||||
|
||||
private DefaultHttpClient paloHttpClient;
|
||||
|
||||
private String strToken = "";
|
||||
|
||||
private int iSessionTimeOut = 0;
|
||||
|
||||
private String strUserName = "";
|
||||
|
||||
private String strUserPW = "";
|
||||
|
||||
private String strServer = "";
|
||||
|
||||
private String strPort = "";
|
||||
|
||||
public paloconnection(String strUserName, String strUserPW, String strServer, String strPort) throws paloexception {
|
||||
|
||||
super();
|
||||
this.strUserName = strUserName;
|
||||
this.strUserPW = strUserPW;
|
||||
this.strServer = strServer;
|
||||
this.strPort = strPort;
|
||||
|
||||
initConnection();
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("user", this.strUserName));
|
||||
qparams.add(new BasicNameValuePair("password", palohelpers.getMD5(this.strUserPW)));
|
||||
|
||||
try{
|
||||
HttpEntity entity = sendToServer(qparams, "/server/login");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.readRecord();
|
||||
this.strToken = csv.get(0);
|
||||
this.iSessionTimeOut = Integer.valueOf(csv.get(1));
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public String getPaloToken(){
|
||||
return strToken;
|
||||
}
|
||||
|
||||
public int getSessionTimeout(){
|
||||
return iSessionTimeOut;
|
||||
}
|
||||
|
||||
public palodatabases getDatabases()throws paloexception {
|
||||
return new palodatabases(this);
|
||||
}
|
||||
|
||||
// Load the Server
|
||||
public void load() throws paloexception{
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.strToken));
|
||||
sendToServerSingleRC(qparams, "/server/load");
|
||||
}
|
||||
|
||||
// Saves the Server
|
||||
public void save() throws paloexception{
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.strToken));
|
||||
sendToServerSingleRC(qparams, "/server/save");
|
||||
}
|
||||
|
||||
// Shutdowns the Server
|
||||
public void shutdown() throws paloexception{
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.strToken));
|
||||
sendToServerSingleRC(qparams, "/server/shutdown");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Logouts the current palo User
|
||||
public void logout() throws paloexception{
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.strToken));
|
||||
|
||||
try{
|
||||
HttpEntity entity = sendToServer(qparams, "/server/logout");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
|
||||
//CsvReader csv = new CsvReader(sendToServer(qparams, "/server/logout").getContent(), Charset.defaultCharset());
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.readRecord();
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
//paloHttpClient.getConnectionManager().shutdown();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
try {
|
||||
HttpEntity entity = sendToServer(qparams, "/server/login");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
csv.readNext();
|
||||
this.strToken = csv.get(0);
|
||||
this.iSessionTimeOut = Integer.valueOf(csv.get(1));
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void initConnection(){
|
||||
|
||||
pingPaloServer();
|
||||
|
||||
paloTargetHost = new HttpHost(strServer, Integer.valueOf(strPort), "http");
|
||||
}
|
||||
|
||||
public String getPaloToken() {
|
||||
return strToken;
|
||||
}
|
||||
|
||||
public int getSessionTimeout() {
|
||||
return iSessionTimeOut;
|
||||
}
|
||||
|
||||
public palodatabases getDatabases() throws paloexception {
|
||||
return new palodatabases(this);
|
||||
}
|
||||
|
||||
// Load the Server
|
||||
public void load() throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.strToken));
|
||||
sendToServerSingleRC(qparams, "/server/load");
|
||||
}
|
||||
|
||||
// Saves the Server
|
||||
public void save() throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.strToken));
|
||||
sendToServerSingleRC(qparams, "/server/save");
|
||||
}
|
||||
|
||||
// Shutdowns the Server
|
||||
public void shutdown() throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.strToken));
|
||||
sendToServerSingleRC(qparams, "/server/shutdown");
|
||||
}
|
||||
|
||||
// Logouts the current palo User
|
||||
public void logout() throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.strToken));
|
||||
|
||||
try {
|
||||
HttpEntity entity = sendToServer(qparams, "/server/logout");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
|
||||
// CsvReader csv = new CsvReader(sendToServer(qparams, "/server/logout").getContent(),
|
||||
// Charset.defaultCharset());
|
||||
csv.setQuoteChar('"');
|
||||
csv.readNext();
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
// paloHttpClient.getConnectionManager().shutdown();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void initConnection() {
|
||||
|
||||
pingPaloServer();
|
||||
|
||||
paloTargetHost = new HttpHost(strServer, Integer.valueOf(strPort), "http");
|
||||
SchemeRegistry supportedSchemes = new SchemeRegistry();
|
||||
supportedSchemes.register(new Scheme("http",PlainSocketFactory.getSocketFactory(), Integer.valueOf(strPort)));
|
||||
supportedSchemes.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), Integer.valueOf(strPort)));
|
||||
|
||||
// prepare parameters
|
||||
HttpParams params = new BasicHttpParams();
|
||||
@@ -133,134 +140,129 @@ public class paloconnection {
|
||||
HttpProtocolParams.setContentCharset(params, "UTF-8");
|
||||
HttpProtocolParams.setUseExpectContinue(params, true);
|
||||
|
||||
ClientConnectionManager connMgr = new ThreadSafeClientConnManager(params,supportedSchemes);
|
||||
ClientConnectionManager connMgr = new ThreadSafeClientConnManager(params, supportedSchemes);
|
||||
paloHttpClient = new DefaultHttpClient(connMgr, params);
|
||||
}
|
||||
|
||||
private void pingPaloServer(){
|
||||
try{
|
||||
//int timeOut = 1000; // I recommend 3 seconds at least int timeout = 3000; / / Ich empfehle 3 Sekunden mindestens
|
||||
//boolean status = InetAddress.getByName(strServer).isReachable(timeOut);
|
||||
Socket s = new Socket(strServer, Integer.valueOf(strPort));
|
||||
s.close();
|
||||
}catch(Exception e){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Retrieves only true or false based on the given connection
|
||||
public boolean sendToServerSingleRC(List<NameValuePair> qparams, String strAPIUrl) throws paloexception{
|
||||
try{
|
||||
HttpEntity entity = sendToServer(qparams, strAPIUrl);
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
//CsvReader csv = new CsvReader(sendToServer(qparams, strAPIUrl).getContent(), Charset.defaultCharset());
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.readRecord();
|
||||
boolean bStatus = Boolean.getBoolean(csv.get(0));
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
return bStatus;
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public HttpEntity sendToServer(List<NameValuePair> qparams, String strAPIUrl) throws paloexception{
|
||||
|
||||
try{
|
||||
URI uri = URIUtils.createURI("http", strServer, Integer.valueOf(strPort), strAPIUrl, URLEncodedUtils.format(qparams, "UTF-8"), null);
|
||||
HttpGet req = new HttpGet(uri);
|
||||
|
||||
// System.out.println(req.getURI());
|
||||
|
||||
// Send to Server
|
||||
HttpResponse rsp = paloHttpClient.execute(paloTargetHost, req);
|
||||
HttpEntity entity = rsp.getEntity();
|
||||
|
||||
///System.out.println(rsp.getStatusLine().getStatusCode());
|
||||
|
||||
if(rsp.getStatusLine().getStatusCode()!=200){
|
||||
// Error had been occured
|
||||
// Close Connection and thend raise paloexception error
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.readRecord();
|
||||
paloexception plX = new paloexception(csv.get(0),csv.get(1),csv.get(2));
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
//req.abort();
|
||||
//paloHttpClient.getConnectionManager().shutdown();
|
||||
throw(plX);
|
||||
}else{
|
||||
return entity;
|
||||
}
|
||||
|
||||
}catch(Exception e){
|
||||
//if(paloHttpClient!=null)paloHttpClient.getConnectionManager().shutdown();
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getRulefunctions()throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", getPaloToken()));
|
||||
try{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
HttpEntity entity = sendToServer(qparams, "/rule/functions");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
while(csv.readRecord()){
|
||||
sb.append(csv.get(0));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
return sb.toString();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getVersion() throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("", ""));
|
||||
try{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
HttpEntity entity = sendToServer(qparams, "/server/info");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
while(csv.readRecord()){
|
||||
sb.append(csv.get(0));
|
||||
sb.append(".");
|
||||
sb.append(csv.get(1));
|
||||
sb.append(".");
|
||||
sb.append(csv.get(2));
|
||||
sb.append(".");
|
||||
sb.append(csv.get(3));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
return sb.toString();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
if(paloHttpClient!=null)paloHttpClient.getConnectionManager().shutdown();
|
||||
} catch(Exception e) {
|
||||
}
|
||||
finally {
|
||||
super.finalize();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void pingPaloServer() {
|
||||
try {
|
||||
// int timeOut = 1000; // I recommend 3 seconds at least int timeout = 3000; / / Ich empfehle 3 Sekunden
|
||||
// mindestens
|
||||
// boolean status = InetAddress.getByName(strServer).isReachable(timeOut);
|
||||
Socket s = new Socket(strServer, Integer.valueOf(strPort));
|
||||
s.close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieves only true or false based on the given connection
|
||||
public boolean sendToServerSingleRC(List<NameValuePair> qparams, String strAPIUrl) throws paloexception {
|
||||
try {
|
||||
HttpEntity entity = sendToServer(qparams, strAPIUrl);
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
// CsvReader csv = new CsvReader(sendToServer(qparams, strAPIUrl).getContent(), Charset.defaultCharset());
|
||||
csv.setQuoteChar('"');
|
||||
csv.readNext();
|
||||
boolean bStatus = Boolean.getBoolean(csv.get(0));
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
return bStatus;
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public HttpEntity sendToServer(List<NameValuePair> qparams, String strAPIUrl) throws paloexception {
|
||||
|
||||
try {
|
||||
URI uri = URIUtils.createURI("http", strServer, Integer.valueOf(strPort), strAPIUrl,
|
||||
URLEncodedUtils.format(qparams, "UTF-8"), null);
|
||||
HttpGet req = new HttpGet(uri);
|
||||
|
||||
// System.out.println(req.getURI());
|
||||
|
||||
// Send to Server
|
||||
HttpResponse rsp = paloHttpClient.execute(paloTargetHost, req);
|
||||
HttpEntity entity = rsp.getEntity();
|
||||
|
||||
// /System.out.println(rsp.getStatusLine().getStatusCode());
|
||||
|
||||
if (rsp.getStatusLine().getStatusCode() != 200) {
|
||||
// Error had been occured
|
||||
// Close Connection and thend raise paloexception error
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
csv.readNext();
|
||||
paloexception plX = new paloexception(csv.get(0), csv.get(1), csv.get(2));
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
// req.abort();
|
||||
// paloHttpClient.getConnectionManager().shutdown();
|
||||
throw (plX);
|
||||
} else {
|
||||
return entity;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
// if(paloHttpClient!=null)paloHttpClient.getConnectionManager().shutdown();
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public String getRulefunctions() throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", getPaloToken()));
|
||||
try {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
HttpEntity entity = sendToServer(qparams, "/rule/functions");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
while (csv.readNext()) {
|
||||
sb.append(csv.get(0));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
return sb.toString();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public String getVersion() throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("", ""));
|
||||
try {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
HttpEntity entity = sendToServer(qparams, "/server/info");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
while (csv.readNext()) {
|
||||
sb.append(csv.get(0));
|
||||
sb.append(".");
|
||||
sb.append(csv.get(1));
|
||||
sb.append(".");
|
||||
sb.append(csv.get(2));
|
||||
sb.append(".");
|
||||
sb.append(csv.get(3));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
return sb.toString();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
if (paloHttpClient != null) {
|
||||
paloHttpClient.getConnectionManager().shutdown();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} finally {
|
||||
super.finalize();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -8,216 +7,219 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.csvreader.CsvReader;
|
||||
import com.talend.csv.CSVReader;
|
||||
|
||||
public class palocube {
|
||||
|
||||
// OK
|
||||
// OK
|
||||
|
||||
|
||||
//@SuppressWarnings("unused")
|
||||
//private ArrayList<palocubelock> paloCubelocks = new ArrayList<palocubelock>();
|
||||
|
||||
private paloconnection plConn;
|
||||
private long lDatabaseId;
|
||||
// @SuppressWarnings("unused")
|
||||
// private ArrayList<palocubelock> paloCubelocks = new ArrayList<palocubelock>();
|
||||
|
||||
private int iCubeId;
|
||||
private String strCubeName;
|
||||
private int iNumberOfDimensions;
|
||||
private int[] iArrDimensionsIdentifier;
|
||||
private long iNumberOfCells;
|
||||
private long lNumberOfFilledCells;
|
||||
private int iCubeStatus;
|
||||
private int iCubeType;
|
||||
@SuppressWarnings("unused")
|
||||
private int iCubeToken;
|
||||
|
||||
public palocube(paloconnection plConn, long lDatabaseId,
|
||||
int iCubeId, //0 cube identifier Identifier of the cube
|
||||
String strCubeName, //1 name_cube string Name of the cube
|
||||
int iNumberOfDimensions, //2 number_dimensions integer Number of dimensions
|
||||
int[] iArrDimensionsIdentifier, //3 dimensions integer Comma separate list of dimension identifiers
|
||||
long lNumberOfCells, //4 number_cells integer Total number of cells
|
||||
long lNumberOfFilledCells,//5 number_filled_cells integer Number of filled numeric base cells plus number of filled string cells
|
||||
int iCubeStatus, //6 status integer Status of cube (0=unloaded, 1=loaded and 2=changed)
|
||||
int iCubeType, //7 type integer Type of cube (0=normal, 1=system, 2=attribute, 3=user info)
|
||||
int strCubeToken//8 cube_token integer The cube token of the cube
|
||||
){
|
||||
super();
|
||||
|
||||
this.plConn = plConn;
|
||||
this.lDatabaseId=lDatabaseId;
|
||||
|
||||
this.iCubeId=iCubeId;
|
||||
this.strCubeName=strCubeName;
|
||||
this.iNumberOfDimensions=iNumberOfDimensions;
|
||||
this.iArrDimensionsIdentifier=iArrDimensionsIdentifier;
|
||||
this.iNumberOfCells=lNumberOfCells;
|
||||
this.lNumberOfFilledCells=lNumberOfFilledCells;
|
||||
this.iCubeStatus=iCubeStatus;
|
||||
this.iCubeType=iCubeType;
|
||||
this.iCubeToken=strCubeToken;
|
||||
}
|
||||
private paloconnection plConn;
|
||||
|
||||
public String getName(){
|
||||
return strCubeName;
|
||||
}
|
||||
private long lDatabaseId;
|
||||
|
||||
public String getDatabaseName(){
|
||||
return "";//strDatabaseName;
|
||||
}
|
||||
|
||||
|
||||
public void rename(String strCubeNewName) throws paloexception{
|
||||
if(null!=strCubeNewName && strCubeNewName.length()>0 && !strCubeName.equals(strCubeNewName)){
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(iCubeId)));
|
||||
qparams.add(new BasicNameValuePair("new_name", strCubeNewName));
|
||||
|
||||
try{
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/cube/rename");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
//CsvReader csv = new CsvReader(this.plConn.sendToServer(qparams, "/cube/rename").getContent(), Charset.defaultCharset());
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.readRecord();
|
||||
this.strCubeName = csv.get(1);
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getCubeId(){
|
||||
return iCubeId;
|
||||
}
|
||||
public int getNumberOfDimensions(){
|
||||
return iNumberOfDimensions;
|
||||
}
|
||||
public long getNumberOfCells(){
|
||||
return iNumberOfCells;
|
||||
}
|
||||
public long getNumberOfFilledCells(){
|
||||
return lNumberOfFilledCells;
|
||||
}
|
||||
|
||||
public int getCubeStatus(){
|
||||
return iCubeStatus;
|
||||
}
|
||||
|
||||
public int getCubeType(){
|
||||
return iCubeType;
|
||||
}
|
||||
|
||||
|
||||
public void save()throws paloexception{
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(this.iCubeId)));
|
||||
plConn.sendToServerSingleRC(qparams, "/cube/save");
|
||||
}
|
||||
private int iCubeId;
|
||||
|
||||
public void load() throws paloexception{
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(this.iCubeId)));
|
||||
plConn.sendToServerSingleRC(qparams, "/cube/load");
|
||||
}
|
||||
private String strCubeName;
|
||||
|
||||
public void unload() throws paloexception{
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(this.iCubeId)));
|
||||
plConn.sendToServerSingleRC(qparams, "/cube/unload");
|
||||
}
|
||||
|
||||
public void refreshCubeInfo() throws paloexception{
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(iCubeId)));
|
||||
try{
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/cube/info");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.readRecord();
|
||||
private int iNumberOfDimensions;
|
||||
|
||||
this.iCubeId = palohelpers.StringToInt(csv.get(0));
|
||||
this.strCubeName = csv.get(1);
|
||||
this.iNumberOfDimensions=palohelpers.StringToInt(csv.get(2));
|
||||
this.iArrDimensionsIdentifier=palohelpers.StringToIntArray(csv.get(3), palohelpers.StringToInt(csv.get(2)));
|
||||
this.iNumberOfCells=palohelpers.StringToLong(csv.get(4));
|
||||
this.lNumberOfFilledCells=palohelpers.StringToLong(csv.get(5));
|
||||
this.iCubeStatus=palohelpers.StringToInt(csv.get(6));
|
||||
this.iCubeType=palohelpers.StringToInt(csv.get(7));
|
||||
this.iCubeToken=palohelpers.StringToInt(csv.get(8));
|
||||
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void clear() throws paloexception{
|
||||
clear(null);
|
||||
}
|
||||
|
||||
public void clear(String strArrArea) throws paloexception{
|
||||
private int[] iArrDimensionsIdentifier;
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(iCubeId)));
|
||||
|
||||
if(strArrArea==null){
|
||||
qparams.add(new BasicNameValuePair("complete", "1"));
|
||||
}else{
|
||||
//qparams.add(new BasicNameValuePair("complete", "0"));
|
||||
qparams.add(new BasicNameValuePair("area", strArrArea));
|
||||
}
|
||||
|
||||
|
||||
try{
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/cube/clear");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.readRecord();
|
||||
private long iNumberOfCells;
|
||||
|
||||
this.iCubeId = palohelpers.StringToInt(csv.get(0));
|
||||
this.strCubeName = csv.get(1);
|
||||
this.iNumberOfDimensions=palohelpers.StringToInt(csv.get(2));
|
||||
this.iArrDimensionsIdentifier=palohelpers.StringToIntArray(csv.get(3), palohelpers.StringToInt(csv.get(2)));
|
||||
this.iNumberOfCells=palohelpers.StringToLong(csv.get(4));
|
||||
this.lNumberOfFilledCells=palohelpers.StringToLong(csv.get(5));
|
||||
this.iCubeStatus=palohelpers.StringToInt(csv.get(6));
|
||||
this.iCubeType=palohelpers.StringToInt(csv.get(7));
|
||||
this.iCubeToken=palohelpers.StringToInt(csv.get(8));
|
||||
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public palorules getCubeRules() throws paloexception {
|
||||
return new palorules(this.plConn, this.lDatabaseId, this.iCubeId);
|
||||
}
|
||||
private long lNumberOfFilledCells;
|
||||
|
||||
public palodimensions getDimensions() throws paloexception {
|
||||
return new palodimensions(this.plConn, this.lDatabaseId, this.iCubeType, this.iArrDimensionsIdentifier);
|
||||
}
|
||||
|
||||
private int iCubeStatus;
|
||||
|
||||
private int iCubeType;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int iCubeToken;
|
||||
|
||||
public palocube(paloconnection plConn, long lDatabaseId, int iCubeId, // 0 cube identifier Identifier of the cube
|
||||
String strCubeName, // 1 name_cube string Name of the cube
|
||||
int iNumberOfDimensions, // 2 number_dimensions integer Number of dimensions
|
||||
int[] iArrDimensionsIdentifier, // 3 dimensions integer Comma separate list of dimension identifiers
|
||||
long lNumberOfCells, // 4 number_cells integer Total number of cells
|
||||
long lNumberOfFilledCells,// 5 number_filled_cells integer Number of filled numeric base cells plus number
|
||||
// of filled string cells
|
||||
int iCubeStatus, // 6 status integer Status of cube (0=unloaded, 1=loaded and 2=changed)
|
||||
int iCubeType, // 7 type integer Type of cube (0=normal, 1=system, 2=attribute, 3=user info)
|
||||
int strCubeToken// 8 cube_token integer The cube token of the cube
|
||||
) {
|
||||
super();
|
||||
|
||||
this.plConn = plConn;
|
||||
this.lDatabaseId = lDatabaseId;
|
||||
|
||||
this.iCubeId = iCubeId;
|
||||
this.strCubeName = strCubeName;
|
||||
this.iNumberOfDimensions = iNumberOfDimensions;
|
||||
this.iArrDimensionsIdentifier = iArrDimensionsIdentifier;
|
||||
this.iNumberOfCells = lNumberOfCells;
|
||||
this.lNumberOfFilledCells = lNumberOfFilledCells;
|
||||
this.iCubeStatus = iCubeStatus;
|
||||
this.iCubeType = iCubeType;
|
||||
this.iCubeToken = strCubeToken;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return strCubeName;
|
||||
}
|
||||
|
||||
public String getDatabaseName() {
|
||||
return "";// strDatabaseName;
|
||||
}
|
||||
|
||||
public void rename(String strCubeNewName) throws paloexception {
|
||||
if (null != strCubeNewName && strCubeNewName.length() > 0 && !strCubeName.equals(strCubeNewName)) {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(iCubeId)));
|
||||
qparams.add(new BasicNameValuePair("new_name", strCubeNewName));
|
||||
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/cube/rename");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
csv.readNext();
|
||||
this.strCubeName = csv.get(1);
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getCubeId() {
|
||||
return iCubeId;
|
||||
}
|
||||
|
||||
public int getNumberOfDimensions() {
|
||||
return iNumberOfDimensions;
|
||||
}
|
||||
|
||||
public long getNumberOfCells() {
|
||||
return iNumberOfCells;
|
||||
}
|
||||
|
||||
public long getNumberOfFilledCells() {
|
||||
return lNumberOfFilledCells;
|
||||
}
|
||||
|
||||
public int getCubeStatus() {
|
||||
return iCubeStatus;
|
||||
}
|
||||
|
||||
public int getCubeType() {
|
||||
return iCubeType;
|
||||
}
|
||||
|
||||
public void save() throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(this.iCubeId)));
|
||||
plConn.sendToServerSingleRC(qparams, "/cube/save");
|
||||
}
|
||||
|
||||
public void load() throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(this.iCubeId)));
|
||||
plConn.sendToServerSingleRC(qparams, "/cube/load");
|
||||
}
|
||||
|
||||
public void unload() throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(this.iCubeId)));
|
||||
plConn.sendToServerSingleRC(qparams, "/cube/unload");
|
||||
}
|
||||
|
||||
public void refreshCubeInfo() throws paloexception {
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(iCubeId)));
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/cube/info");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
csv.readNext();
|
||||
|
||||
this.iCubeId = palohelpers.StringToInt(csv.get(0));
|
||||
this.strCubeName = csv.get(1);
|
||||
this.iNumberOfDimensions = palohelpers.StringToInt(csv.get(2));
|
||||
this.iArrDimensionsIdentifier = palohelpers.StringToIntArray(csv.get(3), palohelpers.StringToInt(csv.get(2)));
|
||||
this.iNumberOfCells = palohelpers.StringToLong(csv.get(4));
|
||||
this.lNumberOfFilledCells = palohelpers.StringToLong(csv.get(5));
|
||||
this.iCubeStatus = palohelpers.StringToInt(csv.get(6));
|
||||
this.iCubeType = palohelpers.StringToInt(csv.get(7));
|
||||
this.iCubeToken = palohelpers.StringToInt(csv.get(8));
|
||||
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void clear() throws paloexception {
|
||||
clear(null);
|
||||
}
|
||||
|
||||
public void clear(String strArrArea) throws paloexception {
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(iCubeId)));
|
||||
|
||||
if (strArrArea == null) {
|
||||
qparams.add(new BasicNameValuePair("complete", "1"));
|
||||
} else {
|
||||
// qparams.add(new BasicNameValuePair("complete", "0"));
|
||||
qparams.add(new BasicNameValuePair("area", strArrArea));
|
||||
}
|
||||
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/cube/clear");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
csv.readNext();
|
||||
|
||||
this.iCubeId = palohelpers.StringToInt(csv.get(0));
|
||||
this.strCubeName = csv.get(1);
|
||||
this.iNumberOfDimensions = palohelpers.StringToInt(csv.get(2));
|
||||
this.iArrDimensionsIdentifier = palohelpers.StringToIntArray(csv.get(3), palohelpers.StringToInt(csv.get(2)));
|
||||
this.iNumberOfCells = palohelpers.StringToLong(csv.get(4));
|
||||
this.lNumberOfFilledCells = palohelpers.StringToLong(csv.get(5));
|
||||
this.iCubeStatus = palohelpers.StringToInt(csv.get(6));
|
||||
this.iCubeType = palohelpers.StringToInt(csv.get(7));
|
||||
this.iCubeToken = palohelpers.StringToInt(csv.get(8));
|
||||
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public palorules getCubeRules() throws paloexception {
|
||||
return new palorules(this.plConn, this.lDatabaseId, this.iCubeId);
|
||||
}
|
||||
|
||||
public palodimensions getDimensions() throws paloexception {
|
||||
return new palodimensions(this.plConn, this.lDatabaseId, this.iCubeType, this.iArrDimensionsIdentifier);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -8,260 +7,248 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.csvreader.CsvReader;
|
||||
import com.talend.csv.CSVReader;
|
||||
|
||||
public class palocubes {
|
||||
|
||||
|
||||
public static final int CUBE_NORMAL = 0;
|
||||
public static final int CUBE_SYSTEM= 1;
|
||||
public static final int CUBE_ATTRIBUT = 2;
|
||||
public static final int CUBE_USER_INFO = 3;
|
||||
public static final int CUBE_UNKNOWN = -1;
|
||||
|
||||
public static final int CUBE_STATUS_UNLOADED = 0;
|
||||
public static final int CUBE_STATUS_LOADED = 1;
|
||||
public static final int CUBE_STATUS_CHANGED = 2;
|
||||
public static final int CUBE_STATUS_UNKNOWN = -1;
|
||||
|
||||
private paloconnection plConn;
|
||||
private palodatabase plDB;
|
||||
|
||||
private ArrayList<palocube> paloCubes = new ArrayList<palocube>();
|
||||
|
||||
public palocubes(paloconnection plConn, palodatabase plDB, int iCubeType) throws paloexception{
|
||||
|
||||
super();
|
||||
|
||||
this.plConn = plConn;
|
||||
this.plDB = plDB;
|
||||
|
||||
public static final int CUBE_NORMAL = 0;
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.plDB.getDatabaseId())));
|
||||
public static final int CUBE_SYSTEM = 1;
|
||||
|
||||
|
||||
switch(iCubeType){
|
||||
case CUBE_NORMAL:
|
||||
qparams.add(new BasicNameValuePair("show_info","0"));
|
||||
qparams.add(new BasicNameValuePair("show_normal","1"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","0"));
|
||||
qparams.add(new BasicNameValuePair("show_system","0"));
|
||||
break;
|
||||
case CUBE_SYSTEM:
|
||||
qparams.add(new BasicNameValuePair("show_info","0"));
|
||||
qparams.add(new BasicNameValuePair("show_normal","0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","0"));
|
||||
qparams.add(new BasicNameValuePair("show_system","1"));
|
||||
break;
|
||||
case CUBE_ATTRIBUT:
|
||||
qparams.add(new BasicNameValuePair("show_info","0"));
|
||||
qparams.add(new BasicNameValuePair("show_normal","0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","1"));
|
||||
qparams.add(new BasicNameValuePair("show_system","0"));
|
||||
break;
|
||||
case CUBE_USER_INFO:
|
||||
qparams.add(new BasicNameValuePair("show_info","1"));
|
||||
qparams.add(new BasicNameValuePair("show_normal","0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","0"));
|
||||
qparams.add(new BasicNameValuePair("show_system","0"));
|
||||
break;
|
||||
case CUBE_UNKNOWN:
|
||||
qparams.add(new BasicNameValuePair("show_info","1"));
|
||||
qparams.add(new BasicNameValuePair("show_normal","1"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","1"));
|
||||
qparams.add(new BasicNameValuePair("show_system","1"));
|
||||
break;
|
||||
}
|
||||
|
||||
try{
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/database/cubes");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
while(csv.readRecord()){
|
||||
palocube plCube = new palocube(plConn, plDB.getDatabaseId(),
|
||||
palohelpers.StringToInt(csv.get(0)),
|
||||
csv.get(1),
|
||||
palohelpers.StringToInt(csv.get(2)),
|
||||
palohelpers.StringToIntArray(csv.get(3), palohelpers.StringToInt(csv.get(2))),
|
||||
palohelpers.StringToLong(csv.get(4)),
|
||||
palohelpers.StringToLong(csv.get(5)),
|
||||
palohelpers.StringToInt(csv.get(6)),
|
||||
palohelpers.StringToInt(csv.get(7)),
|
||||
palohelpers.StringToInt(csv.get(8))
|
||||
);
|
||||
|
||||
paloCubes.add(plCube);
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public palocubes(paloconnection plConn, long lDatabaseId, int iCubeType, int iDimensionId) throws paloexception{
|
||||
|
||||
super();
|
||||
|
||||
this.plConn = plConn;
|
||||
|
||||
public static final int CUBE_ATTRIBUT = 2;
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(iDimensionId)));
|
||||
|
||||
switch(iCubeType){
|
||||
case CUBE_NORMAL:
|
||||
qparams.add(new BasicNameValuePair("show_info","0"));
|
||||
qparams.add(new BasicNameValuePair("show_normal","1"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","0"));
|
||||
qparams.add(new BasicNameValuePair("show_system","0"));
|
||||
break;
|
||||
case CUBE_SYSTEM:
|
||||
qparams.add(new BasicNameValuePair("show_info","0"));
|
||||
qparams.add(new BasicNameValuePair("show_normal","0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","0"));
|
||||
qparams.add(new BasicNameValuePair("show_system","1"));
|
||||
break;
|
||||
case CUBE_ATTRIBUT:
|
||||
qparams.add(new BasicNameValuePair("show_info","0"));
|
||||
qparams.add(new BasicNameValuePair("show_normal","0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","1"));
|
||||
qparams.add(new BasicNameValuePair("show_system","0"));
|
||||
break;
|
||||
case CUBE_USER_INFO:
|
||||
qparams.add(new BasicNameValuePair("show_info","1"));
|
||||
qparams.add(new BasicNameValuePair("show_normal","0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","0"));
|
||||
qparams.add(new BasicNameValuePair("show_system","0"));
|
||||
break;
|
||||
case CUBE_UNKNOWN:
|
||||
qparams.add(new BasicNameValuePair("show_info","1"));
|
||||
qparams.add(new BasicNameValuePair("show_normal","1"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","1"));
|
||||
qparams.add(new BasicNameValuePair("show_system","1"));
|
||||
break;
|
||||
}
|
||||
|
||||
try{
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/dimension/cubes");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
while(csv.readRecord()){
|
||||
palocube plCube = new palocube(plConn, lDatabaseId,
|
||||
palohelpers.StringToInt(csv.get(0)),
|
||||
csv.get(1),
|
||||
palohelpers.StringToInt(csv.get(2)),
|
||||
palohelpers.StringToIntArray(csv.get(3), palohelpers.StringToInt(csv.get(2))),
|
||||
palohelpers.StringToLong(csv.get(4)),
|
||||
palohelpers.StringToLong(csv.get(5)),
|
||||
palohelpers.StringToInt(csv.get(6)),
|
||||
palohelpers.StringToInt(csv.get(7)),
|
||||
palohelpers.StringToInt(csv.get(8))
|
||||
);
|
||||
|
||||
paloCubes.add(plCube);
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
public static final int CUBE_USER_INFO = 3;
|
||||
|
||||
|
||||
|
||||
|
||||
public int getNumberOfCubes(){
|
||||
return paloCubes.size();
|
||||
}
|
||||
|
||||
public palocube getCube(int iIndex){
|
||||
return paloCubes.get(iIndex);
|
||||
}
|
||||
|
||||
public ArrayList<palocube> getCubes(){
|
||||
return paloCubes;
|
||||
}
|
||||
|
||||
public void deleteCube(String strCubeName) throws paloexception{
|
||||
palocube paloCubeToRemove = getCube(strCubeName);
|
||||
if(null != paloCubeToRemove){
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.plDB.getDatabaseId())));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(paloCubeToRemove.getCubeId())));
|
||||
plConn.sendToServerSingleRC(qparams, "/cube/destroy");
|
||||
paloCubes.remove(paloCubeToRemove);
|
||||
}
|
||||
}
|
||||
|
||||
public palocube getCube(String strCubeName){
|
||||
for(palocube paloCube : paloCubes){
|
||||
if(paloCube.getName().equals(strCubeName)) return paloCube;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public palocube getCubeByIdentifier(int iCubeId){
|
||||
for(palocube paloCube : paloCubes){
|
||||
if(paloCube.getCubeId()==iCubeId) return paloCube;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public palocube createCube(String strCubeName, String[] strArrDimensions, int iType) throws paloexception{
|
||||
palodimensions plDIMs = plDB.getDimensions(iType);
|
||||
StringBuilder sbDimensionsToCreate = new StringBuilder();
|
||||
int iPos=0;
|
||||
for(String strDimensionName : strArrDimensions){
|
||||
if(iPos>0)sbDimensionsToCreate.append(",");
|
||||
palodimension plDIM = plDIMs.getDimension(strDimensionName);
|
||||
if(null==plDIM)sbDimensionsToCreate.append("-1");
|
||||
else sbDimensionsToCreate.append(plDIMs.getDimension(strDimensionName).getDimensionId());
|
||||
iPos++;
|
||||
}
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.plDB.getDatabaseId())));
|
||||
qparams.add(new BasicNameValuePair("new_name", strCubeName));
|
||||
qparams.add(new BasicNameValuePair("type", String.valueOf(iType)));
|
||||
qparams.add(new BasicNameValuePair("dimensions", sbDimensionsToCreate.toString()));
|
||||
|
||||
try{
|
||||
palocube plCube=null;
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/cube/create");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
while(csv.readRecord()){
|
||||
//System.out.println(csv.getRawRecord());
|
||||
plCube = new palocube(plConn, plDB.getDatabaseId(),
|
||||
palohelpers.StringToInt(csv.get(0)),
|
||||
csv.get(1),
|
||||
palohelpers.StringToInt(csv.get(2)),
|
||||
palohelpers.StringToIntArray(csv.get(3), palohelpers.StringToInt(csv.get(2))),
|
||||
palohelpers.StringToLong(csv.get(4)),
|
||||
palohelpers.StringToLong(csv.get(5)),
|
||||
palohelpers.StringToInt(csv.get(6)),
|
||||
palohelpers.StringToInt(csv.get(7)),
|
||||
palohelpers.StringToInt(csv.get(8))
|
||||
);
|
||||
|
||||
paloCubes.add(plCube);
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
return plCube;
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
public static final int CUBE_UNKNOWN = -1;
|
||||
|
||||
public static final int CUBE_STATUS_UNLOADED = 0;
|
||||
|
||||
public static final int CUBE_STATUS_LOADED = 1;
|
||||
|
||||
public static final int CUBE_STATUS_CHANGED = 2;
|
||||
|
||||
public static final int CUBE_STATUS_UNKNOWN = -1;
|
||||
|
||||
private paloconnection plConn;
|
||||
|
||||
private palodatabase plDB;
|
||||
|
||||
private ArrayList<palocube> paloCubes = new ArrayList<palocube>();
|
||||
|
||||
public palocubes(paloconnection plConn, palodatabase plDB, int iCubeType) throws paloexception {
|
||||
|
||||
super();
|
||||
|
||||
this.plConn = plConn;
|
||||
this.plDB = plDB;
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.plDB.getDatabaseId())));
|
||||
|
||||
switch (iCubeType) {
|
||||
case CUBE_NORMAL:
|
||||
qparams.add(new BasicNameValuePair("show_info", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_normal", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "0"));
|
||||
break;
|
||||
case CUBE_SYSTEM:
|
||||
qparams.add(new BasicNameValuePair("show_info", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_normal", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "1"));
|
||||
break;
|
||||
case CUBE_ATTRIBUT:
|
||||
qparams.add(new BasicNameValuePair("show_info", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_normal", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "0"));
|
||||
break;
|
||||
case CUBE_USER_INFO:
|
||||
qparams.add(new BasicNameValuePair("show_info", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_normal", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "0"));
|
||||
break;
|
||||
case CUBE_UNKNOWN:
|
||||
qparams.add(new BasicNameValuePair("show_info", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_normal", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "1"));
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/database/cubes");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
while (csv.readNext()) {
|
||||
palocube plCube = new palocube(plConn, plDB.getDatabaseId(), palohelpers.StringToInt(csv.get(0)), csv.get(1),
|
||||
palohelpers.StringToInt(csv.get(2)), palohelpers.StringToIntArray(csv.get(3),
|
||||
palohelpers.StringToInt(csv.get(2))), palohelpers.StringToLong(csv.get(4)),
|
||||
palohelpers.StringToLong(csv.get(5)), palohelpers.StringToInt(csv.get(6)), palohelpers.StringToInt(csv
|
||||
.get(7)), palohelpers.StringToInt(csv.get(8)));
|
||||
|
||||
paloCubes.add(plCube);
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public palocubes(paloconnection plConn, long lDatabaseId, int iCubeType, int iDimensionId) throws paloexception {
|
||||
|
||||
super();
|
||||
|
||||
this.plConn = plConn;
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(iDimensionId)));
|
||||
|
||||
switch (iCubeType) {
|
||||
case CUBE_NORMAL:
|
||||
qparams.add(new BasicNameValuePair("show_info", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_normal", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "0"));
|
||||
break;
|
||||
case CUBE_SYSTEM:
|
||||
qparams.add(new BasicNameValuePair("show_info", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_normal", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "1"));
|
||||
break;
|
||||
case CUBE_ATTRIBUT:
|
||||
qparams.add(new BasicNameValuePair("show_info", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_normal", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "0"));
|
||||
break;
|
||||
case CUBE_USER_INFO:
|
||||
qparams.add(new BasicNameValuePair("show_info", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_normal", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "0"));
|
||||
break;
|
||||
case CUBE_UNKNOWN:
|
||||
qparams.add(new BasicNameValuePair("show_info", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_normal", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "1"));
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/dimension/cubes");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
while (csv.readNext()) {
|
||||
palocube plCube = new palocube(plConn, lDatabaseId, palohelpers.StringToInt(csv.get(0)), csv.get(1),
|
||||
palohelpers.StringToInt(csv.get(2)), palohelpers.StringToIntArray(csv.get(3),
|
||||
palohelpers.StringToInt(csv.get(2))), palohelpers.StringToLong(csv.get(4)),
|
||||
palohelpers.StringToLong(csv.get(5)), palohelpers.StringToInt(csv.get(6)), palohelpers.StringToInt(csv
|
||||
.get(7)), palohelpers.StringToInt(csv.get(8)));
|
||||
|
||||
paloCubes.add(plCube);
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public int getNumberOfCubes() {
|
||||
return paloCubes.size();
|
||||
}
|
||||
|
||||
public palocube getCube(int iIndex) {
|
||||
return paloCubes.get(iIndex);
|
||||
}
|
||||
|
||||
public ArrayList<palocube> getCubes() {
|
||||
return paloCubes;
|
||||
}
|
||||
|
||||
public void deleteCube(String strCubeName) throws paloexception {
|
||||
palocube paloCubeToRemove = getCube(strCubeName);
|
||||
if (null != paloCubeToRemove) {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.plDB.getDatabaseId())));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(paloCubeToRemove.getCubeId())));
|
||||
plConn.sendToServerSingleRC(qparams, "/cube/destroy");
|
||||
paloCubes.remove(paloCubeToRemove);
|
||||
}
|
||||
}
|
||||
|
||||
public palocube getCube(String strCubeName) {
|
||||
for (palocube paloCube : paloCubes) {
|
||||
if (paloCube.getName().equals(strCubeName)) {
|
||||
return paloCube;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public palocube getCubeByIdentifier(int iCubeId) {
|
||||
for (palocube paloCube : paloCubes) {
|
||||
if (paloCube.getCubeId() == iCubeId) {
|
||||
return paloCube;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public palocube createCube(String strCubeName, String[] strArrDimensions, int iType) throws paloexception {
|
||||
palodimensions plDIMs = plDB.getDimensions(iType);
|
||||
StringBuilder sbDimensionsToCreate = new StringBuilder();
|
||||
int iPos = 0;
|
||||
for (String strDimensionName : strArrDimensions) {
|
||||
if (iPos > 0) {
|
||||
sbDimensionsToCreate.append(",");
|
||||
}
|
||||
palodimension plDIM = plDIMs.getDimension(strDimensionName);
|
||||
if (null == plDIM) {
|
||||
sbDimensionsToCreate.append("-1");
|
||||
} else {
|
||||
sbDimensionsToCreate.append(plDIMs.getDimension(strDimensionName).getDimensionId());
|
||||
}
|
||||
iPos++;
|
||||
}
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.plDB.getDatabaseId())));
|
||||
qparams.add(new BasicNameValuePair("new_name", strCubeName));
|
||||
qparams.add(new BasicNameValuePair("type", String.valueOf(iType)));
|
||||
qparams.add(new BasicNameValuePair("dimensions", sbDimensionsToCreate.toString()));
|
||||
|
||||
try {
|
||||
palocube plCube = null;
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/cube/create");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
while (csv.readNext()) {
|
||||
// System.out.println(csv.getRawRecord());
|
||||
plCube = new palocube(plConn, plDB.getDatabaseId(), palohelpers.StringToInt(csv.get(0)), csv.get(1),
|
||||
palohelpers.StringToInt(csv.get(2)), palohelpers.StringToIntArray(csv.get(3),
|
||||
palohelpers.StringToInt(csv.get(2))), palohelpers.StringToLong(csv.get(4)),
|
||||
palohelpers.StringToLong(csv.get(5)), palohelpers.StringToInt(csv.get(6)), palohelpers.StringToInt(csv
|
||||
.get(7)), palohelpers.StringToInt(csv.get(8)));
|
||||
|
||||
paloCubes.add(plCube);
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
return plCube;
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,216 +1,223 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import com.csvreader.CsvReader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.talend.csv.CSVReader;
|
||||
|
||||
public class palodata {
|
||||
|
||||
public palodata() {
|
||||
alPaloElements = new ArrayList();
|
||||
htPaloResultData = new Hashtable();
|
||||
lstDimensionElements = new LinkedList();
|
||||
}
|
||||
public palodata() {
|
||||
alPaloElements = new ArrayList();
|
||||
htPaloResultData = new Hashtable();
|
||||
lstDimensionElements = new LinkedList();
|
||||
}
|
||||
|
||||
public palodata(paloconnection plConn, palodatabase plDB, palocube paloCube)
|
||||
public palodata(paloconnection plConn, palodatabase plDB, palocube paloCube)
|
||||
|
||||
{
|
||||
alPaloElements = new ArrayList();
|
||||
htPaloResultData = new Hashtable();
|
||||
lstDimensionElements = new LinkedList();
|
||||
this.plConn = plConn;
|
||||
lDatabaseId = plDB.getDatabaseId();
|
||||
plCube = paloCube;
|
||||
}
|
||||
{
|
||||
alPaloElements = new ArrayList();
|
||||
htPaloResultData = new Hashtable();
|
||||
lstDimensionElements = new LinkedList();
|
||||
this.plConn = plConn;
|
||||
lDatabaseId = plDB.getDatabaseId();
|
||||
plCube = paloCube;
|
||||
}
|
||||
|
||||
public palodata(paloconnection plConn, palodatabase plDB,
|
||||
palocube paloCube, ArrayList alPaloElements,
|
||||
String strDimensionElementsArray[][], int iBatchSize) {
|
||||
this.alPaloElements = new ArrayList();
|
||||
htPaloResultData = new Hashtable();
|
||||
lstDimensionElements = new LinkedList();
|
||||
this.plConn = plConn;
|
||||
lDatabaseId = plDB.getDatabaseId();
|
||||
plCube = paloCube;
|
||||
this.alPaloElements = alPaloElements;
|
||||
this.strDimensionElementsArray = strDimensionElementsArray;
|
||||
public palodata(paloconnection plConn, palodatabase plDB, palocube paloCube, ArrayList alPaloElements,
|
||||
String strDimensionElementsArray[][], int iBatchSize) {
|
||||
this.alPaloElements = new ArrayList();
|
||||
htPaloResultData = new Hashtable();
|
||||
lstDimensionElements = new LinkedList();
|
||||
this.plConn = plConn;
|
||||
lDatabaseId = plDB.getDatabaseId();
|
||||
plCube = paloCube;
|
||||
this.alPaloElements = alPaloElements;
|
||||
this.strDimensionElementsArray = strDimensionElementsArray;
|
||||
|
||||
this.iBatchSize = iBatchSize;
|
||||
htPaloResultData = new Hashtable();
|
||||
buildDimElemIteratorFromArray();
|
||||
}
|
||||
this.iBatchSize = iBatchSize;
|
||||
htPaloResultData = new Hashtable();
|
||||
buildDimElemIteratorFromArray();
|
||||
}
|
||||
|
||||
private void buildDimElemIteratorFromArray() {
|
||||
iDimensionElementLength = strDimensionElementsArray.length;
|
||||
for (int i = 0; i < strDimensionElementsArray.length; i++)
|
||||
private void buildDimElemIteratorFromArray() {
|
||||
iDimensionElementLength = strDimensionElementsArray.length;
|
||||
for (String[] element : strDimensionElementsArray) {
|
||||
lstDimensionElements.add(Arrays.asList(element));
|
||||
}
|
||||
|
||||
lstDimensionElements.add(Arrays
|
||||
.asList(strDimensionElementsArray[i]));
|
||||
itDimensionElements = palohelpers.finiteCartesianProduct(lstDimensionElements).iterator();
|
||||
}
|
||||
|
||||
itDimensionElements = palohelpers.finiteCartesianProduct(
|
||||
lstDimensionElements).iterator();
|
||||
}
|
||||
public boolean getResults() throws paloexception {
|
||||
int iRowCounter = 0;
|
||||
List lstDimensionElementArray = new LinkedList();
|
||||
htPaloResultData = new Hashtable();
|
||||
for (; itDimensionElements.hasNext() && iRowCounter < iBatchSize; iRowCounter++) {
|
||||
List x = (List) itDimensionElements.next();
|
||||
for (int i = 0; i < x.size(); i++) {
|
||||
lstDimensionElementArray.add(x.get(i));
|
||||
}
|
||||
|
||||
public boolean getResults() throws paloexception {
|
||||
int iRowCounter = 0;
|
||||
List lstDimensionElementArray = new LinkedList();
|
||||
htPaloResultData = new Hashtable();
|
||||
for (; itDimensionElements.hasNext() && iRowCounter < iBatchSize; iRowCounter++) {
|
||||
List x = (List) itDimensionElements.next();
|
||||
for (int i = 0; i < x.size(); i++)
|
||||
lstDimensionElementArray.add((String) x.get(i));
|
||||
}
|
||||
|
||||
}
|
||||
int iPos = 0;
|
||||
int iCoordPos = 0;
|
||||
StringBuilder sbCoordinates = new StringBuilder();
|
||||
for (Iterator iterator = lstDimensionElementArray.iterator(); iterator.hasNext();) {
|
||||
String strCoordElement = (String) iterator.next();
|
||||
if (iPos > 0) {
|
||||
sbCoordinates.append(",");
|
||||
}
|
||||
paloelement plElm = ((paloelements) alPaloElements.get(iCoordPos)).getElement(strCoordElement);
|
||||
if (plElm == null) {
|
||||
sbCoordinates.append("-1");
|
||||
} else {
|
||||
sbCoordinates.append(plElm.getElementIdentifier());
|
||||
}
|
||||
iPos++;
|
||||
if (++iCoordPos >= iDimensionElementLength) {
|
||||
iCoordPos = 0;
|
||||
sbCoordinates.append(":");
|
||||
iPos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int iPos = 0;
|
||||
int iCoordPos = 0;
|
||||
StringBuilder sbCoordinates = new StringBuilder();
|
||||
for (Iterator iterator = lstDimensionElementArray.iterator(); iterator
|
||||
.hasNext();) {
|
||||
String strCoordElement = (String) iterator.next();
|
||||
if (iPos > 0)
|
||||
sbCoordinates.append(",");
|
||||
paloelement plElm = ((paloelements) alPaloElements.get(iCoordPos))
|
||||
.getElement(strCoordElement);
|
||||
if (plElm == null)
|
||||
sbCoordinates.append("-1");
|
||||
else
|
||||
sbCoordinates.append(plElm.getElementIdentifier());
|
||||
iPos++;
|
||||
if (++iCoordPos >= iDimensionElementLength) {
|
||||
iCoordPos = 0;
|
||||
sbCoordinates.append(":");
|
||||
iPos = 0;
|
||||
}
|
||||
}
|
||||
if (iRowCounter > 0) {
|
||||
List qparams = new ArrayList();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(plCube.getCubeId())));
|
||||
qparams.add(new BasicNameValuePair("paths", sbCoordinates.toString()));
|
||||
try {
|
||||
HttpEntity entity = plConn.sendToServer(qparams, "/cell/values");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
int iCoordElem = 0;
|
||||
while (csv.readNext()) {
|
||||
String strArrCoord[] = new String[iDimensionElementLength];
|
||||
for (int i = 0; i < iDimensionElementLength; i++) {
|
||||
strArrCoord[i] = (String) lstDimensionElementArray.get(iCoordElem++);
|
||||
}
|
||||
|
||||
if (iRowCounter > 0) {
|
||||
List qparams = new ArrayList();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String
|
||||
.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(plCube
|
||||
.getCubeId())));
|
||||
qparams.add(new BasicNameValuePair("paths", sbCoordinates
|
||||
.toString()));
|
||||
try {
|
||||
HttpEntity entity = plConn
|
||||
.sendToServer(qparams, "/cell/values");
|
||||
CsvReader csv = new CsvReader(entity.getContent(),
|
||||
Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
int iCoordElem = 0;
|
||||
while (csv.readRecord()) {
|
||||
String strArrCoord[] = new String[iDimensionElementLength];
|
||||
for (int i = 0; i < iDimensionElementLength; i++)
|
||||
strArrCoord[i] = (String) lstDimensionElementArray
|
||||
.get(iCoordElem++);
|
||||
if (palohelpers.StringToInt(csv.get(0)) == 1) {
|
||||
if (palohelpers.StringToInt(csv.get(1)) > 0) {
|
||||
htPaloResultData.put(strArrCoord,
|
||||
new palodatavalue(strArrCoord, palohelpers.StringToDouble(csv.get(2))));
|
||||
} else {
|
||||
htPaloResultData.put(strArrCoord, new palodatavalue(strArrCoord, 0.0D));
|
||||
}
|
||||
} else if (palohelpers.StringToInt(csv.get(0)) == 0) {
|
||||
htPaloResultData.put(strArrCoord, new palodatavalue(strArrCoord, csv.get(2)));
|
||||
}
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
return iRowCounter <= iBatchSize && iRowCounter > 0;
|
||||
}
|
||||
|
||||
if (palohelpers.StringToInt(csv.get(0)) == 1) {
|
||||
if (palohelpers.StringToInt(csv.get(1)) > 0)
|
||||
htPaloResultData.put(
|
||||
strArrCoord,
|
||||
new palodatavalue(strArrCoord, palohelpers
|
||||
.StringToDouble(csv.get(2))));
|
||||
else
|
||||
htPaloResultData.put(strArrCoord,
|
||||
new palodatavalue(strArrCoord, 0.0D));
|
||||
} else if (palohelpers.StringToInt(csv.get(0)) == 0)
|
||||
htPaloResultData.put(strArrCoord, new palodatavalue(
|
||||
strArrCoord, csv.get(2)));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
return iRowCounter <= iBatchSize && iRowCounter > 0;
|
||||
}
|
||||
public Hashtable getResultHashTable() {
|
||||
return htPaloResultData;
|
||||
}
|
||||
|
||||
public Hashtable getResultHashTable() {
|
||||
return htPaloResultData;
|
||||
}
|
||||
public palodatavalue getValue(String strDimensionElementArray[], boolean bRefreshElements) throws paloexception {
|
||||
long lDimensionElementIdentifierArray[] = new long[strDimensionElementArray.length];
|
||||
if (plDims == null || bRefreshElements) {
|
||||
plDims = plCube.getDimensions();
|
||||
}
|
||||
for (int i = 0; i < strDimensionElementArray.length; i++) {
|
||||
paloelement plElm = plDims.getDimension(i).getElements(false).getElement(strDimensionElementArray[i]);
|
||||
if (plElm == null) {
|
||||
lDimensionElementIdentifierArray[i] = -1L;
|
||||
} else {
|
||||
lDimensionElementIdentifierArray[i] = plElm.getElementIdentifier();
|
||||
}
|
||||
}
|
||||
|
||||
public palodatavalue getValue(String strDimensionElementArray[],
|
||||
boolean bRefreshElements) throws paloexception {
|
||||
long lDimensionElementIdentifierArray[] = new long[strDimensionElementArray.length];
|
||||
if (plDims == null || bRefreshElements)
|
||||
plDims = plCube.getDimensions();
|
||||
for (int i = 0; i < strDimensionElementArray.length; i++) {
|
||||
paloelement plElm = plDims.getDimension(i).getElements(false)
|
||||
.getElement(strDimensionElementArray[i]);
|
||||
if (plElm == null)
|
||||
lDimensionElementIdentifierArray[i] = -1L;
|
||||
else
|
||||
lDimensionElementIdentifierArray[i] = plElm
|
||||
.getElementIdentifier();
|
||||
}
|
||||
return getValue(lDimensionElementIdentifierArray);
|
||||
}
|
||||
|
||||
return getValue(lDimensionElementIdentifierArray);
|
||||
}
|
||||
public palodatavalue getValue(long lDimensionElementIdentifierArray[]) throws paloexception {
|
||||
List qparams = new ArrayList();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(plCube.getCubeId())));
|
||||
StringBuilder sbCoordinates = new StringBuilder();
|
||||
int iPos = 0;
|
||||
long al[];
|
||||
int j = (al = lDimensionElementIdentifierArray).length;
|
||||
for (int i = 0; i < j; i++) {
|
||||
long lDimensionElementIdentifier = al[i];
|
||||
if (iPos > 0) {
|
||||
sbCoordinates.append(",");
|
||||
}
|
||||
sbCoordinates.append(lDimensionElementIdentifier);
|
||||
iPos++;
|
||||
}
|
||||
|
||||
public palodatavalue getValue(long lDimensionElementIdentifierArray[])
|
||||
throws paloexception {
|
||||
List qparams = new ArrayList();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String
|
||||
.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(plCube
|
||||
.getCubeId())));
|
||||
StringBuilder sbCoordinates = new StringBuilder();
|
||||
int iPos = 0;
|
||||
long al[];
|
||||
int j = (al = lDimensionElementIdentifierArray).length;
|
||||
for (int i = 0; i < j; i++) {
|
||||
long lDimensionElementIdentifier = al[i];
|
||||
if (iPos > 0)
|
||||
sbCoordinates.append(",");
|
||||
sbCoordinates.append(lDimensionElementIdentifier);
|
||||
iPos++;
|
||||
}
|
||||
qparams.add(new BasicNameValuePair("path", sbCoordinates.toString()));
|
||||
palodatavalue rcDataValue = null;
|
||||
try {
|
||||
HttpEntity entity = plConn.sendToServer(qparams, "/cell/value");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
while (csv.readNext()) {
|
||||
if (palohelpers.StringToInt(csv.get(0)) == 1) {
|
||||
if (palohelpers.StringToInt(csv.get(1)) > 0) {
|
||||
rcDataValue = new palodatavalue(palohelpers.StringToDouble(csv.get(2)));
|
||||
} else {
|
||||
rcDataValue = new palodatavalue(0.0D);
|
||||
}
|
||||
} else if (palohelpers.StringToInt(csv.get(0)) == 0) {
|
||||
rcDataValue = new palodatavalue(csv.get(2));
|
||||
}
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
return rcDataValue;
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
qparams.add(new BasicNameValuePair("path", sbCoordinates.toString()));
|
||||
palodatavalue rcDataValue = null;
|
||||
try {
|
||||
HttpEntity entity = plConn.sendToServer(qparams, "/cell/value");
|
||||
CsvReader csv = new CsvReader(entity.getContent(),
|
||||
Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
while (csv.readRecord())
|
||||
if (palohelpers.StringToInt(csv.get(0)) == 1) {
|
||||
if (palohelpers.StringToInt(csv.get(1)) > 0)
|
||||
rcDataValue = new palodatavalue(
|
||||
palohelpers.StringToDouble(csv.get(2)));
|
||||
else
|
||||
rcDataValue = new palodatavalue(0.0D);
|
||||
} else if (palohelpers.StringToInt(csv.get(0)) == 0)
|
||||
rcDataValue = new palodatavalue(csv.get(2));
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
return rcDataValue;
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
public static final int PALO_SPLASH_DISABLE = 0;
|
||||
|
||||
public static final int PALO_SPLASH_DISABLE = 0;
|
||||
public static final int PALO_SPLASH_DEFAULT = 1;
|
||||
public static final int PALO_SPLASH_BASE_SET = 3;
|
||||
public static final int PALO_SPLASH_BASE_ADD = 2;
|
||||
private paloconnection plConn;
|
||||
private palodimensions plDims;
|
||||
private long lDatabaseId;
|
||||
private ArrayList alPaloElements;
|
||||
private Hashtable htPaloResultData;
|
||||
private palocube plCube;
|
||||
private String strDimensionElementsArray[][];
|
||||
private List lstDimensionElements;
|
||||
private Iterator itDimensionElements;
|
||||
private int iBatchSize;
|
||||
private int iDimensionElementLength;
|
||||
public static final int PALO_SPLASH_DEFAULT = 1;
|
||||
|
||||
public static final int PALO_SPLASH_BASE_SET = 3;
|
||||
|
||||
public static final int PALO_SPLASH_BASE_ADD = 2;
|
||||
|
||||
private paloconnection plConn;
|
||||
|
||||
private palodimensions plDims;
|
||||
|
||||
private long lDatabaseId;
|
||||
|
||||
private ArrayList alPaloElements;
|
||||
|
||||
private Hashtable htPaloResultData;
|
||||
|
||||
private palocube plCube;
|
||||
|
||||
private String strDimensionElementsArray[][];
|
||||
|
||||
private List lstDimensionElements;
|
||||
|
||||
private Iterator itDimensionElements;
|
||||
|
||||
private int iBatchSize;
|
||||
|
||||
private int iDimensionElementLength;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -8,144 +7,148 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.csvreader.CsvReader;
|
||||
import com.talend.csv.CSVReader;
|
||||
|
||||
public class palodatabase {
|
||||
|
||||
|
||||
private paloconnection plConn;
|
||||
private paloconnection plConn;
|
||||
|
||||
// OK
|
||||
//private native palodimensions JNIgetDimensions(palodatabase paloDatabase, int iDimensionType);
|
||||
//private native palocubes JNIgetCubes(palodatabase paloDatabase, int iDimensionType, int iWithCell);
|
||||
|
||||
private String strDatabaseName;
|
||||
private long lDatabaseId;
|
||||
private int iNumberOfDimensions;
|
||||
private int iNumberOfCubes;
|
||||
private int iStatus;
|
||||
private int iType;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private String strDatabaseToken;
|
||||
|
||||
public palodatabase(paloconnection plConn, String strDatabaseName, long lDatabaseId, int iNumberOfDimensions, int iNumberOfCubes, int iStatus, int iType, String strDatabaseToken){
|
||||
super();
|
||||
this.plConn = plConn;
|
||||
this.strDatabaseName = strDatabaseName;
|
||||
this.lDatabaseId = lDatabaseId;
|
||||
this.iNumberOfCubes = iNumberOfCubes;
|
||||
this.iNumberOfDimensions = iNumberOfDimensions;
|
||||
this.iStatus = iStatus;
|
||||
this.iType = iType;
|
||||
this.strDatabaseToken = strDatabaseToken;
|
||||
}
|
||||
|
||||
public palodimensions getDimensions(int iDimensionType)throws paloexception{
|
||||
return new palodimensions(this.plConn, this, iDimensionType);
|
||||
}
|
||||
|
||||
|
||||
public palocubes getCubes(int iCubeType) throws paloexception{
|
||||
return new palocubes(this.plConn, this, iCubeType);
|
||||
//return getCubes(iCubeType, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
public palocubes getCubes(int iCubeType, int iOnlyWithCells){
|
||||
return JNIgetCubes(this, iCubeType, iOnlyWithCells);
|
||||
}*/
|
||||
|
||||
public void save()throws paloexception{
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
plConn.sendToServerSingleRC(qparams, "/database/save");
|
||||
}
|
||||
// OK
|
||||
// private native palodimensions JNIgetDimensions(palodatabase paloDatabase, int iDimensionType);
|
||||
// private native palocubes JNIgetCubes(palodatabase paloDatabase, int iDimensionType, int iWithCell);
|
||||
|
||||
public void load() throws paloexception{
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
plConn.sendToServerSingleRC(qparams, "/database/load");
|
||||
}
|
||||
private String strDatabaseName;
|
||||
|
||||
public void unload()throws paloexception{
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
plConn.sendToServerSingleRC(qparams, "/database/unload");
|
||||
}
|
||||
|
||||
public void rename(String strNewName) throws paloexception{
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("new_name",strNewName));
|
||||
private long lDatabaseId;
|
||||
|
||||
try{
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/database/rename");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
private int iNumberOfDimensions;
|
||||
|
||||
//CsvReader csv = new CsvReader(this.plConn.sendToServer(qparams, "/database/rename").getContent(), Charset.defaultCharset());
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.readRecord();
|
||||
private int iNumberOfCubes;
|
||||
|
||||
this.strDatabaseName = csv.get(1);
|
||||
this.iNumberOfDimensions = Integer.valueOf(csv.get(2));
|
||||
this.iNumberOfCubes = Integer.valueOf(csv.get(3));
|
||||
this.iStatus = Integer.valueOf(csv.get(4));
|
||||
this.iType = Integer.valueOf(csv.get(5));
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
private int iStatus;
|
||||
|
||||
private int iType;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private String strDatabaseToken;
|
||||
|
||||
public palodatabase(paloconnection plConn, String strDatabaseName, long lDatabaseId, int iNumberOfDimensions,
|
||||
int iNumberOfCubes, int iStatus, int iType, String strDatabaseToken) {
|
||||
super();
|
||||
this.plConn = plConn;
|
||||
this.strDatabaseName = strDatabaseName;
|
||||
this.lDatabaseId = lDatabaseId;
|
||||
this.iNumberOfCubes = iNumberOfCubes;
|
||||
this.iNumberOfDimensions = iNumberOfDimensions;
|
||||
this.iStatus = iStatus;
|
||||
this.iType = iType;
|
||||
this.strDatabaseToken = strDatabaseToken;
|
||||
}
|
||||
|
||||
public palodimensions getDimensions(int iDimensionType) throws paloexception {
|
||||
return new palodimensions(this.plConn, this, iDimensionType);
|
||||
}
|
||||
|
||||
public palocubes getCubes(int iCubeType) throws paloexception {
|
||||
return new palocubes(this.plConn, this, iCubeType);
|
||||
// return getCubes(iCubeType, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* public palocubes getCubes(int iCubeType, int iOnlyWithCells){ return JNIgetCubes(this, iCubeType,
|
||||
* iOnlyWithCells); }
|
||||
*/
|
||||
|
||||
public void save() throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
plConn.sendToServerSingleRC(qparams, "/database/save");
|
||||
}
|
||||
|
||||
public void load() throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
plConn.sendToServerSingleRC(qparams, "/database/load");
|
||||
}
|
||||
|
||||
public void unload() throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
plConn.sendToServerSingleRC(qparams, "/database/unload");
|
||||
}
|
||||
|
||||
public void rename(String strNewName) throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("new_name", strNewName));
|
||||
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/database/rename");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
csv.readNext();
|
||||
|
||||
this.strDatabaseName = csv.get(1);
|
||||
this.iNumberOfDimensions = Integer.valueOf(csv.get(2));
|
||||
this.iNumberOfCubes = Integer.valueOf(csv.get(3));
|
||||
this.iStatus = Integer.valueOf(csv.get(4));
|
||||
this.iType = Integer.valueOf(csv.get(5));
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public String getName(){
|
||||
return strDatabaseName;
|
||||
}
|
||||
public long getDatabaseId(){
|
||||
return lDatabaseId;
|
||||
}
|
||||
public int getNumberOfDimensions(){
|
||||
return iNumberOfDimensions;
|
||||
}
|
||||
public int getNumberOfCubes(){
|
||||
return iNumberOfCubes;
|
||||
}
|
||||
public int getStatus(){
|
||||
return iStatus;
|
||||
}
|
||||
public int getType(){
|
||||
return iType;
|
||||
}
|
||||
|
||||
public void refreshDatabaseInfo() throws paloexception{
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
}
|
||||
|
||||
try{
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/database/info");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
//CsvReader csv = new CsvReader(this.plConn.sendToServer(qparams, "/database/info").getContent(), Charset.defaultCharset());
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.readRecord();
|
||||
public String getName() {
|
||||
return strDatabaseName;
|
||||
}
|
||||
|
||||
this.strDatabaseName = csv.get(1);
|
||||
this.iNumberOfDimensions = Integer.valueOf(csv.get(2));
|
||||
this.iNumberOfCubes = Integer.valueOf(csv.get(3));
|
||||
this.iStatus = Integer.valueOf(csv.get(4));
|
||||
this.iType = Integer.valueOf(csv.get(5));
|
||||
this.strDatabaseToken = csv.get(6);
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
public long getDatabaseId() {
|
||||
return lDatabaseId;
|
||||
}
|
||||
|
||||
public int getNumberOfDimensions() {
|
||||
return iNumberOfDimensions;
|
||||
}
|
||||
|
||||
public int getNumberOfCubes() {
|
||||
return iNumberOfCubes;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return iStatus;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return iType;
|
||||
}
|
||||
|
||||
public void refreshDatabaseInfo() throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/database/info");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
csv.readNext();
|
||||
|
||||
this.strDatabaseName = csv.get(1);
|
||||
this.iNumberOfDimensions = Integer.valueOf(csv.get(2));
|
||||
this.iNumberOfCubes = Integer.valueOf(csv.get(3));
|
||||
this.iStatus = Integer.valueOf(csv.get(4));
|
||||
this.iType = Integer.valueOf(csv.get(5));
|
||||
this.strDatabaseToken = csv.get(6);
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -8,108 +7,110 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.csvreader.CsvReader;
|
||||
import com.talend.csv.CSVReader;
|
||||
|
||||
public class palodatabases {
|
||||
|
||||
private paloconnection plConn;
|
||||
|
||||
// OK
|
||||
public static final int DATABASE_TYPE_NORMAL = 0;
|
||||
public static final int DATABASE_TYPE_SYSTEM_= 1;
|
||||
public static final int DATABASE_TYPE_UNKNOWN = -1;
|
||||
|
||||
public static final int DATABASE_STATUS_UNLOADED=0;
|
||||
public static final int DATABASE_STATUS_LOADED=1;
|
||||
public static final int DATABASE_STATUS_CHANGED=2;
|
||||
public static final int DATABASE_STATUS_LOADING=3;
|
||||
public static final int DATABASE_STATUS_UNKNOWN=-1;
|
||||
private paloconnection plConn;
|
||||
|
||||
private ArrayList<palodatabase> paloDatabases = new ArrayList<palodatabase>();
|
||||
|
||||
public palodatabases(paloconnection plConn) throws paloexception{
|
||||
super();
|
||||
|
||||
this.plConn = plConn;
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("show_normal","1"));
|
||||
qparams.add(new BasicNameValuePair("show_system","1"));
|
||||
// OK
|
||||
public static final int DATABASE_TYPE_NORMAL = 0;
|
||||
|
||||
try{
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/server/databases");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
public static final int DATABASE_TYPE_SYSTEM_ = 1;
|
||||
|
||||
//CsvReader csv = new CsvReader(this.plConn.sendToServer(qparams, "/server/databases").getContent(), Charset.defaultCharset());
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
while(csv.readRecord()){
|
||||
paloDatabases.add(new palodatabase(this.plConn, csv.get(1), Long.parseLong(csv.get(0)), Integer.valueOf(csv.get(2)),Integer.valueOf(csv.get(3)),Integer.valueOf(csv.get(4)),Integer.valueOf(csv.get(5)), csv.get(6)));
|
||||
//System.out.println(csv.getRawRecord());
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
public static final int DATABASE_TYPE_UNKNOWN = -1;
|
||||
|
||||
public static final int DATABASE_STATUS_UNLOADED = 0;
|
||||
|
||||
public static final int DATABASE_STATUS_LOADED = 1;
|
||||
|
||||
public static final int DATABASE_STATUS_CHANGED = 2;
|
||||
|
||||
public static final int DATABASE_STATUS_LOADING = 3;
|
||||
|
||||
public static final int DATABASE_STATUS_UNKNOWN = -1;
|
||||
|
||||
private ArrayList<palodatabase> paloDatabases = new ArrayList<palodatabase>();
|
||||
|
||||
public palodatabases(paloconnection plConn) throws paloexception {
|
||||
super();
|
||||
|
||||
this.plConn = plConn;
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("show_normal", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "1"));
|
||||
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/server/databases");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
while (csv.readNext()) {
|
||||
paloDatabases.add(new palodatabase(this.plConn, csv.get(1), Long.parseLong(csv.get(0)), Integer.valueOf(csv
|
||||
.get(2)), Integer.valueOf(csv.get(3)), Integer.valueOf(csv.get(4)), Integer.valueOf(csv.get(5)), csv
|
||||
.get(6)));
|
||||
// System.out.println(csv.getRawRecord());
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public palodatabase createDatabase(String strDatabaseName) throws paloexception{
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("new_name",strDatabaseName));
|
||||
|
||||
try{
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/database/create");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
//CsvReader csv = new CsvReader(this.plConn.sendToServer(qparams, "/database/create").getContent(), Charset.defaultCharset());
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.readRecord();
|
||||
palodatabase plDB = new palodatabase(this.plConn, csv.get(1), Long.parseLong(csv.get(0)), Integer.valueOf(csv.get(2)),Integer.valueOf(csv.get(3)),Integer.valueOf(csv.get(4)),Integer.valueOf(csv.get(5)),"");
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
plDB.refreshDatabaseInfo();
|
||||
paloDatabases.add(plDB);
|
||||
return plDB;
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
|
||||
public palodatabase createDatabase(String strDatabaseName) throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("new_name", strDatabaseName));
|
||||
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/database/create");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
csv.readNext();
|
||||
palodatabase plDB = new palodatabase(this.plConn, csv.get(1), Long.parseLong(csv.get(0)),
|
||||
Integer.valueOf(csv.get(2)), Integer.valueOf(csv.get(3)), Integer.valueOf(csv.get(4)), Integer.valueOf(csv
|
||||
.get(5)), "");
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
plDB.refreshDatabaseInfo();
|
||||
paloDatabases.add(plDB);
|
||||
return plDB;
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void deleteDatabase(String strDatabaseName) throws paloexception{
|
||||
palodatabase paloDBToRemove = getDatabase(strDatabaseName);
|
||||
if(null != paloDBToRemove){
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(paloDBToRemove.getDatabaseId())));
|
||||
plConn.sendToServerSingleRC(qparams, "/database/destroy");
|
||||
paloDatabases.remove(paloDBToRemove);
|
||||
}
|
||||
}
|
||||
public void deleteDatabase(String strDatabaseName) throws paloexception {
|
||||
palodatabase paloDBToRemove = getDatabase(strDatabaseName);
|
||||
if (null != paloDBToRemove) {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(paloDBToRemove.getDatabaseId())));
|
||||
plConn.sendToServerSingleRC(qparams, "/database/destroy");
|
||||
paloDatabases.remove(paloDBToRemove);
|
||||
}
|
||||
}
|
||||
|
||||
public int getNumberOfDatabases() {
|
||||
return paloDatabases.size();
|
||||
}
|
||||
|
||||
public palodatabase getDatabase(int iIndex) {
|
||||
return paloDatabases.get(iIndex);
|
||||
}
|
||||
|
||||
public ArrayList<palodatabase> getDatabases() {
|
||||
return paloDatabases;
|
||||
}
|
||||
|
||||
public palodatabase getDatabase(String strDatabaseName) {
|
||||
for (palodatabase palodb : paloDatabases) {
|
||||
if (palodb.getName().equals(strDatabaseName)) {
|
||||
return palodb;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public int getNumberOfDatabases(){
|
||||
return paloDatabases.size();
|
||||
}
|
||||
|
||||
public palodatabase getDatabase(int iIndex){
|
||||
return paloDatabases.get(iIndex);
|
||||
}
|
||||
|
||||
|
||||
public ArrayList<palodatabase> getDatabases(){
|
||||
return paloDatabases;
|
||||
}
|
||||
|
||||
public palodatabase getDatabase(String strDatabaseName){
|
||||
for(palodatabase palodb : paloDatabases){
|
||||
if(palodb.getName().equals(strDatabaseName)) return palodb;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,127 +1,134 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.csvreader.CsvReader;
|
||||
import com.talend.csv.CSVReader;
|
||||
|
||||
public class palodatamulti {
|
||||
|
||||
public final static int PALO_SPLASH_DISABLE=0;
|
||||
public final static int PALO_SPLASH_DEFAULT=1;
|
||||
public final static int PALO_SPLASH_BASE_SET=3;
|
||||
public final static int PALO_SPLASH_BASE_ADD=2;
|
||||
|
||||
|
||||
private paloconnection plConn;
|
||||
private long lDatabaseId;
|
||||
private ArrayList<paloelements> alPaloElements = new ArrayList<paloelements>();
|
||||
private List<palodatavalue> lstPaloValues = new ArrayList<palodatavalue>();
|
||||
private int iNbOfCoordinates=0;
|
||||
private int iNbOfDataVolumns=0;
|
||||
private int iCurrentPos=0;
|
||||
|
||||
private void initDataSetList(){
|
||||
String strArr[] = new String[iNbOfCoordinates];
|
||||
for(int i=0;i<iNbOfDataVolumns;i++){
|
||||
palodatavalue plDV = new palodatavalue(strArr, 0);
|
||||
lstPaloValues.add(plDV);
|
||||
}
|
||||
}
|
||||
|
||||
public void cleanDataSetList(){
|
||||
iCurrentPos=0;
|
||||
}
|
||||
|
||||
|
||||
public palodatamulti(paloconnection plConn, palodatabase plDB, int iNbOfDataVolumns, int iNbOfCoordinates, ArrayList<paloelements> alPaloElements){
|
||||
this.plConn = plConn;
|
||||
this.lDatabaseId = plDB.getDatabaseId();
|
||||
lstPaloValues = new ArrayList<palodatavalue>(iNbOfDataVolumns);
|
||||
this.iNbOfCoordinates = iNbOfCoordinates;
|
||||
this.iNbOfDataVolumns = iNbOfDataVolumns;
|
||||
this.alPaloElements = alPaloElements;
|
||||
// Init lstPaloValues
|
||||
initDataSetList();
|
||||
}
|
||||
|
||||
|
||||
public void addToValueList(String[] strArrCoordinates, double dValue){
|
||||
strArrCoordinates = replaceStringArrWithElementId(strArrCoordinates);
|
||||
lstPaloValues.get(iCurrentPos++).setValue(strArrCoordinates, dValue);
|
||||
}
|
||||
|
||||
public void addToValueList(String[] strArrCoordinates, String sValue){
|
||||
strArrCoordinates = replaceStringArrWithElementId(strArrCoordinates);
|
||||
lstPaloValues.get(iCurrentPos++).setValue(strArrCoordinates, sValue);
|
||||
}
|
||||
|
||||
public int getNumberOfValues(){
|
||||
return iCurrentPos;
|
||||
}
|
||||
|
||||
public palodatavalue getDataValue(int iPos){
|
||||
return lstPaloValues.get(iPos);
|
||||
}
|
||||
|
||||
|
||||
public final static int PALO_SPLASH_DISABLE = 0;
|
||||
|
||||
public void setData( palocube plCube, int SPLASH_MODE, boolean bAddValue, boolean bUseEventProcessor) throws paloexception{
|
||||
public final static int PALO_SPLASH_DEFAULT = 1;
|
||||
|
||||
StringBuilder sbCoordinates = new StringBuilder();
|
||||
StringBuilder sbValues = new StringBuilder();
|
||||
int iPos=0;
|
||||
for(int i=0;i<iCurrentPos;i++){
|
||||
//for(palodatavalue plValue : this.lstPaloValues){
|
||||
palodatavalue plValue = getDataValue(i);
|
||||
if(iPos>0){
|
||||
sbCoordinates.append(":");
|
||||
sbValues.append(":");
|
||||
}
|
||||
sbCoordinates.append(plValue.getCoordinatesString());
|
||||
if(palodatavalue.PALO_NUMERIC == plValue.getType())
|
||||
sbValues.append(plValue.getDoubleValue());
|
||||
else
|
||||
sbValues.append(plValue.getStringValue());
|
||||
iPos++;
|
||||
}
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(plCube.getCubeId())));
|
||||
public final static int PALO_SPLASH_BASE_SET = 3;
|
||||
|
||||
public final static int PALO_SPLASH_BASE_ADD = 2;
|
||||
|
||||
private paloconnection plConn;
|
||||
|
||||
private long lDatabaseId;
|
||||
|
||||
private ArrayList<paloelements> alPaloElements = new ArrayList<paloelements>();
|
||||
|
||||
private List<palodatavalue> lstPaloValues = new ArrayList<palodatavalue>();
|
||||
|
||||
private int iNbOfCoordinates = 0;
|
||||
|
||||
private int iNbOfDataVolumns = 0;
|
||||
|
||||
private int iCurrentPos = 0;
|
||||
|
||||
private void initDataSetList() {
|
||||
String strArr[] = new String[iNbOfCoordinates];
|
||||
for (int i = 0; i < iNbOfDataVolumns; i++) {
|
||||
palodatavalue plDV = new palodatavalue(strArr, 0);
|
||||
lstPaloValues.add(plDV);
|
||||
}
|
||||
}
|
||||
|
||||
public void cleanDataSetList() {
|
||||
iCurrentPos = 0;
|
||||
}
|
||||
|
||||
public palodatamulti(paloconnection plConn, palodatabase plDB, int iNbOfDataVolumns, int iNbOfCoordinates,
|
||||
ArrayList<paloelements> alPaloElements) {
|
||||
this.plConn = plConn;
|
||||
this.lDatabaseId = plDB.getDatabaseId();
|
||||
lstPaloValues = new ArrayList<palodatavalue>(iNbOfDataVolumns);
|
||||
this.iNbOfCoordinates = iNbOfCoordinates;
|
||||
this.iNbOfDataVolumns = iNbOfDataVolumns;
|
||||
this.alPaloElements = alPaloElements;
|
||||
// Init lstPaloValues
|
||||
initDataSetList();
|
||||
}
|
||||
|
||||
public void addToValueList(String[] strArrCoordinates, double dValue) {
|
||||
strArrCoordinates = replaceStringArrWithElementId(strArrCoordinates);
|
||||
lstPaloValues.get(iCurrentPos++).setValue(strArrCoordinates, dValue);
|
||||
}
|
||||
|
||||
public void addToValueList(String[] strArrCoordinates, String sValue) {
|
||||
strArrCoordinates = replaceStringArrWithElementId(strArrCoordinates);
|
||||
lstPaloValues.get(iCurrentPos++).setValue(strArrCoordinates, sValue);
|
||||
}
|
||||
|
||||
public int getNumberOfValues() {
|
||||
return iCurrentPos;
|
||||
}
|
||||
|
||||
public palodatavalue getDataValue(int iPos) {
|
||||
return lstPaloValues.get(iPos);
|
||||
}
|
||||
|
||||
public void setData(palocube plCube, int SPLASH_MODE, boolean bAddValue, boolean bUseEventProcessor) throws paloexception {
|
||||
|
||||
StringBuilder sbCoordinates = new StringBuilder();
|
||||
StringBuilder sbValues = new StringBuilder();
|
||||
int iPos = 0;
|
||||
for (int i = 0; i < iCurrentPos; i++) {
|
||||
// for(palodatavalue plValue : this.lstPaloValues){
|
||||
palodatavalue plValue = getDataValue(i);
|
||||
if (iPos > 0) {
|
||||
sbCoordinates.append(":");
|
||||
sbValues.append(":");
|
||||
}
|
||||
sbCoordinates.append(plValue.getCoordinatesString());
|
||||
if (palodatavalue.PALO_NUMERIC == plValue.getType()) {
|
||||
sbValues.append(plValue.getDoubleValue());
|
||||
} else {
|
||||
sbValues.append(plValue.getStringValue());
|
||||
}
|
||||
iPos++;
|
||||
}
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(plCube.getCubeId())));
|
||||
|
||||
qparams.add(new BasicNameValuePair("paths", sbCoordinates.toString()));
|
||||
qparams.add(new BasicNameValuePair("values", sbValues.toString()));
|
||||
qparams.add(new BasicNameValuePair("add", palohelpers.BooleanToString(bAddValue)));
|
||||
qparams.add(new BasicNameValuePair("event_processor", palohelpers.BooleanToString(bUseEventProcessor)));
|
||||
qparams.add(new BasicNameValuePair("splash", String.valueOf(SPLASH_MODE)));
|
||||
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/cell/replace_bulk");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
csv.readNext();
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private String[] replaceStringArrWithElementId(String[] strArr) {
|
||||
for (int i = 0; i < strArr.length; i++) {
|
||||
paloelement plElm = alPaloElements.get(i).getElement(strArr[i]);
|
||||
if (null == plElm) {
|
||||
strArr[i] = "-1";
|
||||
} else {
|
||||
strArr[i] = String.valueOf(plElm.getElementIdentifier());
|
||||
}
|
||||
}
|
||||
return strArr;
|
||||
}
|
||||
|
||||
qparams.add(new BasicNameValuePair("paths", sbCoordinates.toString()));
|
||||
qparams.add(new BasicNameValuePair("values", sbValues.toString()));
|
||||
qparams.add(new BasicNameValuePair("add", palohelpers.BooleanToString(bAddValue)));
|
||||
qparams.add(new BasicNameValuePair("event_processor", palohelpers.BooleanToString(bUseEventProcessor)));
|
||||
qparams.add(new BasicNameValuePair("splash", String.valueOf(SPLASH_MODE)));
|
||||
|
||||
try{
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/cell/replace_bulk");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.readRecord();
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private String[] replaceStringArrWithElementId(String[] strArr){
|
||||
for(int i=0;i<strArr.length;i++){
|
||||
paloelement plElm = alPaloElements.get(i).getElement(strArr[i]);
|
||||
if(null==plElm) strArr[i]="-1";
|
||||
else strArr[i] = String.valueOf(plElm.getElementIdentifier());
|
||||
}
|
||||
return strArr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -9,233 +8,222 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.csvreader.CsvReader;
|
||||
import com.talend.csv.CSVReader;
|
||||
|
||||
public class palodimension {
|
||||
|
||||
|
||||
private paloelements paloElements;
|
||||
|
||||
private paloelements paloElements;
|
||||
private paloconnection plConn;
|
||||
private long lDatabaseId;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private String strCubeName;
|
||||
|
||||
private String strDimensionName;
|
||||
private int iDimensionId;
|
||||
@SuppressWarnings("unused")
|
||||
private int iAssocDimension;
|
||||
private int iAttributCube;
|
||||
private int iRightsCube;
|
||||
private int iNumberOfElements;
|
||||
private int iMaximumLevel;
|
||||
private int iMaximumIndent;
|
||||
private int iMaximumDepth;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int iDimensionToken;
|
||||
private int iDimensionType;
|
||||
private paloconnection plConn;
|
||||
|
||||
public palodimension(paloconnection plConn, long lDatabaseId,
|
||||
String strDimensionName,
|
||||
int iDimensionId,
|
||||
int iAssocDimension,
|
||||
int iAttributCube,
|
||||
int iRightsCube,
|
||||
int iNumberOfElements,
|
||||
int iMaximumLevel,
|
||||
int iMaximumIndent,
|
||||
int iMaximumDepth,
|
||||
int iDimensionToken
|
||||
){
|
||||
super();
|
||||
this.plConn = plConn;
|
||||
this.lDatabaseId = lDatabaseId;
|
||||
this.strDimensionName=strDimensionName;
|
||||
this.iDimensionId=iDimensionId;
|
||||
this.iAssocDimension=iAssocDimension;
|
||||
this.iAttributCube=iAttributCube;
|
||||
this.iRightsCube=iRightsCube;
|
||||
this.iNumberOfElements=iNumberOfElements;
|
||||
this.iMaximumLevel=iMaximumLevel;
|
||||
this.iMaximumIndent=iMaximumIndent;
|
||||
this.iMaximumDepth=iMaximumDepth;
|
||||
this.iDimensionToken=iDimensionToken;
|
||||
}
|
||||
|
||||
private long lDatabaseId;
|
||||
|
||||
public paloelements getElements(boolean bRefresh) throws paloexception {
|
||||
if(null==paloElements || bRefresh)
|
||||
paloElements = new paloelements(plConn, this.lDatabaseId, this.iDimensionId);
|
||||
return paloElements;
|
||||
}
|
||||
|
||||
|
||||
public paloelements getElements() throws paloexception {
|
||||
paloElements = new paloelements(plConn, this.lDatabaseId, this.iDimensionId);
|
||||
//return new paloelements(plConn, this.lDatabaseId, this.iDimensionId);
|
||||
return paloElements;
|
||||
}
|
||||
|
||||
public paloelements getElements(HashSet<String> hsFilteredElements) throws paloexception {
|
||||
return new paloelements(plConn, this.lDatabaseId, this.iDimensionId, hsFilteredElements);
|
||||
}
|
||||
|
||||
public String getName(){
|
||||
return strDimensionName;
|
||||
}
|
||||
public int getDimensionId(){
|
||||
return iDimensionId;
|
||||
}
|
||||
|
||||
|
||||
public String getAssocDimension(){
|
||||
@SuppressWarnings("unused")
|
||||
private String strCubeName;
|
||||
|
||||
return "";//return iAssocDimension;
|
||||
}
|
||||
|
||||
public String getAttributCube() throws paloexception{
|
||||
try{
|
||||
palocubes plCubes = getCubes(palocubes.CUBE_ATTRIBUT);
|
||||
if(plCubes!=null && this.iAttributCube > 1){
|
||||
palocube plAttributeCube = plCubes.getCubeByIdentifier(this.iAttributCube);
|
||||
if(plAttributeCube!=null) return plAttributeCube.getName();
|
||||
}
|
||||
}catch(Exception e){
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
public String getRightsCube(){
|
||||
try{
|
||||
palocubes plCubes = getCubes(palocubes.CUBE_SYSTEM);
|
||||
if(plCubes!=null && this.iRightsCube > 1){
|
||||
palocube plAttributeCube = plCubes.getCubeByIdentifier(this.iRightsCube);
|
||||
if(plAttributeCube!=null) return plAttributeCube.getName();
|
||||
}
|
||||
}catch(Exception e){
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public int getNumberOfElements(){
|
||||
return iNumberOfElements;
|
||||
}
|
||||
public int getMaximumLevel(){
|
||||
return iMaximumLevel;
|
||||
}
|
||||
public int getMaximumIndent(){
|
||||
return iMaximumIndent;
|
||||
}
|
||||
public int getMaximumDepth(){
|
||||
return iMaximumDepth;
|
||||
}
|
||||
public int getDimensionType(){
|
||||
return iDimensionType;
|
||||
}
|
||||
private String strDimensionName;
|
||||
|
||||
private int iDimensionId;
|
||||
|
||||
|
||||
public void rename(String strDimensionNewName) throws paloexception{
|
||||
if(null!=strDimensionNewName && strDimensionNewName.length()>0 && !strDimensionName.equals(strDimensionNewName)){
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
qparams.add(new BasicNameValuePair("new_name", strDimensionNewName));
|
||||
|
||||
try{
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/dimension/rename");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
//CsvReader csv = new CsvReader(this.plConn.sendToServer(qparams, "/dimension/rename").getContent(), Charset.defaultCharset());
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.readRecord();
|
||||
this.strDimensionName= csv.get(1);
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public palocubes getCubes() throws paloexception{
|
||||
return new palocubes(this.plConn, this.lDatabaseId, this.iDimensionType, this.iDimensionId);
|
||||
}
|
||||
|
||||
|
||||
public palocubes getCubes(int iCubeType) throws paloexception{
|
||||
return new palocubes(this.plConn, this.lDatabaseId, iCubeType, this.iDimensionId);
|
||||
}
|
||||
@SuppressWarnings("unused")
|
||||
private int iAssocDimension;
|
||||
|
||||
|
||||
|
||||
public void clear() throws paloexception{
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
|
||||
try{
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/dimension/clear");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
|
||||
//CsvReader csv = new CsvReader(this.plConn.sendToServer(qparams, "/dimension/clear").getContent(), Charset.defaultCharset());
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.readRecord();
|
||||
this.strDimensionName= csv.get(1);
|
||||
this.iDimensionId=Integer.valueOf(csv.get(0));
|
||||
this.iAssocDimension=palohelpers.StringToInt(csv.get(7));
|
||||
this.iAttributCube=palohelpers.StringToInt(csv.get(8));
|
||||
this.iRightsCube=palohelpers.StringToInt(csv.get(9));
|
||||
this.iNumberOfElements=palohelpers.StringToInt(csv.get(2));
|
||||
this.iMaximumLevel=palohelpers.StringToInt(csv.get(3));
|
||||
this.iMaximumIndent=palohelpers.StringToInt(csv.get(4));
|
||||
this.iMaximumDepth=palohelpers.StringToInt(csv.get(5));
|
||||
this.iDimensionToken=palohelpers.StringToInt(csv.get(10));
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
private int iAttributCube;
|
||||
|
||||
private int iRightsCube;
|
||||
|
||||
private int iNumberOfElements;
|
||||
|
||||
private int iMaximumLevel;
|
||||
|
||||
private int iMaximumIndent;
|
||||
|
||||
private int iMaximumDepth;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int iDimensionToken;
|
||||
|
||||
private int iDimensionType;
|
||||
|
||||
public palodimension(paloconnection plConn, long lDatabaseId, String strDimensionName, int iDimensionId, int iAssocDimension,
|
||||
int iAttributCube, int iRightsCube, int iNumberOfElements, int iMaximumLevel, int iMaximumIndent, int iMaximumDepth,
|
||||
int iDimensionToken) {
|
||||
super();
|
||||
this.plConn = plConn;
|
||||
this.lDatabaseId = lDatabaseId;
|
||||
this.strDimensionName = strDimensionName;
|
||||
this.iDimensionId = iDimensionId;
|
||||
this.iAssocDimension = iAssocDimension;
|
||||
this.iAttributCube = iAttributCube;
|
||||
this.iRightsCube = iRightsCube;
|
||||
this.iNumberOfElements = iNumberOfElements;
|
||||
this.iMaximumLevel = iMaximumLevel;
|
||||
this.iMaximumIndent = iMaximumIndent;
|
||||
this.iMaximumDepth = iMaximumDepth;
|
||||
this.iDimensionToken = iDimensionToken;
|
||||
}
|
||||
|
||||
public paloelements getElements(boolean bRefresh) throws paloexception {
|
||||
if (null == paloElements || bRefresh) {
|
||||
paloElements = new paloelements(plConn, this.lDatabaseId, this.iDimensionId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void refreshDimensionInfo() throws paloexception{
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
|
||||
try{
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/dimension/info");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
|
||||
//CsvReader csv = new CsvReader(this.plConn.sendToServer(qparams, "/dimension/info").getContent(), Charset.defaultCharset());
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.readRecord();
|
||||
this.strDimensionName= csv.get(1);
|
||||
this.iDimensionId=Integer.valueOf(csv.get(0));
|
||||
this.iAssocDimension=palohelpers.StringToInt(csv.get(7));
|
||||
this.iAttributCube=palohelpers.StringToInt(csv.get(8));
|
||||
this.iRightsCube=palohelpers.StringToInt(csv.get(9));
|
||||
this.iNumberOfElements=palohelpers.StringToInt(csv.get(2));
|
||||
this.iMaximumLevel=palohelpers.StringToInt(csv.get(3));
|
||||
this.iMaximumIndent=palohelpers.StringToInt(csv.get(4));
|
||||
this.iMaximumDepth=palohelpers.StringToInt(csv.get(5));
|
||||
this.iDimensionToken=palohelpers.StringToInt(csv.get(10));
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
return paloElements;
|
||||
}
|
||||
|
||||
public paloelements getElements() throws paloexception {
|
||||
paloElements = new paloelements(plConn, this.lDatabaseId, this.iDimensionId);
|
||||
// return new paloelements(plConn, this.lDatabaseId, this.iDimensionId);
|
||||
return paloElements;
|
||||
}
|
||||
|
||||
public paloelements getElements(HashSet<String> hsFilteredElements) throws paloexception {
|
||||
return new paloelements(plConn, this.lDatabaseId, this.iDimensionId, hsFilteredElements);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return strDimensionName;
|
||||
}
|
||||
|
||||
public int getDimensionId() {
|
||||
return iDimensionId;
|
||||
}
|
||||
|
||||
public String getAssocDimension() {
|
||||
|
||||
return "";// return iAssocDimension;
|
||||
}
|
||||
|
||||
public String getAttributCube() throws paloexception {
|
||||
try {
|
||||
palocubes plCubes = getCubes(palocubes.CUBE_ATTRIBUT);
|
||||
if (plCubes != null && this.iAttributCube > 1) {
|
||||
palocube plAttributeCube = plCubes.getCubeByIdentifier(this.iAttributCube);
|
||||
if (plAttributeCube != null) {
|
||||
return plAttributeCube.getName();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getRightsCube() {
|
||||
try {
|
||||
palocubes plCubes = getCubes(palocubes.CUBE_SYSTEM);
|
||||
if (plCubes != null && this.iRightsCube > 1) {
|
||||
palocube plAttributeCube = plCubes.getCubeByIdentifier(this.iRightsCube);
|
||||
if (plAttributeCube != null) {
|
||||
return plAttributeCube.getName();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public int getNumberOfElements() {
|
||||
return iNumberOfElements;
|
||||
}
|
||||
|
||||
public int getMaximumLevel() {
|
||||
return iMaximumLevel;
|
||||
}
|
||||
|
||||
public int getMaximumIndent() {
|
||||
return iMaximumIndent;
|
||||
}
|
||||
|
||||
public int getMaximumDepth() {
|
||||
return iMaximumDepth;
|
||||
}
|
||||
|
||||
public int getDimensionType() {
|
||||
return iDimensionType;
|
||||
}
|
||||
|
||||
public void rename(String strDimensionNewName) throws paloexception {
|
||||
if (null != strDimensionNewName && strDimensionNewName.length() > 0 && !strDimensionName.equals(strDimensionNewName)) {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
qparams.add(new BasicNameValuePair("new_name", strDimensionNewName));
|
||||
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/dimension/rename");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
csv.readNext();
|
||||
this.strDimensionName = csv.get(1);
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public palocubes getCubes() throws paloexception {
|
||||
return new palocubes(this.plConn, this.lDatabaseId, this.iDimensionType, this.iDimensionId);
|
||||
}
|
||||
|
||||
public palocubes getCubes(int iCubeType) throws paloexception {
|
||||
return new palocubes(this.plConn, this.lDatabaseId, iCubeType, this.iDimensionId);
|
||||
}
|
||||
|
||||
public void clear() throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/dimension/clear");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
csv.readNext();
|
||||
this.strDimensionName = csv.get(1);
|
||||
this.iDimensionId = Integer.valueOf(csv.get(0));
|
||||
this.iAssocDimension = palohelpers.StringToInt(csv.get(7));
|
||||
this.iAttributCube = palohelpers.StringToInt(csv.get(8));
|
||||
this.iRightsCube = palohelpers.StringToInt(csv.get(9));
|
||||
this.iNumberOfElements = palohelpers.StringToInt(csv.get(2));
|
||||
this.iMaximumLevel = palohelpers.StringToInt(csv.get(3));
|
||||
this.iMaximumIndent = palohelpers.StringToInt(csv.get(4));
|
||||
this.iMaximumDepth = palohelpers.StringToInt(csv.get(5));
|
||||
this.iDimensionToken = palohelpers.StringToInt(csv.get(10));
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshDimensionInfo() throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/dimension/info");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
csv.readNext();
|
||||
this.strDimensionName = csv.get(1);
|
||||
this.iDimensionId = Integer.valueOf(csv.get(0));
|
||||
this.iAssocDimension = palohelpers.StringToInt(csv.get(7));
|
||||
this.iAttributCube = palohelpers.StringToInt(csv.get(8));
|
||||
this.iRightsCube = palohelpers.StringToInt(csv.get(9));
|
||||
this.iNumberOfElements = palohelpers.StringToInt(csv.get(2));
|
||||
this.iMaximumLevel = palohelpers.StringToInt(csv.get(3));
|
||||
this.iMaximumIndent = palohelpers.StringToInt(csv.get(4));
|
||||
this.iMaximumDepth = palohelpers.StringToInt(csv.get(5));
|
||||
this.iDimensionToken = palohelpers.StringToInt(csv.get(10));
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -8,273 +7,247 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.csvreader.CsvReader;
|
||||
import com.talend.csv.CSVReader;
|
||||
|
||||
public class palodimensions {
|
||||
|
||||
public static final int DIMENSION_UNKNOWN=-1;
|
||||
public static final int DIMENSION_NORMAL =0;
|
||||
public static final int DIMENSION_SYSTEM =1;
|
||||
public static final int DIMENSION_ATTRIBUTE =2;
|
||||
public static final int DIMENSION_USER_INFO =3;
|
||||
|
||||
public static final int DIMENSION_UNKNOWN = -1;
|
||||
|
||||
private ArrayList<palodimension> paloDimensions = new ArrayList<palodimension>();
|
||||
|
||||
private paloconnection plConn;
|
||||
private palodatabase plDB;
|
||||
|
||||
private String strDatabaseName;
|
||||
private String strCubeName;
|
||||
|
||||
|
||||
|
||||
public palodimensions(paloconnection plConn, palodatabase plDB, int iDimensionType) throws paloexception{
|
||||
super();
|
||||
|
||||
this.plConn = plConn;
|
||||
this.plDB = plDB;
|
||||
|
||||
strDatabaseName = plDB.getName();
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.plDB.getDatabaseId())));
|
||||
|
||||
switch(iDimensionType){
|
||||
case DIMENSION_NORMAL:
|
||||
qparams.add(new BasicNameValuePair("show_normal","1"));
|
||||
qparams.add(new BasicNameValuePair("show_system","0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","0"));
|
||||
qparams.add(new BasicNameValuePair("show_info","0"));
|
||||
break;
|
||||
case DIMENSION_SYSTEM:
|
||||
qparams.add(new BasicNameValuePair("show_normal","0"));
|
||||
qparams.add(new BasicNameValuePair("show_system","1"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","0"));
|
||||
qparams.add(new BasicNameValuePair("show_info","0"));
|
||||
break;
|
||||
case DIMENSION_ATTRIBUTE:
|
||||
qparams.add(new BasicNameValuePair("show_normal","1"));
|
||||
qparams.add(new BasicNameValuePair("show_system","0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","1"));
|
||||
qparams.add(new BasicNameValuePair("show_info","0"));
|
||||
break;
|
||||
case DIMENSION_USER_INFO:
|
||||
qparams.add(new BasicNameValuePair("show_normal","0"));
|
||||
qparams.add(new BasicNameValuePair("show_system","0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","0"));
|
||||
qparams.add(new BasicNameValuePair("show_info","1"));
|
||||
break;
|
||||
case DIMENSION_UNKNOWN:
|
||||
qparams.add(new BasicNameValuePair("show_normal","1"));
|
||||
qparams.add(new BasicNameValuePair("show_system","1"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","1"));
|
||||
qparams.add(new BasicNameValuePair("show_info","1"));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
try{
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/database/dimensions");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
while(csv.readRecord()){
|
||||
paloDimensions.add(new palodimension(
|
||||
this.plConn,
|
||||
this.plDB.getDatabaseId(),
|
||||
csv.get(1),
|
||||
Integer.valueOf(csv.get(0)),
|
||||
palohelpers.StringToInt(csv.get(7)),
|
||||
palohelpers.StringToInt(csv.get(8)),
|
||||
palohelpers.StringToInt(csv.get(9)),
|
||||
palohelpers.StringToInt(csv.get(2)),
|
||||
palohelpers.StringToInt(csv.get(3)),
|
||||
palohelpers.StringToInt(csv.get(4)),
|
||||
palohelpers.StringToInt(csv.get(5)),
|
||||
palohelpers.StringToInt(csv.get(10))
|
||||
));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
public static final int DIMENSION_NORMAL = 0;
|
||||
|
||||
|
||||
public palodimensions(paloconnection plConn, long lDatabaseId, int iDimensionType, int[] iArrDimensionsIdentifier) throws paloexception{
|
||||
|
||||
super();
|
||||
|
||||
this.plConn = plConn;
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
|
||||
switch(iDimensionType){
|
||||
case DIMENSION_NORMAL:
|
||||
qparams.add(new BasicNameValuePair("show_normal","1"));
|
||||
qparams.add(new BasicNameValuePair("show_system","0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","0"));
|
||||
qparams.add(new BasicNameValuePair("show_info","0"));
|
||||
break;
|
||||
case DIMENSION_SYSTEM:
|
||||
qparams.add(new BasicNameValuePair("show_normal","0"));
|
||||
qparams.add(new BasicNameValuePair("show_system","1"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","0"));
|
||||
qparams.add(new BasicNameValuePair("show_info","0"));
|
||||
break;
|
||||
case DIMENSION_ATTRIBUTE:
|
||||
qparams.add(new BasicNameValuePair("show_normal","1"));
|
||||
qparams.add(new BasicNameValuePair("show_system","0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","1"));
|
||||
qparams.add(new BasicNameValuePair("show_info","0"));
|
||||
break;
|
||||
case DIMENSION_USER_INFO:
|
||||
qparams.add(new BasicNameValuePair("show_normal","0"));
|
||||
qparams.add(new BasicNameValuePair("show_system","0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","0"));
|
||||
qparams.add(new BasicNameValuePair("show_info","1"));
|
||||
break;
|
||||
case DIMENSION_UNKNOWN:
|
||||
qparams.add(new BasicNameValuePair("show_normal","1"));
|
||||
qparams.add(new BasicNameValuePair("show_system","1"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute","1"));
|
||||
qparams.add(new BasicNameValuePair("show_info","1"));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
try{
|
||||
|
||||
ArrayList<palodimension> paloDimensionsCube = new ArrayList<palodimension>();
|
||||
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/database/dimensions");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
while(csv.readRecord()){
|
||||
paloDimensionsCube.add(new palodimension(
|
||||
this.plConn,
|
||||
lDatabaseId,
|
||||
csv.get(1),
|
||||
Integer.valueOf(csv.get(0)),
|
||||
palohelpers.StringToInt(csv.get(7)),
|
||||
palohelpers.StringToInt(csv.get(8)),
|
||||
palohelpers.StringToInt(csv.get(9)),
|
||||
palohelpers.StringToInt(csv.get(2)),
|
||||
palohelpers.StringToInt(csv.get(3)),
|
||||
palohelpers.StringToInt(csv.get(4)),
|
||||
palohelpers.StringToInt(csv.get(5)),
|
||||
palohelpers.StringToInt(csv.get(10))
|
||||
));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
|
||||
for(int i=0;i<iArrDimensionsIdentifier.length;i++){
|
||||
for(palodimension plDimCube : paloDimensionsCube){
|
||||
if(plDimCube.getDimensionId()==iArrDimensionsIdentifier[i]) paloDimensions.add(plDimCube);
|
||||
}
|
||||
}
|
||||
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public palodimension createDimension(String strDimensionName, int iType) throws paloexception{
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.plDB.getDatabaseId())));
|
||||
qparams.add(new BasicNameValuePair("new_name", strDimensionName));
|
||||
qparams.add(new BasicNameValuePair("type", String.valueOf(iType)));
|
||||
|
||||
try{
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/dimension/create");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
//CsvReader csv = new CsvReader(this.plConn.sendToServer(qparams, "/dimension/create").getContent(), Charset.defaultCharset());
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.readRecord();
|
||||
palodimension plDim = new palodimension(
|
||||
this.plConn,
|
||||
this.plDB.getDatabaseId(),
|
||||
csv.get(1),
|
||||
palohelpers.StringToInt(csv.get(0)),
|
||||
palohelpers.StringToInt(csv.get(7)),
|
||||
palohelpers.StringToInt(csv.get(8)),
|
||||
palohelpers.StringToInt(csv.get(9)),
|
||||
palohelpers.StringToInt(csv.get(2)),
|
||||
palohelpers.StringToInt(csv.get(3)),
|
||||
palohelpers.StringToInt(csv.get(4)),
|
||||
palohelpers.StringToInt(csv.get(5)),
|
||||
palohelpers.StringToInt(csv.get(10))
|
||||
);
|
||||
paloDimensions.add(plDim);
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
return plDim;
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public palodimension createDimension(String strDimensionName) throws paloexception{
|
||||
return createDimension(strDimensionName, palodimensions.DIMENSION_NORMAL);
|
||||
}
|
||||
|
||||
|
||||
public ArrayList<palodimension> getDimensions(){
|
||||
return paloDimensions;
|
||||
}
|
||||
|
||||
public String getDatabaseName(){
|
||||
return strDatabaseName;
|
||||
}
|
||||
|
||||
public String getCubeName(){
|
||||
return strCubeName;
|
||||
}
|
||||
public static final int DIMENSION_SYSTEM = 1;
|
||||
|
||||
public static final int DIMENSION_ATTRIBUTE = 2;
|
||||
|
||||
public static final int DIMENSION_USER_INFO = 3;
|
||||
|
||||
private ArrayList<palodimension> paloDimensions = new ArrayList<palodimension>();
|
||||
|
||||
private paloconnection plConn;
|
||||
|
||||
private palodatabase plDB;
|
||||
|
||||
private String strDatabaseName;
|
||||
|
||||
private String strCubeName;
|
||||
|
||||
public palodimensions(paloconnection plConn, palodatabase plDB, int iDimensionType) throws paloexception {
|
||||
super();
|
||||
|
||||
this.plConn = plConn;
|
||||
this.plDB = plDB;
|
||||
|
||||
strDatabaseName = plDB.getName();
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.plDB.getDatabaseId())));
|
||||
|
||||
switch (iDimensionType) {
|
||||
case DIMENSION_NORMAL:
|
||||
qparams.add(new BasicNameValuePair("show_normal", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_info", "0"));
|
||||
break;
|
||||
case DIMENSION_SYSTEM:
|
||||
qparams.add(new BasicNameValuePair("show_normal", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_info", "0"));
|
||||
break;
|
||||
case DIMENSION_ATTRIBUTE:
|
||||
qparams.add(new BasicNameValuePair("show_normal", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_info", "0"));
|
||||
break;
|
||||
case DIMENSION_USER_INFO:
|
||||
qparams.add(new BasicNameValuePair("show_normal", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_info", "1"));
|
||||
break;
|
||||
case DIMENSION_UNKNOWN:
|
||||
qparams.add(new BasicNameValuePair("show_normal", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_info", "1"));
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/database/dimensions");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
while (csv.readNext()) {
|
||||
paloDimensions.add(new palodimension(this.plConn, this.plDB.getDatabaseId(), csv.get(1), Integer.valueOf(csv
|
||||
.get(0)), palohelpers.StringToInt(csv.get(7)), palohelpers.StringToInt(csv.get(8)), palohelpers
|
||||
.StringToInt(csv.get(9)), palohelpers.StringToInt(csv.get(2)), palohelpers.StringToInt(csv.get(3)),
|
||||
palohelpers.StringToInt(csv.get(4)), palohelpers.StringToInt(csv.get(5)), palohelpers.StringToInt(csv
|
||||
.get(10))));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public palodimensions(paloconnection plConn, long lDatabaseId, int iDimensionType, int[] iArrDimensionsIdentifier)
|
||||
throws paloexception {
|
||||
|
||||
super();
|
||||
|
||||
this.plConn = plConn;
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
|
||||
switch (iDimensionType) {
|
||||
case DIMENSION_NORMAL:
|
||||
qparams.add(new BasicNameValuePair("show_normal", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_info", "0"));
|
||||
break;
|
||||
case DIMENSION_SYSTEM:
|
||||
qparams.add(new BasicNameValuePair("show_normal", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_info", "0"));
|
||||
break;
|
||||
case DIMENSION_ATTRIBUTE:
|
||||
qparams.add(new BasicNameValuePair("show_normal", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_info", "0"));
|
||||
break;
|
||||
case DIMENSION_USER_INFO:
|
||||
qparams.add(new BasicNameValuePair("show_normal", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "0"));
|
||||
qparams.add(new BasicNameValuePair("show_info", "1"));
|
||||
break;
|
||||
case DIMENSION_UNKNOWN:
|
||||
qparams.add(new BasicNameValuePair("show_normal", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_system", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_attribute", "1"));
|
||||
qparams.add(new BasicNameValuePair("show_info", "1"));
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
ArrayList<palodimension> paloDimensionsCube = new ArrayList<palodimension>();
|
||||
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/database/dimensions");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
while (csv.readNext()) {
|
||||
paloDimensionsCube.add(new palodimension(this.plConn, lDatabaseId, csv.get(1), Integer.valueOf(csv.get(0)),
|
||||
palohelpers.StringToInt(csv.get(7)), palohelpers.StringToInt(csv.get(8)), palohelpers.StringToInt(csv
|
||||
.get(9)), palohelpers.StringToInt(csv.get(2)), palohelpers.StringToInt(csv.get(3)), palohelpers
|
||||
.StringToInt(csv.get(4)), palohelpers.StringToInt(csv.get(5)), palohelpers.StringToInt(csv
|
||||
.get(10))));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
|
||||
for (int element : iArrDimensionsIdentifier) {
|
||||
for (palodimension plDimCube : paloDimensionsCube) {
|
||||
if (plDimCube.getDimensionId() == element) {
|
||||
paloDimensions.add(plDimCube);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public palodimension createDimension(String strDimensionName, int iType) throws paloexception {
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.plDB.getDatabaseId())));
|
||||
qparams.add(new BasicNameValuePair("new_name", strDimensionName));
|
||||
qparams.add(new BasicNameValuePair("type", String.valueOf(iType)));
|
||||
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/dimension/create");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
csv.readNext();
|
||||
palodimension plDim = new palodimension(this.plConn, this.plDB.getDatabaseId(), csv.get(1),
|
||||
palohelpers.StringToInt(csv.get(0)), palohelpers.StringToInt(csv.get(7)),
|
||||
palohelpers.StringToInt(csv.get(8)), palohelpers.StringToInt(csv.get(9)),
|
||||
palohelpers.StringToInt(csv.get(2)), palohelpers.StringToInt(csv.get(3)),
|
||||
palohelpers.StringToInt(csv.get(4)), palohelpers.StringToInt(csv.get(5)),
|
||||
palohelpers.StringToInt(csv.get(10)));
|
||||
paloDimensions.add(plDim);
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
return plDim;
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public palodimension createDimension(String strDimensionName) throws paloexception {
|
||||
return createDimension(strDimensionName, palodimensions.DIMENSION_NORMAL);
|
||||
}
|
||||
|
||||
public ArrayList<palodimension> getDimensions() {
|
||||
return paloDimensions;
|
||||
}
|
||||
|
||||
public String getDatabaseName() {
|
||||
return strDatabaseName;
|
||||
}
|
||||
|
||||
public String getCubeName() {
|
||||
return strCubeName;
|
||||
}
|
||||
|
||||
public int getNumberOfDimensions() {
|
||||
return paloDimensions.size();
|
||||
}
|
||||
|
||||
public palodimension getDimension(int iIndex) {
|
||||
return paloDimensions.get(iIndex);
|
||||
}
|
||||
|
||||
public palodimension getDimension(String strDimensionName) {
|
||||
for (palodimension palodim : paloDimensions) {
|
||||
if (palodim.getName().equals(strDimensionName)) {
|
||||
return palodim;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public palodimension getDimensionByIdentifier(int iDimensionId) {
|
||||
for (palodimension palodim : paloDimensions) {
|
||||
if (palodim.getDimensionId() == iDimensionId) {
|
||||
return palodim;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void deleteDimension(String strDimensionName) throws paloexception {
|
||||
palodimension paloDimToRemove = getDimension(strDimensionName);
|
||||
if (null != paloDimToRemove) {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(plDB.getDatabaseId())));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(paloDimToRemove.getDimensionId())));
|
||||
plConn.sendToServerSingleRC(qparams, "/dimension/destroy");
|
||||
paloDimensions.remove(paloDimToRemove);
|
||||
}
|
||||
}
|
||||
|
||||
public int getNumberOfDimensions(){
|
||||
return paloDimensions.size();
|
||||
}
|
||||
|
||||
public palodimension getDimension(int iIndex){
|
||||
return paloDimensions.get(iIndex);
|
||||
}
|
||||
|
||||
public palodimension getDimension(String strDimensionName){
|
||||
for(palodimension palodim : paloDimensions){
|
||||
if(palodim.getName().equals(strDimensionName)) return palodim;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public palodimension getDimensionByIdentifier(int iDimensionId){
|
||||
for(palodimension palodim : paloDimensions){
|
||||
if(palodim.getDimensionId()==iDimensionId) return palodim;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void deleteDimension(String strDimensionName) throws paloexception{
|
||||
palodimension paloDimToRemove = getDimension(strDimensionName);
|
||||
if(null != paloDimToRemove){
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(plDB.getDatabaseId())));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(paloDimToRemove.getDimensionId())));
|
||||
plConn.sendToServerSingleRC(qparams, "/dimension/destroy");
|
||||
paloDimensions.remove(paloDimToRemove);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -8,425 +7,438 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.csvreader.CsvReader;
|
||||
|
||||
import com.talend.csv.CSVReader;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class paloelement implements Comparable {
|
||||
public class paloelement implements Comparable {
|
||||
|
||||
/*
|
||||
private native void JNIupdateElement(paloelement plElem, paloconsolidations plCons, int iAddToConsolidation);
|
||||
*/
|
||||
|
||||
private paloconnection plConn;
|
||||
private long lDatabaseId;
|
||||
private int iDimensionId;
|
||||
|
||||
|
||||
private long lElementIdentifier;
|
||||
private String strElementName="";
|
||||
private int iElementType;
|
||||
private int iElementLevel;
|
||||
private int iElementIndent;
|
||||
private int iElementDepth;
|
||||
private int iElementPosition;
|
||||
private int iElementNumOfParents;
|
||||
private int[] iArrElementParents;
|
||||
private int iElementNumOfChildren;
|
||||
private int[] iArrElementChildren;
|
||||
private double[] dArrElementChildrenWeights;
|
||||
|
||||
private long lElementParentIdentifier;
|
||||
|
||||
private paloelements paloElements;
|
||||
|
||||
public paloelement(paloconnection plConn, long lDatabaseId, int iDimensionId, paloelements paloElements,
|
||||
long lElementIdentifier, //0 element identifier Identifier of the element
|
||||
String strElementName, //1 name_element string Name of the element
|
||||
int iElementPosition, //2 position integer Position of the element
|
||||
int iElementLevel, //3 level integer Level of the element
|
||||
int iElementIndent, //4 indent integer Indent of the element
|
||||
int iElementDepth, //5 depth integer Depth of the element
|
||||
int iElementType, //6 type integer Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED)
|
||||
int iElementNumOfParents, //7 number_parents integer Number of parents
|
||||
int[] iArrElementParents, //8 parents identifier Comma separate list of parent identifiers
|
||||
int iElementNumOfChildren, //9 number_children integer Number of children
|
||||
int[] iArrElementChildren, //10 children identifier Comma separate list of children identifiers
|
||||
double[] dArrElementChildrenWeights //11 weights double Comma separate list of children weight
|
||||
){
|
||||
super();
|
||||
this.plConn=plConn;
|
||||
this.lDatabaseId=lDatabaseId;
|
||||
this.iDimensionId=iDimensionId;
|
||||
this.paloElements = paloElements;
|
||||
this.lElementIdentifier=lElementIdentifier;
|
||||
this.strElementName=strElementName;
|
||||
this.iElementPosition=iElementPosition;
|
||||
this.iElementLevel=iElementLevel;
|
||||
this.iElementIndent=iElementIndent;
|
||||
this.iElementDepth= iElementDepth;
|
||||
this.iElementType=iElementType;
|
||||
this.iElementNumOfParents=iElementNumOfParents;
|
||||
this.iArrElementParents=iArrElementParents;
|
||||
this.iElementNumOfChildren=iElementNumOfChildren;
|
||||
this.iArrElementChildren=iArrElementChildren;
|
||||
this.dArrElementChildrenWeights=dArrElementChildrenWeights;
|
||||
|
||||
this.lElementParentIdentifier = (null==this.iArrElementParents)? this.lElementIdentifier : this.iArrElementParents[0];
|
||||
}
|
||||
/*
|
||||
* private native void JNIupdateElement(paloelement plElem, paloconsolidations plCons, int iAddToConsolidation);
|
||||
*/
|
||||
|
||||
|
||||
public paloelement(paloelements paloElements){
|
||||
super();
|
||||
this.paloElements = paloElements;
|
||||
}
|
||||
|
||||
/*
|
||||
public void setPaloElements(paloelements paloElements){
|
||||
this.paloElements = paloElements;
|
||||
}*/
|
||||
|
||||
public long getElementIdentifier(){
|
||||
return lElementIdentifier;
|
||||
}
|
||||
public String getName(){
|
||||
return strElementName;
|
||||
}
|
||||
public int getElementType(){
|
||||
return iElementType;
|
||||
}
|
||||
public long getElementLevel(){
|
||||
return iElementLevel;
|
||||
}
|
||||
public long getElementIndent(){
|
||||
return iElementIndent;
|
||||
}
|
||||
public long getElementDepth(){
|
||||
return iElementDepth;
|
||||
}
|
||||
public long getElementPosition(){
|
||||
return iElementPosition;
|
||||
}
|
||||
public long getElementNumOfParents(){
|
||||
return iElementNumOfParents;
|
||||
}
|
||||
public long getElementNumOfChildren(){
|
||||
return iElementNumOfChildren;
|
||||
}
|
||||
public long getElementParentIdentifier(){
|
||||
return lElementParentIdentifier;
|
||||
}
|
||||
|
||||
public boolean hasChildren(){
|
||||
if(iElementNumOfChildren>0) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isConsolidation(){
|
||||
if(paloelements.ELEMENT_CONSOLIDATION==iElementType) return true;
|
||||
return false;
|
||||
}
|
||||
public boolean isNumeric(){
|
||||
if(paloelements.ELEMENT_NUMERIC==iElementType) return true;
|
||||
return false;
|
||||
}
|
||||
public boolean isString(){
|
||||
if(paloelements.ELEMENT_STRING==iElementType) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isRule(){
|
||||
if(paloelements.ELEMENT_RULE==iElementType) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
StringBuffer sbRC = new StringBuffer();
|
||||
sbRC.append(lElementIdentifier+" / ");
|
||||
sbRC.append(strElementName+" / ");
|
||||
sbRC.append(iElementType+" / ");
|
||||
sbRC.append(iElementLevel+" / ");
|
||||
sbRC.append(iElementIndent+" / ");
|
||||
sbRC.append(iElementDepth+" / ");
|
||||
sbRC.append(iElementPosition+" / ");
|
||||
sbRC.append(iElementNumOfParents+" / ");
|
||||
sbRC.append(iElementNumOfChildren+" / ");
|
||||
sbRC.append(lElementParentIdentifier);
|
||||
return sbRC.toString();
|
||||
}
|
||||
|
||||
|
||||
public void rename(String strElementNewName) throws paloexception{
|
||||
if(null!=strElementNewName && strElementNewName.length()>0 && !strElementName.equals(strElementNewName)){
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(this.lElementIdentifier)));
|
||||
qparams.add(new BasicNameValuePair("new_name", strElementNewName));
|
||||
|
||||
try{
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/element/rename");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.readRecord();
|
||||
this.strElementName= csv.get(1);
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
strElementName = strElementNewName;
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getElementChildren(){
|
||||
return iArrElementChildren;
|
||||
}
|
||||
|
||||
public int[] getElementParents(){
|
||||
return iArrElementParents;
|
||||
}
|
||||
|
||||
public double[] getElementChildrenWeights(){
|
||||
return dArrElementChildrenWeights;
|
||||
}
|
||||
|
||||
|
||||
public void move(long lElementNewPosition) throws paloexception{
|
||||
if(lElementNewPosition >-1 && lElementNewPosition != iElementPosition){
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(this.lElementIdentifier)));
|
||||
qparams.add(new BasicNameValuePair("position", String.valueOf(lElementNewPosition)));
|
||||
|
||||
try{
|
||||
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/element/move");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.setUseTextQualifier(true);
|
||||
while(csv.readRecord()){
|
||||
this.lElementIdentifier = palohelpers.StringToLong(csv.get(0));
|
||||
this.strElementName = csv.get(1);
|
||||
this.iElementPosition = palohelpers.StringToInt(csv.get(2));
|
||||
this.iElementLevel = palohelpers.StringToInt(csv.get(3));
|
||||
this.iElementIndent = palohelpers.StringToInt(csv.get(4));
|
||||
this.iElementDepth = palohelpers.StringToInt(csv.get(5));
|
||||
this.iElementType = palohelpers.StringToInt(csv.get(6));
|
||||
this.iElementNumOfParents = palohelpers.StringToInt(csv.get(7));
|
||||
this.iArrElementParents = palohelpers.StringToIntArray(csv.get(8), palohelpers.StringToInt(csv.get(7)));
|
||||
this.iElementNumOfChildren = palohelpers.StringToInt(csv.get(9));
|
||||
this.iArrElementChildren = palohelpers.StringToIntArray(csv.get(10), palohelpers.StringToInt(csv.get(9)));
|
||||
this.dArrElementChildrenWeights = palohelpers.StringToDoubleArray(csv.get(11), palohelpers.StringToInt(csv.get(9)));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//get father paloelement
|
||||
public paloelement getFatherPaloelement() throws paloexception{
|
||||
long identifier = getElementParentIdentifier();
|
||||
paloelement plElm = null;
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(identifier)));
|
||||
|
||||
try{
|
||||
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/element/info");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.setUseTextQualifier(true);
|
||||
while(csv.readRecord()){
|
||||
if(palohelpers.StringToLong(csv.get(0)) == identifier){
|
||||
plElm = new paloelement(
|
||||
this.plConn,
|
||||
this.lDatabaseId,
|
||||
this.iDimensionId,
|
||||
paloElements,
|
||||
palohelpers.StringToLong(csv.get(0)),
|
||||
csv.get(1),
|
||||
palohelpers.StringToInt(csv.get(2)),
|
||||
palohelpers.StringToInt(csv.get(3)),
|
||||
palohelpers.StringToInt(csv.get(4)),
|
||||
palohelpers.StringToInt(csv.get(5)),
|
||||
palohelpers.StringToInt(csv.get(6)),
|
||||
palohelpers.StringToInt(csv.get(7)),
|
||||
palohelpers.StringToIntArray(csv.get(8), palohelpers.StringToInt(csv.get(7))),
|
||||
palohelpers.StringToInt(csv.get(9)),
|
||||
palohelpers.StringToIntArray(csv.get(10), palohelpers.StringToInt(csv.get(9))),
|
||||
palohelpers.StringToDoubleArray(csv.get(11), palohelpers.StringToInt(csv.get(9))));
|
||||
}
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
private paloconnection plConn;
|
||||
|
||||
private long lDatabaseId;
|
||||
|
||||
private int iDimensionId;
|
||||
|
||||
private long lElementIdentifier;
|
||||
|
||||
private String strElementName = "";
|
||||
|
||||
private int iElementType;
|
||||
|
||||
private int iElementLevel;
|
||||
|
||||
private int iElementIndent;
|
||||
|
||||
private int iElementDepth;
|
||||
|
||||
private int iElementPosition;
|
||||
|
||||
private int iElementNumOfParents;
|
||||
|
||||
private int[] iArrElementParents;
|
||||
|
||||
private int iElementNumOfChildren;
|
||||
|
||||
private int[] iArrElementChildren;
|
||||
|
||||
private double[] dArrElementChildrenWeights;
|
||||
|
||||
private long lElementParentIdentifier;
|
||||
|
||||
private paloelements paloElements;
|
||||
|
||||
public paloelement(paloconnection plConn, long lDatabaseId, int iDimensionId, paloelements paloElements,
|
||||
long lElementIdentifier, // 0 element identifier Identifier of the element
|
||||
String strElementName, // 1 name_element string Name of the element
|
||||
int iElementPosition, // 2 position integer Position of the element
|
||||
int iElementLevel, // 3 level integer Level of the element
|
||||
int iElementIndent, // 4 indent integer Indent of the element
|
||||
int iElementDepth, // 5 depth integer Depth of the element
|
||||
int iElementType, // 6 type integer Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED)
|
||||
int iElementNumOfParents, // 7 number_parents integer Number of parents
|
||||
int[] iArrElementParents, // 8 parents identifier Comma separate list of parent identifiers
|
||||
int iElementNumOfChildren, // 9 number_children integer Number of children
|
||||
int[] iArrElementChildren, // 10 children identifier Comma separate list of children identifiers
|
||||
double[] dArrElementChildrenWeights // 11 weights double Comma separate list of children weight
|
||||
) {
|
||||
super();
|
||||
this.plConn = plConn;
|
||||
this.lDatabaseId = lDatabaseId;
|
||||
this.iDimensionId = iDimensionId;
|
||||
this.paloElements = paloElements;
|
||||
this.lElementIdentifier = lElementIdentifier;
|
||||
this.strElementName = strElementName;
|
||||
this.iElementPosition = iElementPosition;
|
||||
this.iElementLevel = iElementLevel;
|
||||
this.iElementIndent = iElementIndent;
|
||||
this.iElementDepth = iElementDepth;
|
||||
this.iElementType = iElementType;
|
||||
this.iElementNumOfParents = iElementNumOfParents;
|
||||
this.iArrElementParents = iArrElementParents;
|
||||
this.iElementNumOfChildren = iElementNumOfChildren;
|
||||
this.iArrElementChildren = iArrElementChildren;
|
||||
this.dArrElementChildrenWeights = dArrElementChildrenWeights;
|
||||
|
||||
this.lElementParentIdentifier = (null == this.iArrElementParents) ? this.lElementIdentifier : this.iArrElementParents[0];
|
||||
}
|
||||
|
||||
public paloelement(paloelements paloElements) {
|
||||
super();
|
||||
this.paloElements = paloElements;
|
||||
}
|
||||
|
||||
/*
|
||||
* public void setPaloElements(paloelements paloElements){ this.paloElements = paloElements; }
|
||||
*/
|
||||
|
||||
public long getElementIdentifier() {
|
||||
return lElementIdentifier;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return strElementName;
|
||||
}
|
||||
|
||||
public int getElementType() {
|
||||
return iElementType;
|
||||
}
|
||||
|
||||
public long getElementLevel() {
|
||||
return iElementLevel;
|
||||
}
|
||||
|
||||
public long getElementIndent() {
|
||||
return iElementIndent;
|
||||
}
|
||||
|
||||
public long getElementDepth() {
|
||||
return iElementDepth;
|
||||
}
|
||||
|
||||
public long getElementPosition() {
|
||||
return iElementPosition;
|
||||
}
|
||||
|
||||
public long getElementNumOfParents() {
|
||||
return iElementNumOfParents;
|
||||
}
|
||||
|
||||
public long getElementNumOfChildren() {
|
||||
return iElementNumOfChildren;
|
||||
}
|
||||
|
||||
public long getElementParentIdentifier() {
|
||||
return lElementParentIdentifier;
|
||||
}
|
||||
|
||||
public boolean hasChildren() {
|
||||
if (iElementNumOfChildren > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isConsolidation() {
|
||||
if (paloelements.ELEMENT_CONSOLIDATION == iElementType) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isNumeric() {
|
||||
if (paloelements.ELEMENT_NUMERIC == iElementType) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isString() {
|
||||
if (paloelements.ELEMENT_STRING == iElementType) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isRule() {
|
||||
if (paloelements.ELEMENT_RULE == iElementType) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer sbRC = new StringBuffer();
|
||||
sbRC.append(lElementIdentifier + " / ");
|
||||
sbRC.append(strElementName + " / ");
|
||||
sbRC.append(iElementType + " / ");
|
||||
sbRC.append(iElementLevel + " / ");
|
||||
sbRC.append(iElementIndent + " / ");
|
||||
sbRC.append(iElementDepth + " / ");
|
||||
sbRC.append(iElementPosition + " / ");
|
||||
sbRC.append(iElementNumOfParents + " / ");
|
||||
sbRC.append(iElementNumOfChildren + " / ");
|
||||
sbRC.append(lElementParentIdentifier);
|
||||
return sbRC.toString();
|
||||
}
|
||||
|
||||
public void rename(String strElementNewName) throws paloexception {
|
||||
if (null != strElementNewName && strElementNewName.length() > 0 && !strElementName.equals(strElementNewName)) {
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(this.lElementIdentifier)));
|
||||
qparams.add(new BasicNameValuePair("new_name", strElementNewName));
|
||||
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/element/rename");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
csv.readNext();
|
||||
this.strElementName = csv.get(1);
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
strElementName = strElementNewName;
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getElementChildren() {
|
||||
return iArrElementChildren;
|
||||
}
|
||||
|
||||
public int[] getElementParents() {
|
||||
return iArrElementParents;
|
||||
}
|
||||
|
||||
public double[] getElementChildrenWeights() {
|
||||
return dArrElementChildrenWeights;
|
||||
}
|
||||
|
||||
public void move(long lElementNewPosition) throws paloexception {
|
||||
if (lElementNewPosition > -1 && lElementNewPosition != iElementPosition) {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(this.lElementIdentifier)));
|
||||
qparams.add(new BasicNameValuePair("position", String.valueOf(lElementNewPosition)));
|
||||
|
||||
try {
|
||||
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/element/move");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
while (csv.readNext()) {
|
||||
this.lElementIdentifier = palohelpers.StringToLong(csv.get(0));
|
||||
this.strElementName = csv.get(1);
|
||||
this.iElementPosition = palohelpers.StringToInt(csv.get(2));
|
||||
this.iElementLevel = palohelpers.StringToInt(csv.get(3));
|
||||
this.iElementIndent = palohelpers.StringToInt(csv.get(4));
|
||||
this.iElementDepth = palohelpers.StringToInt(csv.get(5));
|
||||
this.iElementType = palohelpers.StringToInt(csv.get(6));
|
||||
this.iElementNumOfParents = palohelpers.StringToInt(csv.get(7));
|
||||
this.iArrElementParents = palohelpers.StringToIntArray(csv.get(8), palohelpers.StringToInt(csv.get(7)));
|
||||
this.iElementNumOfChildren = palohelpers.StringToInt(csv.get(9));
|
||||
this.iArrElementChildren = palohelpers.StringToIntArray(csv.get(10), palohelpers.StringToInt(csv.get(9)));
|
||||
this.dArrElementChildrenWeights = palohelpers.StringToDoubleArray(csv.get(11),
|
||||
palohelpers.StringToInt(csv.get(9)));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get father paloelement
|
||||
public paloelement getFatherPaloelement() throws paloexception {
|
||||
long identifier = getElementParentIdentifier();
|
||||
paloelement plElm = null;
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(identifier)));
|
||||
|
||||
try {
|
||||
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/element/info");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
while (csv.readNext()) {
|
||||
if (palohelpers.StringToLong(csv.get(0)) == identifier) {
|
||||
plElm = new paloelement(this.plConn, this.lDatabaseId, this.iDimensionId, paloElements,
|
||||
palohelpers.StringToLong(csv.get(0)), csv.get(1), palohelpers.StringToInt(csv.get(2)),
|
||||
palohelpers.StringToInt(csv.get(3)), palohelpers.StringToInt(csv.get(4)), palohelpers.StringToInt(csv
|
||||
.get(5)), palohelpers.StringToInt(csv.get(6)), palohelpers.StringToInt(csv.get(7)),
|
||||
palohelpers.StringToIntArray(csv.get(8), palohelpers.StringToInt(csv.get(7))),
|
||||
palohelpers.StringToInt(csv.get(9)), palohelpers.StringToIntArray(csv.get(10),
|
||||
palohelpers.StringToInt(csv.get(9))), palohelpers.StringToDoubleArray(csv.get(11),
|
||||
palohelpers.StringToInt(csv.get(9))));
|
||||
}
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
return plElm;
|
||||
}
|
||||
|
||||
public void refreshElementInfo() throws paloexception{
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(this.lElementIdentifier)));
|
||||
|
||||
try{
|
||||
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/element/info");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.setUseTextQualifier(true);
|
||||
while(csv.readRecord()){
|
||||
this.lElementIdentifier = palohelpers.StringToLong(csv.get(0));
|
||||
this.strElementName = csv.get(1);
|
||||
this.iElementPosition = palohelpers.StringToInt(csv.get(2));
|
||||
this.iElementLevel = palohelpers.StringToInt(csv.get(3));
|
||||
this.iElementIndent = palohelpers.StringToInt(csv.get(4));
|
||||
this.iElementDepth = palohelpers.StringToInt(csv.get(5));
|
||||
this.iElementType = palohelpers.StringToInt(csv.get(6));
|
||||
this.iElementNumOfParents = palohelpers.StringToInt(csv.get(7));
|
||||
this.iArrElementParents = palohelpers.StringToIntArray(csv.get(8), palohelpers.StringToInt(csv.get(7)));
|
||||
this.iElementNumOfChildren = palohelpers.StringToInt(csv.get(9));
|
||||
this.iArrElementChildren = palohelpers.StringToIntArray(csv.get(10), palohelpers.StringToInt(csv.get(9)));
|
||||
this.dArrElementChildrenWeights = palohelpers.StringToDoubleArray(csv.get(11), palohelpers.StringToInt(csv.get(9)));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
|
||||
public void refreshElementInfo() throws paloexception {
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(this.lElementIdentifier)));
|
||||
|
||||
try {
|
||||
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/element/info");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
while (csv.readNext()) {
|
||||
this.lElementIdentifier = palohelpers.StringToLong(csv.get(0));
|
||||
this.strElementName = csv.get(1);
|
||||
this.iElementPosition = palohelpers.StringToInt(csv.get(2));
|
||||
this.iElementLevel = palohelpers.StringToInt(csv.get(3));
|
||||
this.iElementIndent = palohelpers.StringToInt(csv.get(4));
|
||||
this.iElementDepth = palohelpers.StringToInt(csv.get(5));
|
||||
this.iElementType = palohelpers.StringToInt(csv.get(6));
|
||||
this.iElementNumOfParents = palohelpers.StringToInt(csv.get(7));
|
||||
this.iArrElementParents = palohelpers.StringToIntArray(csv.get(8), palohelpers.StringToInt(csv.get(7)));
|
||||
this.iElementNumOfChildren = palohelpers.StringToInt(csv.get(9));
|
||||
this.iArrElementChildren = palohelpers.StringToIntArray(csv.get(10), palohelpers.StringToInt(csv.get(9)));
|
||||
this.dArrElementChildrenWeights = palohelpers.StringToDoubleArray(csv.get(11),
|
||||
palohelpers.StringToInt(csv.get(9)));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public paloconsolidations getConsolidations() {
|
||||
return new paloconsolidations(paloElements, this);
|
||||
}
|
||||
|
||||
public void updateElement(paloconsolidations plCons, boolean bAddToConsolidation) throws paloexception{
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(iDimensionId)));
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(lElementIdentifier)));
|
||||
|
||||
}
|
||||
|
||||
String strURLApiCall = "/element/append";
|
||||
|
||||
if(!bAddToConsolidation){
|
||||
if(plCons!=null) iElementType=paloelements.ELEMENT_CONSOLIDATION;
|
||||
qparams.add(new BasicNameValuePair("name_element", strElementName));
|
||||
qparams.add(new BasicNameValuePair("type", String.valueOf(iElementType)));
|
||||
strURLApiCall ="/element/replace";
|
||||
}
|
||||
public paloconsolidations getConsolidations() {
|
||||
return new paloconsolidations(paloElements, this);
|
||||
}
|
||||
|
||||
//if(plConsiElementType=paloelements.ELEMENT_CONSOLIDATION;
|
||||
|
||||
|
||||
if(plCons != null){
|
||||
qparams.add(new BasicNameValuePair("children", plCons.getConsolidationStringElementIdentifiers()));
|
||||
qparams.add(new BasicNameValuePair("weights", plCons.getConsolidationStringElementWeights()));
|
||||
}
|
||||
|
||||
try{
|
||||
|
||||
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, strURLApiCall);
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.setUseTextQualifier(true);
|
||||
csv.readRecord();
|
||||
//System.out.println(csv.getRawRecord());
|
||||
|
||||
this.lElementIdentifier = palohelpers.StringToLong(csv.get(0));
|
||||
this.strElementName = csv.get(1);
|
||||
this.iElementPosition = palohelpers.StringToInt(csv.get(2));
|
||||
this.iElementLevel = palohelpers.StringToInt(csv.get(3));
|
||||
this.iElementIndent = palohelpers.StringToInt(csv.get(4));
|
||||
this.iElementDepth = palohelpers.StringToInt(csv.get(5));
|
||||
this.iElementType = palohelpers.StringToInt(csv.get(6));
|
||||
this.iElementNumOfParents = palohelpers.StringToInt(csv.get(7));
|
||||
this.iArrElementParents = palohelpers.StringToIntArray(csv.get(8), palohelpers.StringToInt(csv.get(7)));
|
||||
this.iElementNumOfChildren = palohelpers.StringToInt(csv.get(9));
|
||||
this.iArrElementChildren = palohelpers.StringToIntArray(csv.get(10), palohelpers.StringToInt(csv.get(9)));
|
||||
this.dArrElementChildrenWeights = palohelpers.StringToDoubleArray(csv.get(11), palohelpers.StringToInt(csv.get(9)));
|
||||
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
|
||||
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
public void updateElement(paloconsolidations plCons, boolean bAddToConsolidation) throws paloexception {
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(iDimensionId)));
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(lElementIdentifier)));
|
||||
|
||||
String strURLApiCall = "/element/append";
|
||||
|
||||
if (!bAddToConsolidation) {
|
||||
if (plCons != null) {
|
||||
iElementType = paloelements.ELEMENT_CONSOLIDATION;
|
||||
}
|
||||
qparams.add(new BasicNameValuePair("name_element", strElementName));
|
||||
qparams.add(new BasicNameValuePair("type", String.valueOf(iElementType)));
|
||||
strURLApiCall = "/element/replace";
|
||||
}
|
||||
}
|
||||
|
||||
public void updateElementConsolidation(String strElementChildrensId, String strElementChildrenWeights, boolean bReplace) throws paloexception{
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(iDimensionId)));
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(lElementIdentifier)));
|
||||
|
||||
|
||||
String strURLApiCall = "/element/append";
|
||||
if(bReplace) strURLApiCall = "/element/replace";
|
||||
iElementType=paloelements.ELEMENT_CONSOLIDATION;
|
||||
qparams.add(new BasicNameValuePair("type", String.valueOf(iElementType)));
|
||||
// if(plConsiElementType=paloelements.ELEMENT_CONSOLIDATION;
|
||||
|
||||
qparams.add(new BasicNameValuePair("children", strElementChildrensId));
|
||||
qparams.add(new BasicNameValuePair("weights", strElementChildrenWeights));
|
||||
|
||||
try{
|
||||
this.plConn.sendToServerSingleRC(qparams, strURLApiCall);
|
||||
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
if (plCons != null) {
|
||||
qparams.add(new BasicNameValuePair("children", plCons.getConsolidationStringElementIdentifiers()));
|
||||
qparams.add(new BasicNameValuePair("weights", plCons.getConsolidationStringElementWeights()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void updateElement() throws paloexception {
|
||||
updateElement(getConsolidations(), false);
|
||||
}
|
||||
|
||||
public void updateElement(paloconsolidations plCons) throws paloexception {
|
||||
updateElement(plCons, false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj){
|
||||
if (null == obj){
|
||||
try {
|
||||
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, strURLApiCall);
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
csv.readNext();
|
||||
// System.out.println(csv.getRawRecord());
|
||||
|
||||
this.lElementIdentifier = palohelpers.StringToLong(csv.get(0));
|
||||
this.strElementName = csv.get(1);
|
||||
this.iElementPosition = palohelpers.StringToInt(csv.get(2));
|
||||
this.iElementLevel = palohelpers.StringToInt(csv.get(3));
|
||||
this.iElementIndent = palohelpers.StringToInt(csv.get(4));
|
||||
this.iElementDepth = palohelpers.StringToInt(csv.get(5));
|
||||
this.iElementType = palohelpers.StringToInt(csv.get(6));
|
||||
this.iElementNumOfParents = palohelpers.StringToInt(csv.get(7));
|
||||
this.iArrElementParents = palohelpers.StringToIntArray(csv.get(8), palohelpers.StringToInt(csv.get(7)));
|
||||
this.iElementNumOfChildren = palohelpers.StringToInt(csv.get(9));
|
||||
this.iArrElementChildren = palohelpers.StringToIntArray(csv.get(10), palohelpers.StringToInt(csv.get(9)));
|
||||
this.dArrElementChildrenWeights = palohelpers.StringToDoubleArray(csv.get(11), palohelpers.StringToInt(csv.get(9)));
|
||||
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void updateElementConsolidation(String strElementChildrensId, String strElementChildrenWeights, boolean bReplace)
|
||||
throws paloexception {
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(iDimensionId)));
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(lElementIdentifier)));
|
||||
|
||||
String strURLApiCall = "/element/append";
|
||||
if (bReplace) {
|
||||
strURLApiCall = "/element/replace";
|
||||
}
|
||||
iElementType = paloelements.ELEMENT_CONSOLIDATION;
|
||||
qparams.add(new BasicNameValuePair("type", String.valueOf(iElementType)));
|
||||
|
||||
qparams.add(new BasicNameValuePair("children", strElementChildrensId));
|
||||
qparams.add(new BasicNameValuePair("weights", strElementChildrenWeights));
|
||||
|
||||
try {
|
||||
this.plConn.sendToServerSingleRC(qparams, strURLApiCall);
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void updateElement() throws paloexception {
|
||||
updateElement(getConsolidations(), false);
|
||||
}
|
||||
|
||||
public void updateElement(paloconsolidations plCons) throws paloexception {
|
||||
updateElement(plCons, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (null == obj) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (obj instanceof paloelement){
|
||||
if (obj instanceof paloelement) {
|
||||
return strElementName.equals(((paloelement) obj).strElementName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public int compareTo ( Object o ){
|
||||
if(this.iElementPosition>((paloelement)o).getElementPosition()) return -1;
|
||||
else return 1;
|
||||
}
|
||||
public int compareTo(Object o) {
|
||||
if (this.iElementPosition > ((paloelement) o).getElementPosition()) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,404 +1,354 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.http.*;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.csvreader.CsvReader;
|
||||
import com.talend.csv.CSVReader;
|
||||
|
||||
public class paloelements {
|
||||
|
||||
// OK
|
||||
|
||||
public static final int ELEMENT_NUMERIC = 1;
|
||||
public static final int ELEMENT_STRING = 2;
|
||||
public static final int ELEMENT_CONSOLIDATION = 4;
|
||||
|
||||
public static final int ELEMENT_RULE = 4;
|
||||
public static final int ELEMENT_UNKNOWN = -1;
|
||||
|
||||
public static final int MODE_UNKNOWN = 0;
|
||||
public static final int MODE_ADD = 1;
|
||||
public static final int MODE_FORCE_ADD = 2;
|
||||
public static final int MODE_UPDATE = 3;
|
||||
public static final int MODE_ADD_OR_UPDATE = 4;
|
||||
|
||||
//D private Hashtable<Integer, String> paloElementsIdentifier = new Hashtable<Integer, String>();
|
||||
//D private Hashtable<String, paloelement> paloElements = new Hashtable<String,paloelement>();
|
||||
|
||||
private Hashtable<Long, String> paloElementsIdentifier = new Hashtable<Long, String>();
|
||||
private Hashtable<String, paloelement> paloElementsList = new Hashtable<String,paloelement>();
|
||||
|
||||
private ArrayList<paloelement> paloSortedElements = new ArrayList<paloelement>();
|
||||
// OK
|
||||
|
||||
private elementComparator elemComp = new elementComparator();
|
||||
public static final int ELEMENT_NUMERIC = 1;
|
||||
|
||||
private paloconnection plConn;
|
||||
private long lDatabaseId;
|
||||
private int iDimensionId;
|
||||
private List<String> elementNameList = new ArrayList<String>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public paloelements(paloconnection plConn, long lDatabaseId, int iDimensionId, HashSet<String> hsFilteredElements)throws paloexception{
|
||||
super();
|
||||
|
||||
|
||||
this.plConn = plConn;
|
||||
this.lDatabaseId=lDatabaseId;
|
||||
this.iDimensionId = iDimensionId;
|
||||
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
|
||||
|
||||
try{
|
||||
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/dimension/elements");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.setUseTextQualifier(true);
|
||||
while(csv.readRecord()){
|
||||
|
||||
if(hsFilteredElements.contains(csv.get(1))){
|
||||
paloelement plElm = new paloelement(
|
||||
this.plConn,
|
||||
this.lDatabaseId,
|
||||
this.iDimensionId,
|
||||
this,
|
||||
palohelpers.StringToLong(csv.get(0)),
|
||||
csv.get(1),
|
||||
palohelpers.StringToInt(csv.get(2)),
|
||||
palohelpers.StringToInt(csv.get(3)),
|
||||
palohelpers.StringToInt(csv.get(4)),
|
||||
palohelpers.StringToInt(csv.get(5)),
|
||||
palohelpers.StringToInt(csv.get(6)),
|
||||
palohelpers.StringToInt(csv.get(7)),
|
||||
palohelpers.StringToIntArray(csv.get(8), palohelpers.StringToInt(csv.get(7))),
|
||||
palohelpers.StringToInt(csv.get(9)),
|
||||
palohelpers.StringToIntArray(csv.get(10), palohelpers.StringToInt(csv.get(9))),
|
||||
palohelpers.StringToDoubleArray(csv.get(11), palohelpers.StringToInt(csv.get(9)))
|
||||
);
|
||||
|
||||
|
||||
paloElementsList.put(plElm.getName(), plElm);
|
||||
paloElementsIdentifier.put(palohelpers.StringToLong(csv.get(0)),csv.get(1));
|
||||
//plElm.setPaloElements(this);
|
||||
/*
|
||||
long lElementIdentifier, //0 element identifier Identifier of the element
|
||||
String strElementName, //1 name_element string Name of the element
|
||||
int iElementPosition, //2 position integer Position of the element
|
||||
int iElementLevel, //3 level integer Level of the element
|
||||
int iElementIndent, //4 indent integer Indent of the element
|
||||
int iElementDepth, //5 depth integer Depth of the element
|
||||
int iElementType, //6 type integer Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED)
|
||||
int iElementNumOfParents, //7 number_parents integer Number of parents
|
||||
int[] iArrElementParents, //8 parents identifier Comma separate list of parent identifiers
|
||||
int iElementNumOfChildren, //9 number_children integer Number of children
|
||||
int[] iArrElementChildren, //10 children identifier Comma separate list of children identifiers
|
||||
double[] dArrElementChildrenWeights //11 weights double Comma separate list of children weight
|
||||
*/
|
||||
}}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
public static final int ELEMENT_STRING = 2;
|
||||
|
||||
public static final int ELEMENT_CONSOLIDATION = 4;
|
||||
|
||||
public static final int ELEMENT_RULE = 4;
|
||||
|
||||
public static final int ELEMENT_UNKNOWN = -1;
|
||||
|
||||
public static final int MODE_UNKNOWN = 0;
|
||||
|
||||
public static final int MODE_ADD = 1;
|
||||
|
||||
public static final int MODE_FORCE_ADD = 2;
|
||||
|
||||
public static final int MODE_UPDATE = 3;
|
||||
|
||||
public static final int MODE_ADD_OR_UPDATE = 4;
|
||||
|
||||
// D private Hashtable<Integer, String> paloElementsIdentifier = new Hashtable<Integer, String>();
|
||||
// D private Hashtable<String, paloelement> paloElements = new Hashtable<String,paloelement>();
|
||||
|
||||
private Hashtable<Long, String> paloElementsIdentifier = new Hashtable<Long, String>();
|
||||
|
||||
private Hashtable<String, paloelement> paloElementsList = new Hashtable<String, paloelement>();
|
||||
|
||||
private ArrayList<paloelement> paloSortedElements = new ArrayList<paloelement>();
|
||||
|
||||
private elementComparator elemComp = new elementComparator();
|
||||
|
||||
private paloconnection plConn;
|
||||
|
||||
private long lDatabaseId;
|
||||
|
||||
private int iDimensionId;
|
||||
|
||||
private List<String> elementNameList = new ArrayList<String>();
|
||||
|
||||
public paloelements(paloconnection plConn, long lDatabaseId, int iDimensionId, HashSet<String> hsFilteredElements)
|
||||
throws paloexception {
|
||||
super();
|
||||
|
||||
this.plConn = plConn;
|
||||
this.lDatabaseId = lDatabaseId;
|
||||
this.iDimensionId = iDimensionId;
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
|
||||
try {
|
||||
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/dimension/elements");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
while (csv.readNext()) {
|
||||
|
||||
if (hsFilteredElements.contains(csv.get(1))) {
|
||||
paloelement plElm = new paloelement(this.plConn, this.lDatabaseId, this.iDimensionId, this,
|
||||
palohelpers.StringToLong(csv.get(0)), csv.get(1), palohelpers.StringToInt(csv.get(2)),
|
||||
palohelpers.StringToInt(csv.get(3)), palohelpers.StringToInt(csv.get(4)), palohelpers.StringToInt(csv
|
||||
.get(5)), palohelpers.StringToInt(csv.get(6)), palohelpers.StringToInt(csv.get(7)),
|
||||
palohelpers.StringToIntArray(csv.get(8), palohelpers.StringToInt(csv.get(7))),
|
||||
palohelpers.StringToInt(csv.get(9)), palohelpers.StringToIntArray(csv.get(10),
|
||||
palohelpers.StringToInt(csv.get(9))), palohelpers.StringToDoubleArray(csv.get(11),
|
||||
palohelpers.StringToInt(csv.get(9))));
|
||||
|
||||
paloElementsList.put(plElm.getName(), plElm);
|
||||
paloElementsIdentifier.put(palohelpers.StringToLong(csv.get(0)), csv.get(1));
|
||||
// plElm.setPaloElements(this);
|
||||
/*
|
||||
* long lElementIdentifier, //0 element identifier Identifier of the element String strElementName,
|
||||
* //1 name_element string Name of the element int iElementPosition, //2 position integer Position
|
||||
* of the element int iElementLevel, //3 level integer Level of the element int iElementIndent, //4
|
||||
* indent integer Indent of the element int iElementDepth, //5 depth integer Depth of the element
|
||||
* int iElementType, //6 type integer Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED) int
|
||||
* iElementNumOfParents, //7 number_parents integer Number of parents int[] iArrElementParents, //8
|
||||
* parents identifier Comma separate list of parent identifiers int iElementNumOfChildren, //9
|
||||
* number_children integer Number of children int[] iArrElementChildren, //10 children identifier
|
||||
* Comma separate list of children identifiers double[] dArrElementChildrenWeights //11 weights
|
||||
* double Comma separate list of children weight
|
||||
*/
|
||||
}
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public paloelements(paloconnection plConn, long lDatabaseId, int iDimensionId)throws paloexception{
|
||||
super();
|
||||
|
||||
|
||||
this.plConn = plConn;
|
||||
this.lDatabaseId=lDatabaseId;
|
||||
this.iDimensionId = iDimensionId;
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
|
||||
|
||||
try{
|
||||
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/dimension/elements");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.setUseTextQualifier(true);
|
||||
while(csv.readRecord()){
|
||||
/*
|
||||
|
||||
paloElementsList.put(csv.get(1), new paloelement(
|
||||
this.plConn,
|
||||
this.lDatabaseId,
|
||||
this.iDimensionId,
|
||||
this,
|
||||
palohelpers.StringToLong(csv.get(0)),
|
||||
csv.get(1),
|
||||
palohelpers.StringToInt(csv.get(2)),
|
||||
palohelpers.StringToInt(csv.get(3)),
|
||||
palohelpers.StringToInt(csv.get(4)),
|
||||
palohelpers.StringToInt(csv.get(5)),
|
||||
palohelpers.StringToInt(csv.get(6)),
|
||||
palohelpers.StringToInt(csv.get(7)),
|
||||
palohelpers.StringToIntArray(csv.get(8), palohelpers.StringToInt(csv.get(7))),
|
||||
palohelpers.StringToInt(csv.get(9)),
|
||||
palohelpers.StringToIntArray(csv.get(10), palohelpers.StringToInt(csv.get(9))),
|
||||
palohelpers.StringToDoubleArray(csv.get(11), palohelpers.StringToInt(csv.get(9)))
|
||||
));*/
|
||||
|
||||
|
||||
|
||||
paloelement plElm = new paloelement(
|
||||
this.plConn,
|
||||
this.lDatabaseId,
|
||||
this.iDimensionId,
|
||||
this,
|
||||
palohelpers.StringToLong(csv.get(0)),
|
||||
csv.get(1),
|
||||
palohelpers.StringToInt(csv.get(2)),
|
||||
palohelpers.StringToInt(csv.get(3)),
|
||||
palohelpers.StringToInt(csv.get(4)),
|
||||
palohelpers.StringToInt(csv.get(5)),
|
||||
palohelpers.StringToInt(csv.get(6)),
|
||||
palohelpers.StringToInt(csv.get(7)),
|
||||
palohelpers.StringToIntArray(csv.get(8), palohelpers.StringToInt(csv.get(7))),
|
||||
palohelpers.StringToInt(csv.get(9)),
|
||||
palohelpers.StringToIntArray(csv.get(10), palohelpers.StringToInt(csv.get(9))),
|
||||
palohelpers.StringToDoubleArray(csv.get(11), palohelpers.StringToInt(csv.get(9)))
|
||||
);
|
||||
|
||||
|
||||
paloElementsList.put(plElm.getName(), plElm);
|
||||
paloElementsIdentifier.put(palohelpers.StringToLong(csv.get(0)),csv.get(1));
|
||||
//plElm.setPaloElements(this);
|
||||
/*
|
||||
long lElementIdentifier, //0 element identifier Identifier of the element
|
||||
String strElementName, //1 name_element string Name of the element
|
||||
int iElementPosition, //2 position integer Position of the element
|
||||
int iElementLevel, //3 level integer Level of the element
|
||||
int iElementIndent, //4 indent integer Indent of the element
|
||||
int iElementDepth, //5 depth integer Depth of the element
|
||||
int iElementType, //6 type integer Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED)
|
||||
int iElementNumOfParents, //7 number_parents integer Number of parents
|
||||
int[] iArrElementParents, //8 parents identifier Comma separate list of parent identifiers
|
||||
int iElementNumOfChildren, //9 number_children integer Number of children
|
||||
int[] iArrElementChildren, //10 children identifier Comma separate list of children identifiers
|
||||
double[] dArrElementChildrenWeights //11 weights double Comma separate list of children weight
|
||||
*/
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
|
||||
public paloelements(paloconnection plConn, long lDatabaseId, int iDimensionId) throws paloexception {
|
||||
super();
|
||||
|
||||
this.plConn = plConn;
|
||||
this.lDatabaseId = lDatabaseId;
|
||||
this.iDimensionId = iDimensionId;
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
|
||||
try {
|
||||
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/dimension/elements");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
while (csv.readNext()) {
|
||||
/*
|
||||
*
|
||||
* paloElementsList.put(csv.get(1), new paloelement( this.plConn, this.lDatabaseId, this.iDimensionId,
|
||||
* this, palohelpers.StringToLong(csv.get(0)), csv.get(1), palohelpers.StringToInt(csv.get(2)),
|
||||
* palohelpers.StringToInt(csv.get(3)), palohelpers.StringToInt(csv.get(4)),
|
||||
* palohelpers.StringToInt(csv.get(5)), palohelpers.StringToInt(csv.get(6)),
|
||||
* palohelpers.StringToInt(csv.get(7)), palohelpers.StringToIntArray(csv.get(8),
|
||||
* palohelpers.StringToInt(csv.get(7))), palohelpers.StringToInt(csv.get(9)),
|
||||
* palohelpers.StringToIntArray(csv.get(10), palohelpers.StringToInt(csv.get(9))),
|
||||
* palohelpers.StringToDoubleArray(csv.get(11), palohelpers.StringToInt(csv.get(9))) ));
|
||||
*/
|
||||
|
||||
paloelement plElm = new paloelement(this.plConn, this.lDatabaseId, this.iDimensionId, this,
|
||||
palohelpers.StringToLong(csv.get(0)), csv.get(1), palohelpers.StringToInt(csv.get(2)),
|
||||
palohelpers.StringToInt(csv.get(3)), palohelpers.StringToInt(csv.get(4)), palohelpers.StringToInt(csv
|
||||
.get(5)), palohelpers.StringToInt(csv.get(6)), palohelpers.StringToInt(csv.get(7)),
|
||||
palohelpers.StringToIntArray(csv.get(8), palohelpers.StringToInt(csv.get(7))),
|
||||
palohelpers.StringToInt(csv.get(9)), palohelpers.StringToIntArray(csv.get(10),
|
||||
palohelpers.StringToInt(csv.get(9))), palohelpers.StringToDoubleArray(csv.get(11),
|
||||
palohelpers.StringToInt(csv.get(9))));
|
||||
|
||||
paloElementsList.put(plElm.getName(), plElm);
|
||||
paloElementsIdentifier.put(palohelpers.StringToLong(csv.get(0)), csv.get(1));
|
||||
// plElm.setPaloElements(this);
|
||||
/*
|
||||
* long lElementIdentifier, //0 element identifier Identifier of the element String strElementName, //1
|
||||
* name_element string Name of the element int iElementPosition, //2 position integer Position of the
|
||||
* element int iElementLevel, //3 level integer Level of the element int iElementIndent, //4 indent
|
||||
* integer Indent of the element int iElementDepth, //5 depth integer Depth of the element int
|
||||
* iElementType, //6 type integer Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED) int
|
||||
* iElementNumOfParents, //7 number_parents integer Number of parents int[] iArrElementParents, //8
|
||||
* parents identifier Comma separate list of parent identifiers int iElementNumOfChildren, //9
|
||||
* number_children integer Number of children int[] iArrElementChildren, //10 children identifier Comma
|
||||
* separate list of children identifiers double[] dArrElementChildrenWeights //11 weights double Comma
|
||||
* separate list of children weight
|
||||
*/
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void createElementsBulk(String strElementNames, String strElementTypes) throws paloexception{
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
|
||||
qparams.add(new BasicNameValuePair("name_elements", strElementNames));
|
||||
qparams.add(new BasicNameValuePair("types", strElementTypes));
|
||||
this.plConn.sendToServerSingleRC(qparams, "/element/create_bulk");
|
||||
|
||||
}
|
||||
|
||||
|
||||
public paloelement createElement(String strElementName, int iElementType, int iMode) throws paloexception{
|
||||
paloelement plElem = null;
|
||||
|
||||
if(!elementNameList.contains(strElementName)){
|
||||
elementNameList.add(strElementName);
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
|
||||
qparams.add(new BasicNameValuePair("new_name", strElementName));
|
||||
qparams.add(new BasicNameValuePair("type", String.valueOf(iElementType)));
|
||||
|
||||
try{
|
||||
HttpEntity entity=null;
|
||||
switch(iMode){
|
||||
case MODE_ADD:
|
||||
entity = this.plConn.sendToServer(qparams, "/element/create");
|
||||
break;
|
||||
case MODE_UNKNOWN:
|
||||
case MODE_ADD_OR_UPDATE:
|
||||
paloelement plElm = getElement(strElementName);
|
||||
if(null==plElm) entity = this.plConn.sendToServer(qparams, "/element/create");
|
||||
else{
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(plElm.getElementIdentifier())));
|
||||
entity = this.plConn.sendToServer(qparams, "/element/replace");
|
||||
}
|
||||
break;
|
||||
case MODE_UPDATE:
|
||||
plElm = getElement(strElementName);
|
||||
if(null==plElm) throw new paloexception("Element " + strElementName +" does not exists!");
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(plElm.getElementIdentifier())));
|
||||
entity = this.plConn.sendToServer(qparams, "/element/replace");
|
||||
break;
|
||||
case MODE_FORCE_ADD:
|
||||
plElm = getElement(strElementName);
|
||||
if(null!=plElm) deleteElement(plElm);
|
||||
entity = this.plConn.sendToServer(qparams, "/element/create");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.setUseTextQualifier(true);
|
||||
csv.readRecord();
|
||||
plElem = new paloelement(
|
||||
this.plConn,
|
||||
this.lDatabaseId,
|
||||
this.iDimensionId,
|
||||
this,
|
||||
palohelpers.StringToLong(csv.get(0)),
|
||||
csv.get(1),
|
||||
palohelpers.StringToInt(csv.get(2)),
|
||||
palohelpers.StringToInt(csv.get(3)),
|
||||
palohelpers.StringToInt(csv.get(4)),
|
||||
palohelpers.StringToInt(csv.get(5)),
|
||||
palohelpers.StringToInt(csv.get(6)),
|
||||
palohelpers.StringToInt(csv.get(7)),
|
||||
palohelpers.StringToIntArray(csv.get(8), palohelpers.StringToInt(csv.get(7))),
|
||||
palohelpers.StringToInt(csv.get(9)),
|
||||
palohelpers.StringToIntArray(csv.get(10), palohelpers.StringToInt(csv.get(9))),
|
||||
palohelpers.StringToDoubleArray(csv.get(11), palohelpers.StringToInt(csv.get(9)))
|
||||
);
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
paloElementsList.put(plElem.getName(), plElem);
|
||||
paloElementsIdentifier.put(plElem.getElementIdentifier(),plElem.getName());
|
||||
//plElem.setPaloElements(this);
|
||||
|
||||
}catch(Exception e){
|
||||
System.out.println("Hier " + strElementName);
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
return plElem;
|
||||
}
|
||||
public void createElementsBulk(String strElementNames, String strElementTypes) throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
|
||||
qparams.add(new BasicNameValuePair("name_elements", strElementNames));
|
||||
qparams.add(new BasicNameValuePair("types", strElementTypes));
|
||||
this.plConn.sendToServerSingleRC(qparams, "/element/create_bulk");
|
||||
|
||||
public paloelement createElement(String strElementName, int iElementType)throws paloexception{
|
||||
return createElement(strElementName, iElementType, MODE_ADD);
|
||||
}
|
||||
}
|
||||
|
||||
public paloelement createElement(String strElementName) throws paloexception{
|
||||
return createElement(strElementName, ELEMENT_NUMERIC, MODE_ADD);
|
||||
}
|
||||
|
||||
|
||||
public void deleteElement(paloelement paloElemToRemove) throws paloexception{
|
||||
if(null != paloElemToRemove){
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(paloElemToRemove.getElementIdentifier())));
|
||||
plConn.sendToServerSingleRC(qparams, "/element/destroy");
|
||||
paloElementsIdentifier.remove(paloElemToRemove.getElementIdentifier());
|
||||
paloElementsList.remove(paloElemToRemove.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void deleteElement(String strElementName) throws paloexception{
|
||||
paloelement paloElemToRemove = getElement(strElementName);
|
||||
if(null != paloElemToRemove){
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(paloElemToRemove.getElementIdentifier())));
|
||||
plConn.sendToServerSingleRC(qparams, "/element/destroy");
|
||||
paloElementsIdentifier.remove(paloElemToRemove.getElementIdentifier());
|
||||
paloElementsList.remove(paloElemToRemove.getName());
|
||||
}
|
||||
}
|
||||
|
||||
public int getNumberOfElements(){
|
||||
return paloElementsList.size();
|
||||
}
|
||||
|
||||
public paloelement getElement(int iIndex){
|
||||
return paloElementsList.get(iIndex);
|
||||
}
|
||||
|
||||
public paloelement getElementByIdentifier(long lElementIdentifier){
|
||||
return paloElementsList.get(paloElementsIdentifier.get(lElementIdentifier));
|
||||
}
|
||||
|
||||
|
||||
public ArrayList<paloelement> getFilteredElements(long lParentPosition){
|
||||
public paloelement createElement(String strElementName, int iElementType, int iMode) throws paloexception {
|
||||
paloelement plElem = null;
|
||||
|
||||
ArrayList<paloelement> paloFilteredElements = new ArrayList<paloelement>();
|
||||
for(paloelement plElement:getElements()){
|
||||
if(lParentPosition==plElement.getElementParentIdentifier()){
|
||||
paloFilteredElements.add(plElement);
|
||||
}
|
||||
}
|
||||
return paloFilteredElements;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void buildSortedElementArray(){
|
||||
paloSortedElements = new ArrayList<paloelement>();
|
||||
Object[] arObjectsToSort = paloElementsList.entrySet().toArray();
|
||||
Arrays.sort(arObjectsToSort, (Comparator)elemComp);
|
||||
for(int i=0;i<arObjectsToSort.length;i++){
|
||||
paloSortedElements.add(((paloelement)((Map.Entry)arObjectsToSort[i]).getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<paloelement> getElements(){
|
||||
if(paloSortedElements==null || paloSortedElements.size()<1) buildSortedElementArray();
|
||||
return paloSortedElements;
|
||||
|
||||
/*
|
||||
ArrayList<paloelement> rcArrayList = new ArrayList<paloelement>();
|
||||
Object[] arObjectsToSort = paloElements.entrySet().toArray();
|
||||
Arrays.sort(arObjectsToSort, (Comparator)elemComp);
|
||||
for(int i=0;i<arObjectsToSort.length;i++){
|
||||
rcArrayList.add(((paloelement)((Map.Entry)arObjectsToSort[i]).getValue()));
|
||||
}
|
||||
return rcArrayList;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
public paloelement getElement(String strElementName){
|
||||
return paloElementsList.get(strElementName);
|
||||
}
|
||||
|
||||
class elementComparator implements Comparator<Map.Entry<String, paloelement>>{
|
||||
public int compare(Map.Entry<String, paloelement> o1, Map.Entry<String, paloelement> o2){
|
||||
if(o1.getValue().getElementPosition()> o2.getValue().getElementPosition()) return 1;
|
||||
else return -1;
|
||||
}
|
||||
}
|
||||
if (!elementNameList.contains(strElementName)) {
|
||||
elementNameList.add(strElementName);
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
|
||||
qparams.add(new BasicNameValuePair("new_name", strElementName));
|
||||
qparams.add(new BasicNameValuePair("type", String.valueOf(iElementType)));
|
||||
|
||||
try {
|
||||
HttpEntity entity = null;
|
||||
switch (iMode) {
|
||||
case MODE_ADD:
|
||||
entity = this.plConn.sendToServer(qparams, "/element/create");
|
||||
break;
|
||||
case MODE_UNKNOWN:
|
||||
case MODE_ADD_OR_UPDATE:
|
||||
paloelement plElm = getElement(strElementName);
|
||||
if (null == plElm) {
|
||||
entity = this.plConn.sendToServer(qparams, "/element/create");
|
||||
} else {
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(plElm.getElementIdentifier())));
|
||||
entity = this.plConn.sendToServer(qparams, "/element/replace");
|
||||
}
|
||||
break;
|
||||
case MODE_UPDATE:
|
||||
plElm = getElement(strElementName);
|
||||
if (null == plElm) {
|
||||
throw new paloexception("Element " + strElementName + " does not exists!");
|
||||
}
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(plElm.getElementIdentifier())));
|
||||
entity = this.plConn.sendToServer(qparams, "/element/replace");
|
||||
break;
|
||||
case MODE_FORCE_ADD:
|
||||
plElm = getElement(strElementName);
|
||||
if (null != plElm) {
|
||||
deleteElement(plElm);
|
||||
}
|
||||
entity = this.plConn.sendToServer(qparams, "/element/create");
|
||||
break;
|
||||
|
||||
}
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
csv.readNext();
|
||||
plElem = new paloelement(this.plConn, this.lDatabaseId, this.iDimensionId, this, palohelpers.StringToLong(csv
|
||||
.get(0)), csv.get(1), palohelpers.StringToInt(csv.get(2)), palohelpers.StringToInt(csv.get(3)),
|
||||
palohelpers.StringToInt(csv.get(4)), palohelpers.StringToInt(csv.get(5)), palohelpers.StringToInt(csv
|
||||
.get(6)), palohelpers.StringToInt(csv.get(7)), palohelpers.StringToIntArray(csv.get(8),
|
||||
palohelpers.StringToInt(csv.get(7))), palohelpers.StringToInt(csv.get(9)),
|
||||
palohelpers.StringToIntArray(csv.get(10), palohelpers.StringToInt(csv.get(9))),
|
||||
palohelpers.StringToDoubleArray(csv.get(11), palohelpers.StringToInt(csv.get(9))));
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
paloElementsList.put(plElem.getName(), plElem);
|
||||
paloElementsIdentifier.put(plElem.getElementIdentifier(), plElem.getName());
|
||||
// plElem.setPaloElements(this);
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("Hier " + strElementName);
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
return plElem;
|
||||
}
|
||||
|
||||
public paloelement createElement(String strElementName, int iElementType) throws paloexception {
|
||||
return createElement(strElementName, iElementType, MODE_ADD);
|
||||
}
|
||||
|
||||
public paloelement createElement(String strElementName) throws paloexception {
|
||||
return createElement(strElementName, ELEMENT_NUMERIC, MODE_ADD);
|
||||
}
|
||||
|
||||
public void deleteElement(paloelement paloElemToRemove) throws paloexception {
|
||||
if (null != paloElemToRemove) {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(paloElemToRemove.getElementIdentifier())));
|
||||
plConn.sendToServerSingleRC(qparams, "/element/destroy");
|
||||
paloElementsIdentifier.remove(paloElemToRemove.getElementIdentifier());
|
||||
paloElementsList.remove(paloElemToRemove.getName());
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteElement(String strElementName) throws paloexception {
|
||||
paloelement paloElemToRemove = getElement(strElementName);
|
||||
if (null != paloElemToRemove) {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("dimension", String.valueOf(this.iDimensionId)));
|
||||
qparams.add(new BasicNameValuePair("element", String.valueOf(paloElemToRemove.getElementIdentifier())));
|
||||
plConn.sendToServerSingleRC(qparams, "/element/destroy");
|
||||
paloElementsIdentifier.remove(paloElemToRemove.getElementIdentifier());
|
||||
paloElementsList.remove(paloElemToRemove.getName());
|
||||
}
|
||||
}
|
||||
|
||||
public int getNumberOfElements() {
|
||||
return paloElementsList.size();
|
||||
}
|
||||
|
||||
public paloelement getElement(int iIndex) {
|
||||
return paloElementsList.get(iIndex);
|
||||
}
|
||||
|
||||
public paloelement getElementByIdentifier(long lElementIdentifier) {
|
||||
return paloElementsList.get(paloElementsIdentifier.get(lElementIdentifier));
|
||||
}
|
||||
|
||||
public ArrayList<paloelement> getFilteredElements(long lParentPosition) {
|
||||
|
||||
ArrayList<paloelement> paloFilteredElements = new ArrayList<paloelement>();
|
||||
for (paloelement plElement : getElements()) {
|
||||
if (lParentPosition == plElement.getElementParentIdentifier()) {
|
||||
paloFilteredElements.add(plElement);
|
||||
}
|
||||
}
|
||||
return paloFilteredElements;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void buildSortedElementArray() {
|
||||
paloSortedElements = new ArrayList<paloelement>();
|
||||
Object[] arObjectsToSort = paloElementsList.entrySet().toArray();
|
||||
Arrays.sort(arObjectsToSort, (Comparator) elemComp);
|
||||
for (Object element : arObjectsToSort) {
|
||||
paloSortedElements.add(((paloelement) ((Map.Entry) element).getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<paloelement> getElements() {
|
||||
if (paloSortedElements == null || paloSortedElements.size() < 1) {
|
||||
buildSortedElementArray();
|
||||
}
|
||||
return paloSortedElements;
|
||||
|
||||
/*
|
||||
* ArrayList<paloelement> rcArrayList = new ArrayList<paloelement>(); Object[] arObjectsToSort =
|
||||
* paloElements.entrySet().toArray(); Arrays.sort(arObjectsToSort, (Comparator)elemComp); for(int
|
||||
* i=0;i<arObjectsToSort.length;i++){
|
||||
* rcArrayList.add(((paloelement)((Map.Entry)arObjectsToSort[i]).getValue())); } return rcArrayList;
|
||||
*/
|
||||
}
|
||||
|
||||
public paloelement getElement(String strElementName) {
|
||||
return paloElementsList.get(strElementName);
|
||||
}
|
||||
|
||||
class elementComparator implements Comparator<Map.Entry<String, paloelement>> {
|
||||
|
||||
public int compare(Map.Entry<String, paloelement> o1, Map.Entry<String, paloelement> o2) {
|
||||
if (o1.getValue().getElementPosition() > o2.getValue().getElementPosition()) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -9,147 +8,150 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.csvreader.CsvReader;
|
||||
import com.talend.csv.CSVReader;
|
||||
|
||||
public class palorule {
|
||||
|
||||
private paloconnection plConn;
|
||||
private long lDatabaseId;
|
||||
private int iCubeId;
|
||||
private paloconnection plConn;
|
||||
|
||||
private int lIdentifier;
|
||||
private String strDefinition;
|
||||
private String strExtern_Id;
|
||||
private String strComment;
|
||||
private long lTimeStamp;
|
||||
private boolean bActivated;
|
||||
private long lDatabaseId;
|
||||
|
||||
|
||||
public palorule(
|
||||
paloconnection plConn,
|
||||
long lDatabaseId,
|
||||
int iCubeId,
|
||||
int lIdentifier, //0 rule identifier Identifier of the rule
|
||||
String strDefinition,//1 rule_string string Textual representation for the rule
|
||||
String strExtern_Id,//2 external_identifier string external identifier of the rule
|
||||
String strComment, //3 comment string comment for the rule
|
||||
long lTimeStamp, // 4 timestamp string creation time of the rule in seconds since 1970-01-01
|
||||
boolean bActivated // 5 active integer 0=rule is not active, 1=rule is active
|
||||
){
|
||||
super();
|
||||
this.plConn=plConn;
|
||||
this.lDatabaseId=lDatabaseId;
|
||||
this.iCubeId=iCubeId;
|
||||
this.lIdentifier=lIdentifier;
|
||||
this.strDefinition=strDefinition;
|
||||
this.strExtern_Id=strExtern_Id;
|
||||
this.strComment=strComment;
|
||||
this.lTimeStamp=lTimeStamp;
|
||||
this.bActivated=bActivated;
|
||||
|
||||
}
|
||||
private int iCubeId;
|
||||
|
||||
public long getIdentifier(){
|
||||
return lIdentifier;
|
||||
}
|
||||
private int lIdentifier;
|
||||
|
||||
public String getDefinition(){
|
||||
return strDefinition;
|
||||
}
|
||||
public void setDefinition(String strDefinition){
|
||||
this.strDefinition= strDefinition;
|
||||
}
|
||||
|
||||
public String getExtern_Id(){
|
||||
return strExtern_Id;
|
||||
}
|
||||
public void setExtern_Id(String strExtern_Id){
|
||||
this.strExtern_Id=strExtern_Id;
|
||||
}
|
||||
|
||||
public String getComment(){
|
||||
return strComment;
|
||||
}
|
||||
public void setComment(String strComment){
|
||||
this.strComment=strComment;
|
||||
}
|
||||
|
||||
public long getTimeStamp(){
|
||||
return lTimeStamp;
|
||||
}
|
||||
|
||||
public Date getModificationData(){
|
||||
return palohelpers.getCalcDateBegin((int)lTimeStamp);
|
||||
}
|
||||
|
||||
public boolean getActivated(){
|
||||
return bActivated;
|
||||
}
|
||||
public void setActivated(boolean bActivated){
|
||||
this.bActivated=bActivated;
|
||||
}
|
||||
private String strDefinition;
|
||||
|
||||
|
||||
public void refreshRuleInfo() throws paloexception{
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(this.iCubeId)));
|
||||
qparams.add(new BasicNameValuePair("rule", String.valueOf(this.lIdentifier)));
|
||||
qparams.add(new BasicNameValuePair("use_identifier", palohelpers.BooleanToString(false)));
|
||||
|
||||
try{
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/rule/info");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
while(csv.readRecord()){
|
||||
lIdentifier = palohelpers.StringToInt(csv.get(0));
|
||||
strDefinition = csv.get(1);
|
||||
strExtern_Id =csv.get(2);
|
||||
strComment = csv.get(3);
|
||||
lTimeStamp=palohelpers.StringToLong(csv.get(4));
|
||||
bActivated = palohelpers.StringToBoolean(csv.get(5));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
private String strExtern_Id;
|
||||
|
||||
private String strComment;
|
||||
|
||||
private long lTimeStamp;
|
||||
|
||||
private boolean bActivated;
|
||||
|
||||
public palorule(paloconnection plConn, long lDatabaseId, int iCubeId, int lIdentifier, // 0 rule identifier
|
||||
// Identifier of the rule
|
||||
String strDefinition,// 1 rule_string string Textual representation for the rule
|
||||
String strExtern_Id,// 2 external_identifier string external identifier of the rule
|
||||
String strComment, // 3 comment string comment for the rule
|
||||
long lTimeStamp, // 4 timestamp string creation time of the rule in seconds since 1970-01-01
|
||||
boolean bActivated // 5 active integer 0=rule is not active, 1=rule is active
|
||||
) {
|
||||
super();
|
||||
this.plConn = plConn;
|
||||
this.lDatabaseId = lDatabaseId;
|
||||
this.iCubeId = iCubeId;
|
||||
this.lIdentifier = lIdentifier;
|
||||
this.strDefinition = strDefinition;
|
||||
this.strExtern_Id = strExtern_Id;
|
||||
this.strComment = strComment;
|
||||
this.lTimeStamp = lTimeStamp;
|
||||
this.bActivated = bActivated;
|
||||
|
||||
}
|
||||
|
||||
public long getIdentifier() {
|
||||
return lIdentifier;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return strDefinition;
|
||||
}
|
||||
|
||||
public void setDefinition(String strDefinition) {
|
||||
this.strDefinition = strDefinition;
|
||||
}
|
||||
|
||||
public String getExtern_Id() {
|
||||
return strExtern_Id;
|
||||
}
|
||||
|
||||
public void setExtern_Id(String strExtern_Id) {
|
||||
this.strExtern_Id = strExtern_Id;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return strComment;
|
||||
}
|
||||
|
||||
public void setComment(String strComment) {
|
||||
this.strComment = strComment;
|
||||
}
|
||||
|
||||
public long getTimeStamp() {
|
||||
return lTimeStamp;
|
||||
}
|
||||
|
||||
public Date getModificationData() {
|
||||
return palohelpers.getCalcDateBegin((int) lTimeStamp);
|
||||
}
|
||||
|
||||
public boolean getActivated() {
|
||||
return bActivated;
|
||||
}
|
||||
|
||||
public void setActivated(boolean bActivated) {
|
||||
this.bActivated = bActivated;
|
||||
}
|
||||
|
||||
public void refreshRuleInfo() throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(this.iCubeId)));
|
||||
qparams.add(new BasicNameValuePair("rule", String.valueOf(this.lIdentifier)));
|
||||
qparams.add(new BasicNameValuePair("use_identifier", palohelpers.BooleanToString(false)));
|
||||
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/rule/info");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
while (csv.readNext()) {
|
||||
lIdentifier = palohelpers.StringToInt(csv.get(0));
|
||||
strDefinition = csv.get(1);
|
||||
strExtern_Id = csv.get(2);
|
||||
strComment = csv.get(3);
|
||||
lTimeStamp = palohelpers.StringToLong(csv.get(4));
|
||||
bActivated = palohelpers.StringToBoolean(csv.get(5));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void modifyRule() throws paloexception {
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(this.iCubeId)));
|
||||
qparams.add(new BasicNameValuePair("rule", String.valueOf(this.lIdentifier)));
|
||||
qparams.add(new BasicNameValuePair("definition", strDefinition));
|
||||
qparams.add(new BasicNameValuePair("activate", palohelpers.BooleanToString(this.bActivated)));
|
||||
qparams.add(new BasicNameValuePair("external_identifier", strExtern_Id));
|
||||
qparams.add(new BasicNameValuePair("comment", strComment));
|
||||
qparams.add(new BasicNameValuePair("use_identifier", palohelpers.BooleanToString(false)));
|
||||
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/rule/modify");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
while (csv.readNext()) {
|
||||
lIdentifier = palohelpers.StringToInt(csv.get(0));
|
||||
strDefinition = csv.get(1);
|
||||
strExtern_Id = csv.get(2);
|
||||
strComment = csv.get(3);
|
||||
lTimeStamp = palohelpers.StringToLong(csv.get(4));
|
||||
bActivated = palohelpers.StringToBoolean(csv.get(5));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void modifyRule() throws paloexception{
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(this.iCubeId)));
|
||||
qparams.add(new BasicNameValuePair("rule", String.valueOf(this.lIdentifier)));
|
||||
qparams.add(new BasicNameValuePair("definition", strDefinition));
|
||||
qparams.add(new BasicNameValuePair("activate", palohelpers.BooleanToString(this.bActivated)));
|
||||
qparams.add(new BasicNameValuePair("external_identifier", strExtern_Id));
|
||||
qparams.add(new BasicNameValuePair("comment", strComment));
|
||||
qparams.add(new BasicNameValuePair("use_identifier", palohelpers.BooleanToString(false)));
|
||||
|
||||
try{
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/rule/modify");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
while(csv.readRecord()){
|
||||
lIdentifier = palohelpers.StringToInt(csv.get(0));
|
||||
strDefinition = csv.get(1);
|
||||
strExtern_Id =csv.get(2);
|
||||
strComment = csv.get(3);
|
||||
lTimeStamp=palohelpers.StringToLong(csv.get(4));
|
||||
bActivated = palohelpers.StringToBoolean(csv.get(5));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
}catch(Exception e){
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -8,243 +7,214 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.csvreader.CsvReader;
|
||||
import com.talend.csv.CSVReader;
|
||||
|
||||
public class palorules {
|
||||
public static final int RULES_TEXT = 0;
|
||||
public static final int RULES_NUMERIC = 1;
|
||||
|
||||
private ArrayList<palorule> paloRules = new ArrayList<palorule>();
|
||||
public static final int RULES_TEXT = 0;
|
||||
|
||||
private paloconnection plConn;
|
||||
private long lDatabaseId;
|
||||
private int iCubeId;
|
||||
public static final int RULES_NUMERIC = 1;
|
||||
|
||||
private String strRuleParseResult;
|
||||
private ArrayList<palorule> paloRules = new ArrayList<palorule>();
|
||||
|
||||
public palorules(paloconnection plConn, long lDatabaseId, int iCubeId)
|
||||
throws paloexception {
|
||||
super();
|
||||
this.plConn = plConn;
|
||||
this.lDatabaseId = lDatabaseId;
|
||||
this.iCubeId = iCubeId;
|
||||
private paloconnection plConn;
|
||||
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String
|
||||
.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(this.iCubeId)));
|
||||
qparams.add(new BasicNameValuePair("use_identifier", "0"));
|
||||
try {
|
||||
HttpEntity entity = this.plConn
|
||||
.sendToServer(qparams, "/cube/rules");
|
||||
CsvReader csv = new CsvReader(entity.getContent(),
|
||||
Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
while (csv.readRecord()) {
|
||||
// System.out.println(csv.getRawRecord());
|
||||
paloRules.add(new palorule(plConn, lDatabaseId, iCubeId,
|
||||
palohelpers.StringToInt(csv.get(0)), csv.get(1), csv
|
||||
.get(2), csv.get(3), palohelpers
|
||||
.StringToLong(csv.get(4)), palohelpers
|
||||
.StringToBoolean(csv.get(5))));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
private long lDatabaseId;
|
||||
|
||||
}
|
||||
private int iCubeId;
|
||||
|
||||
public int getNumberOfRules() {
|
||||
return paloRules.size();
|
||||
}
|
||||
private String strRuleParseResult;
|
||||
|
||||
// Returns the Rule at the given Position
|
||||
public palorule getRule(int iIndex) {
|
||||
return paloRules.get(iIndex);
|
||||
}
|
||||
public palorules(paloconnection plConn, long lDatabaseId, int iCubeId) throws paloexception {
|
||||
super();
|
||||
this.plConn = plConn;
|
||||
this.lDatabaseId = lDatabaseId;
|
||||
this.iCubeId = iCubeId;
|
||||
|
||||
// Returns the Rule with the given Identifier
|
||||
public palorule getRule(long lIdentifier) {
|
||||
for (palorule paloRule : paloRules) {
|
||||
if (paloRule.getIdentifier() == lIdentifier)
|
||||
return paloRule;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(this.iCubeId)));
|
||||
qparams.add(new BasicNameValuePair("use_identifier", "0"));
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/cube/rules");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
while (csv.readNext()) {
|
||||
// System.out.println(csv.getRawRecord());
|
||||
paloRules.add(new palorule(plConn, lDatabaseId, iCubeId, palohelpers.StringToInt(csv.get(0)), csv.get(1), csv
|
||||
.get(2), csv.get(3), palohelpers.StringToLong(csv.get(4)), palohelpers.StringToBoolean(csv.get(5))));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
|
||||
// Returns the Rule with the given Extern_Id
|
||||
public palorule getRule(String strExtern_Id) {
|
||||
for (palorule paloRule : paloRules) {
|
||||
if (paloRule.getExtern_Id().equals(strExtern_Id))
|
||||
return paloRule;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<palorule> getRules() {
|
||||
return paloRules;
|
||||
}
|
||||
public int getNumberOfRules() {
|
||||
return paloRules.size();
|
||||
}
|
||||
|
||||
// Deletes the Rule at the given position
|
||||
public void deleteRule(int iIndex) throws paloexception {
|
||||
palorule paloRuleToRemove = getRule(iIndex);
|
||||
if (null != paloRuleToRemove) {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String
|
||||
.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String
|
||||
.valueOf(this.iCubeId)));
|
||||
qparams.add(new BasicNameValuePair("rule", String
|
||||
.valueOf(paloRuleToRemove.getIdentifier())));
|
||||
plConn.sendToServerSingleRC(qparams, "/rule/destroy");
|
||||
paloRules.remove(paloRuleToRemove);
|
||||
}
|
||||
}
|
||||
// Returns the Rule at the given Position
|
||||
public palorule getRule(int iIndex) {
|
||||
return paloRules.get(iIndex);
|
||||
}
|
||||
|
||||
// Deletes the Rule with given Identifier
|
||||
public void deleteRule(long lIdentifier) throws paloexception {
|
||||
palorule paloRuleToRemove = getRule(lIdentifier);
|
||||
if (null != paloRuleToRemove) {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String
|
||||
.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String
|
||||
.valueOf(this.iCubeId)));
|
||||
qparams.add(new BasicNameValuePair("rule", String
|
||||
.valueOf(paloRuleToRemove.getIdentifier())));
|
||||
plConn.sendToServerSingleRC(qparams, "/rule/destroy");
|
||||
paloRules.remove(paloRuleToRemove);
|
||||
}
|
||||
}
|
||||
// Returns the Rule with the given Identifier
|
||||
public palorule getRule(long lIdentifier) {
|
||||
for (palorule paloRule : paloRules) {
|
||||
if (paloRule.getIdentifier() == lIdentifier) {
|
||||
return paloRule;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Deletes the Rule with given External_Id
|
||||
public void deleteRule(String strExtern_Id) throws paloexception {
|
||||
palorule paloRuleToRemove = getRule(strExtern_Id);
|
||||
if (null != paloRuleToRemove) {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String
|
||||
.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String
|
||||
.valueOf(this.iCubeId)));
|
||||
qparams.add(new BasicNameValuePair("rule", String
|
||||
.valueOf(paloRuleToRemove.getIdentifier())));
|
||||
plConn.sendToServerSingleRC(qparams, "/rule/destroy");
|
||||
paloRules.remove(paloRuleToRemove);
|
||||
}
|
||||
}
|
||||
// Returns the Rule with the given Extern_Id
|
||||
public palorule getRule(String strExtern_Id) {
|
||||
for (palorule paloRule : paloRules) {
|
||||
if (paloRule.getExtern_Id().equals(strExtern_Id)) {
|
||||
return paloRule;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String parseRule(String strRuleToParse) throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String
|
||||
.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(this.iCubeId)));
|
||||
qparams.add(new BasicNameValuePair("definition", strRuleToParse));
|
||||
try {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
HttpEntity entity = this.plConn
|
||||
.sendToServer(qparams, "/rule/parse");
|
||||
CsvReader csv = new CsvReader(entity.getContent(),
|
||||
Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
while (csv.readRecord()) {
|
||||
sb.append(csv.get(0));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
return sb.toString();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
public ArrayList<palorule> getRules() {
|
||||
return paloRules;
|
||||
}
|
||||
|
||||
public String getParseRuleResult() {
|
||||
return strRuleParseResult;
|
||||
}
|
||||
// Deletes the Rule at the given position
|
||||
public void deleteRule(int iIndex) throws paloexception {
|
||||
palorule paloRuleToRemove = getRule(iIndex);
|
||||
if (null != paloRuleToRemove) {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(this.iCubeId)));
|
||||
qparams.add(new BasicNameValuePair("rule", String.valueOf(paloRuleToRemove.getIdentifier())));
|
||||
plConn.sendToServerSingleRC(qparams, "/rule/destroy");
|
||||
paloRules.remove(paloRuleToRemove);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a rule to the given cube
|
||||
*
|
||||
*
|
||||
* @param The
|
||||
* rule definition
|
||||
* @param Identifier
|
||||
* flag
|
||||
* @param An
|
||||
* external Id
|
||||
* @param The
|
||||
* comment for this rule
|
||||
* @param Acitvation
|
||||
* flag
|
||||
* @return The added palorule
|
||||
*/
|
||||
public palorule addRule(String strRuleDefinition, boolean bUseIdentifier,
|
||||
String strExtern_Id, String strComment, boolean bActivate)
|
||||
throws paloexception {
|
||||
palorule plRule = null;
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String
|
||||
.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(this.iCubeId)));
|
||||
qparams.add(new BasicNameValuePair("definition", strRuleDefinition));
|
||||
qparams.add(new BasicNameValuePair("activate", palohelpers
|
||||
.BooleanToString(bActivate)));
|
||||
qparams.add(new BasicNameValuePair("external_identifier", strExtern_Id));
|
||||
qparams.add(new BasicNameValuePair("comment", strComment));
|
||||
qparams.add(new BasicNameValuePair("use_identifier", palohelpers
|
||||
.BooleanToString(bUseIdentifier)));
|
||||
// Deletes the Rule with given Identifier
|
||||
public void deleteRule(long lIdentifier) throws paloexception {
|
||||
palorule paloRuleToRemove = getRule(lIdentifier);
|
||||
if (null != paloRuleToRemove) {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(this.iCubeId)));
|
||||
qparams.add(new BasicNameValuePair("rule", String.valueOf(paloRuleToRemove.getIdentifier())));
|
||||
plConn.sendToServerSingleRC(qparams, "/rule/destroy");
|
||||
paloRules.remove(paloRuleToRemove);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams,
|
||||
"/rule/create");
|
||||
CsvReader csv = new CsvReader(entity.getContent(),
|
||||
Charset.forName("UTF-8"));
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
while (csv.readRecord()) {
|
||||
// System.out.println(csv.getRawRecord());
|
||||
plRule = new palorule(plConn, lDatabaseId, iCubeId,
|
||||
palohelpers.StringToInt(csv.get(0)), csv.get(1),
|
||||
csv.get(2), csv.get(3), palohelpers.StringToLong(csv
|
||||
.get(4)), palohelpers.StringToBoolean(csv
|
||||
.get(5)));
|
||||
paloRules.add(plRule);
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
return plRule;
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
// Deletes the Rule with given External_Id
|
||||
public void deleteRule(String strExtern_Id) throws paloexception {
|
||||
palorule paloRuleToRemove = getRule(strExtern_Id);
|
||||
if (null != paloRuleToRemove) {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(this.iCubeId)));
|
||||
qparams.add(new BasicNameValuePair("rule", String.valueOf(paloRuleToRemove.getIdentifier())));
|
||||
plConn.sendToServerSingleRC(qparams, "/rule/destroy");
|
||||
paloRules.remove(paloRuleToRemove);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
paloconnection pcon = new paloconnection("admin", "admin", "localhost",
|
||||
"7777");
|
||||
palodatabases pds = new palodatabases(pcon);
|
||||
palodatabase pd = pds.createDatabase("PaloRuleTest");
|
||||
palodimensions pdims = pd.getDimensions(0);
|
||||
palodimension pdim = null;
|
||||
palodimension pdim1 = null;
|
||||
pdim = pdims.getDimension("Monat");
|
||||
if (pdim == null)
|
||||
pdim = pdims.createDimension("Monat");
|
||||
pdim1 = pdims.getDimension("D2");
|
||||
if (pdim1 == null)
|
||||
pdim = pdims.createDimension("D2");
|
||||
palocubes pcs = new palocubes(pcon, pd, 0);
|
||||
if (pcs.getCube("cube1") == null)
|
||||
pcs.createCube("cube1", new String[] { "Monat", "D2" }, 0);
|
||||
palorules pll = new palorules(pcon, pd.getDatabaseId(), pcs.getCube(
|
||||
"cube1").getCubeId());
|
||||
}
|
||||
public String parseRule(String strRuleToParse) throws paloexception {
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(this.iCubeId)));
|
||||
qparams.add(new BasicNameValuePair("definition", strRuleToParse));
|
||||
try {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/rule/parse");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
while (csv.readNext()) {
|
||||
sb.append(csv.get(0));
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
return sb.toString();
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public String getParseRuleResult() {
|
||||
return strRuleParseResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a rule to the given cube
|
||||
*
|
||||
*
|
||||
* @param The rule definition
|
||||
* @param Identifier flag
|
||||
* @param An external Id
|
||||
* @param The comment for this rule
|
||||
* @param Acitvation flag
|
||||
* @return The added palorule
|
||||
*/
|
||||
public palorule addRule(String strRuleDefinition, boolean bUseIdentifier, String strExtern_Id, String strComment,
|
||||
boolean bActivate) throws paloexception {
|
||||
palorule plRule = null;
|
||||
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
|
||||
qparams.add(new BasicNameValuePair("sid", this.plConn.getPaloToken()));
|
||||
qparams.add(new BasicNameValuePair("database", String.valueOf(this.lDatabaseId)));
|
||||
qparams.add(new BasicNameValuePair("cube", String.valueOf(this.iCubeId)));
|
||||
qparams.add(new BasicNameValuePair("definition", strRuleDefinition));
|
||||
qparams.add(new BasicNameValuePair("activate", palohelpers.BooleanToString(bActivate)));
|
||||
qparams.add(new BasicNameValuePair("external_identifier", strExtern_Id));
|
||||
qparams.add(new BasicNameValuePair("comment", strComment));
|
||||
qparams.add(new BasicNameValuePair("use_identifier", palohelpers.BooleanToString(bUseIdentifier)));
|
||||
|
||||
try {
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/rule/create");
|
||||
CSVReader csv = new CSVReader(entity.getContent(), ';', "UTF-8");
|
||||
csv.setQuoteChar('"');
|
||||
while (csv.readNext()) {
|
||||
// System.out.println(csv.getRawRecord());
|
||||
plRule = new palorule(plConn, lDatabaseId, iCubeId, palohelpers.StringToInt(csv.get(0)), csv.get(1), csv.get(2),
|
||||
csv.get(3), palohelpers.StringToLong(csv.get(4)), palohelpers.StringToBoolean(csv.get(5)));
|
||||
paloRules.add(plRule);
|
||||
}
|
||||
csv.close();
|
||||
entity.consumeContent();
|
||||
return plRule;
|
||||
} catch (Exception e) {
|
||||
throw new paloexception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
paloconnection pcon = new paloconnection("admin", "admin", "localhost", "7777");
|
||||
palodatabases pds = new palodatabases(pcon);
|
||||
palodatabase pd = pds.createDatabase("PaloRuleTest");
|
||||
palodimensions pdims = pd.getDimensions(0);
|
||||
palodimension pdim = null;
|
||||
palodimension pdim1 = null;
|
||||
pdim = pdims.getDimension("Monat");
|
||||
if (pdim == null) {
|
||||
pdim = pdims.createDimension("Monat");
|
||||
}
|
||||
pdim1 = pdims.getDimension("D2");
|
||||
if (pdim1 == null) {
|
||||
pdim = pdims.createDimension("D2");
|
||||
}
|
||||
palocubes pcs = new palocubes(pcon, pd, 0);
|
||||
if (pcs.getCube("cube1") == null) {
|
||||
pcs.createCube("cube1", new String[] { "Monat", "D2" }, 0);
|
||||
}
|
||||
palorules pll = new palorules(pcon, pd.getDatabaseId(), pcs.getCube("cube1").getCubeId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<path id="compile.classpath">
|
||||
<pathelement location="${component.plugin.home}/tSalesforceBulkExec/partnerBulk.jar" />
|
||||
<pathelement location="${component.plugin.home}/tSalesforceBulkExec/wsc.jar" />
|
||||
<pathelement location="${component.plugin.home}/tFileInputDelimited/javacsv.jar" />
|
||||
<pathelement location="${component.plugin.home}/tFileInputDelimited/talendcsv.jar" />
|
||||
</path>
|
||||
|
||||
<!-- #################################################### -->
|
||||
|
||||
@@ -2,167 +2,228 @@ package com.sforce.soap.partner;
|
||||
|
||||
/** * Generated class, please do not edit. */
|
||||
public class ChildRelationship implements com.sforce.ws.bind.XMLizable {
|
||||
/** * Constructor */
|
||||
public ChildRelationship() {
|
||||
}
|
||||
|
||||
/** * Constructor */
|
||||
public ChildRelationship() {
|
||||
}
|
||||
/**
|
||||
* * element : cascadeDelete of type
|
||||
* {http://www.w3.org/2001/XMLSchema}boolean * java type: boolean
|
||||
*/
|
||||
private static final com.sforce.ws.bind.TypeInfo cascadeDelete__typeInfo = new com.sforce.ws.bind.TypeInfo(
|
||||
"urn:partner.soap.sforce.com", "cascadeDelete",
|
||||
"http://www.w3.org/2001/XMLSchema", "boolean", 1, 1, true);
|
||||
private boolean cascadeDelete__is_set = false;
|
||||
private boolean cascadeDelete;
|
||||
|
||||
/** * element : cascadeDelete of type {http://www.w3.org/2001/XMLSchema}boolean * java type: boolean */
|
||||
private static final com.sforce.ws.bind.TypeInfo cascadeDelete__typeInfo = new com.sforce.ws.bind.TypeInfo(
|
||||
"urn:partner.soap.sforce.com", "cascadeDelete", "http://www.w3.org/2001/XMLSchema", "boolean", 1, 1, true);
|
||||
public boolean getCascadeDelete() {
|
||||
return cascadeDelete;
|
||||
}
|
||||
|
||||
private boolean cascadeDelete__is_set = false;
|
||||
public boolean isCascadeDelete() {
|
||||
return cascadeDelete;
|
||||
}
|
||||
|
||||
private boolean cascadeDelete;
|
||||
public void setCascadeDelete(boolean cascadeDelete) {
|
||||
this.cascadeDelete = cascadeDelete;
|
||||
cascadeDelete__is_set = true;
|
||||
}
|
||||
|
||||
public boolean getCascadeDelete() {
|
||||
return cascadeDelete;
|
||||
}
|
||||
/**
|
||||
* * element : childSObject of type {http://www.w3.org/2001/XMLSchema}string
|
||||
* * java type: java.lang.String
|
||||
*/
|
||||
private static final com.sforce.ws.bind.TypeInfo childSObject__typeInfo = new com.sforce.ws.bind.TypeInfo(
|
||||
"urn:partner.soap.sforce.com", "childSObject",
|
||||
"http://www.w3.org/2001/XMLSchema", "string", 1, 1, true);
|
||||
private boolean childSObject__is_set = false;
|
||||
private java.lang.String childSObject;
|
||||
|
||||
public boolean isCascadeDelete() {
|
||||
return cascadeDelete;
|
||||
}
|
||||
public java.lang.String getChildSObject() {
|
||||
return childSObject;
|
||||
}
|
||||
|
||||
public void setCascadeDelete(boolean cascadeDelete) {
|
||||
this.cascadeDelete = cascadeDelete;
|
||||
cascadeDelete__is_set = true;
|
||||
}
|
||||
public void setChildSObject(java.lang.String childSObject) {
|
||||
this.childSObject = childSObject;
|
||||
childSObject__is_set = true;
|
||||
}
|
||||
|
||||
/** * element : childSObject of type {http://www.w3.org/2001/XMLSchema}string * java type: java.lang.String */
|
||||
private static final com.sforce.ws.bind.TypeInfo childSObject__typeInfo = new com.sforce.ws.bind.TypeInfo(
|
||||
"urn:partner.soap.sforce.com", "childSObject", "http://www.w3.org/2001/XMLSchema", "string", 1, 1, true);
|
||||
/**
|
||||
* * element : deprecatedAndHidden of type
|
||||
* {http://www.w3.org/2001/XMLSchema}boolean * java type: boolean
|
||||
*/
|
||||
private static final com.sforce.ws.bind.TypeInfo deprecatedAndHidden__typeInfo = new com.sforce.ws.bind.TypeInfo(
|
||||
"urn:partner.soap.sforce.com", "deprecatedAndHidden",
|
||||
"http://www.w3.org/2001/XMLSchema", "boolean", 1, 1, true);
|
||||
private boolean deprecatedAndHidden__is_set = false;
|
||||
private boolean deprecatedAndHidden;
|
||||
|
||||
private boolean childSObject__is_set = false;
|
||||
public boolean getDeprecatedAndHidden() {
|
||||
return deprecatedAndHidden;
|
||||
}
|
||||
|
||||
private java.lang.String childSObject;
|
||||
public boolean isDeprecatedAndHidden() {
|
||||
return deprecatedAndHidden;
|
||||
}
|
||||
|
||||
public java.lang.String getChildSObject() {
|
||||
return childSObject;
|
||||
}
|
||||
public void setDeprecatedAndHidden(boolean deprecatedAndHidden) {
|
||||
this.deprecatedAndHidden = deprecatedAndHidden;
|
||||
deprecatedAndHidden__is_set = true;
|
||||
}
|
||||
|
||||
public void setChildSObject(java.lang.String childSObject) {
|
||||
this.childSObject = childSObject;
|
||||
childSObject__is_set = true;
|
||||
}
|
||||
/**
|
||||
* * element : field of type {http://www.w3.org/2001/XMLSchema}string * java
|
||||
* type: java.lang.String
|
||||
*/
|
||||
private static final com.sforce.ws.bind.TypeInfo field__typeInfo = new com.sforce.ws.bind.TypeInfo(
|
||||
"urn:partner.soap.sforce.com", "field",
|
||||
"http://www.w3.org/2001/XMLSchema", "string", 1, 1, true);
|
||||
private boolean field__is_set = false;
|
||||
private java.lang.String field;
|
||||
|
||||
/** * element : deprecatedAndHidden of type {http://www.w3.org/2001/XMLSchema}boolean * java type: boolean */
|
||||
private static final com.sforce.ws.bind.TypeInfo deprecatedAndHidden__typeInfo = new com.sforce.ws.bind.TypeInfo(
|
||||
"urn:partner.soap.sforce.com", "deprecatedAndHidden", "http://www.w3.org/2001/XMLSchema", "boolean", 1, 1, true);
|
||||
public java.lang.String getField() {
|
||||
return field;
|
||||
}
|
||||
|
||||
private boolean deprecatedAndHidden__is_set = false;
|
||||
public void setField(java.lang.String field) {
|
||||
this.field = field;
|
||||
field__is_set = true;
|
||||
}
|
||||
|
||||
private boolean deprecatedAndHidden;
|
||||
/**
|
||||
* * element : relationshipName of type
|
||||
* {http://www.w3.org/2001/XMLSchema}string * java type: java.lang.String
|
||||
*/
|
||||
private static final com.sforce.ws.bind.TypeInfo relationshipName__typeInfo = new com.sforce.ws.bind.TypeInfo(
|
||||
"urn:partner.soap.sforce.com", "relationshipName",
|
||||
"http://www.w3.org/2001/XMLSchema", "string", 0, 1, true);
|
||||
private boolean relationshipName__is_set = false;
|
||||
private java.lang.String relationshipName;
|
||||
|
||||
public boolean getDeprecatedAndHidden() {
|
||||
return deprecatedAndHidden;
|
||||
}
|
||||
public java.lang.String getRelationshipName() {
|
||||
return relationshipName;
|
||||
}
|
||||
|
||||
public boolean isDeprecatedAndHidden() {
|
||||
return deprecatedAndHidden;
|
||||
}
|
||||
public void setRelationshipName(java.lang.String relationshipName) {
|
||||
this.relationshipName = relationshipName;
|
||||
relationshipName__is_set = true;
|
||||
}
|
||||
|
||||
public void setDeprecatedAndHidden(boolean deprecatedAndHidden) {
|
||||
this.deprecatedAndHidden = deprecatedAndHidden;
|
||||
deprecatedAndHidden__is_set = true;
|
||||
}
|
||||
/**
|
||||
* * element : restrictedDelete of type
|
||||
* {http://www.w3.org/2001/XMLSchema}boolean * java type: boolean
|
||||
*/
|
||||
private static final com.sforce.ws.bind.TypeInfo restrictedDelete__typeInfo = new com.sforce.ws.bind.TypeInfo(
|
||||
"urn:partner.soap.sforce.com", "restrictedDelete",
|
||||
"http://www.w3.org/2001/XMLSchema", "boolean", 0, 1, true);
|
||||
private boolean restrictedDelete__is_set = false;
|
||||
private boolean restrictedDelete;
|
||||
|
||||
/** * element : field of type {http://www.w3.org/2001/XMLSchema}string * java type: java.lang.String */
|
||||
private static final com.sforce.ws.bind.TypeInfo field__typeInfo = new com.sforce.ws.bind.TypeInfo(
|
||||
"urn:partner.soap.sforce.com", "field", "http://www.w3.org/2001/XMLSchema", "string", 1, 1, true);
|
||||
public boolean getRestrictedDelete() {
|
||||
return restrictedDelete;
|
||||
}
|
||||
|
||||
private boolean field__is_set = false;
|
||||
public boolean isRestrictedDelete() {
|
||||
return restrictedDelete;
|
||||
}
|
||||
|
||||
private java.lang.String field;
|
||||
public void setRestrictedDelete(boolean restrictedDelete) {
|
||||
this.restrictedDelete = restrictedDelete;
|
||||
restrictedDelete__is_set = true;
|
||||
}
|
||||
|
||||
public java.lang.String getField() {
|
||||
return field;
|
||||
}
|
||||
/** */
|
||||
public void write(javax.xml.namespace.QName __element,
|
||||
com.sforce.ws.parser.XmlOutputStream __out,
|
||||
com.sforce.ws.bind.TypeMapper __typeMapper)
|
||||
throws java.io.IOException {
|
||||
__out.writeStartTag(__element.getNamespaceURI(),
|
||||
__element.getLocalPart());
|
||||
writeFields(__out, __typeMapper);
|
||||
__out.writeEndTag(__element.getNamespaceURI(), __element.getLocalPart());
|
||||
}
|
||||
|
||||
public void setField(java.lang.String field) {
|
||||
this.field = field;
|
||||
field__is_set = true;
|
||||
}
|
||||
protected void writeFields(com.sforce.ws.parser.XmlOutputStream __out,
|
||||
com.sforce.ws.bind.TypeMapper __typeMapper)
|
||||
throws java.io.IOException {
|
||||
__typeMapper.writeBoolean(__out, cascadeDelete__typeInfo,
|
||||
cascadeDelete, cascadeDelete__is_set);
|
||||
__typeMapper.writeString(__out, childSObject__typeInfo, childSObject,
|
||||
childSObject__is_set);
|
||||
__typeMapper.writeBoolean(__out, deprecatedAndHidden__typeInfo,
|
||||
deprecatedAndHidden, deprecatedAndHidden__is_set);
|
||||
__typeMapper.writeString(__out, field__typeInfo, field, field__is_set);
|
||||
__typeMapper.writeString(__out, relationshipName__typeInfo,
|
||||
relationshipName, relationshipName__is_set);
|
||||
__typeMapper.writeBoolean(__out, restrictedDelete__typeInfo,
|
||||
restrictedDelete, restrictedDelete__is_set);
|
||||
}
|
||||
|
||||
/** * element : relationshipName of type {http://www.w3.org/2001/XMLSchema}string * java type: java.lang.String */
|
||||
private static final com.sforce.ws.bind.TypeInfo relationshipName__typeInfo = new com.sforce.ws.bind.TypeInfo(
|
||||
"urn:partner.soap.sforce.com", "relationshipName", "http://www.w3.org/2001/XMLSchema", "string", 0, 1, true);
|
||||
public void load(com.sforce.ws.parser.XmlInputStream __in,
|
||||
com.sforce.ws.bind.TypeMapper __typeMapper)
|
||||
throws java.io.IOException, com.sforce.ws.ConnectionException {
|
||||
__typeMapper.consumeStartTag(__in);
|
||||
loadFields(__in, __typeMapper);
|
||||
__typeMapper.consumeEndTag(__in);
|
||||
}
|
||||
|
||||
private boolean relationshipName__is_set = false;
|
||||
protected void loadFields(com.sforce.ws.parser.XmlInputStream __in,
|
||||
com.sforce.ws.bind.TypeMapper __typeMapper)
|
||||
throws java.io.IOException, com.sforce.ws.ConnectionException {
|
||||
__in.peekTag();
|
||||
if (__typeMapper.verifyElement(__in, cascadeDelete__typeInfo)) {
|
||||
setCascadeDelete((boolean) __typeMapper.readBoolean(__in,
|
||||
cascadeDelete__typeInfo, boolean.class));
|
||||
}
|
||||
__in.peekTag();
|
||||
if (__typeMapper.verifyElement(__in, childSObject__typeInfo)) {
|
||||
setChildSObject((java.lang.String) __typeMapper.readString(__in,
|
||||
childSObject__typeInfo, java.lang.String.class));
|
||||
}
|
||||
__in.peekTag();
|
||||
if (__typeMapper.verifyElement(__in, deprecatedAndHidden__typeInfo)) {
|
||||
setDeprecatedAndHidden((boolean) __typeMapper.readBoolean(__in,
|
||||
deprecatedAndHidden__typeInfo, boolean.class));
|
||||
}
|
||||
__in.peekTag();
|
||||
if (__typeMapper.verifyElement(__in, field__typeInfo)) {
|
||||
setField((java.lang.String) __typeMapper.readString(__in,
|
||||
field__typeInfo, java.lang.String.class));
|
||||
}
|
||||
__in.peekTag();
|
||||
if (__typeMapper.isElement(__in, relationshipName__typeInfo)) {
|
||||
setRelationshipName((java.lang.String) __typeMapper.readString(
|
||||
__in, relationshipName__typeInfo, java.lang.String.class));
|
||||
}
|
||||
__in.peekTag();
|
||||
if (__typeMapper.isElement(__in, restrictedDelete__typeInfo)) {
|
||||
setRestrictedDelete((boolean) __typeMapper.readBoolean(__in,
|
||||
restrictedDelete__typeInfo, boolean.class));
|
||||
}
|
||||
}
|
||||
|
||||
private java.lang.String relationshipName;
|
||||
|
||||
public java.lang.String getRelationshipName() {
|
||||
return relationshipName;
|
||||
}
|
||||
|
||||
public void setRelationshipName(java.lang.String relationshipName) {
|
||||
this.relationshipName = relationshipName;
|
||||
relationshipName__is_set = true;
|
||||
}
|
||||
|
||||
/** */
|
||||
public void write(javax.xml.namespace.QName __element, com.sforce.ws.parser.XmlOutputStream __out,
|
||||
com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException {
|
||||
__out.writeStartTag(__element.getNamespaceURI(), __element.getLocalPart());
|
||||
writeFields(__out, __typeMapper);
|
||||
__out.writeEndTag(__element.getNamespaceURI(), __element.getLocalPart());
|
||||
}
|
||||
|
||||
protected void writeFields(com.sforce.ws.parser.XmlOutputStream __out, com.sforce.ws.bind.TypeMapper __typeMapper)
|
||||
throws java.io.IOException {
|
||||
__typeMapper.writeBoolean(__out, cascadeDelete__typeInfo, cascadeDelete, cascadeDelete__is_set);
|
||||
__typeMapper.writeString(__out, childSObject__typeInfo, childSObject, childSObject__is_set);
|
||||
__typeMapper.writeBoolean(__out, deprecatedAndHidden__typeInfo, deprecatedAndHidden, deprecatedAndHidden__is_set);
|
||||
__typeMapper.writeString(__out, field__typeInfo, field, field__is_set);
|
||||
__typeMapper.writeString(__out, relationshipName__typeInfo, relationshipName, relationshipName__is_set);
|
||||
}
|
||||
|
||||
public void load(com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper)
|
||||
throws java.io.IOException, com.sforce.ws.ConnectionException {
|
||||
__typeMapper.consumeStartTag(__in);
|
||||
loadFields(__in, __typeMapper);
|
||||
__typeMapper.consumeEndTag(__in);
|
||||
}
|
||||
|
||||
protected void loadFields(com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper)
|
||||
throws java.io.IOException, com.sforce.ws.ConnectionException {
|
||||
__in.peekTag();
|
||||
if (__typeMapper.verifyElement(__in, cascadeDelete__typeInfo)) {
|
||||
setCascadeDelete((boolean) __typeMapper.readBoolean(__in, cascadeDelete__typeInfo, boolean.class));
|
||||
}
|
||||
__in.peekTag();
|
||||
if (__typeMapper.verifyElement(__in, childSObject__typeInfo)) {
|
||||
setChildSObject((java.lang.String) __typeMapper.readString(__in, childSObject__typeInfo, java.lang.String.class));
|
||||
}
|
||||
__in.peekTag();
|
||||
if (__typeMapper.verifyElement(__in, deprecatedAndHidden__typeInfo)) {
|
||||
setDeprecatedAndHidden((boolean) __typeMapper.readBoolean(__in, deprecatedAndHidden__typeInfo, boolean.class));
|
||||
}
|
||||
__in.peekTag();
|
||||
if (__typeMapper.verifyElement(__in, field__typeInfo)) {
|
||||
setField((java.lang.String) __typeMapper.readString(__in, field__typeInfo, java.lang.String.class));
|
||||
}
|
||||
__in.peekTag();
|
||||
if (__typeMapper.isElement(__in, relationshipName__typeInfo)) {
|
||||
setRelationshipName((java.lang.String) __typeMapper.readString(__in, relationshipName__typeInfo,
|
||||
java.lang.String.class));
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
java.lang.StringBuilder sb = new java.lang.StringBuilder();
|
||||
sb.append("[ChildRelationship ");
|
||||
sb.append(" cascadeDelete=");
|
||||
sb.append("'" + com.sforce.ws.util.Verbose.toString(cascadeDelete) + "'\n");
|
||||
sb.append(" childSObject=");
|
||||
sb.append("'" + com.sforce.ws.util.Verbose.toString(childSObject) + "'\n");
|
||||
sb.append(" deprecatedAndHidden=");
|
||||
sb.append("'" + com.sforce.ws.util.Verbose.toString(deprecatedAndHidden) + "'\n");
|
||||
sb.append(" field=");
|
||||
sb.append("'" + com.sforce.ws.util.Verbose.toString(field) + "'\n");
|
||||
sb.append(" relationshipName=");
|
||||
sb.append("'" + com.sforce.ws.util.Verbose.toString(relationshipName) + "'\n");
|
||||
sb.append("]\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
public String toString() {
|
||||
java.lang.StringBuilder sb = new java.lang.StringBuilder();
|
||||
sb.append("[ChildRelationship ");
|
||||
sb.append(" cascadeDelete=");
|
||||
sb.append("'" + com.sforce.ws.util.Verbose.toString(cascadeDelete)
|
||||
+ "'\n");
|
||||
sb.append(" childSObject=");
|
||||
sb.append("'" + com.sforce.ws.util.Verbose.toString(childSObject)
|
||||
+ "'\n");
|
||||
sb.append(" deprecatedAndHidden=");
|
||||
sb.append("'"
|
||||
+ com.sforce.ws.util.Verbose.toString(deprecatedAndHidden)
|
||||
+ "'\n");
|
||||
sb.append(" field=");
|
||||
sb.append("'" + com.sforce.ws.util.Verbose.toString(field) + "'\n");
|
||||
sb.append(" relationshipName=");
|
||||
sb.append("'" + com.sforce.ws.util.Verbose.toString(relationshipName)
|
||||
+ "'\n");
|
||||
sb.append(" restrictedDelete=");
|
||||
sb.append("'" + com.sforce.ws.util.Verbose.toString(restrictedDelete)
|
||||
+ "'\n");
|
||||
sb.append("]\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import com.sforce.ws.ConnectionException;
|
||||
/** * Generated class, please do not edit. */
|
||||
public class Connector {
|
||||
|
||||
public static final String END_POINT = "https://login.salesforce.com/services/Soap/u/24.0";
|
||||
public static final String END_POINT = "https://login.salesforce.com/services/Soap/u/25.0";
|
||||
|
||||
public static PartnerConnection newConnection(String username, String password) throws ConnectionException {
|
||||
ConnectorConfig config = new ConnectorConfig();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,48 +2,28 @@ package com.sforce.soap.partner;
|
||||
|
||||
/** * Generated enum, please do not edit. */
|
||||
public enum FieldType {
|
||||
/** * Enumeration : string */
|
||||
string,
|
||||
/** * Enumeration : picklist */
|
||||
picklist,
|
||||
/** * Enumeration : multipicklist */
|
||||
multipicklist,
|
||||
/** * Enumeration : combobox */
|
||||
combobox,
|
||||
/** * Enumeration : reference */
|
||||
reference,
|
||||
/** * Enumeration : base64 */
|
||||
base64,
|
||||
/** * Enumeration : _boolean */
|
||||
_boolean,
|
||||
/** * Enumeration : currency */
|
||||
currency,
|
||||
/** * Enumeration : textarea */
|
||||
textarea,
|
||||
/** * Enumeration : _int */
|
||||
_int,
|
||||
/** * Enumeration : _double */
|
||||
_double,
|
||||
/** * Enumeration : percent */
|
||||
percent,
|
||||
/** * Enumeration : phone */
|
||||
phone,
|
||||
/** * Enumeration : id */
|
||||
id,
|
||||
/** * Enumeration : date */
|
||||
date,
|
||||
/** * Enumeration : datetime */
|
||||
datetime,
|
||||
/** * Enumeration : time */
|
||||
time,
|
||||
/** * Enumeration : url */
|
||||
url,
|
||||
/** * Enumeration : email */
|
||||
email,
|
||||
/** * Enumeration : encryptedstring */
|
||||
encryptedstring,
|
||||
/** * Enumeration : datacategorygroupreference */
|
||||
datacategorygroupreference,
|
||||
/** * Enumeration : anyType */
|
||||
anyType,
|
||||
}
|
||||
/** * Enumeration : string */
|
||||
string, /** * Enumeration : picklist */
|
||||
picklist, /** * Enumeration : multipicklist */
|
||||
multipicklist, /** * Enumeration : combobox */
|
||||
combobox, /** * Enumeration : reference */
|
||||
reference, /** * Enumeration : base64 */
|
||||
base64, /** * Enumeration : _boolean */
|
||||
_boolean, /** * Enumeration : currency */
|
||||
currency, /** * Enumeration : textarea */
|
||||
textarea, /** * Enumeration : _int */
|
||||
_int, /** * Enumeration : _double */
|
||||
_double, /** * Enumeration : percent */
|
||||
percent, /** * Enumeration : phone */
|
||||
phone, /** * Enumeration : id */
|
||||
id, /** * Enumeration : date */
|
||||
date, /** * Enumeration : datetime */
|
||||
datetime, /** * Enumeration : time */
|
||||
time, /** * Enumeration : url */
|
||||
url, /** * Enumeration : email */
|
||||
email, /** * Enumeration : encryptedstring */
|
||||
encryptedstring, /** * Enumeration : datacategorygroupreference */
|
||||
datacategorygroupreference, /** * Enumeration : location */
|
||||
location, /** * Enumeration : anyType */
|
||||
anyType,
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,338 +2,338 @@ package com.sforce.soap.partner;
|
||||
|
||||
/** * Generated enum, please do not edit. */
|
||||
public enum StatusCode {
|
||||
/** * Enumeration : ALL_OR_NONE_OPERATION_ROLLED_BACK */
|
||||
ALL_OR_NONE_OPERATION_ROLLED_BACK,
|
||||
/** * Enumeration : ALREADY_IN_PROCESS */
|
||||
ALREADY_IN_PROCESS,
|
||||
/** * Enumeration : ASSIGNEE_TYPE_REQUIRED */
|
||||
ASSIGNEE_TYPE_REQUIRED,
|
||||
/** * Enumeration : BAD_CUSTOM_ENTITY_PARENT_DOMAIN */
|
||||
BAD_CUSTOM_ENTITY_PARENT_DOMAIN,
|
||||
/** * Enumeration : BCC_NOT_ALLOWED_IF_BCC_COMPLIANCE_ENABLED */
|
||||
BCC_NOT_ALLOWED_IF_BCC_COMPLIANCE_ENABLED,
|
||||
/** * Enumeration : CANNOT_CASCADE_PRODUCT_ACTIVE */
|
||||
CANNOT_CASCADE_PRODUCT_ACTIVE,
|
||||
/** * Enumeration : CANNOT_CHANGE_FIELD_TYPE_OF_APEX_REFERENCED_FIELD */
|
||||
CANNOT_CHANGE_FIELD_TYPE_OF_APEX_REFERENCED_FIELD,
|
||||
/** * Enumeration : CANNOT_CREATE_ANOTHER_MANAGED_PACKAGE */
|
||||
CANNOT_CREATE_ANOTHER_MANAGED_PACKAGE,
|
||||
/** * Enumeration : CANNOT_DEACTIVATE_DIVISION */
|
||||
CANNOT_DEACTIVATE_DIVISION,
|
||||
/** * Enumeration : CANNOT_DELETE_LAST_DATED_CONVERSION_RATE */
|
||||
CANNOT_DELETE_LAST_DATED_CONVERSION_RATE,
|
||||
/** * Enumeration : CANNOT_DELETE_MANAGED_OBJECT */
|
||||
CANNOT_DELETE_MANAGED_OBJECT,
|
||||
/** * Enumeration : CANNOT_DISABLE_LAST_ADMIN */
|
||||
CANNOT_DISABLE_LAST_ADMIN,
|
||||
/** * Enumeration : CANNOT_ENABLE_IP_RESTRICT_REQUESTS */
|
||||
CANNOT_ENABLE_IP_RESTRICT_REQUESTS,
|
||||
/** * Enumeration : CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY */
|
||||
CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY,
|
||||
/** * Enumeration : CANNOT_MODIFY_MANAGED_OBJECT */
|
||||
CANNOT_MODIFY_MANAGED_OBJECT,
|
||||
/** * Enumeration : CANNOT_RENAME_APEX_REFERENCED_FIELD */
|
||||
CANNOT_RENAME_APEX_REFERENCED_FIELD,
|
||||
/** * Enumeration : CANNOT_RENAME_APEX_REFERENCED_OBJECT */
|
||||
CANNOT_RENAME_APEX_REFERENCED_OBJECT,
|
||||
/** * Enumeration : CANNOT_REPARENT_RECORD */
|
||||
CANNOT_REPARENT_RECORD,
|
||||
/** * Enumeration : CANNOT_UPDATE_CONVERTED_LEAD */
|
||||
CANNOT_UPDATE_CONVERTED_LEAD,
|
||||
/** * Enumeration : CANT_DISABLE_CORP_CURRENCY */
|
||||
CANT_DISABLE_CORP_CURRENCY,
|
||||
/** * Enumeration : CANT_UNSET_CORP_CURRENCY */
|
||||
CANT_UNSET_CORP_CURRENCY,
|
||||
/** * Enumeration : CHILD_SHARE_FAILS_PARENT */
|
||||
CHILD_SHARE_FAILS_PARENT,
|
||||
/** * Enumeration : CIRCULAR_DEPENDENCY */
|
||||
CIRCULAR_DEPENDENCY,
|
||||
/** * Enumeration : COMMUNITY_NOT_ACCESSIBLE */
|
||||
COMMUNITY_NOT_ACCESSIBLE,
|
||||
/** * Enumeration : CUSTOM_CLOB_FIELD_LIMIT_EXCEEDED */
|
||||
CUSTOM_CLOB_FIELD_LIMIT_EXCEEDED,
|
||||
/** * Enumeration : CUSTOM_ENTITY_OR_FIELD_LIMIT */
|
||||
CUSTOM_ENTITY_OR_FIELD_LIMIT,
|
||||
/** * Enumeration : CUSTOM_FIELD_INDEX_LIMIT_EXCEEDED */
|
||||
CUSTOM_FIELD_INDEX_LIMIT_EXCEEDED,
|
||||
/** * Enumeration : CUSTOM_INDEX_EXISTS */
|
||||
CUSTOM_INDEX_EXISTS,
|
||||
/** * Enumeration : CUSTOM_LINK_LIMIT_EXCEEDED */
|
||||
CUSTOM_LINK_LIMIT_EXCEEDED,
|
||||
/** * Enumeration : CUSTOM_TAB_LIMIT_EXCEEDED */
|
||||
CUSTOM_TAB_LIMIT_EXCEEDED,
|
||||
/** * Enumeration : DELETE_FAILED */
|
||||
DELETE_FAILED,
|
||||
/** * Enumeration : DELETE_OPERATION_TOO_LARGE */
|
||||
DELETE_OPERATION_TOO_LARGE,
|
||||
/** * Enumeration : DELETE_REQUIRED_ON_CASCADE */
|
||||
DELETE_REQUIRED_ON_CASCADE,
|
||||
/** * Enumeration : DEPENDENCY_EXISTS */
|
||||
DEPENDENCY_EXISTS,
|
||||
/** * Enumeration : DUPLICATE_CASE_SOLUTION */
|
||||
DUPLICATE_CASE_SOLUTION,
|
||||
/** * Enumeration : DUPLICATE_COMM_NICKNAME */
|
||||
DUPLICATE_COMM_NICKNAME,
|
||||
/** * Enumeration : DUPLICATE_CUSTOM_ENTITY_DEFINITION */
|
||||
DUPLICATE_CUSTOM_ENTITY_DEFINITION,
|
||||
/** * Enumeration : DUPLICATE_CUSTOM_TAB_MOTIF */
|
||||
DUPLICATE_CUSTOM_TAB_MOTIF,
|
||||
/** * Enumeration : DUPLICATE_DEVELOPER_NAME */
|
||||
DUPLICATE_DEVELOPER_NAME,
|
||||
/** * Enumeration : DUPLICATE_EXTERNAL_ID */
|
||||
DUPLICATE_EXTERNAL_ID,
|
||||
/** * Enumeration : DUPLICATE_MASTER_LABEL */
|
||||
DUPLICATE_MASTER_LABEL,
|
||||
/** * Enumeration : DUPLICATE_SENDER_DISPLAY_NAME */
|
||||
DUPLICATE_SENDER_DISPLAY_NAME,
|
||||
/** * Enumeration : DUPLICATE_USERNAME */
|
||||
DUPLICATE_USERNAME,
|
||||
/** * Enumeration : DUPLICATE_VALUE */
|
||||
DUPLICATE_VALUE,
|
||||
/** * Enumeration : EMAIL_NOT_PROCESSED_DUE_TO_PRIOR_ERROR */
|
||||
EMAIL_NOT_PROCESSED_DUE_TO_PRIOR_ERROR,
|
||||
/** * Enumeration : EMPTY_SCONTROL_FILE_NAME */
|
||||
EMPTY_SCONTROL_FILE_NAME,
|
||||
/** * Enumeration : ENTITY_FAILED_IFLASTMODIFIED_ON_UPDATE */
|
||||
ENTITY_FAILED_IFLASTMODIFIED_ON_UPDATE,
|
||||
/** * Enumeration : ENTITY_IS_ARCHIVED */
|
||||
ENTITY_IS_ARCHIVED,
|
||||
/** * Enumeration : ENTITY_IS_DELETED */
|
||||
ENTITY_IS_DELETED,
|
||||
/** * Enumeration : ENTITY_IS_LOCKED */
|
||||
ENTITY_IS_LOCKED,
|
||||
/** * Enumeration : ERROR_IN_MAILER */
|
||||
ERROR_IN_MAILER,
|
||||
/** * Enumeration : FAILED_ACTIVATION */
|
||||
FAILED_ACTIVATION,
|
||||
/** * Enumeration : FIELD_CUSTOM_VALIDATION_EXCEPTION */
|
||||
FIELD_CUSTOM_VALIDATION_EXCEPTION,
|
||||
/** * Enumeration : FIELD_FILTER_VALIDATION_EXCEPTION */
|
||||
FIELD_FILTER_VALIDATION_EXCEPTION,
|
||||
/** * Enumeration : FIELD_INTEGRITY_EXCEPTION */
|
||||
FIELD_INTEGRITY_EXCEPTION,
|
||||
/** * Enumeration : FILTERED_LOOKUP_LIMIT_EXCEEDED */
|
||||
FILTERED_LOOKUP_LIMIT_EXCEEDED,
|
||||
/** * Enumeration : HTML_FILE_UPLOAD_NOT_ALLOWED */
|
||||
HTML_FILE_UPLOAD_NOT_ALLOWED,
|
||||
/** * Enumeration : IMAGE_TOO_LARGE */
|
||||
IMAGE_TOO_LARGE,
|
||||
/** * Enumeration : INACTIVE_OWNER_OR_USER */
|
||||
INACTIVE_OWNER_OR_USER,
|
||||
/** * Enumeration : INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY */
|
||||
INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY,
|
||||
/** * Enumeration : INSUFFICIENT_ACCESS_OR_READONLY */
|
||||
INSUFFICIENT_ACCESS_OR_READONLY,
|
||||
/** * Enumeration : INVALID_ACCESS_LEVEL */
|
||||
INVALID_ACCESS_LEVEL,
|
||||
/** * Enumeration : INVALID_ARGUMENT_TYPE */
|
||||
INVALID_ARGUMENT_TYPE,
|
||||
/** * Enumeration : INVALID_ASSIGNEE_TYPE */
|
||||
INVALID_ASSIGNEE_TYPE,
|
||||
/** * Enumeration : INVALID_ASSIGNMENT_RULE */
|
||||
INVALID_ASSIGNMENT_RULE,
|
||||
/** * Enumeration : INVALID_BATCH_OPERATION */
|
||||
INVALID_BATCH_OPERATION,
|
||||
/** * Enumeration : INVALID_CONTENT_TYPE */
|
||||
INVALID_CONTENT_TYPE,
|
||||
/** * Enumeration : INVALID_CREDIT_CARD_INFO */
|
||||
INVALID_CREDIT_CARD_INFO,
|
||||
/** * Enumeration : INVALID_CROSS_REFERENCE_KEY */
|
||||
INVALID_CROSS_REFERENCE_KEY,
|
||||
/** * Enumeration : INVALID_CROSS_REFERENCE_TYPE_FOR_FIELD */
|
||||
INVALID_CROSS_REFERENCE_TYPE_FOR_FIELD,
|
||||
/** * Enumeration : INVALID_CURRENCY_CONV_RATE */
|
||||
INVALID_CURRENCY_CONV_RATE,
|
||||
/** * Enumeration : INVALID_CURRENCY_CORP_RATE */
|
||||
INVALID_CURRENCY_CORP_RATE,
|
||||
/** * Enumeration : INVALID_CURRENCY_ISO */
|
||||
INVALID_CURRENCY_ISO,
|
||||
/** * Enumeration : INVALID_DATA_CATEGORY_GROUP_REFERENCE */
|
||||
INVALID_DATA_CATEGORY_GROUP_REFERENCE,
|
||||
/** * Enumeration : INVALID_DATA_URI */
|
||||
INVALID_DATA_URI,
|
||||
/** * Enumeration : INVALID_EMAIL_ADDRESS */
|
||||
INVALID_EMAIL_ADDRESS,
|
||||
/** * Enumeration : INVALID_EMPTY_KEY_OWNER */
|
||||
INVALID_EMPTY_KEY_OWNER,
|
||||
/** * Enumeration : INVALID_FIELD */
|
||||
INVALID_FIELD,
|
||||
/** * Enumeration : INVALID_FIELD_FOR_INSERT_UPDATE */
|
||||
INVALID_FIELD_FOR_INSERT_UPDATE,
|
||||
/** * Enumeration : INVALID_FIELD_WHEN_USING_TEMPLATE */
|
||||
INVALID_FIELD_WHEN_USING_TEMPLATE,
|
||||
/** * Enumeration : INVALID_FILTER_ACTION */
|
||||
INVALID_FILTER_ACTION,
|
||||
/** * Enumeration : INVALID_GOOGLE_DOCS_URL */
|
||||
INVALID_GOOGLE_DOCS_URL,
|
||||
/** * Enumeration : INVALID_ID_FIELD */
|
||||
INVALID_ID_FIELD,
|
||||
/** * Enumeration : INVALID_INET_ADDRESS */
|
||||
INVALID_INET_ADDRESS,
|
||||
/** * Enumeration : INVALID_LINEITEM_CLONE_STATE */
|
||||
INVALID_LINEITEM_CLONE_STATE,
|
||||
/** * Enumeration : INVALID_MASTER_OR_TRANSLATED_SOLUTION */
|
||||
INVALID_MASTER_OR_TRANSLATED_SOLUTION,
|
||||
/** * Enumeration : INVALID_MESSAGE_ID_REFERENCE */
|
||||
INVALID_MESSAGE_ID_REFERENCE,
|
||||
/** * Enumeration : INVALID_OPERATION */
|
||||
INVALID_OPERATION,
|
||||
/** * Enumeration : INVALID_OPERATOR */
|
||||
INVALID_OPERATOR,
|
||||
/** * Enumeration : INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST */
|
||||
INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST,
|
||||
/** * Enumeration : INVALID_PACKAGE_VERSION */
|
||||
INVALID_PACKAGE_VERSION,
|
||||
/** * Enumeration : INVALID_PARTNER_NETWORK_STATUS */
|
||||
INVALID_PARTNER_NETWORK_STATUS,
|
||||
/** * Enumeration : INVALID_PERSON_ACCOUNT_OPERATION */
|
||||
INVALID_PERSON_ACCOUNT_OPERATION,
|
||||
/** * Enumeration : INVALID_READ_ONLY_USER_DML */
|
||||
INVALID_READ_ONLY_USER_DML,
|
||||
/** * Enumeration : INVALID_SAVE_AS_ACTIVITY_FLAG */
|
||||
INVALID_SAVE_AS_ACTIVITY_FLAG,
|
||||
/** * Enumeration : INVALID_SESSION_ID */
|
||||
INVALID_SESSION_ID,
|
||||
/** * Enumeration : INVALID_SETUP_OWNER */
|
||||
INVALID_SETUP_OWNER,
|
||||
/** * Enumeration : INVALID_STATUS */
|
||||
INVALID_STATUS,
|
||||
/** * Enumeration : INVALID_TYPE */
|
||||
INVALID_TYPE,
|
||||
/** * Enumeration : INVALID_TYPE_FOR_OPERATION */
|
||||
INVALID_TYPE_FOR_OPERATION,
|
||||
/** * Enumeration : INVALID_TYPE_ON_FIELD_IN_RECORD */
|
||||
INVALID_TYPE_ON_FIELD_IN_RECORD,
|
||||
/** * Enumeration : IP_RANGE_LIMIT_EXCEEDED */
|
||||
IP_RANGE_LIMIT_EXCEEDED,
|
||||
/** * Enumeration : LICENSE_LIMIT_EXCEEDED */
|
||||
LICENSE_LIMIT_EXCEEDED,
|
||||
/** * Enumeration : LIGHT_PORTAL_USER_EXCEPTION */
|
||||
LIGHT_PORTAL_USER_EXCEPTION,
|
||||
/** * Enumeration : LIMIT_EXCEEDED */
|
||||
LIMIT_EXCEEDED,
|
||||
/** * Enumeration : MALFORMED_ID */
|
||||
MALFORMED_ID,
|
||||
/** * Enumeration : MANAGER_NOT_DEFINED */
|
||||
MANAGER_NOT_DEFINED,
|
||||
/** * Enumeration : MASSMAIL_RETRY_LIMIT_EXCEEDED */
|
||||
MASSMAIL_RETRY_LIMIT_EXCEEDED,
|
||||
/** * Enumeration : MASS_MAIL_LIMIT_EXCEEDED */
|
||||
MASS_MAIL_LIMIT_EXCEEDED,
|
||||
/** * Enumeration : MAXIMUM_CCEMAILS_EXCEEDED */
|
||||
MAXIMUM_CCEMAILS_EXCEEDED,
|
||||
/** * Enumeration : MAXIMUM_DASHBOARD_COMPONENTS_EXCEEDED */
|
||||
MAXIMUM_DASHBOARD_COMPONENTS_EXCEEDED,
|
||||
/** * Enumeration : MAXIMUM_HIERARCHY_LEVELS_REACHED */
|
||||
MAXIMUM_HIERARCHY_LEVELS_REACHED,
|
||||
/** * Enumeration : MAXIMUM_SIZE_OF_ATTACHMENT */
|
||||
MAXIMUM_SIZE_OF_ATTACHMENT,
|
||||
/** * Enumeration : MAXIMUM_SIZE_OF_DOCUMENT */
|
||||
MAXIMUM_SIZE_OF_DOCUMENT,
|
||||
/** * Enumeration : MAX_ACTIONS_PER_RULE_EXCEEDED */
|
||||
MAX_ACTIONS_PER_RULE_EXCEEDED,
|
||||
/** * Enumeration : MAX_ACTIVE_RULES_EXCEEDED */
|
||||
MAX_ACTIVE_RULES_EXCEEDED,
|
||||
/** * Enumeration : MAX_APPROVAL_STEPS_EXCEEDED */
|
||||
MAX_APPROVAL_STEPS_EXCEEDED,
|
||||
/** * Enumeration : MAX_FORMULAS_PER_RULE_EXCEEDED */
|
||||
MAX_FORMULAS_PER_RULE_EXCEEDED,
|
||||
/** * Enumeration : MAX_RULES_EXCEEDED */
|
||||
MAX_RULES_EXCEEDED,
|
||||
/** * Enumeration : MAX_RULE_ENTRIES_EXCEEDED */
|
||||
MAX_RULE_ENTRIES_EXCEEDED,
|
||||
/** * Enumeration : MAX_TASK_DESCRIPTION_EXCEEEDED */
|
||||
MAX_TASK_DESCRIPTION_EXCEEEDED,
|
||||
/** * Enumeration : MAX_TM_RULES_EXCEEDED */
|
||||
MAX_TM_RULES_EXCEEDED,
|
||||
/** * Enumeration : MAX_TM_RULE_ITEMS_EXCEEDED */
|
||||
MAX_TM_RULE_ITEMS_EXCEEDED,
|
||||
/** * Enumeration : MERGE_FAILED */
|
||||
MERGE_FAILED,
|
||||
/** * Enumeration : MISSING_ARGUMENT */
|
||||
MISSING_ARGUMENT,
|
||||
/** * Enumeration : MIXED_DML_OPERATION */
|
||||
MIXED_DML_OPERATION,
|
||||
/** * Enumeration : NONUNIQUE_SHIPPING_ADDRESS */
|
||||
NONUNIQUE_SHIPPING_ADDRESS,
|
||||
/** * Enumeration : NO_APPLICABLE_PROCESS */
|
||||
NO_APPLICABLE_PROCESS,
|
||||
/** * Enumeration : NO_ATTACHMENT_PERMISSION */
|
||||
NO_ATTACHMENT_PERMISSION,
|
||||
/** * Enumeration : NO_INACTIVE_DIVISION_MEMBERS */
|
||||
NO_INACTIVE_DIVISION_MEMBERS,
|
||||
/** * Enumeration : NO_MASS_MAIL_PERMISSION */
|
||||
NO_MASS_MAIL_PERMISSION,
|
||||
/** * Enumeration : NUMBER_OUTSIDE_VALID_RANGE */
|
||||
NUMBER_OUTSIDE_VALID_RANGE,
|
||||
/** * Enumeration : NUM_HISTORY_FIELDS_BY_SOBJECT_EXCEEDED */
|
||||
NUM_HISTORY_FIELDS_BY_SOBJECT_EXCEEDED,
|
||||
/** * Enumeration : OPTED_OUT_OF_MASS_MAIL */
|
||||
OPTED_OUT_OF_MASS_MAIL,
|
||||
/** * Enumeration : OP_WITH_INVALID_USER_TYPE_EXCEPTION */
|
||||
OP_WITH_INVALID_USER_TYPE_EXCEPTION,
|
||||
/** * Enumeration : PACKAGE_LICENSE_REQUIRED */
|
||||
PACKAGE_LICENSE_REQUIRED,
|
||||
/** * Enumeration : PORTAL_NO_ACCESS */
|
||||
PORTAL_NO_ACCESS,
|
||||
/** * Enumeration : PORTAL_USER_ALREADY_EXISTS_FOR_CONTACT */
|
||||
PORTAL_USER_ALREADY_EXISTS_FOR_CONTACT,
|
||||
/** * Enumeration : PRIVATE_CONTACT_ON_ASSET */
|
||||
PRIVATE_CONTACT_ON_ASSET,
|
||||
/** * Enumeration : RECORD_IN_USE_BY_WORKFLOW */
|
||||
RECORD_IN_USE_BY_WORKFLOW,
|
||||
/** * Enumeration : REQUEST_RUNNING_TOO_LONG */
|
||||
REQUEST_RUNNING_TOO_LONG,
|
||||
/** * Enumeration : REQUIRED_FEATURE_MISSING */
|
||||
REQUIRED_FEATURE_MISSING,
|
||||
/** * Enumeration : REQUIRED_FIELD_MISSING */
|
||||
REQUIRED_FIELD_MISSING,
|
||||
/** * Enumeration : SELF_REFERENCE_FROM_TRIGGER */
|
||||
SELF_REFERENCE_FROM_TRIGGER,
|
||||
/** * Enumeration : SHARE_NEEDED_FOR_CHILD_OWNER */
|
||||
SHARE_NEEDED_FOR_CHILD_OWNER,
|
||||
/** * Enumeration : SINGLE_EMAIL_LIMIT_EXCEEDED */
|
||||
SINGLE_EMAIL_LIMIT_EXCEEDED,
|
||||
/** * Enumeration : STANDARD_PRICE_NOT_DEFINED */
|
||||
STANDARD_PRICE_NOT_DEFINED,
|
||||
/** * Enumeration : STORAGE_LIMIT_EXCEEDED */
|
||||
STORAGE_LIMIT_EXCEEDED,
|
||||
/** * Enumeration : STRING_TOO_LONG */
|
||||
STRING_TOO_LONG,
|
||||
/** * Enumeration : TABSET_LIMIT_EXCEEDED */
|
||||
TABSET_LIMIT_EXCEEDED,
|
||||
/** * Enumeration : TEMPLATE_NOT_ACTIVE */
|
||||
TEMPLATE_NOT_ACTIVE,
|
||||
/** * Enumeration : TERRITORY_REALIGN_IN_PROGRESS */
|
||||
TERRITORY_REALIGN_IN_PROGRESS,
|
||||
/** * Enumeration : TEXT_DATA_OUTSIDE_SUPPORTED_CHARSET */
|
||||
TEXT_DATA_OUTSIDE_SUPPORTED_CHARSET,
|
||||
/** * Enumeration : TOO_MANY_APEX_REQUESTS */
|
||||
TOO_MANY_APEX_REQUESTS,
|
||||
/** * Enumeration : TOO_MANY_ENUM_VALUE */
|
||||
TOO_MANY_ENUM_VALUE,
|
||||
/** * Enumeration : TRANSFER_REQUIRES_READ */
|
||||
TRANSFER_REQUIRES_READ,
|
||||
/** * Enumeration : UNABLE_TO_LOCK_ROW */
|
||||
UNABLE_TO_LOCK_ROW,
|
||||
/** * Enumeration : UNAVAILABLE_RECORDTYPE_EXCEPTION */
|
||||
UNAVAILABLE_RECORDTYPE_EXCEPTION,
|
||||
/** * Enumeration : UNDELETE_FAILED */
|
||||
UNDELETE_FAILED,
|
||||
/** * Enumeration : UNKNOWN_EXCEPTION */
|
||||
UNKNOWN_EXCEPTION,
|
||||
/** * Enumeration : UNSPECIFIED_EMAIL_ADDRESS */
|
||||
UNSPECIFIED_EMAIL_ADDRESS,
|
||||
/** * Enumeration : UNSUPPORTED_APEX_TRIGGER_OPERATON */
|
||||
UNSUPPORTED_APEX_TRIGGER_OPERATON,
|
||||
/** * Enumeration : UNVERIFIED_SENDER_ADDRESS */
|
||||
UNVERIFIED_SENDER_ADDRESS,
|
||||
/** * Enumeration : USER_OWNS_PORTAL_ACCOUNT_EXCEPTION */
|
||||
USER_OWNS_PORTAL_ACCOUNT_EXCEPTION,
|
||||
/** * Enumeration : USER_WITH_APEX_SHARES_EXCEPTION */
|
||||
USER_WITH_APEX_SHARES_EXCEPTION,
|
||||
/** * Enumeration : WEBLINK_SIZE_LIMIT_EXCEEDED */
|
||||
WEBLINK_SIZE_LIMIT_EXCEEDED,
|
||||
/** * Enumeration : WRONG_CONTROLLER_TYPE */
|
||||
WRONG_CONTROLLER_TYPE,
|
||||
}
|
||||
/** * Enumeration : ALL_OR_NONE_OPERATION_ROLLED_BACK */
|
||||
ALL_OR_NONE_OPERATION_ROLLED_BACK, /** * Enumeration : ALREADY_IN_PROCESS */
|
||||
ALREADY_IN_PROCESS, /** * Enumeration : ASSIGNEE_TYPE_REQUIRED */
|
||||
ASSIGNEE_TYPE_REQUIRED, /** * Enumeration : BAD_CUSTOM_ENTITY_PARENT_DOMAIN */
|
||||
BAD_CUSTOM_ENTITY_PARENT_DOMAIN, /**
|
||||
* * Enumeration :
|
||||
* BCC_NOT_ALLOWED_IF_BCC_COMPLIANCE_ENABLED
|
||||
*/
|
||||
BCC_NOT_ALLOWED_IF_BCC_COMPLIANCE_ENABLED, /**
|
||||
* * Enumeration :
|
||||
* CANNOT_CASCADE_PRODUCT_ACTIVE
|
||||
*/
|
||||
CANNOT_CASCADE_PRODUCT_ACTIVE, /**
|
||||
* * Enumeration :
|
||||
* CANNOT_CHANGE_FIELD_TYPE_OF_APEX_REFERENCED_FIELD
|
||||
*/
|
||||
CANNOT_CHANGE_FIELD_TYPE_OF_APEX_REFERENCED_FIELD, /**
|
||||
* * Enumeration :
|
||||
* CANNOT_CREATE_ANOTHER_MANAGED_PACKAGE
|
||||
*/
|
||||
CANNOT_CREATE_ANOTHER_MANAGED_PACKAGE, /**
|
||||
* * Enumeration :
|
||||
* CANNOT_DEACTIVATE_DIVISION
|
||||
*/
|
||||
CANNOT_DEACTIVATE_DIVISION, /**
|
||||
* * Enumeration :
|
||||
* CANNOT_DELETE_LAST_DATED_CONVERSION_RATE
|
||||
*/
|
||||
CANNOT_DELETE_LAST_DATED_CONVERSION_RATE, /**
|
||||
* * Enumeration :
|
||||
* CANNOT_DELETE_MANAGED_OBJECT
|
||||
*/
|
||||
CANNOT_DELETE_MANAGED_OBJECT, /** * Enumeration : CANNOT_DISABLE_LAST_ADMIN */
|
||||
CANNOT_DISABLE_LAST_ADMIN, /**
|
||||
* * Enumeration :
|
||||
* CANNOT_ENABLE_IP_RESTRICT_REQUESTS
|
||||
*/
|
||||
CANNOT_ENABLE_IP_RESTRICT_REQUESTS, /**
|
||||
* * Enumeration :
|
||||
* CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY
|
||||
*/
|
||||
CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, /**
|
||||
* * Enumeration :
|
||||
* CANNOT_MODIFY_MANAGED_OBJECT
|
||||
*/
|
||||
CANNOT_MODIFY_MANAGED_OBJECT, /**
|
||||
* * Enumeration :
|
||||
* CANNOT_RENAME_APEX_REFERENCED_FIELD
|
||||
*/
|
||||
CANNOT_RENAME_APEX_REFERENCED_FIELD, /**
|
||||
* * Enumeration :
|
||||
* CANNOT_RENAME_APEX_REFERENCED_OBJECT
|
||||
*/
|
||||
CANNOT_RENAME_APEX_REFERENCED_OBJECT, /**
|
||||
* * Enumeration :
|
||||
* CANNOT_REPARENT_RECORD
|
||||
*/
|
||||
CANNOT_REPARENT_RECORD, /** * Enumeration : CANNOT_UPDATE_CONVERTED_LEAD */
|
||||
CANNOT_UPDATE_CONVERTED_LEAD, /** * Enumeration : CANT_DISABLE_CORP_CURRENCY */
|
||||
CANT_DISABLE_CORP_CURRENCY, /** * Enumeration : CANT_UNSET_CORP_CURRENCY */
|
||||
CANT_UNSET_CORP_CURRENCY, /** * Enumeration : CHILD_SHARE_FAILS_PARENT */
|
||||
CHILD_SHARE_FAILS_PARENT, /** * Enumeration : CIRCULAR_DEPENDENCY */
|
||||
CIRCULAR_DEPENDENCY, /** * Enumeration : COMMUNITY_NOT_ACCESSIBLE */
|
||||
COMMUNITY_NOT_ACCESSIBLE, /**
|
||||
* * Enumeration : CUSTOM_CLOB_FIELD_LIMIT_EXCEEDED
|
||||
*/
|
||||
CUSTOM_CLOB_FIELD_LIMIT_EXCEEDED, /**
|
||||
* * Enumeration :
|
||||
* CUSTOM_ENTITY_OR_FIELD_LIMIT
|
||||
*/
|
||||
CUSTOM_ENTITY_OR_FIELD_LIMIT, /**
|
||||
* * Enumeration :
|
||||
* CUSTOM_FIELD_INDEX_LIMIT_EXCEEDED
|
||||
*/
|
||||
CUSTOM_FIELD_INDEX_LIMIT_EXCEEDED, /** * Enumeration : CUSTOM_INDEX_EXISTS */
|
||||
CUSTOM_INDEX_EXISTS, /** * Enumeration : CUSTOM_LINK_LIMIT_EXCEEDED */
|
||||
CUSTOM_LINK_LIMIT_EXCEEDED, /** * Enumeration : CUSTOM_TAB_LIMIT_EXCEEDED */
|
||||
CUSTOM_TAB_LIMIT_EXCEEDED, /** * Enumeration : DELETE_FAILED */
|
||||
DELETE_FAILED, /** * Enumeration : DELETE_OPERATION_TOO_LARGE */
|
||||
DELETE_OPERATION_TOO_LARGE, /** * Enumeration : DELETE_REQUIRED_ON_CASCADE */
|
||||
DELETE_REQUIRED_ON_CASCADE, /** * Enumeration : DEPENDENCY_EXISTS */
|
||||
DEPENDENCY_EXISTS, /** * Enumeration : DUPLICATE_CASE_SOLUTION */
|
||||
DUPLICATE_CASE_SOLUTION, /** * Enumeration : DUPLICATE_COMM_NICKNAME */
|
||||
DUPLICATE_COMM_NICKNAME, /**
|
||||
* * Enumeration :
|
||||
* DUPLICATE_CUSTOM_ENTITY_DEFINITION
|
||||
*/
|
||||
DUPLICATE_CUSTOM_ENTITY_DEFINITION, /**
|
||||
* * Enumeration :
|
||||
* DUPLICATE_CUSTOM_TAB_MOTIF
|
||||
*/
|
||||
DUPLICATE_CUSTOM_TAB_MOTIF, /** * Enumeration : DUPLICATE_DEVELOPER_NAME */
|
||||
DUPLICATE_DEVELOPER_NAME, /** * Enumeration : DUPLICATE_EXTERNAL_ID */
|
||||
DUPLICATE_EXTERNAL_ID, /** * Enumeration : DUPLICATE_MASTER_LABEL */
|
||||
DUPLICATE_MASTER_LABEL, /** * Enumeration : DUPLICATE_SENDER_DISPLAY_NAME */
|
||||
DUPLICATE_SENDER_DISPLAY_NAME, /** * Enumeration : DUPLICATE_USERNAME */
|
||||
DUPLICATE_USERNAME, /** * Enumeration : DUPLICATE_VALUE */
|
||||
DUPLICATE_VALUE, /** * Enumeration : EMAIL_NOT_PROCESSED_DUE_TO_PRIOR_ERROR */
|
||||
EMAIL_NOT_PROCESSED_DUE_TO_PRIOR_ERROR, /**
|
||||
* * Enumeration :
|
||||
* EMPTY_SCONTROL_FILE_NAME
|
||||
*/
|
||||
EMPTY_SCONTROL_FILE_NAME, /**
|
||||
* * Enumeration :
|
||||
* ENTITY_FAILED_IFLASTMODIFIED_ON_UPDATE
|
||||
*/
|
||||
ENTITY_FAILED_IFLASTMODIFIED_ON_UPDATE, /**
|
||||
* * Enumeration : ENTITY_IS_ARCHIVED
|
||||
*/
|
||||
ENTITY_IS_ARCHIVED, /** * Enumeration : ENTITY_IS_DELETED */
|
||||
ENTITY_IS_DELETED, /** * Enumeration : ENTITY_IS_LOCKED */
|
||||
ENTITY_IS_LOCKED, /** * Enumeration : ERROR_IN_MAILER */
|
||||
ERROR_IN_MAILER, /** * Enumeration : EXTERNAL_OBJECT_AUTHENTICATION_EXCEPTION */
|
||||
EXTERNAL_OBJECT_AUTHENTICATION_EXCEPTION, /**
|
||||
* * Enumeration :
|
||||
* EXTERNAL_OBJECT_CONNECTION_EXCEPTION
|
||||
*/
|
||||
EXTERNAL_OBJECT_CONNECTION_EXCEPTION, /**
|
||||
* * Enumeration :
|
||||
* EXTERNAL_OBJECT_EXCEPTION
|
||||
*/
|
||||
EXTERNAL_OBJECT_EXCEPTION, /**
|
||||
* * Enumeration :
|
||||
* EXTERNAL_OBJECT_UNSUPPORTED_EXCEPTION
|
||||
*/
|
||||
EXTERNAL_OBJECT_UNSUPPORTED_EXCEPTION, /** * Enumeration : FAILED_ACTIVATION */
|
||||
FAILED_ACTIVATION, /** * Enumeration : FIELD_CUSTOM_VALIDATION_EXCEPTION */
|
||||
FIELD_CUSTOM_VALIDATION_EXCEPTION, /**
|
||||
* * Enumeration :
|
||||
* FIELD_FILTER_VALIDATION_EXCEPTION
|
||||
*/
|
||||
FIELD_FILTER_VALIDATION_EXCEPTION, /**
|
||||
* * Enumeration :
|
||||
* FIELD_INTEGRITY_EXCEPTION
|
||||
*/
|
||||
FIELD_INTEGRITY_EXCEPTION, /** * Enumeration : FILTERED_LOOKUP_LIMIT_EXCEEDED */
|
||||
FILTERED_LOOKUP_LIMIT_EXCEEDED, /**
|
||||
* * Enumeration :
|
||||
* HTML_FILE_UPLOAD_NOT_ALLOWED
|
||||
*/
|
||||
HTML_FILE_UPLOAD_NOT_ALLOWED, /** * Enumeration : IMAGE_TOO_LARGE */
|
||||
IMAGE_TOO_LARGE, /** * Enumeration : INACTIVE_OWNER_OR_USER */
|
||||
INACTIVE_OWNER_OR_USER, /**
|
||||
* * Enumeration :
|
||||
* INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY
|
||||
*/
|
||||
INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, /**
|
||||
* * Enumeration :
|
||||
* INSUFFICIENT_ACCESS_OR_READONLY
|
||||
*/
|
||||
INSUFFICIENT_ACCESS_OR_READONLY, /** * Enumeration : INVALID_ACCESS_LEVEL */
|
||||
INVALID_ACCESS_LEVEL, /** * Enumeration : INVALID_ARGUMENT_TYPE */
|
||||
INVALID_ARGUMENT_TYPE, /** * Enumeration : INVALID_ASSIGNEE_TYPE */
|
||||
INVALID_ASSIGNEE_TYPE, /** * Enumeration : INVALID_ASSIGNMENT_RULE */
|
||||
INVALID_ASSIGNMENT_RULE, /** * Enumeration : INVALID_BATCH_OPERATION */
|
||||
INVALID_BATCH_OPERATION, /** * Enumeration : INVALID_CONTENT_TYPE */
|
||||
INVALID_CONTENT_TYPE, /** * Enumeration : INVALID_CREDIT_CARD_INFO */
|
||||
INVALID_CREDIT_CARD_INFO, /** * Enumeration : INVALID_CROSS_REFERENCE_KEY */
|
||||
INVALID_CROSS_REFERENCE_KEY, /**
|
||||
* * Enumeration :
|
||||
* INVALID_CROSS_REFERENCE_TYPE_FOR_FIELD
|
||||
*/
|
||||
INVALID_CROSS_REFERENCE_TYPE_FOR_FIELD, /**
|
||||
* * Enumeration :
|
||||
* INVALID_CURRENCY_CONV_RATE
|
||||
*/
|
||||
INVALID_CURRENCY_CONV_RATE, /** * Enumeration : INVALID_CURRENCY_CORP_RATE */
|
||||
INVALID_CURRENCY_CORP_RATE, /** * Enumeration : INVALID_CURRENCY_ISO */
|
||||
INVALID_CURRENCY_ISO, /**
|
||||
* * Enumeration :
|
||||
* INVALID_DATA_CATEGORY_GROUP_REFERENCE
|
||||
*/
|
||||
INVALID_DATA_CATEGORY_GROUP_REFERENCE, /** * Enumeration : INVALID_DATA_URI */
|
||||
INVALID_DATA_URI, /** * Enumeration : INVALID_EMAIL_ADDRESS */
|
||||
INVALID_EMAIL_ADDRESS, /** * Enumeration : INVALID_EMPTY_KEY_OWNER */
|
||||
INVALID_EMPTY_KEY_OWNER, /** * Enumeration : INVALID_FIELD */
|
||||
INVALID_FIELD, /** * Enumeration : INVALID_FIELD_FOR_INSERT_UPDATE */
|
||||
INVALID_FIELD_FOR_INSERT_UPDATE, /**
|
||||
* * Enumeration :
|
||||
* INVALID_FIELD_WHEN_USING_TEMPLATE
|
||||
*/
|
||||
INVALID_FIELD_WHEN_USING_TEMPLATE, /** * Enumeration : INVALID_FILTER_ACTION */
|
||||
INVALID_FILTER_ACTION, /** * Enumeration : INVALID_GOOGLE_DOCS_URL */
|
||||
INVALID_GOOGLE_DOCS_URL, /** * Enumeration : INVALID_ID_FIELD */
|
||||
INVALID_ID_FIELD, /** * Enumeration : INVALID_INET_ADDRESS */
|
||||
INVALID_INET_ADDRESS, /** * Enumeration : INVALID_LINEITEM_CLONE_STATE */
|
||||
INVALID_LINEITEM_CLONE_STATE, /**
|
||||
* * Enumeration :
|
||||
* INVALID_MASTER_OR_TRANSLATED_SOLUTION
|
||||
*/
|
||||
INVALID_MASTER_OR_TRANSLATED_SOLUTION, /**
|
||||
* * Enumeration :
|
||||
* INVALID_MESSAGE_ID_REFERENCE
|
||||
*/
|
||||
INVALID_MESSAGE_ID_REFERENCE, /** * Enumeration : INVALID_OPERATION */
|
||||
INVALID_OPERATION, /** * Enumeration : INVALID_OPERATOR */
|
||||
INVALID_OPERATOR, /** * Enumeration : INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST */
|
||||
INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST, /**
|
||||
* * Enumeration :
|
||||
* INVALID_PACKAGE_VERSION
|
||||
*/
|
||||
INVALID_PACKAGE_VERSION, /** * Enumeration : INVALID_PARTNER_NETWORK_STATUS */
|
||||
INVALID_PARTNER_NETWORK_STATUS, /**
|
||||
* * Enumeration :
|
||||
* INVALID_PERSON_ACCOUNT_OPERATION
|
||||
*/
|
||||
INVALID_PERSON_ACCOUNT_OPERATION, /** * Enumeration : INVALID_QUERY_LOCATOR */
|
||||
INVALID_QUERY_LOCATOR, /** * Enumeration : INVALID_READ_ONLY_USER_DML */
|
||||
INVALID_READ_ONLY_USER_DML, /** * Enumeration : INVALID_SAVE_AS_ACTIVITY_FLAG */
|
||||
INVALID_SAVE_AS_ACTIVITY_FLAG, /** * Enumeration : INVALID_SESSION_ID */
|
||||
INVALID_SESSION_ID, /** * Enumeration : INVALID_SETUP_OWNER */
|
||||
INVALID_SETUP_OWNER, /** * Enumeration : INVALID_STATUS */
|
||||
INVALID_STATUS, /** * Enumeration : INVALID_TYPE */
|
||||
INVALID_TYPE, /** * Enumeration : INVALID_TYPE_FOR_OPERATION */
|
||||
INVALID_TYPE_FOR_OPERATION, /**
|
||||
* * Enumeration :
|
||||
* INVALID_TYPE_ON_FIELD_IN_RECORD
|
||||
*/
|
||||
INVALID_TYPE_ON_FIELD_IN_RECORD, /** * Enumeration : IP_RANGE_LIMIT_EXCEEDED */
|
||||
IP_RANGE_LIMIT_EXCEEDED, /** * Enumeration : LICENSE_LIMIT_EXCEEDED */
|
||||
LICENSE_LIMIT_EXCEEDED, /** * Enumeration : LIGHT_PORTAL_USER_EXCEPTION */
|
||||
LIGHT_PORTAL_USER_EXCEPTION, /** * Enumeration : LIMIT_EXCEEDED */
|
||||
LIMIT_EXCEEDED, /** * Enumeration : MALFORMED_ID */
|
||||
MALFORMED_ID, /** * Enumeration : MANAGER_NOT_DEFINED */
|
||||
MANAGER_NOT_DEFINED, /** * Enumeration : MASSMAIL_RETRY_LIMIT_EXCEEDED */
|
||||
MASSMAIL_RETRY_LIMIT_EXCEEDED, /** * Enumeration : MASS_MAIL_LIMIT_EXCEEDED */
|
||||
MASS_MAIL_LIMIT_EXCEEDED, /** * Enumeration : MAXIMUM_CCEMAILS_EXCEEDED */
|
||||
MAXIMUM_CCEMAILS_EXCEEDED, /**
|
||||
* * Enumeration :
|
||||
* MAXIMUM_DASHBOARD_COMPONENTS_EXCEEDED
|
||||
*/
|
||||
MAXIMUM_DASHBOARD_COMPONENTS_EXCEEDED, /**
|
||||
* * Enumeration :
|
||||
* MAXIMUM_HIERARCHY_LEVELS_REACHED
|
||||
*/
|
||||
MAXIMUM_HIERARCHY_LEVELS_REACHED, /**
|
||||
* * Enumeration :
|
||||
* MAXIMUM_SIZE_OF_ATTACHMENT
|
||||
*/
|
||||
MAXIMUM_SIZE_OF_ATTACHMENT, /** * Enumeration : MAXIMUM_SIZE_OF_DOCUMENT */
|
||||
MAXIMUM_SIZE_OF_DOCUMENT, /** * Enumeration : MAX_ACTIONS_PER_RULE_EXCEEDED */
|
||||
MAX_ACTIONS_PER_RULE_EXCEEDED, /** * Enumeration : MAX_ACTIVE_RULES_EXCEEDED */
|
||||
MAX_ACTIVE_RULES_EXCEEDED, /** * Enumeration : MAX_APPROVAL_STEPS_EXCEEDED */
|
||||
MAX_APPROVAL_STEPS_EXCEEDED, /**
|
||||
* * Enumeration :
|
||||
* MAX_FORMULAS_PER_RULE_EXCEEDED
|
||||
*/
|
||||
MAX_FORMULAS_PER_RULE_EXCEEDED, /** * Enumeration : MAX_RULES_EXCEEDED */
|
||||
MAX_RULES_EXCEEDED, /** * Enumeration : MAX_RULE_ENTRIES_EXCEEDED */
|
||||
MAX_RULE_ENTRIES_EXCEEDED, /** * Enumeration : MAX_TASK_DESCRIPTION_EXCEEEDED */
|
||||
MAX_TASK_DESCRIPTION_EXCEEEDED, /** * Enumeration : MAX_TM_RULES_EXCEEDED */
|
||||
MAX_TM_RULES_EXCEEDED, /** * Enumeration : MAX_TM_RULE_ITEMS_EXCEEDED */
|
||||
MAX_TM_RULE_ITEMS_EXCEEDED, /** * Enumeration : MERGE_FAILED */
|
||||
MERGE_FAILED, /** * Enumeration : MISSING_ARGUMENT */
|
||||
MISSING_ARGUMENT, /** * Enumeration : MIXED_DML_OPERATION */
|
||||
MIXED_DML_OPERATION, /** * Enumeration : NONUNIQUE_SHIPPING_ADDRESS */
|
||||
NONUNIQUE_SHIPPING_ADDRESS, /** * Enumeration : NO_APPLICABLE_PROCESS */
|
||||
NO_APPLICABLE_PROCESS, /** * Enumeration : NO_ATTACHMENT_PERMISSION */
|
||||
NO_ATTACHMENT_PERMISSION, /** * Enumeration : NO_INACTIVE_DIVISION_MEMBERS */
|
||||
NO_INACTIVE_DIVISION_MEMBERS, /** * Enumeration : NO_MASS_MAIL_PERMISSION */
|
||||
NO_MASS_MAIL_PERMISSION, /** * Enumeration : NUMBER_OUTSIDE_VALID_RANGE */
|
||||
NUMBER_OUTSIDE_VALID_RANGE, /**
|
||||
* * Enumeration :
|
||||
* NUM_HISTORY_FIELDS_BY_SOBJECT_EXCEEDED
|
||||
*/
|
||||
NUM_HISTORY_FIELDS_BY_SOBJECT_EXCEEDED, /**
|
||||
* * Enumeration :
|
||||
* OPTED_OUT_OF_MASS_MAIL
|
||||
*/
|
||||
OPTED_OUT_OF_MASS_MAIL, /**
|
||||
* * Enumeration :
|
||||
* OP_WITH_INVALID_USER_TYPE_EXCEPTION
|
||||
*/
|
||||
OP_WITH_INVALID_USER_TYPE_EXCEPTION, /**
|
||||
* * Enumeration :
|
||||
* PACKAGE_LICENSE_REQUIRED
|
||||
*/
|
||||
PACKAGE_LICENSE_REQUIRED, /** * Enumeration : PORTAL_NO_ACCESS */
|
||||
PORTAL_NO_ACCESS, /** * Enumeration : PORTAL_USER_ALREADY_EXISTS_FOR_CONTACT */
|
||||
PORTAL_USER_ALREADY_EXISTS_FOR_CONTACT, /**
|
||||
* * Enumeration :
|
||||
* PRIVATE_CONTACT_ON_ASSET
|
||||
*/
|
||||
PRIVATE_CONTACT_ON_ASSET, /** * Enumeration : QUERY_TIMEOUT */
|
||||
QUERY_TIMEOUT, /** * Enumeration : RECORD_IN_USE_BY_WORKFLOW */
|
||||
RECORD_IN_USE_BY_WORKFLOW, /** * Enumeration : REQUEST_RUNNING_TOO_LONG */
|
||||
REQUEST_RUNNING_TOO_LONG, /** * Enumeration : REQUIRED_FEATURE_MISSING */
|
||||
REQUIRED_FEATURE_MISSING, /** * Enumeration : REQUIRED_FIELD_MISSING */
|
||||
REQUIRED_FIELD_MISSING, /** * Enumeration : SELF_REFERENCE_FROM_TRIGGER */
|
||||
SELF_REFERENCE_FROM_TRIGGER, /** * Enumeration : SHARE_NEEDED_FOR_CHILD_OWNER */
|
||||
SHARE_NEEDED_FOR_CHILD_OWNER, /** * Enumeration : SINGLE_EMAIL_LIMIT_EXCEEDED */
|
||||
SINGLE_EMAIL_LIMIT_EXCEEDED, /** * Enumeration : STANDARD_PRICE_NOT_DEFINED */
|
||||
STANDARD_PRICE_NOT_DEFINED, /** * Enumeration : STORAGE_LIMIT_EXCEEDED */
|
||||
STORAGE_LIMIT_EXCEEDED, /** * Enumeration : STRING_TOO_LONG */
|
||||
STRING_TOO_LONG, /** * Enumeration : TABSET_LIMIT_EXCEEDED */
|
||||
TABSET_LIMIT_EXCEEDED, /** * Enumeration : TEMPLATE_NOT_ACTIVE */
|
||||
TEMPLATE_NOT_ACTIVE, /** * Enumeration : TERRITORY_REALIGN_IN_PROGRESS */
|
||||
TERRITORY_REALIGN_IN_PROGRESS, /**
|
||||
* * Enumeration :
|
||||
* TEXT_DATA_OUTSIDE_SUPPORTED_CHARSET
|
||||
*/
|
||||
TEXT_DATA_OUTSIDE_SUPPORTED_CHARSET, /**
|
||||
* * Enumeration :
|
||||
* TOO_MANY_APEX_REQUESTS
|
||||
*/
|
||||
TOO_MANY_APEX_REQUESTS, /** * Enumeration : TOO_MANY_ENUM_VALUE */
|
||||
TOO_MANY_ENUM_VALUE, /** * Enumeration : TRANSFER_REQUIRES_READ */
|
||||
TRANSFER_REQUIRES_READ, /** * Enumeration : UNABLE_TO_LOCK_ROW */
|
||||
UNABLE_TO_LOCK_ROW, /** * Enumeration : UNAVAILABLE_RECORDTYPE_EXCEPTION */
|
||||
UNAVAILABLE_RECORDTYPE_EXCEPTION, /** * Enumeration : UNDELETE_FAILED */
|
||||
UNDELETE_FAILED, /** * Enumeration : UNKNOWN_EXCEPTION */
|
||||
UNKNOWN_EXCEPTION, /** * Enumeration : UNSPECIFIED_EMAIL_ADDRESS */
|
||||
UNSPECIFIED_EMAIL_ADDRESS, /**
|
||||
* * Enumeration :
|
||||
* UNSUPPORTED_APEX_TRIGGER_OPERATON
|
||||
*/
|
||||
UNSUPPORTED_APEX_TRIGGER_OPERATON, /**
|
||||
* * Enumeration :
|
||||
* UNVERIFIED_SENDER_ADDRESS
|
||||
*/
|
||||
UNVERIFIED_SENDER_ADDRESS, /**
|
||||
* * Enumeration :
|
||||
* USER_OWNS_PORTAL_ACCOUNT_EXCEPTION
|
||||
*/
|
||||
USER_OWNS_PORTAL_ACCOUNT_EXCEPTION, /**
|
||||
* * Enumeration :
|
||||
* USER_WITH_APEX_SHARES_EXCEPTION
|
||||
*/
|
||||
USER_WITH_APEX_SHARES_EXCEPTION, /**
|
||||
* * Enumeration :
|
||||
* WEBLINK_SIZE_LIMIT_EXCEEDED
|
||||
*/
|
||||
WEBLINK_SIZE_LIMIT_EXCEEDED, /** * Enumeration : WRONG_CONTROLLER_TYPE */
|
||||
WRONG_CONTROLLER_TYPE,
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user