svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / extension / updatetable / UpdateTableProcessImpl.java @ 46503
History | View | Annotate | Download (3.06 KB)
1 |
/*
|
---|---|
2 |
* To change this license header, choose License Headers in Project Properties.
|
3 |
* To change this template file, choose Tools | Templates
|
4 |
* and open the template in the editor.
|
5 |
*/
|
6 |
package org.gvsig.app.extension.updatetable; |
7 |
|
8 |
import java.util.logging.Level; |
9 |
import java.util.logging.Logger; |
10 |
import static org.gvsig.app.extension.updatetable.UpdateTableProcessParametersImpl.BATCHUPDATE_PROCESS_ALL; |
11 |
import static org.gvsig.app.extension.updatetable.UpdateTableProcessParametersImpl.BATCHUPDATE_PROCESS_ONLY_EDITEDS; |
12 |
import static org.gvsig.app.extension.updatetable.UpdateTableProcessParametersImpl.BATCHUPDATE_PROCESS_ONLY_SELECTION; |
13 |
import org.gvsig.app.extension.updatetable.UpdateTableProcessParametersImpl.ProcessFieldParameters; |
14 |
import org.gvsig.expressionevaluator.Expression; |
15 |
import org.gvsig.expressionevaluator.ExpressionUtils; |
16 |
import org.gvsig.fmap.dal.exception.DataException; |
17 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
18 |
import org.gvsig.fmap.dal.feature.Feature; |
19 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
20 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
21 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
22 |
import org.gvsig.tools.task.SimpleTaskStatus; |
23 |
|
24 |
/**
|
25 |
*
|
26 |
* @author jjdelcerro
|
27 |
*/
|
28 |
public class UpdateTableProcessImpl { |
29 |
|
30 |
private final UpdateTableProcessParametersImpl parameters; |
31 |
private final SimpleTaskStatus status; |
32 |
private final Runnable postprocess; |
33 |
|
34 |
public UpdateTableProcessImpl(UpdateTableProcessParametersImpl parameters, SimpleTaskStatus status, Runnable postprocess) { |
35 |
this.parameters = parameters;
|
36 |
this.status = status;
|
37 |
this.postprocess = postprocess;
|
38 |
} |
39 |
|
40 |
public void start() { |
41 |
Thread th = new Thread(this::process, "UpdateTableProcess"); |
42 |
th.start(); |
43 |
} |
44 |
|
45 |
public void process() { |
46 |
switch(this.parameters.getRowsToProcess()){ |
47 |
case BATCHUPDATE_PROCESS_ALL:
|
48 |
batchUpdateProcessAll(); |
49 |
break;
|
50 |
case BATCHUPDATE_PROCESS_ONLY_SELECTION:
|
51 |
//TODO:
|
52 |
break;
|
53 |
case BATCHUPDATE_PROCESS_ONLY_EDITEDS:
|
54 |
//TODO:
|
55 |
break;
|
56 |
} |
57 |
|
58 |
} |
59 |
|
60 |
private void batchUpdateProcessAll() { |
61 |
try {
|
62 |
FeatureStore store = this.parameters.getStore();
|
63 |
Expression filter = this.parameters.getFilter(); |
64 |
FeatureQuery query = store.createFeatureQuery(filter); |
65 |
FeatureSet featureSet = store.getFeatureSet(filter); |
66 |
for (Feature feature : featureSet) {
|
67 |
|
68 |
} |
69 |
} catch (DataException ex) {
|
70 |
Logger.getLogger(UpdateTableProcessImpl.class.getName()).log(Level.SEVERE, null, ex); |
71 |
} |
72 |
|
73 |
} |
74 |
|
75 |
private void processFeature(EditableFeature feature){ |
76 |
// for (ProcessFieldParameters parameter : parameters) {
|
77 |
// String name = parameter.getName();
|
78 |
// Expression expression = parameter.getExpression();
|
79 |
// v = ExpressionUtils.evaluate(expression);
|
80 |
// feature.setFeature(name, );
|
81 |
//
|
82 |
// }
|
83 |
|
84 |
} |
85 |
} |