Compare commits
318 Commits
release/5.
...
release/5.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
318b2e55cd | ||
|
|
6952d67b63 | ||
|
|
fe7d5fb1b2 | ||
|
|
67b8734846 | ||
|
|
24d9dc57d9 | ||
|
|
8973fe3d80 | ||
|
|
3382845dea | ||
|
|
34780e383a | ||
|
|
56ccdc3a1d | ||
|
|
771b22c5ea | ||
|
|
8c2c8378c7 | ||
|
|
0b16e773b0 | ||
|
|
909ee24e6a | ||
|
|
d492dc9019 | ||
|
|
3a6a2134c3 | ||
|
|
2b9fa412a8 | ||
|
|
7f63c512a0 | ||
|
|
1858912816 | ||
|
|
d994a62da3 | ||
|
|
91d5f5dd10 | ||
|
|
6026d4693f | ||
|
|
ca74b8305a | ||
|
|
072ab2d624 | ||
|
|
60941241c1 | ||
|
|
e63e207d0e | ||
|
|
a8f6e80b77 | ||
|
|
162a04721e | ||
|
|
96e72e81dd | ||
|
|
f84b11f054 | ||
|
|
cbcada0dd4 | ||
|
|
e88d0bef06 | ||
|
|
b9b33711c4 | ||
|
|
a541b3867e | ||
|
|
f51ab4a86c | ||
|
|
fb3bb857af | ||
|
|
bc66ed653b | ||
|
|
ba469d89aa | ||
|
|
0c9b357307 | ||
|
|
b8ad95763f | ||
|
|
c9d2c70b29 | ||
|
|
b5be75e74d | ||
|
|
f67dc9439c | ||
|
|
1340a5149f | ||
|
|
966e665563 | ||
|
|
d069fb6d48 | ||
|
|
d117428729 | ||
|
|
7d3cf48ee0 | ||
|
|
37644bd3a7 | ||
|
|
61eb0a6e24 | ||
|
|
a7797b6a56 | ||
|
|
44d4ff2836 | ||
|
|
6abe61d003 | ||
|
|
f3ba4b9e1f | ||
|
|
55d0c8cf7a | ||
|
|
5d6a9da6c1 | ||
|
|
27e4d6887a | ||
|
|
8baae08e1a | ||
|
|
025ae75cfe | ||
|
|
96372ee9c8 | ||
|
|
adf63b4581 | ||
|
|
7d16e466ca | ||
|
|
0b0e47f90e | ||
|
|
3fa1b64557 | ||
|
|
4ff9121327 | ||
|
|
8b22997e89 | ||
|
|
27f079de90 | ||
|
|
dff41d0ca1 | ||
|
|
3bf6c024a9 | ||
|
|
dda51a6c4d | ||
|
|
ba700675dc | ||
|
|
ac24c606b2 | ||
|
|
92f0d904e0 | ||
|
|
5580c4f746 | ||
|
|
5dc9434446 | ||
|
|
d327510dbb | ||
|
|
8b1f10b6f0 | ||
|
|
1d43d196fa | ||
|
|
79f959f6ba | ||
|
|
671552768d | ||
|
|
6b3db7d520 | ||
|
|
48d823e701 | ||
|
|
4e331b6435 | ||
|
|
1c48f80336 | ||
|
|
f9a2fec665 | ||
|
|
b307495787 | ||
|
|
fc18cd9826 | ||
|
|
bfa79a2c7d | ||
|
|
3fe6b7072f | ||
|
|
3fc8772d98 | ||
|
|
4b4fe8254c | ||
|
|
4a274ce551 | ||
|
|
67e7c1e360 | ||
|
|
11c0b50642 | ||
|
|
dc7f98170f | ||
|
|
c2e19faf31 | ||
|
|
14fa9b9ab4 | ||
|
|
20ade70c18 | ||
|
|
8f47ca06bf | ||
|
|
89af574ae3 | ||
|
|
04868f33dd | ||
|
|
476a47f6d7 | ||
|
|
12d5738edb | ||
|
|
b37dcdad6d | ||
|
|
791bb97f68 | ||
|
|
837e018058 | ||
|
|
5477fb511b | ||
|
|
a1676262b1 | ||
|
|
1e97bfebd7 | ||
|
|
6cdca170c1 | ||
|
|
ce7ea8f587 | ||
|
|
998a94ef86 | ||
|
|
57133af940 | ||
|
|
346699c965 | ||
|
|
179bc4ca41 | ||
|
|
51a7845fe4 | ||
|
|
c2c9f9c0c1 | ||
|
|
ba32f5ba0f | ||
|
|
c9e6815ea0 | ||
|
|
481ee969fc | ||
|
|
62ff41ca2c | ||
|
|
5db0dddacf | ||
|
|
f406122851 | ||
|
|
d70fddc07d | ||
|
|
1bd12dde38 | ||
|
|
9390a6f16e | ||
|
|
c3e59b7662 | ||
|
|
0dc20c334f | ||
|
|
a41fbfbe58 | ||
|
|
d141c1f29c | ||
|
|
54e632c861 | ||
|
|
af7043807b | ||
|
|
8ef5277bfb | ||
|
|
a76cb33d21 | ||
|
|
04a2084555 | ||
|
|
b277e6dd13 | ||
|
|
9aa7d8d28f | ||
|
|
629f23b5ef | ||
|
|
cc5c5bbd22 | ||
|
|
956cb457be | ||
|
|
cbf14e35a0 | ||
|
|
2f7d35f24c | ||
|
|
0731a48ecb | ||
|
|
a57259815e | ||
|
|
2d32eef25f | ||
|
|
3f534c2ece | ||
|
|
4eda2aef8e | ||
|
|
c6d4fdb890 | ||
|
|
6b254e23ad | ||
|
|
13b418de87 | ||
|
|
fba08078fe | ||
|
|
7f9b93f650 | ||
|
|
86729d7ea6 | ||
|
|
27169ab3e3 | ||
|
|
de6f004ab7 | ||
|
|
cdfda37cc4 | ||
|
|
55896a35bc | ||
|
|
1aeda8fd97 | ||
|
|
477ce66633 | ||
|
|
69b410a73c | ||
|
|
b46fffad4b | ||
|
|
a1a0b8c53c | ||
|
|
84e8d16f61 | ||
|
|
131a060979 | ||
|
|
d49fc79aff | ||
|
|
93c45f90fc | ||
|
|
a8f0e499d2 | ||
|
|
a9b59e25bf | ||
|
|
824ee2144d | ||
|
|
ef1a9bc0c9 | ||
|
|
71fc8e661b | ||
|
|
0527978183 | ||
|
|
ecb6131c67 | ||
|
|
b790f27629 | ||
|
|
ac46e57615 | ||
|
|
1e52d915a6 | ||
|
|
d0be52e8f3 | ||
|
|
dcdc6f9de1 | ||
|
|
ae58ffb1db | ||
|
|
3c9597ef56 | ||
|
|
4fbd95a69e | ||
|
|
a667abd7d3 | ||
|
|
124ccf6d08 | ||
|
|
cb8e9dc1c5 | ||
|
|
a7d84f6631 | ||
|
|
9c2cc27fed | ||
|
|
de68301f94 | ||
|
|
f6265f728c | ||
|
|
c05245c97d | ||
|
|
c4ab265d5e | ||
|
|
8d1fb2b5e9 | ||
|
|
f487848efa | ||
|
|
7dfd9eb5f2 | ||
|
|
8bc6cb3514 | ||
|
|
88bb955b12 | ||
|
|
88bb63dbec | ||
|
|
9451097465 | ||
|
|
85203d3488 | ||
|
|
33ca3cd4c6 | ||
|
|
b042706b78 | ||
|
|
d5023ee2d0 | ||
|
|
425f8c74e3 | ||
|
|
eed50f4acc | ||
|
|
8070f0337c | ||
|
|
be7cc36fe1 | ||
|
|
091b43aa8c | ||
|
|
b2be8f45e1 | ||
|
|
67084b33f1 | ||
|
|
431d2295f1 | ||
|
|
664cbda6f5 | ||
|
|
946d99935b | ||
|
|
c3f231717c | ||
|
|
984496b2cd | ||
|
|
23a374ee96 | ||
|
|
f7ca748efc | ||
|
|
6c28e8797d | ||
|
|
e391ce6f04 | ||
|
|
88e2fd5f88 | ||
|
|
720a0a9166 | ||
|
|
ebd07a17bf | ||
|
|
2bc92157ec | ||
|
|
654a2165cf | ||
|
|
9e830d4a4c | ||
|
|
2f506a8564 | ||
|
|
016f4d3162 | ||
|
|
438209d786 | ||
|
|
06b65fa196 | ||
|
|
0c1f4de4fd | ||
|
|
7b8b4a4803 | ||
|
|
5c40e48b57 | ||
|
|
09467cbda1 | ||
|
|
11a1146f02 | ||
|
|
903b935a83 | ||
|
|
c990d6704a | ||
|
|
6d80f9d129 | ||
|
|
7a544a1330 | ||
|
|
3be7686641 | ||
|
|
274e29ef71 | ||
|
|
fc643f11e3 | ||
|
|
a54c5f2031 | ||
|
|
5e5e9b8357 | ||
|
|
9a8fc1d90b | ||
|
|
fe38139f9c | ||
|
|
73a808043b | ||
|
|
fba4b0e14d | ||
|
|
89583c76b6 | ||
|
|
2c92949a89 | ||
|
|
4bba82799f | ||
|
|
b675bbfe69 | ||
|
|
c03bc2546c | ||
|
|
6e9f84e0a1 | ||
|
|
7e79551faf | ||
|
|
0becd5225e | ||
|
|
cc79fb20b8 | ||
|
|
5534b3c0df | ||
|
|
aa001743a4 | ||
|
|
3bf83faa59 | ||
|
|
73cf44b806 | ||
|
|
0e27da60a8 | ||
|
|
f425577f6c | ||
|
|
b2a7c8175d | ||
|
|
3d5d5eb52c | ||
|
|
c122bd6863 | ||
|
|
c3cf28ac39 | ||
|
|
8debb7852f | ||
|
|
d4e8e0e49c | ||
|
|
f5d33f99bf | ||
|
|
7dee5ea298 | ||
|
|
8241a44867 | ||
|
|
337e92b9fe | ||
|
|
3e3d20c775 | ||
|
|
a48fe71712 | ||
|
|
16a06fb61b | ||
|
|
778c88e5d1 | ||
|
|
4da509065b | ||
|
|
af0866d3c7 | ||
|
|
972204e54c | ||
|
|
5e8adf6be7 | ||
|
|
472859a371 | ||
|
|
2fe371c609 | ||
|
|
d535e09cae | ||
|
|
b831da367d | ||
|
|
d144e3ab7b | ||
|
|
356d226b28 | ||
|
|
1565ca19b9 | ||
|
|
0945eccf9e | ||
|
|
7a68b88b96 | ||
|
|
7204185af1 | ||
|
|
ffbc900692 | ||
|
|
10ab6ca310 | ||
|
|
4f22cdc3c5 | ||
|
|
c4333b8e97 | ||
|
|
e2c552e965 | ||
|
|
9cb9727798 | ||
|
|
0a05b20a52 | ||
|
|
12f9ef0cf5 | ||
|
|
aefdc66221 | ||
|
|
66a8975e48 | ||
|
|
0816d975c2 | ||
|
|
c5e7eae92b | ||
|
|
320c295952 | ||
|
|
e28ef8ef92 | ||
|
|
a1fd73eccb | ||
|
|
bd49b9c4fb | ||
|
|
842d53771c | ||
|
|
00f2ca59ef | ||
|
|
60a868a56e | ||
|
|
008cad994c | ||
|
|
83fc90b319 | ||
|
|
fd5671b6cc | ||
|
|
afd3184f20 | ||
|
|
4f05eb9c72 | ||
|
|
eeba280121 | ||
|
|
47b22e5da1 | ||
|
|
ee8bbe2ff3 | ||
|
|
fad295b2c0 | ||
|
|
52769aca2f | ||
|
|
4b16b2a5e1 | ||
|
|
544b6acc29 |
@@ -740,7 +740,7 @@
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="true"/>
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.jet.core"
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
PushToPaletteActionProvider.Error2=Fout
|
||||
PushToPaletteActionProvider.Error=Fout
|
||||
NewActionProvider.New=Nieuw
|
||||
NewActionProvider.NewComponent=Nieuw Component
|
||||
AbstractXMLConfigPage.Delete=Verwijderen
|
||||
WizardJetFilesChoosePage.Directory=Directory:
|
||||
CreateComponentWizard.NewComponent=Nieuw Component
|
||||
WizardComponentFolderPage.Name=Naam
|
||||
WizardComponentFolderPage.Perl=Perl
|
||||
WizardJetFilesChoosePage.UseDefaultIcon=Gebruik default icon
|
||||
WizardJetFilesChoosePage.ChoseAIcon=Kies een icon
|
||||
AbstractXMLConfigPage.New=Nieuw
|
||||
WizardComponentFolderPage.Java=Java
|
||||
@@ -1,2 +1,3 @@
|
||||
PushToPaletteActionProvider.Error2=Gre\u0161ka
|
||||
PushToPaletteActionProvider.Error=Gre\u0161ka
|
||||
AbstractXMLConfigPage.Delete=DELETE
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
FileCopy.ExceptionMSG=\u6E90\u6587\u4EF6"
|
||||
EditComponentActionProvider.Edit=\u7F16\u8F91\u7EC4\u4EF6
|
||||
ImportComponentDialog.ErrorMSG4=\u6CA1\u6709\u9009\u62E9\u7EC4\u4EF6\u5BFC\u5165
|
||||
AbstractXMLConfigPage.TYPETip=%u8CC7%u6599%u578B%u614B.
|
||||
PushToPaletteActionProvider.Error2=\u9519\u8BEF
|
||||
CopyFromPaletteActionProvider.Label2=\u4ECEpalette\u5BFC\u5165\u7EC4\u4EF6
|
||||
AbstractXMLConfigPage.MAXOUTPUTTip=\u6574\u6570\u503C.\u8FDE\u63A5\u6700\u5927\u503C\u8F93\u51FA
|
||||
ImportComponentDialog.Browser=\u6D4F\u89C8..
|
||||
ComponentProjectPreferencePage.WarningMSG=\u8B66\u544A,\u8FD9\u79CD\u4FEE\u6539\u4EC5\u4EC5\u5F71\u54CD\u7EC4\u4EF6\u8BBE\u8BA1\u5668\uFF0C\u4E0D\u5F71\u54CDPalette.
|
||||
AbstractXMLConfigPage.MAXINPUTTip=\u6574\u6570\u503C.\u8FDE\u63A5\u6700\u5927\u503C\u8F93\u5165.
|
||||
PushToPaletteActionProvider.ErrorMSG2=\u7528\u6237\u7EC4\u4EF6\u6587\u4EF6\u5939\u4E0D\u5B58\u5728\u3002
|
||||
ComponentProjectManager.CreationProblems=\u95ee\u9898\u521b\u5efa
|
||||
CopyComponentActionProvider.InputName=\u8F93\u5165\u65B0\u7684\u7EC4\u4EF6\u540D
|
||||
CreateComponentWizard.SpecifyRes=\u6307\u5B9A\u8D44\u6E90
|
||||
AbstractXMLConfigPage.REPOSITORYVALUETip=%u9078%u64C7 Metadata %u5132%u85CF%u5EAB.
|
||||
PushToPaletteActionProvider.ErrorMSG=\u7528\u6237\u7EC4\u4EF6\u6587\u4EF6\u5939\u672A\u8BBE\u7F6E\u3002
|
||||
AbstractXMLConfigPage.NUMROWTip=\u6574\u6570\u503C.\u6B64\u53C2\u6570\u5217\u4F4D\u7F6E\u5728\u7EC4\u4EF6\u89C6\u56FE
|
||||
PushToPaletteActionProvider.Error=\u9519\u8BEF
|
||||
ComponentProjectManager.InternalErrorMsg=\u5185\u90E8\u9519\u8BEF\uFF1A{0}
|
||||
AbstractXMLConfigPage.IntValue=%u6574%u6578%u503C
|
||||
ImportComponentDialog.ImportCanceled=\u5BFC\u5165\u7EC4\u4EF6\u5DF2\u53D6\u6D88
|
||||
PushToPaletteActionProvider.OK=\u786E\u5B9A
|
||||
WizardJetFilesChoosePage.BeginFile=\u5F00\u59CB\u6587\u4EF6
|
||||
AbstractXMLConfigPage.COLORTip=RGB\u5341\u516D\u8FDB\u5236.\u4F8B\u5982:"00FF00"
|
||||
CreateComponentWizard.CreateXMLPerl=\u521B\u5EFAPERL\u7EC4\u4EF6\u7684XML\u914D\u7F6E\u6587\u4EF6
|
||||
ImportComponentDialog.SelectDirectoryLabel=\u9009\u62E9\u4E00\u4E2A\u8DEF\u5F84\uFF1A
|
||||
PushToPaletteActionProvider.Information=\u4FE1\u606F
|
||||
PluginConstant.Borwser=\u6D4F\u89C8..
|
||||
NewActionProvider.New=\u65b0
|
||||
AbstractXMLConfigPage.EXTENSIONTip=\u63D2\u4EF6\u540D\u79F0\u5B57\u7B26\u4E32\u503C.\u6B64\u9009\u9879\u7528\u4E8E\u5916\u90E8\u7EC4\u4EF6.
|
||||
ImportComponentDialog.ShowPaletteComponents=\u663E\u793A\u7EC4\u4EF6\u8C03\u8272\u677F
|
||||
ComponentProjectPreferencePage.ChooseProject=\u9009\u62E9\u7EC4\u4EF6\u8BBE\u8BA1\u5DE5\u7A0B\u6587\u4EF6\u5939
|
||||
WizardComponentFolderPage.ErrMSG5=\u7EC4\u4EF6\u65CF\u65E0\u5185\u5BB9
|
||||
AbstractXMLConfigPage.BooleanTip=Boolean\u503C(\u771F\u6216\u5047).
|
||||
AbstractXMLConfigPage.Delete=\u5220\u9664
|
||||
WizardComponentFolderPage.ErrMSG3=\u7EC4\u4EF6\u5DF2\u5B58\u5728
|
||||
WizardComponentFolderPage.ErrMSG2=\u7EC4\u4EF6\u540D\u4E3A\u7A7A
|
||||
WizardComponentFolderPage.ErrMSG1=\u6CA1\u6709\u9009\u62E9\u7EC4\u4EF6\u7684\u8BED\u8A00
|
||||
CreateComponentWizard.FillIn=\u586B\u5199\u7EC4\u4EF6\u5C5E\u6027
|
||||
ImportComponentDialog.ImportCanceledMSG=\u5DF2\u53D6\u6D88\u4ECEPalette\u4E0A\u5BFC\u5165\u7EC4\u4EF6
|
||||
ComponentProjectPreferencePage.Warning=\u8B66\u544A
|
||||
AbstractXMLConfigPage.VERSIONTip=%u8ACB%u7528%u4E00%u500B%u5341%u9032%u4F4D%u6578%u503C%u4F86%u6A19%u8A18%u60A8%u7684%u65B0%u5143%u4EF6%u7248%u672C.
|
||||
WizardJetFilesChoosePage.Directory=\u76EE\u5F55
|
||||
WizardComponentFolderPage.Name=\u8fde\u63a5\u540d
|
||||
RemoveResourceAction.Remove=\u5220\u9664
|
||||
WizardJetFilesChoosePage.UseIconFrom=\u9009\u62E9\u56FE\u6807\uFF1A
|
||||
ImportComponentDialog.ImportFinished=\u5BFC\u5165\u7EC4\u4EF6\u5B8C\u6210
|
||||
AbstractXMLConfigPage.SetProperties=\u8BBE\u7F6E\u9009\u62E9\u5143\u7D20\u5C5E\u6027
|
||||
ProjectSelectionDialog.ChooseFolder=\u5728\u6B64\u4F1A\u8BDD\u4E2D\u9009\u62E9\u4E00\u4E2A\u5DE5\u7A0B\u6587\u4EF6\u5939
|
||||
ComponentProjectPreferencePage.ComponentProject=\u7EC4\u4EF6\u5DE5\u7A0B
|
||||
ImportComponentDialog.ImportFinishedMSG=\u7EC4\u4EF6\u5BFC\u5165\u6210\u529F
|
||||
AddExternalResourceAction.ErrorTitle=\u5916\u90E8\u6863\u6848\u9519\u8BEF
|
||||
AbstractXMLConfigPage.MININPUTTip=\u6574\u6570\u503C.\u8FDE\u63A5\u6700\u5C0F\u503C\u8F93\u51FA
|
||||
WizardJetFilesChoosePage.MainFile=\u4E3B\u6587\u4EF6
|
||||
CreateComponentWizard.CreateXMLJava=\u521B\u5EFAJava\u7EC4\u4EF6\u7684XML\u914D\u7F6E\u6587\u4EF6
|
||||
WizardJetFilesChoosePage.UseDefaultIcon=\u4F7F\u7528\u9ED8\u8BA4\u7684\u56FE\u6807
|
||||
CopyComponentActionProvider.CopyComponent=\u590D\u5236\u8FD9\u4E2A\u7EC4\u4EF6
|
||||
ImportComponentDialog.ChooseComponentsLabel=\u9009\u62E9\u8981\u5BFC\u5165\u7684\u7EC4\u4EF6\uFF1A
|
||||
AddExternalResourceAction.ErrorMsg=\u9009\u5B9A\u7684\u5916\u90E8\u6863\u6848\u662F\u4E0D\u53EF\u7528\u6216\u4E0D\u5B58\u5728.
|
||||
ComponentProjectManager.NewProject=\u65B0\u7EC4\u4EF6\u9879\u76EE
|
||||
CopyFromPaletteActionProvider.Label=\u4ECEPalette\u590D\u5236\u7EC4\u4EF6
|
||||
WizardJetFilesChoosePage.ChoseAIcon=\u9009\u62E9\u6309\u94AE
|
||||
ComponentProjectPreferencePage.SelectPath=\u9009\u62E9\u7EC4\u4EF6\u5DE5\u7A0B\u8DEF\u5F84
|
||||
AbstractXMLConfigPage.LINESTYLETip=\u6574\u6570\u503C.\u8FDE\u63A5\u7EBF\u98CE\u683C(1: Solid, 2: Dash, 3: Dot, 4: Dashdot)
|
||||
WizardJetFilesChoosePage.EndFile=\u7ED3\u675F\u6587\u4EF6
|
||||
PushToPaletteActionProvider.InformationMSG=\u7EC4\u4EF6\u5DF2\u53D1\u5E03\uFF0Cpalette\u5C06\u5237\u65B0\u3002
|
||||
ProjectSelectionDialog.ComponentProject=\u7EC4\u4EF6\u5DE5\u7A0B
|
||||
ComponentProjectPreferencePage.ButtonLabel0=\u786E\u5B9A
|
||||
AbstractXMLConfigPage.New=\u65b0
|
||||
CopyComponentValidator.ComponentExist=\u6B64\u7EC4\u4EF6\u5DF2\u5B58\u5728
|
||||
ImportComponentDialog.WarningMSG=\u64CD\u4F5C\u5C06\u8986\u76D6\u5DE5\u4F5C\u533A\u5DF2\u5B58\u5728\u7684\u7EC4\u4EF6\u3002\u60A8\u771F\u7684\u8981\u5BFC\u5165\u5DF2\u9009\u62E9\u7684\u7EC4\u4EF6\u5417\uFF1F
|
||||
CreateComponentWizard.MainProperties=\u4E3B\u8981\u5C5E\u6027
|
||||
ComponentProjectManager.WarningMsg=\u5E95\u5C42\u6587\u4EF6\u7CFB\u7EDF\u4E0D\u533A\u5206\u5927\u5C0F\u5199\u3002\u5DF2\u7ECF\u5B58\u5728\u4E00\u4E2A\u9879\u76EE\u4E0E{0}\u51B2\u7A81
|
||||
WizardComponentFolderPage.Family=\u65cf
|
||||
PushToPaletteActionProvider.OK3=\u786E\u5B9A
|
||||
PushToPaletteActionProvider.OK2=\u786E\u5B9A
|
||||
CopyComponentActionProvider.CopyComponent2=\u590D\u5236\u7EC4\u4EF6
|
||||
AbstractXMLConfigPage.CTYPETip=\u8FDE\u7ED3\u5668\u7C7B\u578B
|
||||
AddResourceAction.ChooseResource=&\u9009\u62E9\u6DFB\u52A0jars\u548Czips:
|
||||
ImportComponentDialog.WarningTitle=\u8B66\u544A
|
||||
AddExternalResourceAction.AddELibs=\u6DFB\u52A0\u5916\u90E8\u5E93...
|
||||
ImportComponentDialog.NoComponentsAvailable=\u6CA1\u6709\u53EF\u7528\u7684\u7EC4\u4EF6
|
||||
AbstractXMLConfigPage.MINOUTPUTTip=\u6574\u6570\u503C\u3002\u8FDE\u63A5\u6700\u5C0F\u503C\u8F93\u51FA
|
||||
ValidateComponentXMLActionProvider.ok=\u786E\u8BA4
|
||||
ValidateComponentXMLActionProvider.result=\u9A8C\u8BC1\u7ED3\u679C
|
||||
ValidateComponentXMLActionProvider.valid=\u7EC4\u4EF6XML\u6587\u4EF6\u5408\u6CD5\uFF01
|
||||
ValidateComponentXMLActionProvider.validate=\u9A8C\u8BC1\u7EC4\u4EF6XML\u6587\u4EF6
|
||||
@@ -1,6 +0,0 @@
|
||||
FileWizard.0=\u6587\u4EF6\u5411\u5BFC
|
||||
\n
|
||||
ApplicationActionBarAdvisor.helpMenu=\u5E2E\u52A9(&H)
|
||||
ApplicationActionBarAdvisor.fileMenu=\u6587\u4EF6(&F)
|
||||
ShowViewAction.actionLabel=\u663E\u793A\u89C6\u56FE...(&v)
|
||||
ApplicationActionBarAdvisor.windowMenu=\u7A97\u53E3(&W)
|
||||
@@ -12,6 +12,10 @@
|
||||
// ============================================================================
|
||||
package org.talend.componentdesigner;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
@@ -42,10 +46,18 @@ public class ComponentDesigenerPlugin extends AbstractUIPlugin {
|
||||
*
|
||||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
plugin = this;
|
||||
Properties prop = new Properties();
|
||||
try {
|
||||
prop.load(ComponentDesigenerPlugin.class.getResourceAsStream("log4j.properties")); //$NON-NLS-1$
|
||||
} catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
org.talend.componentdesigner.exception.ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
PropertyConfigurator.configure(prop);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -53,7 +65,6 @@ public class ComponentDesigenerPlugin extends AbstractUIPlugin {
|
||||
*
|
||||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
@Override
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
plugin = null;
|
||||
super.stop(context);
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
### direct log messages to stdout ###
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.Target=System.out
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
|
||||
|
||||
### direct messages to file hibernate.log ###
|
||||
#log4j.appender.file=org.apache.log4j.FileAppender
|
||||
#log4j.appender.file.File=hibernate.log
|
||||
#log4j.appender.file.layout=org.apache.log4j.PatternLayout
|
||||
#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
|
||||
|
||||
### set log levels - for more verbose logging change 'info' to 'debug' ###
|
||||
|
||||
log4j.rootLogger=warn, stdout
|
||||
|
||||
#log4j.logger.org.hibernate=info
|
||||
log4j.logger.org.hibernate=debug
|
||||
|
||||
### log HQL query parser activity
|
||||
#log4j.logger.org.hibernate.hql.ast.AST=debug
|
||||
|
||||
### log just the SQL
|
||||
#log4j.logger.org.hibernate.SQL=debug
|
||||
|
||||
### log JDBC bind parameters ###
|
||||
log4j.logger.org.hibernate.type=info
|
||||
#log4j.logger.org.hibernate.type=debug
|
||||
|
||||
### log schema export/update ###
|
||||
log4j.logger.org.hibernate.tool.hbm2ddl=debug
|
||||
|
||||
### log HQL parse trees
|
||||
#log4j.logger.org.hibernate.hql=debug
|
||||
|
||||
### log cache activity ###
|
||||
#log4j.logger.org.hibernate.cache=debug
|
||||
|
||||
### log transaction activity
|
||||
#log4j.logger.org.hibernate.transaction=debug
|
||||
|
||||
### log JDBC resource acquisition
|
||||
#log4j.logger.org.hibernate.jdbc=debug
|
||||
|
||||
### enable the following line if you want to track down connection ###
|
||||
### leakages when using DriverManagerConnectionProvider ###
|
||||
#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
|
||||
@@ -39,6 +39,7 @@ public class NewActionProvider extends CommonActionProvider {
|
||||
|
||||
private IAction newProjectAction;
|
||||
|
||||
@Override
|
||||
public void init(ICommonActionExtensionSite anExtensionSite) {
|
||||
|
||||
if (anExtensionSite.getViewSite() instanceof ICommonViewerWorkbenchSite) {
|
||||
@@ -49,6 +50,7 @@ public class NewActionProvider extends CommonActionProvider {
|
||||
/**
|
||||
* Adds a submenu to the given menu with the name "New Component".
|
||||
*/
|
||||
@Override
|
||||
public void fillContextMenu(IMenuManager menu) {
|
||||
for (IContributionItem item : menu.getItems()) {
|
||||
if (item == null || item.getId() == null) {
|
||||
@@ -82,6 +84,7 @@ public class NewActionProvider extends CommonActionProvider {
|
||||
/*
|
||||
* (non-Javadoc) Method declared on IAction.
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
CreateComponentWizard wizard = new CreateComponentWizard();
|
||||
wizard.init(PlatformUI.getWorkbench(), null);
|
||||
|
||||
@@ -60,6 +60,7 @@ public class TreeNodeAttrCompsite extends Composite {
|
||||
|
||||
nodeText.addModifyListener(new ModifyListener() {
|
||||
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
nodeData.getXMLNode().setTextContent(nodeText.getText());
|
||||
nodeData.setBodayText(nodeText.getText());
|
||||
@@ -87,6 +88,7 @@ public class TreeNodeAttrCompsite extends Composite {
|
||||
|
||||
attrText.addModifyListener(new ModifyListener() {
|
||||
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
String attrName = attrLabel.getText().split(MARK)[0];
|
||||
if (attrText.getText().equals(PluginConstant.EMPTY_STRING)) {
|
||||
@@ -128,6 +130,7 @@ public class TreeNodeAttrCompsite extends Composite {
|
||||
|
||||
attrCombo.addModifyListener(new ModifyListener() {
|
||||
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
String attrName = attrLabel.getText().split(MARK)[0];
|
||||
if (attrCombo.getText().equals(PluginConstant.EMPTY_STRING)) {
|
||||
|
||||
@@ -134,6 +134,7 @@ public abstract class AbstractXMLConfigPage extends AbstractComponentPage {
|
||||
*
|
||||
* @see org.talend.componentdesigner.ui.wizard.creatcomponent.AbstractComponentPage#initialize()
|
||||
*/
|
||||
@Override
|
||||
protected void initialize() {
|
||||
availableXmlTree.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@@ -152,6 +153,7 @@ public abstract class AbstractXMLConfigPage extends AbstractComponentPage {
|
||||
itemDel.setText(Messages.getString("AbstractXMLConfigPage.Delete")); //$NON-NLS-1$
|
||||
itemDel.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
TreeNodeData currentNodeData = (TreeNodeData) treeItem[0].getParentItem().getData();
|
||||
currentNodeData.getXMLNode().removeChild(((TreeNodeData) treeItem[0].getData()).getXMLNode());
|
||||
@@ -171,6 +173,7 @@ public abstract class AbstractXMLConfigPage extends AbstractComponentPage {
|
||||
nodeMenuItem.setText(itemName);
|
||||
nodeMenuItem.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
TreeItem newItem = new TreeItem(treeItem[0], 0);
|
||||
newItem.setText(itemName);
|
||||
@@ -226,6 +229,7 @@ public abstract class AbstractXMLConfigPage extends AbstractComponentPage {
|
||||
*
|
||||
* @see org.talend.componentdesigner.ui.wizard.creatcomponent.AbstractComponentPage#validatePage()
|
||||
*/
|
||||
@Override
|
||||
protected boolean validatePage() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
prefs.configuration.LINK_STYLE.AUTO=Automatisch
|
||||
prefs.configuration.LINK_STYLE.LINE=Lijnen (snel)
|
||||
prefs.configuration.LINK_STYLE.BEZIER_CURVE=Rondingen
|
||||
@@ -1,3 +0,0 @@
|
||||
prefs.configuration.LINK_STYLE.AUTO=\u81EA\u52A8
|
||||
prefs.configuration.title=\u8fd0\u884c\u6b65\u9aa4\u914d\u7f6e
|
||||
prefs.configuration.LINK_STYLE=\u9ED8\u8BA4\u94FE\u63A5\u663E\u793A\u4E3A\uFF1A
|
||||
@@ -12,9 +12,6 @@
|
||||
// ============================================================================
|
||||
package org.talend.designer.abstractmap;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.oro.text.regex.MalformedPatternException;
|
||||
import org.apache.oro.text.regex.Pattern;
|
||||
import org.apache.oro.text.regex.PatternCompiler;
|
||||
@@ -112,34 +109,21 @@ public abstract class AbstractMapComponent extends AbstractExternalNode {
|
||||
hasOrRenameData(oldName, newName, true);
|
||||
|
||||
}
|
||||
|
||||
private static Map<String, Pattern> patternsCache = new HashMap<String, Pattern>();
|
||||
|
||||
protected final Pattern getRenamePattern(String oldName) {
|
||||
if (patternsCache.containsKey(oldName)) {
|
||||
return patternsCache.get(oldName);
|
||||
}
|
||||
PatternCompiler compiler = new Perl5Compiler();
|
||||
Pattern pattern = null;
|
||||
try {
|
||||
pattern = compiler.compile("\\b(" + UpdateContextVariablesHelper.replaceSpecialChar(oldName) + ")(\\b|\\_)"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
patternsCache.put(oldName, pattern);
|
||||
return pattern;
|
||||
} catch (MalformedPatternException e) {
|
||||
ExceptionHandler.process(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static Map<String, Perl5Substitution> substitutionsCache = new HashMap<String, Perl5Substitution>();
|
||||
|
||||
protected final Perl5Substitution getRenameSubstitution(String newName) {
|
||||
if (substitutionsCache.containsKey(newName)) {
|
||||
return substitutionsCache.get(newName);
|
||||
}
|
||||
Perl5Substitution ps = new Perl5Substitution(newName + "$2", Perl5Substitution.INTERPOLATE_ALL); //$NON-NLS-1$
|
||||
substitutionsCache.put(newName, ps);
|
||||
return ps;
|
||||
return new Perl5Substitution(newName + "$2", Perl5Substitution.INTERPOLATE_ALL); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
AlfrescoModelDialog.modelTable.title=Titel
|
||||
AlfrescoOutputManager.schemaError.title=Fout in schema
|
||||
AlfrescoModelDialog.add=Toevoegen
|
||||
AlfrescoModelDialog.removeModelFailed=Fout bij verwijderen model
|
||||
AlfrescoModelDialog.modelTable.name=Naam
|
||||
@@ -1,20 +0,0 @@
|
||||
AlfrescoModelDialog.missingAspectDefinitions.msg=\u6240\u9009\u62E9\u7684\u65B9\u9762\u6D89\u53CA\u672A\u77E5\u7684Alfresco\u65B9\u9762: ${0}.\u8BF7\u63D0\u4F9Balfresco \u6A21\u578B\u6587\u4EF6\u5B9A\u4E49\u4ED6\u4EEC.
|
||||
AlfrescoModelDialog.modelTable.title=\u6807\u9898
|
||||
AlfrescoModelDialog.availableAspects=\u53EF\u7528\u56E0\u7D20
|
||||
AlfrescoModelDialog.missingAspectDefinitions.title=\u7F3A\u7701\u65B9\u9762\u5B9A\u4E49
|
||||
AlfrescoOutputManager.schemaError.title=schema\u9519\u8BEF
|
||||
AlfrescoModelDialog.missingTypeDefinitions.msg=\u6240\u9009\u62E9\u7684\u7C7B\u578B\u6D89\u53CA\u672A\u77E5\u7684Alfresco\u7C7B\u578B\u6216\u65B9\u9762: ${0}.\uFF0C\u8BF7\u63D0\u4F9Balfresco \u6A21\u578B\u6587\u4EF6\u5B9A\u4E49\u4ED6\u4EEC.
|
||||
AlfrescoModelDialog.missingTypeDefinitions.title=\u7F3A\u7701\u7C7B\u578B\u5B9A\u4E49
|
||||
AlfrescoModelDialog.add=\u6DFB\u52A0...
|
||||
AlfrescoOutputModelManager.errorReadingModel=\u8BFB\u53D6Alfresco\u7684\u6A21\u578B\u6587\u4EF6\u9519\u8BEF
|
||||
AlfrescoModelDialog.aspects=\u65B9\u9762
|
||||
AlfrescoOutputManager.schemaError.msg=\u8BF7\u5148\u540C\u6B65schema
|
||||
AlfrescoOutputModelManager.alreadyAdded=\u8BE5\u6A21\u578B\u5DF2\u6DFB\u52A0
|
||||
AlfrescoModelDialog.removeModelFailed=\u79FB\u9664\u6A21\u578B\u5931\u8D25
|
||||
AlfrescoOutputModelManager.prefixConflict=\u65E0\u6CD5\u6DFB\u52A0\u6A21\u578B\uFF0C\u524D\u7F00\u4E0E\u4EE5\u524D\u6DFB\u52A0\u6A21\u578B\u51B2\u7A81
|
||||
AlfrescoOutputModelManager.notYetAdded=\u8BE5\u6A21\u578B\u5C1A\u672A\u6DFB\u52A0
|
||||
AlfrescoModelDialog.type=\u7C7B\u578B
|
||||
AlfrescoModelDialog.addModelFailed=\u6DFB\u52A0\u6A21\u578B\u5931\u8D25
|
||||
AlfrescoModelDialog.modelTable.name=\u8fde\u63a5\u540d
|
||||
AlfrescoModelDialog.remove=\u5220\u9664
|
||||
AlfrescoOutputManager.failedLoadModel=\u65E0\u6CD5\u52A0\u8F7D\u7684\u7EC4\u4EF6\u5143\u6570\u636E\u6A21\u578B, \u91CD\u65B0\u521D\u59CB\u5316
|
||||
@@ -1 +0,0 @@
|
||||
pluginName=\u7EC4\u4EF6\u6A21\u5757
|
||||
@@ -1,9 +0,0 @@
|
||||
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
|
||||
@@ -1,80 +0,0 @@
|
||||
BusinessInitDiagramFileAction.DiagramFile=\u56FE\u8868\u6587\u4EF6
|
||||
BusinessAbstractParser.ValueOfLongIsExpected=\u503C\u7684\u7C7B\u578B\u5E94\u8BE5\u4E3ALong
|
||||
BusinessAbstractParser.ValueOfFloatIsExpected=\u503C\u7684\u7C7B\u578B\u5E94\u8BE5\u4E3AFloat
|
||||
BusinessPaletteFactory.DataComment=\u521B\u5EFA\u65B0\u7684\u6570\u636E
|
||||
CreateDiagramAction.CreateBusinessModel=\u521B\u5EFA\u4E1A\u52A1\u6A21\u578B
|
||||
BusinessCreationWizardPage.CreatenewBusinessDiagram=\u521B\u5EFA\u65B0\u7684\u903B\u8F91\u56FE\u3002
|
||||
BusinessAbstractParser.StringIntegerConvertError=String\u7C7B\u578B\u7684\u503C\u4E0D\u80FD\u8F6C\u6362\u4E3AInteger\u7C7B\u578B
|
||||
BusinessPaletteFactory.CreateGear=\u521B\u5EFA\u9F7F\u8F6E
|
||||
SimpleBusinessCreationWizardPage.Title=\u65B0\u7684\u4E1A\u52A1\u6A21\u578B
|
||||
BusinessNewDiagramFileWizard.CreateNewDiagram=\u521B\u5EFA\u65B0\u7684\u56FE\u8868
|
||||
BusinessAbstractParser.UnknownLiteral=\u65E0\u6548\u7684\u6587\u5B57
|
||||
BusinessAbstractParser.StringLongConverError=String\u7C7B\u578B\u7684\u503C\u4E0D\u80FD\u8F6C\u6362\u4E3ALong\u7C7B\u578B
|
||||
AssignmentPropertySection.DeleteAssignment=\u5220\u9664\u8D4B\u503C
|
||||
AssignmentPropertySection.Type=\u7C7B\u578B
|
||||
BusinessModelingAssistantProvider.AvaiableDomainModelElements=\u65E0\u6548\u7684\u57DF\u6A21\u578B\u5143\u7D20
|
||||
BusinessPaletteFactory.BidirectionalRelationShip=\u53CC\u5411\u5173\u8054
|
||||
BusinessPaletteFactory.CreateDirectionalRelationShip=\u521B\u5EFA\u65B9\u5411\u5173\u8054
|
||||
BusinessPaletteFactory.CreateBidirectionalRelationShip=\u521B\u5EFA\u53CC\u5411\u5173\u8054
|
||||
AssignmentPropertySection.Name=\u540D\u79F0
|
||||
CreateAssignmentCommand.CannotAssign=\u4E0D\u80FD\u5206\u914D\u3002
|
||||
BusinessNewDiagramFileWizard.DiagramRootElement=\u56FE\u8868\u6839\u5143\u7D20
|
||||
BusinessNewDiagramFileWizard.NoDiagramRootElementSelectedError=\u6CA1\u6709\u56FE\u8868\u6839\u5143\u7D20\u88AB\u9009\u4E2D
|
||||
BusinessVisualIDRegistry.ParseError=\u4E0D\u80FD\u628A\u89C6\u56FE\u7C7B\u578B\u5F53\u4F5CvisialID\u6570\u5B57\u6765\u8F6C\u6362
|
||||
OpenDiagramAction.EditBusinessModel=\u7F16\u8F91\u4E1A\u52A1\u6A21\u578B
|
||||
BusinessAbstractParser.ValueOfTypeByteIsExpected=\u503C\u7684\u7C7B\u578B\u5E94\u8BE5\u4E3AByte
|
||||
BusinessAbstractParser.ValueOfTypeCharacterIsExpected=\u503C\u7684\u7C7B\u578B\u5E94\u8BE5\u4E3ACharacter
|
||||
BusinessPaletteFactory.ActionComment=\u521B\u5EFA\u65B0\u7684\u52A8\u4F5C
|
||||
BusinessAbstractParser.ValueOfTypeStringIsExpected=\u503C\u7684\u7C7B\u578B\u5E94\u8BE5\u4E3AString
|
||||
BusinessInitDiagramFileAction.Error=\u9519\u8BEF
|
||||
BusinessNewDiagramFileWizard.SelectRootElement=\u9009\u62E9\u56FE\u8868\u6839\u5143\u7D20
|
||||
RepositoryFactoryProxyLabelProvider.Deleted=\uFF08\u5220\u9664\uFF09
|
||||
BusinessPaletteFactory.TerminalComment=\u521B\u5EFA\u65B0\u7684\u4E2D\u65AD\u70B9
|
||||
BusinessAbstractParser.ValueOfShortIsExpected=\u503C\u7684\u7C7B\u578B\u5E94\u8BE5\u4E3AShort
|
||||
BusinessPaletteFactory.DatabaseComment=\u521B\u5EFA\u65B0\u7684\u6570\u636E\u5E93
|
||||
AssignmentPropertySection.Comment=\u6CE8\u91CA
|
||||
SimpleBusinessCreationWizard.NewBusinessModel=\u65B0\u7684\u4E1A\u52A1\u578B
|
||||
BusinessNewDiagramFileWizard.InvalidDiagramRootElementSelected=\u9009\u4E2D\u4E86\u65E0\u6548\u7684\u56FE\u8868\u6839\u5143\u7D20
|
||||
BusinessInitDiagramFileAction.IntialNew=\u521D\u59CB\u5316\u65B0\u7684
|
||||
FindAssignmentAction.FindAssignments=\u67E5\u627E\u5206\u914D\u4EFB\u52A1
|
||||
RepositoryFactoryProxyLabelProvider.NotFound=\uFF08\u672A\u53D1\u73B0\uFF09
|
||||
BusinessPaletteFactory.Terminal=\u4E2D\u65AD\u70B9
|
||||
BusinessAbstractParser.InvalidInputAt=\u65E0\u6548\u7684\u8F93\u5165\u5728
|
||||
BusinessPaletteFactory.Gear=\u9F7F\u8F6E
|
||||
BusinessPaletteFactory.InputComment=\u521B\u5EFA\u65B0\u7684\u8F93\u5165
|
||||
BusinessPaletteFactory.Data=\u6570\u636E
|
||||
BusinessPaletteFactory.Ellipse=\u692D\u5706
|
||||
BusinessPaletteFactory.Input=\u8F93\u5165
|
||||
BusinessPaletteFactory.List=\u5217\u8868
|
||||
BusinessPaletteFactory.Relationshop=\u5173\u7CFB
|
||||
BusinessAbstractParser.ValueOfBooleanIsExpected=\u503C\u7684\u7C7B\u578B\u5E94\u8BE5\u4E3ABoolean
|
||||
BusinessPaletteFactory.decision=\u51B3\u7B56
|
||||
BusinessPaletteFactory.Document=\u6587\u6863
|
||||
BusinessModelingAssistantProvider.SelectDomainModelElement=\u9009\u62E9\u57DF\u6A21\u578B\u5143\u7D20
|
||||
BusinessPaletteFactory.CreateActor=\u521B\u5EFA\u89D2\u8272
|
||||
BusinessAbstractParser.StringDoubleConvertError=String\u7C7B\u578B\u7684\u503C\u4E0D\u80FD\u8F6C\u6362\u4E3ADoule\u7C7B\u578B
|
||||
BusinessPaletteFactory.Actor=\u89D2\u8272
|
||||
EditAction.Edit=\u7F16\u8F91\u5206\u914D\u4EFB\u52A1
|
||||
BusinessCreationWizardPage.CreateBusinessDiagram=\u521B\u5EFA\u903B\u8F91\u56FE
|
||||
BusinessPaletteFactory.Database=\u6570\u636E\u6E90
|
||||
BusinessPaletteFactory.ListComment=\u521B\u5EFA\u65B0\u7684\u5217\u8868
|
||||
BusinessPaletteFactory.DirectionalRelationShip=\u65B9\u5411\u5173\u8054
|
||||
BusinessPaletteFactory.Action=\u52A8\u4F5C
|
||||
BusinessPaletteFactory.RelationshopComment=\u521B\u5EFA\u65B0\u7684\u5173\u7CFB
|
||||
BusinessInitDiagramFileAction.LoadFaild=\u6A21\u578B\u6587\u4EF6\u88C5\u8F7D\u5931\u8D25
|
||||
BusinessPaletteFactory.DecisionComment=\u521B\u5EFA\u65B0\u7684\u51B3\u7B56
|
||||
BusinessAbstractParser.ValueOfDoubleIsExpected=\u503C\u7684\u7C7B\u578B\u5E94\u8BE5\u4E3ADouble
|
||||
OpenDiagramAction.ReadBusinessModel=\u8BFB\u53D6\u4E1A\u52A1\u6A21\u578B
|
||||
BusinessInitDiagramFileAction.UnableToLoadResource=\u4E0D\u80FD\u53BB\u88C5\u8F7D\u8D44\u6E90:
|
||||
BusinessPaletteFactory.CreateEllipse=\u521B\u5EFA\u692D\u5706
|
||||
BusinessNewDiagramFileWizard.DiagramFile=\u56FE\u8868\u6587\u4EF6
|
||||
BusinessAbstractParser.StringShortConverError=String\u7C7B\u578B\u7684\u503C\u4E0D\u80FD\u8F6C\u6362\u4E3AShort\u7C7B\u578B
|
||||
BusinessPaletteFactory.DocuemntComment=\u521B\u5EFA\u65B0\u7684\u6587\u6863
|
||||
BusinessAbstractParser.ValueOfIntegerIsExpected=\u503C\u7684\u7C7B\u578B\u5E94\u8BE5\u4E3AInteger
|
||||
BusinessNewDiagramFileWizard.SelectDiagramRootElement=\u9009\u62E9\u56FE\u8868\u6839\u5143\u7D20\uFF1A
|
||||
BusinessNewDiagramFileWizard.SelectSemanticModelElement=\u9009\u62E9\u8981\u5728\u56FE\u8868\u4E0A\u63CF\u8FF0\u7684\u8BED\u4E49\u6A21\u578B\u5143\u7D20
|
||||
BusinessAbstractParser.StringFloatConvertError=String\u7C7B\u578B\u7684\u503C\u4E0D\u80FD\u8F6C\u6362\u4E3AFloat\u7C7B\u578B
|
||||
BusinessAbstractParser.StringValueDoesNotConvertToByteValue=String\u7C7B\u578B\u7684\u503C\u4E0D\u80FD\u8F6C\u6362\u4E3AByte\u7C7B\u578B
|
||||
BusinessNewDiagramFileWizard.IntialNewEcoreDiagramFile=\u521D\u59CB\u5316\u65B0\u7684Ecore\u56FE\u8868\u6587\u4EF6
|
||||
BusinessTooltipFigure.assignedMeta={0}\u5206\u914D\u5143\u6570\u636E
|
||||
DeleteAssignmentAction.DeleteAssignment=\u5220\u9664\u8D4B\u503C
|
||||
@@ -557,16 +557,5 @@
|
||||
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>
|
||||
|
||||
@@ -82,5 +82,3 @@ RepositoryFactoryProxyLabelProvider.Deleted=\ (Deleted)
|
||||
AssignmentPropertySection.Type=Type
|
||||
AssignmentPropertySection.Name=Name
|
||||
AssignmentPropertySection.Comment=Comment
|
||||
BusinessDiagramEditor.canNotSaveTitle=Warning
|
||||
BusinessDiagramEditor.canNotSaveMessage=Business Model is not locked by user, can not save.
|
||||
|
||||
@@ -69,7 +69,6 @@ public class OpenDiagramAction extends AContextualAction implements IIntroAction
|
||||
*
|
||||
* @see org.eclipse.jface.action.Action#run()
|
||||
*/
|
||||
@Override
|
||||
protected void doRun() {
|
||||
ISelection selection = getSelectedObject();
|
||||
if (selection == null) {
|
||||
@@ -97,11 +96,10 @@ public class OpenDiagramAction extends AContextualAction implements IIntroAction
|
||||
if (part instanceof BusinessDiagramEditor) {
|
||||
((BusinessDiagramEditor) part).setLastVersion(true);
|
||||
}
|
||||
// TDI-21143 : Studio repository view : remove all refresh call to repo view
|
||||
// IRepositoryView view = getViewPart();
|
||||
// if (view != null) {
|
||||
// view.refresh(repositoryNode);
|
||||
// }
|
||||
IRepositoryView view = getViewPart();
|
||||
if (view != null) {
|
||||
view.refresh(repositoryNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,25 +13,14 @@
|
||||
package org.talend.designer.business.diagram.custom.actions;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.wizard.Wizard;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.part.EditorPart;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.ui.runtime.exception.MessageBoxExceptionHandler;
|
||||
import org.talend.commons.ui.runtime.image.ECoreImage;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.core.CorePlugin;
|
||||
@@ -84,8 +73,8 @@ public class SaveAsBusinessModelWizard extends Wizard {
|
||||
RepositoryNode repositoryNode = repositoryEditorInput.getRepositoryNode();
|
||||
// see: RepositoryEditorInput.setRepositoryNode(IRepositoryNode repositoryNode)
|
||||
if (repositoryNode == null) {
|
||||
repositoryNode = (RepositoryNode) CorePlugin.getDefault().getRepositoryService()
|
||||
.getRepositoryNode(repositoryEditorInput.getItem().getProperty().getId(), false);
|
||||
repositoryNode = (RepositoryNode) CorePlugin.getDefault().getRepositoryService().getRepositoryNode(
|
||||
repositoryEditorInput.getItem().getProperty().getId(), false);
|
||||
}
|
||||
|
||||
IRepositoryService service = DesignerPlugin.getDefault().getRepositoryService();
|
||||
@@ -131,7 +120,13 @@ public class SaveAsBusinessModelWizard extends Wizard {
|
||||
isUpdate = isUpdate();
|
||||
|
||||
if (isUpdate) {
|
||||
update();
|
||||
assginVlaues(oldProperty, property);
|
||||
|
||||
repositoryFactory.save(oldBusinessProcessItem);
|
||||
|
||||
// assign value
|
||||
businessProcessItem = oldBusinessProcessItem;
|
||||
|
||||
} else {
|
||||
property.setId(repositoryFactory.getNextId());
|
||||
|
||||
@@ -157,34 +152,6 @@ public class SaveAsBusinessModelWizard extends Wizard {
|
||||
return ok;
|
||||
}
|
||||
|
||||
private void update() {
|
||||
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
try {
|
||||
assginVlaues(oldProperty, property);
|
||||
|
||||
repositoryFactory.save(oldBusinessProcessItem);
|
||||
// assign value
|
||||
businessProcessItem = oldBusinessProcessItem;
|
||||
} catch (PersistenceException pe) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(),
|
||||
"persistance error", pe)); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
};
|
||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||
try {
|
||||
ISchedulingRule schedulingRule = workspace.getRoot();
|
||||
// the update the project files need to be done in the workspace runnable to avoid all notification
|
||||
// of changes before the end of the modifications.
|
||||
workspace.run(runnable, schedulingRule, IWorkspace.AVOID_UPDATE, null);
|
||||
} catch (CoreException e) {
|
||||
MessageBoxExceptionHandler.process(e.getCause());
|
||||
}
|
||||
}
|
||||
|
||||
public BusinessProcessItem getBusinessProcessItem() {
|
||||
return this.businessProcessItem;
|
||||
}
|
||||
|
||||
@@ -213,9 +213,9 @@ public abstract class BusinessItemShapeEditPart extends ShapeNodeEditPart {
|
||||
private BusinessAlignment getAlignment(String alignment) {
|
||||
BusinessAlignment[] alignments = BusinessAlignment.values();
|
||||
BusinessAlignment position = null;
|
||||
for (int i = 0; i < alignments.length; i++) {
|
||||
if (alignments[i].toString().equalsIgnoreCase(alignment)) {
|
||||
position = alignments[i];
|
||||
for (BusinessAlignment alignment2 : alignments) {
|
||||
if (alignment2.toString().equalsIgnoreCase(alignment)) {
|
||||
position = alignment2;
|
||||
return position;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.MetadataToolHelper;
|
||||
import org.talend.core.model.metadata.MetadataTool;
|
||||
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,16 +42,15 @@ public class RepositoryFactoryProxyLabelProvider extends AdapterFactoryLabelProv
|
||||
if (columnIndex == 0) {
|
||||
IRepositoryViewObject lastVersion = getLastVersion(object);
|
||||
if (lastVersion == null) {
|
||||
MetadataTable table = MetadataToolHelper.getMetadataTableFromRepository(assignment.getTalendItem().getId());
|
||||
MetadataTable table = MetadataTool.getMetadataTableFromRepository(assignment.getTalendItem().getId());
|
||||
if (table != null) {
|
||||
return image;
|
||||
}
|
||||
Query query = MetadataToolHelper.getQueryFromRepository(assignment.getTalendItem().getId());
|
||||
Query query = MetadataTool.getQueryFromRepository(assignment.getTalendItem().getId());
|
||||
if (query != null) {
|
||||
return image;
|
||||
}
|
||||
SAPFunctionUnit function = MetadataToolHelper
|
||||
.getSAPFunctionFromRepository(assignment.getTalendItem().getId());
|
||||
SAPFunctionUnit function = MetadataTool.getSAPFunctionFromRepository(assignment.getTalendItem().getId());
|
||||
if (function != null) {
|
||||
return image;
|
||||
}
|
||||
@@ -98,26 +97,22 @@ public class RepositoryFactoryProxyLabelProvider extends AdapterFactoryLabelProv
|
||||
try {
|
||||
if (columnIndex == 0) {
|
||||
if (lastVersion == null) {
|
||||
MetadataTable table = MetadataToolHelper.getMetadataTableFromRepository(assignment.getTalendItem().getId());
|
||||
MetadataTable table = MetadataTool.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 = MetadataToolHelper.getQueryFromRepository(assignment.getTalendItem().getId());
|
||||
Query query = MetadataTool.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 = MetadataToolHelper
|
||||
.getSAPFunctionFromRepository(assignment.getTalendItem().getId());
|
||||
SAPFunctionUnit function = MetadataTool.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();
|
||||
@@ -156,8 +151,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) {
|
||||
|
||||
@@ -31,7 +31,7 @@ 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.MetadataToolHelper;
|
||||
import org.talend.core.model.metadata.MetadataTool;
|
||||
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;
|
||||
@@ -117,9 +117,9 @@ public class ElementHelper {
|
||||
labels.add(label);
|
||||
} else {
|
||||
|
||||
MetadataTable table = MetadataToolHelper.getMetadataTableFromRepository(talendItem.getId());
|
||||
Query query = MetadataToolHelper.getQueryFromRepository(talendItem.getId());
|
||||
SAPFunctionUnit function = MetadataToolHelper.getSAPFunctionFromRepository(talendItem.getId());
|
||||
MetadataTable table = MetadataTool.getMetadataTableFromRepository(talendItem.getId());
|
||||
Query query = MetadataTool.getQueryFromRepository(talendItem.getId());
|
||||
SAPFunctionUnit function = MetadataTool.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.MetadataToolHelper;
|
||||
import org.talend.core.model.metadata.MetadataTool;
|
||||
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;
|
||||
@@ -289,7 +289,7 @@ public class BusinessAssignmentComposite extends AbstractTabComposite {
|
||||
curNode = RepositoryNodeUtilities.getRepositoryNode(lastVersion);
|
||||
select(viewer, curNode);
|
||||
} else if (item instanceof TableMetadata) {
|
||||
MetadataTable table = MetadataToolHelper.getMetadataTableFromRepository(item.getId());
|
||||
MetadataTable table = MetadataTool.getMetadataTableFromRepository(item.getId());
|
||||
if (table != null) {
|
||||
String id = item.getId().split(" - ")[0]; //$NON-NLS-1$
|
||||
|
||||
@@ -303,8 +303,8 @@ public class BusinessAssignmentComposite extends AbstractTabComposite {
|
||||
|
||||
}
|
||||
} else if (item instanceof Query) {
|
||||
org.talend.core.model.metadata.builder.connection.Query query = MetadataToolHelper
|
||||
.getQueryFromRepository(item.getId());
|
||||
org.talend.core.model.metadata.builder.connection.Query query = MetadataTool.getQueryFromRepository(item
|
||||
.getId());
|
||||
if (query != null) {
|
||||
String id = item.getId().split(" - ")[0]; //$NON-NLS-1$
|
||||
IRepositoryView view = getRepositoryView();
|
||||
@@ -314,7 +314,7 @@ public class BusinessAssignmentComposite extends AbstractTabComposite {
|
||||
}
|
||||
|
||||
} else if (item instanceof SAPFunction) {
|
||||
SAPFunctionUnit function = MetadataToolHelper.getSAPFunctionFromRepository(item.getId());
|
||||
SAPFunctionUnit function = MetadataTool.getSAPFunctionFromRepository(item.getId());
|
||||
if (function != null) {
|
||||
IRepositoryView view = getRepositoryView();
|
||||
RepositoryNode node = RepositoryNodeUtilities.getSAPFunctionFromConnection(item.getId());
|
||||
@@ -454,19 +454,18 @@ public class BusinessAssignmentComposite extends AbstractTabComposite {
|
||||
return repositoryNode;
|
||||
}
|
||||
} else if (item instanceof TableMetadata) {
|
||||
MetadataTable table = MetadataToolHelper.getMetadataTableFromRepository(item.getId());
|
||||
MetadataTable table = MetadataTool.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 = MetadataToolHelper.getQueryFromRepository(item
|
||||
.getId());
|
||||
org.talend.core.model.metadata.builder.connection.Query query = MetadataTool.getQueryFromRepository(item.getId());
|
||||
if (query != null) {
|
||||
return RepositoryNodeUtilities.getQueryFromConnection(item.getId());
|
||||
}
|
||||
} else if (item instanceof SAPFunction) {
|
||||
SAPFunctionUnit function = MetadataToolHelper.getSAPFunctionFromRepository(item.getId());
|
||||
SAPFunctionUnit function = MetadataTool.getSAPFunctionFromRepository(item.getId());
|
||||
if (function != null) {
|
||||
return RepositoryNodeUtilities.getSAPFunctionFromConnection(item.getId());
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.eclipse.gmf.runtime.diagram.ui.internal.editparts.NoteAttachmentEditP
|
||||
import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer;
|
||||
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.StorageDiagramDocumentProvider;
|
||||
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.editor.FileDiagramEditor;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.ui.IEditorInput;
|
||||
@@ -58,16 +57,13 @@ import org.talend.designer.business.diagram.custom.dnd.BusinessDiagramDropTarget
|
||||
import org.talend.designer.business.diagram.custom.edit.parts.BaseBusinessItemRelationShipEditPart;
|
||||
import org.talend.designer.business.diagram.custom.edit.parts.BusinessItemShapeEditPart;
|
||||
import org.talend.designer.business.diagram.custom.figures.BusinessItemShapeFigure;
|
||||
import org.talend.designer.business.diagram.i18n.Messages;
|
||||
import org.talend.designer.business.model.business.diagram.edit.parts.BusinessEditPartFactory;
|
||||
import org.talend.designer.business.model.business.diagram.edit.parts.BusinessProcessEditPart;
|
||||
import org.talend.designer.business.model.business.diagram.providers.BusinessDiagramActionProvider;
|
||||
import org.talend.designer.core.ui.ActiveProcessTracker;
|
||||
import org.talend.designer.core.ui.views.jobsettings.JobSettingsView;
|
||||
import org.talend.repository.editor.RepositoryEditorInput;
|
||||
import org.talend.repository.model.ERepositoryStatus;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.talend.repository.model.IRepositoryService;
|
||||
import org.talend.repository.model.RepositoryNode;
|
||||
|
||||
/**
|
||||
@@ -175,29 +171,10 @@ public class BusinessDiagramEditor extends FileDiagramEditor implements IGotoMar
|
||||
|
||||
@Override
|
||||
public void doSave(IProgressMonitor progressMonitor) {
|
||||
super.doSave(progressMonitor);
|
||||
if (repositoryEditorInput != null) {
|
||||
BusinessProcessItem businessProcessItem = (BusinessProcessItem) repositoryEditorInput.getItem();
|
||||
IRepositoryService service = CorePlugin.getDefault().getRepositoryService();
|
||||
IProxyRepositoryFactory repFactory = service.getProxyRepositoryFactory();
|
||||
try {
|
||||
repFactory.updateLockStatus();
|
||||
// For TDI-23825, if not lock by user try to lock again.
|
||||
boolean locked = repFactory.getStatus(businessProcessItem) == ERepositoryStatus.LOCK_BY_USER;
|
||||
if (!locked) {
|
||||
repFactory.lock(businessProcessItem);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
ERepositoryStatus status = repFactory.getStatus(businessProcessItem);
|
||||
if (!status.equals(ERepositoryStatus.LOCK_BY_USER) && !repFactory.getRepositoryContext().isEditableAsReadOnly()) {
|
||||
MessageDialog.openWarning(getEditorSite().getShell(),
|
||||
Messages.getString("BusinessDiagramEditor.canNotSaveTitle"), //$NON-NLS-1$
|
||||
Messages.getString("BusinessDiagramEditor.canNotSaveMessage")); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
super.doSave(progressMonitor);
|
||||
DiagramResourceManager diagramResourceManager = new DiagramResourceManager();
|
||||
BusinessProcessItem businessProcessItem = (BusinessProcessItem) repositoryEditorInput.getItem();
|
||||
diagramResourceManager.updateFromResource(businessProcessItem, repositoryEditorInput.getFile());
|
||||
// remove the function of sve SVG file because the imported business model can't save SVG file.
|
||||
// saveSVG(businessProcessItem);
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
pluginName=\u7EC4\u4EF6\u6A21\u5757
|
||||
format=\u683C\u5F0F
|
||||
@@ -1,5 +0,0 @@
|
||||
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
|
||||
@@ -1,45 +0,0 @@
|
||||
CodeGeneratorEmittersPoolFactory.JETEmitters.NoPresent=JETEmitters\u5DE5\u7A0B\u4E0D\u5B58\u5728\uFF0C\u9700\u8981\u91CD\u65B0\u5B8C\u6574\u521D\u59CB\u5316\u3002
|
||||
CodeGeneratorEmittersPoolFactory.Class.NotFound=\u6A21\u677F\u4F9D\u7136\u5B58\u5728\uFF0C\u4F46\u662F\u7C7B{0}
|
||||
CodeGeneratorEmittersPoolFactory.PersitentData.Error=\u6301\u4E45\u5316\u6570\u636E\u4E0D\u80FD\u4FDD\u5B58\uFF1A
|
||||
CodeGeneratorEmittersPoolFactory.initMessage=\u521D\u59CB\u5316\u4EE3\u7801\u751F\u6210\u5F15\u64CE...
|
||||
EmfEmittersPersistence.CodeGen.DataMissing=\u4EE3\u7801\u751F\u6210\u6570\u636E\u6D41\u5931\uFF0C\u5F00\u59CB\u91CD\u65B0\u751F\u6210\u4EE3\u7801\u3002
|
||||
CodeGenerator.JET.TimeOut=JET\u521D\u59CB\u5316\u8D85\u65F6\uFF01
|
||||
generatedcode.copyright.body4=\u4F60\u53EF\u4EE5\u5728\u5728GNU LGPL \u8BB8\u53EF\u8BC1\u4E0B\u652F\u914D\u8FD9\u4E9B\u4EE3\u7801
|
||||
CodeGenerator.Node.NotFound=\u5728\u5F53\u524D
|
||||
generatedcode.copyright.body3=\u4F60\u53EF\u4EE5\u5728www.talend.com\u53D1\u73B0\u66F4\u591A\u5173\u4E8ETalend\u4EA7\u54C1\u4FE1\u606F
|
||||
generatedcode.copyright.body2=/ \u4F5C\u4E1A\u8BBE\u8BA1 (CodeGenerator version {0}).
|
||||
generatedcode.copyright.body1=\u6E90\u4EE3\u7801\u88AB{0}\u81EA\u52A8\u751F\u6210
|
||||
JetSkeletonManager.updateProblem=\u5F53\u66F4\u65B0\u6301\u4E45\u6570\u636E\u65F6\u51FA\u73B0\u9519\u8BEF
|
||||
CodeGeneratorEmittersPoolFactory.codeThread=\u4EE3\u7801\u751F\u6210\u540E\u53F0\u7EBF\u7A0B
|
||||
CodeGeneratorEmittersPoolFactory.componentCompiled=\u7EC4\u4EF6\u7F16\u8BD1{0}\u6BEB\u79D2
|
||||
CodeGeneratorEmittersPoolFactory.failCompail=\u7EC4\u4EF6\u7F16\u8BD1\u5931\u8D25: \r\n
|
||||
CodeGeneratorEmittersPoolFactory.initialException=\u521D\u59CB\u5316\u5F02\u5E38
|
||||
CodeGeneratorEmittersPoolFactory.jetEmitterInitialException=\u521D\u59CB\u5316JetEmitter\u51FA\u9519
|
||||
CodeGeneratorService.invalidLanguage1=\u65E0\u6548\u7684\u8BED\u8A00\u7C7B\u578B.
|
||||
CodeGeneratorService.invalidLanguage2=\u65E0\u6548\u7684\u8BED\u8A00\u7C7B\u578B.
|
||||
CodeGenInit.addMarkers=\u5DE5\u4F5C\u533A\u4E2D\u6DFB\u52A0\u6807\u8BB0
|
||||
CodeGenInit.createProject=\u521B\u5EFA{0} \u5DE5\u7A0B
|
||||
CodeGenInit.deleteProject=\u5220\u9664{0} \u5DE5\u7A0B
|
||||
CodeGenInit.initTemplate=\u521D\u59CB\u5316\u6A21\u677F
|
||||
CodeGenInit.removeLink=\u5220\u9664\u94FE\u63A5\u8D44\u6E90
|
||||
CodeGenInit.saveWorkspace=\u4FDD\u5B58\u5DE5\u4F5C\u533A
|
||||
DocumentRootImpl.mixed=\ (\u6DF7\u5408:
|
||||
ComponentsFactory.afterSystemComponent=\u5728\u7CFB\u7EDF\u7EC4\u4EF6
|
||||
ComponentsLocalProviderService.componentLoadError=\u7EC4\u4EF6\u52A0\u8F7D\u9519\u8BEF
|
||||
ComponentsLocalProviderService.talendExchangeError=Talend Exchange\u9519\u8BEF
|
||||
ComponentsPreferencePage.ButtonLabel0=\u786E\u5B9A
|
||||
ComponentsPreferencePage.configuration.LINK_STYLE=\u9ED8\u8BA4\u94FE\u63A5\u663E\u793A\u4E3A\uFF1A
|
||||
ComponentsPreferencePage.rowLimit=\u884c\u9650\u5236
|
||||
ComponentsPreferencePage.WarningTitle=\u8B66\u544A
|
||||
ComponenttRunJobPreferencePage.label=\u53CC\u51FBtRunJob\u7EC4\u4EF6\u540E\u4E0D\u663E\u793A\u5BF9\u5E94\u7684JOB
|
||||
ComponenttRunJobPreferencePage.showCorrespondingJob=\u53CC\u51FBtRunJob\u7EC4\u4EF6\u540E\u663E\u793A\u5BF9\u5E94JOB
|
||||
XsdValidationCacheManager.unableLoadxsd=\u52A0\u8F7Dxsd\u9A8C\u8BC1\u7F13\u5B58\u6587\u4EF6\u5931\u8D25
|
||||
XsdValidationCacheManager.unableSavexsd=\u4FDD\u5B58xsd\u9A8C\u8BC1\u7F13\u5B58\u6587\u4EF6\u5931\u8D25
|
||||
prefs.configuration.LINK_STYLE.AUTO=\u81EA\u52A8
|
||||
FAMILY.Access=Access
|
||||
FAMILY.Business=\u4E1A\u52A1
|
||||
FAMILY.Business_Intelligence=\u5546\u4E1A\u667A\u80FD
|
||||
FAMILY.File=\u6587\u4ef6
|
||||
FAMILY.Input=\u8F93\u5165
|
||||
FAMILY.Output=\u6807\u51c6\u8f93\u51fa
|
||||
FAMILY.System=\u7CFB\u7EDF
|
||||
@@ -1,7 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,28 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,7 +0,0 @@
|
||||
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
|
||||
@@ -1,8 +0,0 @@
|
||||
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
|
||||
@@ -1,4 +0,0 @@
|
||||
source.. = src/main/java/
|
||||
output.. = class/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
@@ -1,53 +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.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,10 +6,8 @@
|
||||
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
|
||||
"
|
||||
%>
|
||||
<%
|
||||
@@ -17,107 +15,63 @@
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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__")%>
|
||||
|
||||
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;
|
||||
<%
|
||||
}
|
||||
%>
|
||||
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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
<%
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (startable) {
|
||||
%>
|
||||
contextRegister.register(<%=beanID%>, new <%=beanClass%>(<%=sb.toString()%>));
|
||||
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();
|
||||
}
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
camelContext = new org.apache.camel.impl.DefaultCamelContext();
|
||||
<%
|
||||
}
|
||||
%>
|
||||
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__");
|
||||
@@ -140,8 +94,7 @@
|
||||
String amqUri = ElementParameterParser.getValue(node, "__AMQ_BROKER_URI__").trim();
|
||||
|
||||
%>
|
||||
{
|
||||
javax.jms.ConnectionFactory jmsConnectionFactory = new org.apache.activemq.ActiveMQConnectionFactory(<%=amqUri%>);
|
||||
jmsConnectionFactory = new org.apache.activemq.ActiveMQConnectionFactory(<%=amqUri%>);
|
||||
<%
|
||||
String amqPool = ElementParameterParser.getValue(node, "__AMQ_POOL__").trim();
|
||||
if("true".equals(amqPool)){
|
||||
@@ -178,7 +131,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%>L);
|
||||
pooledConnectionFactory_<%=node.getUniqueName()%>.setExpiryTimeout(<%=amq_pool_expiry_timeout%>);
|
||||
pooledConnectionFactory_<%=node.getUniqueName()%>.setIdleTimeout(<%=amq_pool_idle_timeout%>);
|
||||
pooledConnectionFactory_<%=node.getUniqueName()%>.setMaxConnections(<%=amq_pool_max_connections%>);
|
||||
pooledConnectionFactory_<%=node.getUniqueName()%>.setMaximumActive(<%=amq_pool_max_active%>);
|
||||
@@ -192,9 +145,6 @@
|
||||
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__");
|
||||
@@ -220,8 +170,7 @@
|
||||
}
|
||||
|
||||
%>
|
||||
{
|
||||
javax.jms.ConnectionFactory jmsConnectionFactory = new com.ibm.mq.jms.MQQueueConnectionFactory();
|
||||
jmsConnectionFactory = new com.ibm.mq.jms.MQQueueConnectionFactory();
|
||||
((com.ibm.mq.jms.MQConnectionFactory) jmsConnectionFactory).setHostName(<%=wmqServer%>);
|
||||
try {
|
||||
((com.ibm.mq.jms.MQConnectionFactory) jmsConnectionFactory).setPort(<%=wmqPort%>);
|
||||
@@ -248,22 +197,23 @@
|
||||
org.apache.camel.component.jms.JmsComponent.jmsComponent<%=transactedMethodStr%>(connectionFactoryAdapter<%=node.getUniqueName()%>));
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
|
||||
}else if("Other".equals(mqType)){
|
||||
%>
|
||||
{
|
||||
javax.jms.ConnectionFactory jmsConnectionFactory;
|
||||
<%=ElementParameterParser.getValue(node, "__OTHER_CODE__")%>
|
||||
camelContext.addComponent(<%=name%>,
|
||||
org.apache.camel.component.jms.JmsComponent.jmsComponent<%=transactedMethodStr%>(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
|
||||
@@ -271,40 +221,36 @@
|
||||
camelContext.setName("<%=process.getName() + "-ctx"%>");
|
||||
return answer;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
protected org.apache.camel.view.ModelFileGenerator createModelFileGenerator()
|
||||
throws javax.xml.bind.JAXBException {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
final CamelImpl camelImplementation = new CamelImpl();
|
||||
if(start){
|
||||
stopDelegate = new TalendESBRoute() {
|
||||
|
||||
public int runJobInTOS(String[] args) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
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();
|
||||
<%
|
||||
public String[][] runJob(String[] args) {
|
||||
return null;
|
||||
}
|
||||
%>
|
||||
return camelContext;
|
||||
}
|
||||
|
||||
public void stop() throws Exception {
|
||||
camelImplementation.stop();
|
||||
}
|
||||
|
||||
public void shutdown() throws Exception {
|
||||
camelImplementation.shutdown();
|
||||
}
|
||||
};
|
||||
camelImplementation.enableHangupSupport();
|
||||
camelImplementation.run();
|
||||
}
|
||||
return routeBuilder;
|
||||
|
||||
}
|
||||
@@ -42,21 +42,101 @@
|
||||
|
||||
List< ? extends INode> processNodes = (List< ? extends INode>)process.getGeneratingNodes();
|
||||
%>
|
||||
return new RouteBuilder() {
|
||||
public void configure() throws java.lang.Exception {
|
||||
|
||||
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() {
|
||||
public void configure() throws Exception {
|
||||
<%
|
||||
for (INode node : processNodes) {
|
||||
if (node.getComponent().getName().equals("cCXF")) {
|
||||
IElementParameter param = node.getElementParameter("LABEL");
|
||||
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 cid = "";
|
||||
if (param != null && !"__UNIQUE_NAME__".equals(param.getValue())) {
|
||||
cid = (String)param.getValue();
|
||||
} else {
|
||||
cid = node.getUniqueName();
|
||||
}
|
||||
String endpointVar = "endpoint_" + node.getUniqueName();
|
||||
String endpointVar = "endpoint" + cid;
|
||||
String uriRef = "uriMap.get(\"" + cid + "\")";
|
||||
%>
|
||||
// CXF endpoint for <%=cid%>
|
||||
@@ -100,7 +180,7 @@
|
||||
}
|
||||
//http://jira.talendforge.org/browse/TESB-3850
|
||||
String formatType = ElementParameterParser.getValue(node, "__DATAFORMAT__");
|
||||
if ("true".equals(useSAM) && !"RAW".equals(formatType)) {
|
||||
if ("true".equals(useSAM) && !"MESSAGE".equals(formatType)) {
|
||||
%>
|
||||
// Add Service Activity Monitor Service to <%=endpointVar%>
|
||||
if (eventFeature != null) {
|
||||
|
||||
@@ -32,19 +32,9 @@ 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(<%=expression%>)
|
||||
.when().<%=connsIf.get(0).getRouteConnectionType()%>(<%=connsIf.get(0).getCondition()%>)
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
.when().<%=expression%>
|
||||
<%
|
||||
}
|
||||
} else if(connsIf.get(0).getLineStyle()==EConnectionType.ROUTE_OTHER) {
|
||||
%>
|
||||
.otherwise()
|
||||
|
||||
@@ -144,14 +144,9 @@ currentComponent="<%=node.getUniqueName() %>";
|
||||
if ((codePart.equals(ECodePart.BEGIN))&&(stat)&&connSet.size()>0) {
|
||||
for(IConnection con:connSet){
|
||||
%>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if(execStat){
|
||||
runStat.updateStatOnConnection("<%=con.getUniqueName() %>"+iterateId,0, 0);
|
||||
}
|
||||
<% }
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
try {
|
||||
context.store(baos, "");
|
||||
} catch (java.lang.Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
%>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -45,12 +45,7 @@ public class CLASS
|
||||
// toReturn += createCallProcess(conn.getTarget(), className, isMultiThread);
|
||||
// }
|
||||
//}
|
||||
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}";
|
||||
toReturn += "\n}finally {\n}";
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
org.talend.core.model.process.IContextParameter
|
||||
org.talend.core.model.metadata.types.JavaTypesManager
|
||||
org.talend.core.model.utils.JavaResourcesHelper
|
||||
java.util.Map
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
"
|
||||
class="Footer"
|
||||
skeleton="footer_java.skeleton"
|
||||
@@ -19,8 +17,7 @@
|
||||
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());
|
||||
@@ -28,195 +25,6 @@
|
||||
boolean stats = codeGenArgument.isStatistics();
|
||||
|
||||
%>
|
||||
|
||||
protected void doStart() throws java.lang.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 java.lang.Exception {
|
||||
super.doStop();
|
||||
getCamelContexts().get(0).stop();
|
||||
}
|
||||
|
||||
protected ProducerTemplate findOrCreateCamelTemplate() {
|
||||
return getCamelContexts().get(0).createProducerTemplate();
|
||||
}
|
||||
|
||||
public void stop() throws java.lang.Exception {
|
||||
super.stop();
|
||||
}
|
||||
|
||||
public void shutdown() throws java.lang.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 (java.lang.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;
|
||||
@@ -240,8 +48,8 @@ for (IContextParameter ctxParam : params) {
|
||||
|
||||
private boolean execStat = true;
|
||||
|
||||
private Properties context_param = new Properties();
|
||||
public Map<String, Object> parentContextMap = new HashMap<String, Object>();
|
||||
private java.util.Properties context_param = new java.util.Properties();
|
||||
public java.util.Map<String, Object> parentContextMap = new java.util.HashMap<String, Object>();
|
||||
|
||||
public static void main(String[] args){
|
||||
final <%=process.getName() %> <%=process.getName() %>Class = new <%=process.getName() %>();
|
||||
@@ -307,27 +115,10 @@ for (IContextParameter ctxParam : params) {
|
||||
<%
|
||||
}
|
||||
%>
|
||||
//read context values
|
||||
readContextValues(contextStr);
|
||||
|
||||
|
||||
try {
|
||||
run();
|
||||
} catch (java.lang.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");
|
||||
java.io.InputStream inContext = <%=process.getName()%>.class.getClassLoader().getResourceAsStream("<%=codeGenArgument.getCurrentProjectName().toLowerCase() %>/<%=jobFolderName %>/contexts/"+contextStr+".properties");
|
||||
|
||||
if (inContext!=null) {
|
||||
//defaultProps is in order to keep the original context value
|
||||
@@ -336,7 +127,7 @@ for (IContextParameter ctxParam : params) {
|
||||
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 " + contextName);
|
||||
System.err.println("Could not find the context " + contextStr);
|
||||
}
|
||||
|
||||
if(!context_param.isEmpty()) {
|
||||
@@ -392,7 +183,7 @@ for (IContextParameter ctxParam : params) {
|
||||
} //end for
|
||||
%>
|
||||
} catch (java.io.IOException ie) {
|
||||
System.err.println("Could not load context "+contextName);
|
||||
System.err.println("Could not load context "+contextStr);
|
||||
ie.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -415,6 +206,15 @@ for (IContextParameter ctxParam : params) {
|
||||
}
|
||||
%>
|
||||
}
|
||||
try {
|
||||
initUriMap();
|
||||
Route(true);
|
||||
} catch (Exception e) {
|
||||
System.err.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void evalParam(String arg) {
|
||||
@@ -453,64 +253,4 @@ for (IContextParameter ctxParam : params) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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() || !process.getNodesOfType("tRouteInput").isEmpty();
|
||||
boolean talendEsbJobFactory = !process.getNodesOfType("tESBProviderRequest").isEmpty() || !process.getNodesOfType("tRouteInput").isEmpty();
|
||||
boolean talendEsbJob = !process.getNodesOfType("tESBProviderRequest").isEmpty() || !process.getNodesOfType("tESBConsumer").isEmpty();
|
||||
boolean talendEsbJobFactory = !process.getNodesOfType("tESBProviderRequest").isEmpty();
|
||||
|
||||
if (talendMdmJob) {
|
||||
talendJobInterfaces += ", TalendMDMJob"; // Talend MDM job
|
||||
@@ -116,19 +116,7 @@ public class <%=process.getName()%> implements <%=talendJobInterfaces%> {
|
||||
|
||||
<% if (talendEsbJobFactory) { %>
|
||||
public TalendESBJob newTalendESBJob() {
|
||||
<%=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;
|
||||
return new <%=process.getName()%>();
|
||||
}
|
||||
<% } %>
|
||||
|
||||
@@ -259,17 +247,6 @@ 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")) {
|
||||
%>
|
||||
@@ -307,36 +284,28 @@ public String getExceptionStackTrace() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private java.lang.Exception exception = null;
|
||||
private Exception exception = null;
|
||||
|
||||
public java.lang.Exception getException() {
|
||||
public Exception getException() {
|
||||
if ("failure".equals(this.getStatus())) {
|
||||
return this.exception;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private class TalendException extends java.lang.Exception {
|
||||
private class TalendException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private java.util.Map<String, Object> globalMap = null;
|
||||
private java.lang.Exception e = null;
|
||||
private Exception e = null;
|
||||
private String currentComponent = null;
|
||||
|
||||
private TalendException(java.lang.Exception e, String errorComponent, final java.util.Map<String, Object> globalMap) {
|
||||
private TalendException(Exception e, String errorComponent, final java.util.Map<String, Object> globalMap) {
|
||||
this.currentComponent= errorComponent;
|
||||
this.globalMap = globalMap;
|
||||
this.e = e;
|
||||
}
|
||||
|
||||
public java.lang.Exception getException() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public String getCurrentComponent() {
|
||||
return this.currentComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printStackTrace() {
|
||||
@@ -477,7 +446,7 @@ private class TalendException extends java.lang.Exception {
|
||||
for (INode node : processNodes) {
|
||||
if (node.isActivate()) {
|
||||
%>
|
||||
public void <%=node.getUniqueName() %>_error(java.lang.Exception exception, String errorComponent, final java.util.Map<String, Object> globalMap) throws TalendException {
|
||||
public void <%=node.getUniqueName() %>_error(Exception exception, String errorComponent, final java.util.Map<String, Object> globalMap) throws TalendException {
|
||||
end_Hash.put("<%=node.getUniqueName() %>", System.currentTimeMillis());
|
||||
<%
|
||||
boolean ifBeforRunError = NodeUtil.checkComponentErrorConnectionAfterNode(node);
|
||||
@@ -540,7 +509,7 @@ private class TalendException extends java.lang.Exception {
|
||||
}
|
||||
%>
|
||||
|
||||
} catch (java.lang.Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
<%
|
||||
@@ -583,27 +552,9 @@ private class TalendException extends java.lang.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%>
|
||||
<%=subjob_start_node.getDesignSubjobStartNode().getUniqueName() %>_onSubJobError(exception, errorComponent, globalMap);
|
||||
<%=node.getDesignSubjobStartNode().getUniqueName() %>_onSubJobError(exception, errorComponent, globalMap);
|
||||
|
||||
}
|
||||
<%
|
||||
}
|
||||
@@ -611,7 +562,7 @@ private class TalendException extends java.lang.Exception {
|
||||
for (INode node : processNodes) {
|
||||
if (node.isDesignSubjobStartNode()) {
|
||||
%>
|
||||
public void <%=node.getUniqueName() %>_onSubJobError(java.lang.Exception exception, String errorComponent, final java.util.Map<String, Object> globalMap) throws TalendException {
|
||||
public void <%=node.getUniqueName() %>_onSubJobError(Exception exception, String errorComponent, final java.util.Map<String, Object> globalMap) throws TalendException {
|
||||
<%
|
||||
List< ? extends IConnection> conns = node.getOutgoingConnections();
|
||||
int count = 0;
|
||||
@@ -661,7 +612,7 @@ resumeUtil.addLog("SYSTEM_LOG", "NODE:"+ errorComponent, "", Thread.currentThrea
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} catch (java.lang.Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
<%
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
org.talend.designer.codegen.ITalendSynchronizer
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
org.talend.designer.runprocess.CodeGeneratorRoutine
|
||||
org.talend.core.model.process.EParameterFieldType
|
||||
"
|
||||
class="Header"
|
||||
%>
|
||||
@@ -56,77 +55,44 @@ if (service instanceof AbstractBrandingService) {
|
||||
package <%= packageName %>;
|
||||
|
||||
<%
|
||||
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){
|
||||
for (String routine : CodeGeneratorRoutine.getRequiredRoutineName(process)) {
|
||||
if (!routine.equals(ITalendSynchronizer.TEMPLATE)) {
|
||||
%>
|
||||
<%=s%> ;
|
||||
import routines.<%=routine%>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
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__") %>
|
||||
|
||||
|
||||
<%
|
||||
List<INode> nodesWithImport = process.getNodesWithImport();
|
||||
if (nodesWithImport != null) {
|
||||
for (INode node:nodesWithImport) {
|
||||
%>
|
||||
//the import part of <%=node.getUniqueName() %>
|
||||
<%=ElementParameterParser.getValue(node, "__IMPORT__") %>
|
||||
|
||||
<% }
|
||||
}
|
||||
%>
|
||||
|
||||
/**
|
||||
@@ -136,9 +102,25 @@ package <%= packageName %>;
|
||||
* @version <%=version %>
|
||||
* @status <%=ElementParameterParser.getValue(process, "__STATUS__") %>
|
||||
*/
|
||||
public class <%=process.getName()%> extends MainSupport implements TalendESBRoute {
|
||||
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 <%=process.getName()%>(){
|
||||
initUriMap();
|
||||
}
|
||||
|
||||
public void stop() throws Exception {
|
||||
if (stopDelegate != null) stopDelegate.stop();
|
||||
}
|
||||
|
||||
public void shutdown() throws Exception {
|
||||
if (stopDelegate != null) stopDelegate.shutdown();
|
||||
}
|
||||
|
||||
<%
|
||||
@@ -157,9 +139,7 @@ package <%= packageName %>;
|
||||
|
||||
<%
|
||||
for (INode node : graphicalNodes) {
|
||||
if("cCXF".equals(node.getComponent().getName())
|
||||
&& "true".equals(ElementParameterParser.getValue(node, "__ENABLE_SAM__"))
|
||||
&& !"RAW".equals(ElementParameterParser.getValue(node, "__DATAFORMAT__"))) { %>
|
||||
if("cCXF".equals(node.getComponent().getName())) { %>
|
||||
//ESB Service Activity Monitor Feature
|
||||
private org.apache.cxf.feature.AbstractFeature eventFeature;
|
||||
|
||||
@@ -171,158 +151,40 @@ package <%= packageName %>;
|
||||
}
|
||||
%>
|
||||
|
||||
private Map<String, String> uriMap;
|
||||
private org.apache.camel.builder.RouteBuilder routeBuilder;
|
||||
|
||||
public Map<String,String> getUriMap() {
|
||||
private java.util.Map<String, String> uriMap;
|
||||
|
||||
public java.util.Map<String,String> getUriMap() {
|
||||
return this.uriMap;
|
||||
}
|
||||
|
||||
public void loadCustomUriMap(Map<String,String> newMap) {
|
||||
public void loadCustomUriMap(java.util.Map<String,String> newMap) {
|
||||
if(newMap == null) {
|
||||
return;
|
||||
}
|
||||
for(Map.Entry<String, String> entry: newMap.entrySet()) {
|
||||
for(java.util.Map.Entry<String, String> entry: newMap.entrySet()) {
|
||||
uriMap.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* the readContextValues(contextName) may have to invoked first before this
|
||||
*/
|
||||
public void initUriMap() {
|
||||
uriMap = new HashMap<String, String>();
|
||||
protected void initUriMap() {
|
||||
uriMap = new java.util.HashMap<String, String>();
|
||||
<%
|
||||
String cid = "";
|
||||
String componentName = "";
|
||||
String uri = "";
|
||||
for (INode node : graphicalNodes) {
|
||||
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;
|
||||
if (param != null && !"__UNIQUE_NAME__".equals(param.getValue())) {
|
||||
cid = (String) param.getValue();
|
||||
} else {
|
||||
cid = node.getUniqueName();
|
||||
}
|
||||
|
||||
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__");
|
||||
@@ -334,7 +196,7 @@ for (INode node : graphicalNodes) {
|
||||
|
||||
StringBuffer arguments = new StringBuffer();
|
||||
|
||||
uri = "\"file://\"+" + filePath;
|
||||
uri = "\"file:///\"+" + filePath;
|
||||
|
||||
if ("true".equals(noop)) {
|
||||
arguments.append("\"noop=true\"+");
|
||||
@@ -396,17 +258,7 @@ for (INode node : graphicalNodes) {
|
||||
sb.append("\"cxf://\"+").append(url).append("+\"?" + serviceType + "=\"");
|
||||
|
||||
if ("wsdlURL".equals(serviceType)) {
|
||||
|
||||
//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 + "\"";
|
||||
}
|
||||
String filePath = ElementParameterParser.getValue(node, "__WSDL_FILE__");
|
||||
filePath.replaceAll("\\\\","/");
|
||||
sb.append("+").append(filePath);
|
||||
} else {
|
||||
@@ -477,11 +329,10 @@ for (INode node : graphicalNodes) {
|
||||
|
||||
} else if("cJMS".equals(componentName)) {
|
||||
//http://jira.talendforge.org/browse/TESB-4861
|
||||
String name = ElementParameterParser.getValue(node, "__ROUTE_COMPONENT_TYPE_ID__");
|
||||
String name = ElementParameterParser.getValue(node, "__CONNECTION_FACOTRY__");
|
||||
if (name == null || name.equals("")) {
|
||||
name = "jms";
|
||||
}
|
||||
name = name.replace("_", "");
|
||||
name = "\"" + name + "\"";
|
||||
//String name = ElementParameterParser.getValue(node, "__NAME__").trim();
|
||||
//Remove unnecessary subfix
|
||||
@@ -675,10 +526,10 @@ for (INode node : graphicalNodes) {
|
||||
String resourceUri = ElementParameterParser.getValue(node, "__URI__");
|
||||
sb.append(resourceUri);
|
||||
|
||||
boolean hasParam = resourceUri==null?false:resourceUri.contains("?");
|
||||
boolean hasParam = false;
|
||||
|
||||
String method = ElementParameterParser.getValue(node, "__METHOD__");
|
||||
if("GET".equals(method)||"HEAD".equals(method) || "DELETE".equals(method)){
|
||||
if("GET".equals(method)||"HEAD".equals(method)){
|
||||
List<Map<String, String>> parameters = (List<Map<String, String>>) ElementParameterParser.getObjectValue(node, "__PARAMETERS__");
|
||||
String encodeCharset = ElementParameterParser.getValue(node, "__ENCODER_CHARSET__");
|
||||
|
||||
@@ -720,3 +571,93 @@ 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 %>
|
||||
|
||||
@@ -58,7 +58,7 @@ if(execStat){
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} catch (java.lang.Exception e) {
|
||||
} catch (Exception e) {
|
||||
this.status = "failure";
|
||||
Integer localErrorCode = (Integer) (((java.util.Map) threadLocal.get()).get("errorCode"));
|
||||
if (localErrorCode != null) {
|
||||
|
||||
@@ -53,7 +53,6 @@ for (IConnection iterateConn : iterateConnSet) { //1
|
||||
|
||||
%>
|
||||
NB_ITERATE_<%=iterateNodeName %>++;
|
||||
iterateLoop++;
|
||||
<%
|
||||
|
||||
parallelIterate = "true".equals(ElementParameterParser.getValue(iterateConn, "__ENABLE_PARALLEL__"));
|
||||
@@ -93,7 +92,6 @@ 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();
|
||||
@@ -157,7 +155,6 @@ for (IConnection iterateConn : iterateConnSet) { //1
|
||||
<%}%>
|
||||
}
|
||||
iterateId = "." + threadID;
|
||||
iterateLoop++;
|
||||
<%if(isRunJob) {%>
|
||||
//bug21906 copy context to local for mutilthread
|
||||
context.synchronizeContext();
|
||||
@@ -203,7 +200,7 @@ if(execStat){
|
||||
for (IConnection inLineConn : allInLineJobConns) {
|
||||
%>
|
||||
if(execStat){
|
||||
runStat.updateStatOnConnection("<%=inLineConn.getUniqueName() %>", 3, 0);
|
||||
runStat.updateStatOnConnection("<%=inLineConn.getUniqueName() %>", 3, "exec" + NB_ITERATE_<%=iterateNodeName %>);
|
||||
}
|
||||
<%
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
if(isParallelize){
|
||||
%>
|
||||
|
||||
} catch (java.lang.Exception e) {
|
||||
} catch (Exception e) {
|
||||
this.status = "failure";
|
||||
Integer localErrorCode = (Integer) (((java.util.Map) threadLocal.get()).get("errorCode"));
|
||||
if (localErrorCode != null) {
|
||||
@@ -84,7 +84,7 @@
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
} catch (java.lang.Exception te) {
|
||||
} catch (Exception te) {
|
||||
throw new TalendException(te, currentComponent, globalMap);
|
||||
}
|
||||
<%
|
||||
@@ -204,7 +204,7 @@
|
||||
%>
|
||||
|
||||
|
||||
} catch(java.lang.Exception e) {
|
||||
} catch(Exception e) {
|
||||
|
||||
throw new TalendException(e, currentComponent, globalMap);
|
||||
|
||||
|
||||
@@ -134,12 +134,8 @@ public static class <%=conn.getName() %>Struct<%=templateOrigin %> implements ro
|
||||
if (metadata !=null) {
|
||||
for (IMetadataColumn column: metadata.getListColumns()) {
|
||||
JavaType javaType = JavaTypesManager.getJavaTypeFromId(column.getTalendType());
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getTalendType(), column.isNullable());
|
||||
if("id_Document".equals(javaType.getId())) {
|
||||
typeToGenerate = javaType.getNullableClass().getCanonicalName();
|
||||
}
|
||||
%>
|
||||
public <%= typeToGenerate %> <%=column.getLabel() %><%
|
||||
public <%= JavaTypesManager.getTypeToGenerate(column.getTalendType(), column.isNullable()) %> <%=column.getLabel() %><%
|
||||
|
||||
if(javaType == JavaTypesManager.CHARACTER && !column.isNullable()) {
|
||||
%> = ' '<%
|
||||
@@ -147,11 +143,11 @@ public static class <%=conn.getName() %>Struct<%=templateOrigin %> implements ro
|
||||
|
||||
%>;
|
||||
|
||||
public <%= typeToGenerate %> get<%=column.getLabel().substring(0, 1).toUpperCase()%><%=column.getLabel().substring(1)%> () {
|
||||
public <%= JavaTypesManager.getTypeToGenerate(column.getTalendType(), column.isNullable()) %> get<%=column.getLabel().substring(0, 1).toUpperCase()%><%=column.getLabel().substring(1)%> () {
|
||||
return this.<%=column.getLabel()%>;
|
||||
}
|
||||
<%
|
||||
if((conn.getLineStyle() == EConnectionType.FLOW_REF) && conn.getTarget().getUniqueName().startsWith("tXMLMap") && "id_Document".equals(javaType.getId())) {
|
||||
if("id_Document".equals(javaType.getId())) {
|
||||
%>
|
||||
public java.util.Map<String,Object> documentLookupResult = new java.util.HashMap<String,Object>();
|
||||
<%
|
||||
@@ -564,9 +560,6 @@ public static class <%=conn.getName() %>Struct<%=templateOrigin %> implements ro
|
||||
<%
|
||||
} else if(javaType.isObjectBased() || typeToGenerate.equals("Geometry") || typeToGenerate.equals("Dynamic")) {
|
||||
hasAtLeastOneObjectType = true;
|
||||
if("id_Document".equals(javaType.getId())) {
|
||||
typeToGenerate = javaType.getNullableClass().getCanonicalName();
|
||||
}
|
||||
%>
|
||||
this.<%=column.getLabel() %> = (<%= typeToGenerate %>) dis.readObject();
|
||||
<%
|
||||
@@ -740,9 +733,6 @@ public static class <%=conn.getName() %>Struct<%=templateOrigin %> implements ro
|
||||
<%
|
||||
} else if(typeToGenerate.equals("Object") || typeToGenerate.equals("Geometry") || typeToGenerate.equals("BigDecimal") || typeToGenerate.equals("List") || typeToGenerate.equals("Dynamic") || typeToGenerate.equals("Document")) {
|
||||
hasAtLeastOneObjectType = true;
|
||||
if("id_Document".equals(javaType.getId())) {
|
||||
typeToGenerate = javaType.getNullableClass().getCanonicalName();
|
||||
}
|
||||
%>
|
||||
this.<%=column.getLabel() %> = (<%= typeToGenerate %>) ois.readObject();
|
||||
<%
|
||||
@@ -993,7 +983,6 @@ 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();
|
||||
@@ -1010,12 +999,11 @@ public void <%=subTree.getName() %>Process(final java.util.Map<String, Object> g
|
||||
%>
|
||||
|
||||
String iterateId = "";
|
||||
int iterateLoop = 0;
|
||||
String currentComponent = "";
|
||||
|
||||
try {
|
||||
|
||||
String currentMethodName = new java.lang.Exception().getStackTrace()[0].getMethodName();
|
||||
String currentMethodName = new Exception().getStackTrace()[0].getMethodName();
|
||||
boolean resumeIt = currentMethodName.equals(resumeEntryMethodName);
|
||||
if( resumeEntryMethodName == null || resumeIt || globalResumeTicket){//start the resume
|
||||
globalResumeTicket = true;
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
boolean stat = codeGenArgument.isStatistics();
|
||||
%>
|
||||
|
||||
/**
|
||||
* please initial uri map first before using the returned RouteBuilder
|
||||
* @return RouteBuilder
|
||||
*/
|
||||
public RouteBuilder route() {
|
||||
public org.apache.camel.builder.RouteBuilder Route(final boolean start) throws Exception {
|
||||
|
||||
String iterateId = "";
|
||||
String currentComponent = "";
|
||||
|
||||
|
||||
@@ -669,14 +669,8 @@ 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();
|
||||
|
||||
@@ -69,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.TalendCacheUtils;
|
||||
import org.talend.core.utils.BrandingChecker;
|
||||
import org.talend.designer.codegen.CodeGeneratorActivator;
|
||||
import org.talend.designer.codegen.i18n.Messages;
|
||||
import org.talend.designer.core.ITisLocalProviderService;
|
||||
@@ -145,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", "tELTMysqlMap" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
"tJava", "tLibraryLoad", "tFileInputFullRow", "tSocketOutput", "tFilterRow" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
|
||||
public ComponentsFactory() {
|
||||
if (!INCLUDEFILEINJET_SUFFIX.equals(".inc.javajet")) { //$NON-NLS-1$
|
||||
@@ -159,7 +159,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
Project currentProject = ProjectManager.getInstance().getCurrentProject();
|
||||
if (currentProject != null && currentProject.getEmfProject() != null) {
|
||||
|
||||
List<ComponentSetting> components = currentProject.getEmfProject().getComponentsSettings();
|
||||
List<ComponentSetting> components = (List<ComponentSetting>) currentProject.getEmfProject().getComponentsSettings();
|
||||
return components;
|
||||
}
|
||||
return Collections.emptyList();
|
||||
@@ -231,7 +231,8 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
ProjectManager manager = ProjectManager.getInstance();
|
||||
List<Project> referencedProjects = manager.getReferencedProjects();
|
||||
for (Project curProject : referencedProjects) {
|
||||
List<ComponentSetting> componentsSettings = curProject.getEmfProject().getComponentsSettings();
|
||||
List<ComponentSetting> componentsSettings = (List<ComponentSetting>) curProject.getEmfProject()
|
||||
.getComponentsSettings();
|
||||
for (ComponentSetting setting : componentsSettings) {
|
||||
if (setting.isHidden() && setting.getName().equals(settingInMain.getName())
|
||||
&& setting.getFamily().equals(settingInMain.getFamily())) {
|
||||
@@ -261,7 +262,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 = TalendCacheUtils.cleanComponentCache();
|
||||
boolean isNeedClean = cleanComponentCache();
|
||||
isCreated = hasComponentFile(installLocation) && !isNeedClean;
|
||||
if (isReset) {
|
||||
isCreated = false;
|
||||
@@ -347,7 +348,6 @@ 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)
|
||||
@@ -482,6 +482,11 @@ 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,7 +517,6 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUserComponentsFromComponentsProviderExtension() {
|
||||
ComponentsProviderManager.getInstance().getProviders();
|
||||
ComponentsProviderManager componentsProviderManager = ComponentsProviderManager.getInstance();
|
||||
@@ -583,7 +587,6 @@ 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)
|
||||
@@ -604,7 +607,6 @@ 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) != '.'
|
||||
@@ -911,7 +913,6 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
component.setImageRegistry(componentsImageRegistry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
if (componentList == null) {
|
||||
init(false);
|
||||
@@ -919,7 +920,6 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
return componentList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IComponent get(String name) {
|
||||
if (componentList == null) {
|
||||
init(false);
|
||||
@@ -933,7 +933,6 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeComponents(IProgressMonitor monitor) {
|
||||
this.monitor = monitor;
|
||||
if (componentList == null) {
|
||||
@@ -943,7 +942,6 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
this.subMonitor = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeComponents(IProgressMonitor monitor, boolean duringLogon) {
|
||||
this.monitor = monitor;
|
||||
if (componentList == null) {
|
||||
@@ -958,7 +956,6 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
*
|
||||
* @see org.talend.core.model.components.IComponentsFactory#getComponents()
|
||||
*/
|
||||
@Override
|
||||
public Set<IComponent> getComponents() {
|
||||
if (componentList == null) {
|
||||
init(false);
|
||||
@@ -966,7 +963,6 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
return componentList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IComponent> getCustomComponents() {
|
||||
if (customComponentList == null) {
|
||||
init(false);
|
||||
@@ -979,7 +975,6 @@ 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(
|
||||
@@ -997,7 +992,6 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
*
|
||||
* @see org.talend.core.model.components.IComponentsFactory#getSkeletons()
|
||||
*/
|
||||
@Override
|
||||
public List<String> getSkeletons() {
|
||||
if (skeletonList == null) {
|
||||
init(false);
|
||||
@@ -1005,7 +999,6 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
return skeletonList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
componentsImageRegistry.clear();
|
||||
componentList = null;
|
||||
@@ -1015,7 +1008,6 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetCache() {
|
||||
componentsImageRegistry.clear();
|
||||
componentList = null;
|
||||
@@ -1034,7 +1026,6 @@ 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);
|
||||
|
||||
@@ -1065,7 +1056,6 @@ 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) {
|
||||
@@ -1090,7 +1080,6 @@ 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);
|
||||
@@ -1149,17 +1138,14 @@ 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;
|
||||
}
|
||||
@@ -1211,12 +1197,10 @@ 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>();
|
||||
|
||||
@@ -1233,7 +1217,6 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ImageDescriptor> getComponentsImageRegistry() {
|
||||
return componentsImageRegistry;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@ import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
@@ -50,7 +48,6 @@ public class UserComponentsProvider extends AbstractComponentsProvider {
|
||||
public UserComponentsProvider() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected File getExternalComponentsLocation() {
|
||||
IPreferenceStore prefStore = CodeGeneratorActivator.getDefault().getPreferenceStore();
|
||||
String path = prefStore.getString(IComponentPreferenceConstant.USER_COMPONENTS_FOLDER);
|
||||
@@ -78,7 +75,6 @@ public class UserComponentsProvider extends AbstractComponentsProvider {
|
||||
return path.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preComponentsLoad() throws IOException {
|
||||
File installationFolder = getInstallationFolder();
|
||||
if (installationFolder.exists()) {
|
||||
@@ -87,9 +83,8 @@ public class UserComponentsProvider extends AbstractComponentsProvider {
|
||||
FilesUtils.createFoldersIfNotExists(installationFolder.getAbsolutePath(), false);
|
||||
FileFilter ff = new FileFilter() {
|
||||
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
if (FilesUtils.isSVNFolder(pathname)) {
|
||||
if (pathname.getName().equals(".svn")) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -99,11 +94,9 @@ public class UserComponentsProvider extends AbstractComponentsProvider {
|
||||
|
||||
// synchroniz shared custom component
|
||||
if (PluginChecker.isSVNProviderPluginLoaded()) {
|
||||
Set<Project> allProjects = new HashSet<Project>();
|
||||
allProjects.add(ProjectManager.getInstance().getCurrentProject());
|
||||
allProjects.addAll(ProjectManager.getInstance().getReferencedProjects());
|
||||
for (Project project : allProjects) {
|
||||
String projectLabel = project.getTechnicalLabel();
|
||||
Project currentProject = ProjectManager.getInstance().getCurrentProject();
|
||||
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);
|
||||
|
||||
@@ -80,14 +80,20 @@ public class XsdValidationCacheManager {
|
||||
|
||||
public boolean needCheck(java.io.File file, long currentCRC) {
|
||||
String path = file.getAbsolutePath();
|
||||
Long lastCheckedCRC = alreadyCheckedXsd.get(path);
|
||||
if (forceXSDAlreadyChecked) {
|
||||
alreadyCheckedXsd.put(path, currentCRC);
|
||||
return false;
|
||||
} else {
|
||||
Long lastCheckedCRC = alreadyCheckedXsd.get(path);
|
||||
|
||||
if (lastCheckedCRC == null) {
|
||||
return true;
|
||||
if (lastCheckedCRC == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean isChanged = currentCRC != lastCheckedCRC;
|
||||
|
||||
return isChanged;
|
||||
}
|
||||
|
||||
boolean isChanged = currentCRC != lastCheckedCRC;
|
||||
return isChanged;
|
||||
}
|
||||
|
||||
public void setChecked(File file, long currentCRC) {
|
||||
|
||||
@@ -14,7 +14,6 @@ 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;
|
||||
@@ -28,6 +27,7 @@ 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;
|
||||
@@ -52,10 +52,12 @@ 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;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.core.model.components.ComponentCompilations;
|
||||
import org.talend.designer.codegen.i18n.Messages;
|
||||
|
||||
/**
|
||||
@@ -298,107 +300,93 @@ 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$
|
||||
IFolder sourceContainer = project.getFolder("src");
|
||||
|
||||
IContainer sourceContainer = (IContainer) sourcePackageFragmentRoot.getCorrespondingResource();
|
||||
while (stringTokenizer.hasMoreElements()) {
|
||||
String folderName = stringTokenizer.nextToken();
|
||||
sourceContainer = sourceContainer.getFolder(new Path(folderName));
|
||||
if (!sourceContainer.exists()) {
|
||||
try {
|
||||
sourceContainer.create(true, true, new SubProgressMonitor(subProgressMonitor, 1));
|
||||
((IFolder) 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 {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
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();
|
||||
|
||||
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;
|
||||
}
|
||||
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETUpdating_message", //$NON-NLS-1$
|
||||
new Object[] { targetFile.getFullPath() }));
|
||||
targetFile.setContents(contents, true, true, new SubProgressMonitor(subProgressMonitor, 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() }));
|
||||
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETBuilding_message", //$NON-NLS-1$
|
||||
new Object[] { project.getName() }));
|
||||
|
||||
if (!ComponentCompilations.getMarkers()) {
|
||||
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) }))));
|
||||
}
|
||||
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$
|
||||
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;
|
||||
}
|
||||
// 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);
|
||||
|
||||
@@ -620,16 +620,11 @@ public final class CodeGeneratorEmittersPoolFactory {
|
||||
} catch (Error e) {
|
||||
throw new ClassNotFoundException(e.getMessage(), e);
|
||||
}
|
||||
// TDI-23079
|
||||
try {
|
||||
Method[] methods = theClass.getDeclaredMethods();
|
||||
for (int i = 0; i < methods.length; ++i) {
|
||||
if (methods[i].getName().equals(methodName)) {
|
||||
return methods[i];
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
RefreshComponenentsAction.Label=Componentenlijst verversen
|
||||
@@ -1,2 +0,0 @@
|
||||
DownloadComponenentsAction.Label=\u4E0B\u8F7D\u9009\u62E9\u7684\u7EC4\u4EF6
|
||||
RefreshComponenentsAction.Label=\u5237\u65B0\u7EC4\u4EF6\u6E05\u5355
|
||||
@@ -1,7 +1,6 @@
|
||||
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
|
||||
@@ -10,7 +9,6 @@ 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
|
||||
@@ -21,7 +19,6 @@ 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
|
||||
|
||||
@@ -1,13 +1 @@
|
||||
AvailableExtensionsComposite.Version=Versie
|
||||
DownloadedExtensionsComposite.updateOperateStatus=Update
|
||||
MyExtensionsComposite.Version=Versie
|
||||
MyExtensionsComposite.UpdateOperateStatus=Update
|
||||
MyExtensionsComposite.ModifyOperateStatus=Wijzigen
|
||||
MyExtensionsComposite.DeleteOperateStatus=Verwijderen
|
||||
MyExtensionsComposite.Form.Compatibility.Version=Versie
|
||||
MyExtensionsComposite.Form.Upload.Browse=Blader...
|
||||
RefreshJob.FindExtensions.Title=Beschikbare extensies zoeken
|
||||
RefreshJob.FindExtensions.Message=Extensies zoeken op Exchange...
|
||||
UploadRevisionJob.Title=Upload Revisie...
|
||||
UploadRevisionJob.Message=Upload Revisie...
|
||||
UploadRevisionAction.InstalledFailure=Upload Revisie gefaald.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
DownloadedExtensionsComposite.updateOperateStatus=UPDATE
|
||||
MyExtensionsComposite.UpdateOperateStatus=UPDATE
|
||||
MyExtensionsComposite.DeleteOperateStatus=DELETE
|
||||
ImportExchangeDialog.TEMPLATES_BUTTON=SQL \u0161abloni
|
||||
ImportExchangeDialog.REFRESH_BUTTON=Osve\u017Eavanje
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
AvailableExtensionsComposite.ExtensionName=\u6269\u5C55\u540D
|
||||
AvailableExtensionsComposite.Version=\u7248\u672C
|
||||
AvailableExtensionsComposite.Author=\u4F5C\u8005
|
||||
AvailableExtensionsComposite.FilterTitle=\u8FC7\u6EE4
|
||||
DownloadedExtensionsComposite.ExtensionName=\u6269\u5C55\u540D
|
||||
DownloadedExtensionsComposite.installedOperateStatus=\u5DF2\u88C5\u8F7D
|
||||
DownloadedExtensionsComposite.updateOperateStatus=\u66F4\u65B0
|
||||
MyExtensionsComposite.ExtensionName=\u6269\u5C55\u540D
|
||||
MyExtensionsComposite.Version=\u7248\u672C
|
||||
MyExtensionsComposite.UpdateOperateStatus=\u66F4\u65B0
|
||||
MyExtensionsComposite.DeleteOperateStatus=\u5220\u9664
|
||||
MyExtensionsComposite.Form.Compatibility.Version=\u7248\u672C
|
||||
MyExtensionsComposite.Form.Description=\u5FC5\u8981\u7684
|
||||
MyExtensionsComposite.Form.Upload.Browse=\u6D4F\u89C8...
|
||||
DownloadComponenentsAction.DownloadTaskName=\u4ECEURL\u4E0B\u8F7D\u6587\u4EF6
|
||||
ImportExchangeDialog.dialogTitle=\u4ECETalend Exchange\u9009\u62E9\u4E00\u4E2A\u9879\u76EE
|
||||
ImportExchangeDialog.WARNING=\u8B66\u544A
|
||||
ImportExchangeDialog.EXTENSION_NAME=\u6269\u5C55\u540D
|
||||
ImportExchangeDialog.LATEST_REVISION=\u6700\u65B0\u7248\u672C
|
||||
ImportExchangeDialog.JOB_BUTTON=\u4F5C\u4E1A\u8BBE\u8BA1
|
||||
ImportExchangeDialog.DOWNLOAD_JOB=\u4E0B\u8F7D\u4F5C\u4E1A\u8BBE\u8BA1
|
||||
ImportExchangeDialog.ROUTINES_BUTTON=\u5E38\u89C4
|
||||
ImportExchangeDialog.TEMPLATES_PROGRESSBAR=\u4E0B\u8F7DSQL\u6A21\u677F......
|
||||
ImportExchangeDialog.REFRESH_BUTTON=\u5237\u65B0
|
||||
ImportExchangeDialog.OPERATION_CANCELLED=\u64CD\u4F5C\u5DF2\u53D6\u6D88
|
||||
@@ -75,16 +75,14 @@ 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 (FilesUtils.isSVNFolder(pathname)) {
|
||||
if (pathname.getName().equals(".svn")) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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,8 +42,6 @@ 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;
|
||||
@@ -53,7 +51,9 @@ 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;
|
||||
@@ -288,7 +288,7 @@ public class DownloadComponenentsAction extends Action implements IIntroAction {
|
||||
URL url = new URL(downloadUrl);
|
||||
|
||||
monitor.setTaskName(ExchangeConstants.getDownloadTaskNameLable() + url.toString());
|
||||
DownloadHelper downloader = new DownloadHelper();
|
||||
ComponentDownloader downloader = new ComponentDownloader();
|
||||
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(DownloadHelper downloader, int bytesRead) {
|
||||
public void downloadProgress(ComponentDownloader 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 DownloadHelper().download(url, tempFile);
|
||||
new ComponentDownloader().download(url, tempFile);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ public class DownloadExtensionProvider implements IIntroXHTMLContentProvider {
|
||||
String url = "http://org.eclipse.ui.intro/runAction?pluginId=org.talend.designer.components.exchange&"
|
||||
+ "class=org.talend.designer.components.exchange.ui.actions.UpdateAction&"
|
||||
+ "id=org.talend.designer.components.exchange.ui.actions.UpdateAction&"
|
||||
+ AvailableCompositeProvider.NUMBER + "=" + count;
|
||||
+ AvailableCompositeProvider.NUMBER + count;
|
||||
;
|
||||
hyperlink.setAttribute("href", url);
|
||||
Text view = dom.createTextNode(Messages
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,57 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
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,10 +27,8 @@ 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");
|
||||
@@ -149,15 +147,6 @@ 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 >}}
|
||||
*
|
||||
@@ -185,15 +174,6 @@ 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,27 +68,4 @@ 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,7 +1,6 @@
|
||||
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;
|
||||
@@ -12,6 +11,12 @@ 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;
|
||||
@@ -137,7 +142,6 @@ 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;
|
||||
@@ -154,8 +158,9 @@ public class ComplexSAXLooper implements ISAXLooper {
|
||||
hd = newHandler2();
|
||||
}
|
||||
saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", hd);
|
||||
reader = new UnicodeReader(new java.io.FileInputStream(fileURL),this.charset);
|
||||
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader);
|
||||
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(
|
||||
new UnicodeReader(new java.io.FileInputStream(fileURL),this.charset));
|
||||
// inSource.setEncoding(this.charset);
|
||||
saxParser.parse(inSource, hd);
|
||||
|
||||
} catch (ParserConfigurationException e) {
|
||||
@@ -164,14 +169,6 @@ public class ComplexSAXLooper implements ISAXLooper {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(reader!=null) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +179,6 @@ 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();
|
||||
@@ -193,9 +189,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.
|
||||
reader = new UnicodeReader(is,this.charset);
|
||||
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader);
|
||||
saxParser.parse(inSource, hd);
|
||||
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(new UnicodeReader(is,this.charset));
|
||||
// inSource.setEncoding(this.charset);
|
||||
saxParser.parse(is, hd);
|
||||
|
||||
} catch (ParserConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
@@ -203,14 +199,6 @@ 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,7 +12,6 @@
|
||||
// ============================================================================
|
||||
package org.talend.xml.sax.simpleparser;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
@@ -114,7 +113,6 @@ public class SimpleSAXLooper implements ISAXLooper,Callable {
|
||||
}
|
||||
|
||||
public Object call() throws Exception {
|
||||
Reader reader = null;
|
||||
try {
|
||||
DefaultHandler hd = new SimpleSAXLoopHandler(nodes, bcache);
|
||||
SAXParser saxParser = null;
|
||||
@@ -128,22 +126,17 @@ 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.
|
||||
reader = new UnicodeReader(new java.io.FileInputStream(fileURL),this.charset);
|
||||
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader);
|
||||
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(
|
||||
new UnicodeReader(new java.io.FileInputStream(fileURL),this.charset));
|
||||
// inSource.setEncoding(this.charset);
|
||||
saxParser.parse(inSource, hd);
|
||||
} else {
|
||||
reader = new UnicodeReader(is,this.charset);
|
||||
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader);
|
||||
saxParser.parse(inSource, hd);
|
||||
org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(new UnicodeReader(is,this.charset));
|
||||
// inSource.setEncoding(this.charset);
|
||||
saxParser.parse(is, hd);
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
if(reader!=null) {
|
||||
reader.close();
|
||||
}
|
||||
} finally {
|
||||
bcache.notifyErrorOccurred();
|
||||
}
|
||||
bcache.notifyErrorOccurred();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,7 @@ public class FileCopy {
|
||||
|
||||
public static void copyFile(String srcFileName, String desFileName, boolean delSrc) throws Exception {
|
||||
|
||||
FileInputStream srcInputStream = null;
|
||||
try{
|
||||
srcInputStream = new FileInputStream(srcFileName);
|
||||
FileInputStream srcInputStream = new FileInputStream(srcFileName);
|
||||
long lastModified = new File(srcFileName).lastModified();
|
||||
int available = srcInputStream.available();
|
||||
if (available > L_SIZE) {// X > 100M
|
||||
@@ -49,11 +47,6 @@ 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)
|
||||
@@ -100,13 +93,8 @@ public class FileCopy {
|
||||
try {
|
||||
in = srcInputStream.getChannel();
|
||||
out = new FileOutputStream(dest).getChannel();
|
||||
|
||||
int maxCount = (32 * 1024 * 1024) - (28 * 1024);
|
||||
long size = in.size();
|
||||
long position = 0;
|
||||
while (position < size) {
|
||||
position += in.transferTo(position, maxCount, out);
|
||||
}
|
||||
|
||||
in.transferTo(0, in.size(), out);
|
||||
|
||||
in.close();
|
||||
out.close();
|
||||
|
||||
@@ -1,55 +1,32 @@
|
||||
package org.talend.mdm.bulkload.client;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
public class BulkloadClient {
|
||||
|
||||
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) {
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
@@ -99,11 +76,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() {
|
||||
@@ -113,75 +90,93 @@ public class BulkloadClient {
|
||||
public void setOptions(BulkloadOptions options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
/**
|
||||
* load from a huge xml string
|
||||
* @param xmlString A full xml document.
|
||||
* @throws Exception Thrown in case of bulk load error.
|
||||
*/
|
||||
public void load(String xmlString) throws Exception {
|
||||
load(new ByteArrayInputStream(xmlString.getBytes("UTF-8")));
|
||||
public void load(List<String > items) {
|
||||
doLoad(items);
|
||||
}
|
||||
/**
|
||||
* load from a huge xml string
|
||||
* @param xmlString
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <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,131 +1,189 @@
|
||||
package org.talend.mdm.bulkload.client;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
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 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.cookie.CookiePolicy;
|
||||
import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
|
||||
import org.apache.commons.httpclient.methods.PutMethod;
|
||||
import org.apache.commons.httpclient.methods.PostMethod;
|
||||
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 {
|
||||
|
||||
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);
|
||||
/**
|
||||
* @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;
|
||||
|
||||
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$
|
||||
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();
|
||||
|
||||
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);
|
||||
d = builder.parse(new InputSource(new StringReader(xmlString)));
|
||||
|
||||
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));
|
||||
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));
|
||||
|
||||
client.executeMethod(config, putMethod);
|
||||
responseBody = putMethod.getResponseBodyAsString();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
putMethod.releaseConnection();
|
||||
}
|
||||
URI uri = new URI(URL, false, "utf-8");
|
||||
HostConfiguration config = new HostConfiguration();
|
||||
config.setHost(uri);
|
||||
|
||||
int statusCode = putMethod.getStatusCode();
|
||||
if (statusCode >= 400) {
|
||||
throw new BulkloadException(responseBody);
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
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();
|
||||
if (statusCode >= 400)
|
||||
return false;
|
||||
String str = "";
|
||||
try {
|
||||
str = postMethod.getResponseBodyAsString();
|
||||
} catch (IOException e) {
|
||||
|
||||
Runnable loadRunnable = new AsyncLoadRunnable(url, cluster, concept, dataModel, validate, smartPK, merger, username, password, universe, startedBulkloadCount);
|
||||
Thread loadThread = new Thread(loadRunnable);
|
||||
loadThread.start();
|
||||
}
|
||||
System.out.println(str);
|
||||
|
||||
return merger;
|
||||
}
|
||||
postMethod.releaseConnection();
|
||||
return true;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,52 +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.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);
|
||||
}
|
||||
}
|
||||
@@ -1,191 +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.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;
|
||||
}
|
||||
}
|
||||
@@ -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/talendcsv.jar"/>
|
||||
<pathelement location="lib/javacsv-2.0.jar"/>
|
||||
</path>
|
||||
<target name="init">
|
||||
<mkdir dir="bin"/>
|
||||
|
||||
@@ -1,138 +1,131 @@
|
||||
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.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.*;
|
||||
|
||||
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;
|
||||
import com.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;
|
||||
|
||||
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();
|
||||
|
||||
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(), ';', "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());
|
||||
|
||||
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"));
|
||||
|
||||
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());
|
||||
//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());
|
||||
}
|
||||
}
|
||||
|
||||
private void initConnection() {
|
||||
|
||||
pingPaloServer();
|
||||
|
||||
paloTargetHost = new HttpHost(strServer, Integer.valueOf(strPort), "http");
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
@@ -140,129 +133,134 @@ 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) {
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -7,219 +8,216 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.talend.csv.CSVReader;
|
||||
import com.csvreader.CsvReader;
|
||||
|
||||
public class palocube {
|
||||
|
||||
// OK
|
||||
// OK
|
||||
|
||||
// @SuppressWarnings("unused")
|
||||
// private ArrayList<palocubelock> paloCubelocks = new ArrayList<palocubelock>();
|
||||
|
||||
//@SuppressWarnings("unused")
|
||||
//private ArrayList<palocubelock> paloCubelocks = new ArrayList<palocubelock>();
|
||||
|
||||
private paloconnection plConn;
|
||||
private long lDatabaseId;
|
||||
|
||||
private paloconnection plConn;
|
||||
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 long lDatabaseId;
|
||||
public String getName(){
|
||||
return strCubeName;
|
||||
}
|
||||
|
||||
private int iCubeId;
|
||||
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 String strCubeName;
|
||||
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 int iNumberOfDimensions;
|
||||
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[] iArrDimensionsIdentifier;
|
||||
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 long iNumberOfCells;
|
||||
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 lNumberOfFilledCells;
|
||||
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 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);
|
||||
}
|
||||
public palodimensions getDimensions() throws paloexception {
|
||||
return new palodimensions(this.plConn, this.lDatabaseId, this.iCubeType, this.iArrDimensionsIdentifier);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -7,248 +8,260 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.talend.csv.CSVReader;
|
||||
import com.csvreader.CsvReader;
|
||||
|
||||
public class palocubes {
|
||||
|
||||
public static final int CUBE_NORMAL = 0;
|
||||
|
||||
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_SYSTEM = 1;
|
||||
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_ATTRIBUT = 2;
|
||||
|
||||
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_USER_INFO = 3;
|
||||
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_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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,223 +1,216 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
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 com.csvreader.CsvReader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.*;
|
||||
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 (String[] element : strDimensionElementsArray) {
|
||||
lstDimensionElements.add(Arrays.asList(element));
|
||||
}
|
||||
private void buildDimElemIteratorFromArray() {
|
||||
iDimensionElementLength = strDimensionElementsArray.length;
|
||||
for (int i = 0; i < strDimensionElementsArray.length; i++)
|
||||
|
||||
itDimensionElements = palohelpers.finiteCartesianProduct(lstDimensionElements).iterator();
|
||||
}
|
||||
lstDimensionElements.add(Arrays
|
||||
.asList(strDimensionElementsArray[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(x.get(i));
|
||||
}
|
||||
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((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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
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 (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 (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++);
|
||||
|
||||
public Hashtable getResultHashTable() {
|
||||
return htPaloResultData;
|
||||
}
|
||||
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 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 Hashtable getResultHashTable() {
|
||||
return htPaloResultData;
|
||||
}
|
||||
|
||||
return getValue(lDimensionElementIdentifierArray);
|
||||
}
|
||||
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(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++;
|
||||
}
|
||||
return getValue(lDimensionElementIdentifierArray);
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
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 static final int PALO_SPLASH_DISABLE = 0;
|
||||
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_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_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;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -7,148 +8,144 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.talend.csv.CSVReader;
|
||||
import com.csvreader.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);
|
||||
// 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");
|
||||
}
|
||||
|
||||
private String strDatabaseName;
|
||||
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 long lDatabaseId;
|
||||
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 int iNumberOfDimensions;
|
||||
try{
|
||||
HttpEntity entity = this.plConn.sendToServer(qparams, "/database/rename");
|
||||
CsvReader csv = new CsvReader(entity.getContent(), Charset.forName("UTF-8"));
|
||||
|
||||
private int iNumberOfCubes;
|
||||
//CsvReader csv = new CsvReader(this.plConn.sendToServer(qparams, "/database/rename").getContent(), Charset.defaultCharset());
|
||||
csv.setDelimiter(';');
|
||||
csv.setTextQualifier('"');
|
||||
csv.readRecord();
|
||||
|
||||
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());
|
||||
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)));
|
||||
|
||||
public String getName() {
|
||||
return strDatabaseName;
|
||||
}
|
||||
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 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());
|
||||
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,5 +1,6 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -7,110 +8,108 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.talend.csv.CSVReader;
|
||||
import com.csvreader.CsvReader;
|
||||
|
||||
public class palodatabases {
|
||||
|
||||
private paloconnection plConn;
|
||||
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;
|
||||
|
||||
// OK
|
||||
public static final int DATABASE_TYPE_NORMAL = 0;
|
||||
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"));
|
||||
|
||||
public static final int DATABASE_TYPE_SYSTEM_ = 1;
|
||||
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_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());
|
||||
//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 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 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 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 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,134 +1,127 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.talend.csv.CSVReader;
|
||||
import com.csvreader.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;
|
||||
|
||||
public final static int PALO_SPLASH_DISABLE = 0;
|
||||
|
||||
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_DEFAULT = 1;
|
||||
public void setData( palocube plCube, int SPLASH_MODE, boolean bAddValue, boolean bUseEventProcessor) throws paloexception{
|
||||
|
||||
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;
|
||||
}
|
||||
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(), 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,5 +1,6 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -8,222 +9,233 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.talend.csv.CSVReader;
|
||||
import com.csvreader.CsvReader;
|
||||
|
||||
public class palodimension {
|
||||
|
||||
private paloelements paloElements;
|
||||
|
||||
|
||||
private paloconnection plConn;
|
||||
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 long lDatabaseId;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private String strCubeName;
|
||||
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(){
|
||||
|
||||
private String strDimensionName;
|
||||
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 int iDimensionId;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int iAssocDimension;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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 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());
|
||||
}
|
||||
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) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
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 "";
|
||||
}
|
||||
|
||||
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,5 +1,6 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -7,247 +8,273 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.talend.csv.CSVReader;
|
||||
import com.csvreader.CsvReader;
|
||||
|
||||
public class palodimensions {
|
||||
|
||||
public static final int DIMENSION_UNKNOWN = -1;
|
||||
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_NORMAL = 0;
|
||||
|
||||
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;
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
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(), 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 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;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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,5 +1,6 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -7,438 +8,425 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.talend.csv.CSVReader;
|
||||
import com.csvreader.CsvReader;
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class paloelement implements Comparable {
|
||||
public class paloelement implements Comparable {
|
||||
|
||||
/*
|
||||
* private native void JNIupdateElement(paloelement plElem, paloconsolidations plCons, int iAddToConsolidation);
|
||||
*/
|
||||
/*
|
||||
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 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());
|
||||
|
||||
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());
|
||||
}
|
||||
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(), ';', "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 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 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)));
|
||||
|
||||
|
||||
public paloconsolidations getConsolidations() {
|
||||
return new paloconsolidations(paloElements, this);
|
||||
}
|
||||
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 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";
|
||||
//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 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)));
|
||||
|
||||
|
||||
// if(plConsiElementType=paloelements.ELEMENT_CONSOLIDATION;
|
||||
String strURLApiCall = "/element/append";
|
||||
if(bReplace) strURLApiCall = "/element/replace";
|
||||
iElementType=paloelements.ELEMENT_CONSOLIDATION;
|
||||
qparams.add(new BasicNameValuePair("type", String.valueOf(iElementType)));
|
||||
|
||||
if (plCons != null) {
|
||||
qparams.add(new BasicNameValuePair("children", plCons.getConsolidationStringElementIdentifiers()));
|
||||
qparams.add(new BasicNameValuePair("weights", plCons.getConsolidationStringElementWeights()));
|
||||
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);
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
@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,354 +1,404 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
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 java.nio.charset.Charset;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.*;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.talend.csv.CSVReader;
|
||||
import com.csvreader.CsvReader;
|
||||
|
||||
public class paloelements {
|
||||
|
||||
// OK
|
||||
// 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>();
|
||||
|
||||
public static final int ELEMENT_NUMERIC = 1;
|
||||
private elementComparator elemComp = new elementComparator();
|
||||
|
||||
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());
|
||||
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 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 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 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;
|
||||
|
||||
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)));
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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, int iElementType, int iMode) throws paloexception {
|
||||
paloelement plElem = null;
|
||||
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){
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -8,150 +9,147 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.talend.csv.CSVReader;
|
||||
import com.csvreader.CsvReader;
|
||||
|
||||
public class palorule {
|
||||
|
||||
private paloconnection plConn;
|
||||
private paloconnection plConn;
|
||||
private long lDatabaseId;
|
||||
private int iCubeId;
|
||||
|
||||
private long lDatabaseId;
|
||||
private int lIdentifier;
|
||||
private String strDefinition;
|
||||
private String strExtern_Id;
|
||||
private String strComment;
|
||||
private long lTimeStamp;
|
||||
private boolean bActivated;
|
||||
|
||||
private int iCubeId;
|
||||
|
||||
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 lIdentifier;
|
||||
public long getIdentifier(){
|
||||
return lIdentifier;
|
||||
}
|
||||
|
||||
private String strDefinition;
|
||||
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 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 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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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,5 +1,6 @@
|
||||
package org.talend.jpalo;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -7,214 +8,243 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import com.talend.csv.CSVReader;
|
||||
import com.csvreader.CsvReader;
|
||||
|
||||
public class palorules {
|
||||
public static final int RULES_TEXT = 0;
|
||||
public static final int RULES_NUMERIC = 1;
|
||||
|
||||
public static final int RULES_TEXT = 0;
|
||||
private ArrayList<palorule> paloRules = new ArrayList<palorule>();
|
||||
|
||||
public static final int RULES_NUMERIC = 1;
|
||||
private paloconnection plConn;
|
||||
private long lDatabaseId;
|
||||
private int iCubeId;
|
||||
|
||||
private ArrayList<palorule> paloRules = new ArrayList<palorule>();
|
||||
private String strRuleParseResult;
|
||||
|
||||
private paloconnection plConn;
|
||||
public palorules(paloconnection plConn, long lDatabaseId, int iCubeId)
|
||||
throws paloexception {
|
||||
super();
|
||||
this.plConn = plConn;
|
||||
this.lDatabaseId = lDatabaseId;
|
||||
this.iCubeId = iCubeId;
|
||||
|
||||
private long lDatabaseId;
|
||||
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 int iCubeId;
|
||||
}
|
||||
|
||||
private String strRuleParseResult;
|
||||
public int getNumberOfRules() {
|
||||
return paloRules.size();
|
||||
}
|
||||
|
||||
public palorules(paloconnection plConn, long lDatabaseId, int iCubeId) throws paloexception {
|
||||
super();
|
||||
this.plConn = plConn;
|
||||
this.lDatabaseId = lDatabaseId;
|
||||
this.iCubeId = iCubeId;
|
||||
// Returns the Rule at the given Position
|
||||
public palorule getRule(int iIndex) {
|
||||
return paloRules.get(iIndex);
|
||||
}
|
||||
|
||||
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 Identifier
|
||||
public palorule getRule(long lIdentifier) {
|
||||
for (palorule paloRule : paloRules) {
|
||||
if (paloRule.getIdentifier() == lIdentifier)
|
||||
return paloRule;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
// 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 int getNumberOfRules() {
|
||||
return paloRules.size();
|
||||
}
|
||||
public ArrayList<palorule> getRules() {
|
||||
return paloRules;
|
||||
}
|
||||
|
||||
// Returns the Rule at the given Position
|
||||
public palorule getRule(int iIndex) {
|
||||
return paloRules.get(iIndex);
|
||||
}
|
||||
// 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 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 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 Extern_Id
|
||||
public palorule getRule(String strExtern_Id) {
|
||||
for (palorule paloRule : paloRules) {
|
||||
if (paloRule.getExtern_Id().equals(strExtern_Id)) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<palorule> getRules() {
|
||||
return paloRules;
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
public String getParseRuleResult() {
|
||||
return strRuleParseResult;
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 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 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);
|
||||
}
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
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/talendcsv.jar" />
|
||||
<pathelement location="${component.plugin.home}/tFileInputDelimited/javacsv.jar" />
|
||||
</path>
|
||||
|
||||
<!-- #################################################### -->
|
||||
|
||||
@@ -2,228 +2,167 @@ package com.sforce.soap.partner;
|
||||
|
||||
/** * Generated class, please do not edit. */
|
||||
public class ChildRelationship implements com.sforce.ws.bind.XMLizable {
|
||||
/** * 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;
|
||||
/** * Constructor */
|
||||
public ChildRelationship() {
|
||||
}
|
||||
|
||||
public boolean getCascadeDelete() {
|
||||
return 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 isCascadeDelete() {
|
||||
return cascadeDelete;
|
||||
}
|
||||
private boolean cascadeDelete__is_set = false;
|
||||
|
||||
public void setCascadeDelete(boolean cascadeDelete) {
|
||||
this.cascadeDelete = cascadeDelete;
|
||||
cascadeDelete__is_set = true;
|
||||
}
|
||||
private boolean 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 getCascadeDelete() {
|
||||
return cascadeDelete;
|
||||
}
|
||||
|
||||
public java.lang.String getChildSObject() {
|
||||
return childSObject;
|
||||
}
|
||||
public boolean isCascadeDelete() {
|
||||
return cascadeDelete;
|
||||
}
|
||||
|
||||
public void setChildSObject(java.lang.String childSObject) {
|
||||
this.childSObject = childSObject;
|
||||
childSObject__is_set = true;
|
||||
}
|
||||
public void setCascadeDelete(boolean cascadeDelete) {
|
||||
this.cascadeDelete = cascadeDelete;
|
||||
cascadeDelete__is_set = 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;
|
||||
/** * 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);
|
||||
|
||||
public boolean getDeprecatedAndHidden() {
|
||||
return deprecatedAndHidden;
|
||||
}
|
||||
private boolean childSObject__is_set = false;
|
||||
|
||||
public boolean isDeprecatedAndHidden() {
|
||||
return deprecatedAndHidden;
|
||||
}
|
||||
private java.lang.String childSObject;
|
||||
|
||||
public void setDeprecatedAndHidden(boolean deprecatedAndHidden) {
|
||||
this.deprecatedAndHidden = deprecatedAndHidden;
|
||||
deprecatedAndHidden__is_set = true;
|
||||
}
|
||||
public java.lang.String getChildSObject() {
|
||||
return childSObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* * 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;
|
||||
public void setChildSObject(java.lang.String childSObject) {
|
||||
this.childSObject = childSObject;
|
||||
childSObject__is_set = true;
|
||||
}
|
||||
|
||||
public java.lang.String getField() {
|
||||
return 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 void setField(java.lang.String field) {
|
||||
this.field = field;
|
||||
field__is_set = true;
|
||||
}
|
||||
private boolean deprecatedAndHidden__is_set = false;
|
||||
|
||||
/**
|
||||
* * 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;
|
||||
private boolean deprecatedAndHidden;
|
||||
|
||||
public java.lang.String getRelationshipName() {
|
||||
return relationshipName;
|
||||
}
|
||||
public boolean getDeprecatedAndHidden() {
|
||||
return deprecatedAndHidden;
|
||||
}
|
||||
|
||||
public void setRelationshipName(java.lang.String relationshipName) {
|
||||
this.relationshipName = relationshipName;
|
||||
relationshipName__is_set = true;
|
||||
}
|
||||
public boolean isDeprecatedAndHidden() {
|
||||
return deprecatedAndHidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* * 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;
|
||||
public void setDeprecatedAndHidden(boolean deprecatedAndHidden) {
|
||||
this.deprecatedAndHidden = deprecatedAndHidden;
|
||||
deprecatedAndHidden__is_set = true;
|
||||
}
|
||||
|
||||
public boolean getRestrictedDelete() {
|
||||
return 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 isRestrictedDelete() {
|
||||
return restrictedDelete;
|
||||
}
|
||||
private boolean field__is_set = false;
|
||||
|
||||
public void setRestrictedDelete(boolean restrictedDelete) {
|
||||
this.restrictedDelete = restrictedDelete;
|
||||
restrictedDelete__is_set = true;
|
||||
}
|
||||
private java.lang.String 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 java.lang.String getField() {
|
||||
return field;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
public void setField(java.lang.String field) {
|
||||
this.field = field;
|
||||
field__is_set = 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);
|
||||
}
|
||||
/** * 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);
|
||||
|
||||
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 boolean relationshipName__is_set = false;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user