Revision 44411 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/main/java/org/gvsig/export/impl/DefaultExportProcess.java
DefaultExportProcess.java | ||
---|---|---|
3 | 3 |
import java.util.List; |
4 | 4 |
import java.util.Objects; |
5 | 5 |
import javax.swing.JOptionPane; |
6 |
import org.apache.commons.lang3.StringUtils; |
|
6 | 7 |
import org.cresques.cts.ICoordTrans; |
7 | 8 |
import org.cresques.cts.IProjection; |
8 | 9 |
import org.gvsig.export.ExportException; |
... | ... | |
15 | 16 |
import org.gvsig.export.spi.ExportServiceManager; |
16 | 17 |
import org.gvsig.expressionevaluator.Expression; |
17 | 18 |
import org.gvsig.fmap.dal.OpenDataStoreParameters; |
19 |
import org.gvsig.fmap.dal.exception.DataException; |
|
18 | 20 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
19 | 21 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
22 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
20 | 23 |
import org.gvsig.tools.ToolsLocator; |
21 | 24 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
22 | 25 |
import org.gvsig.tools.task.TaskStatus; |
... | ... | |
39 | 42 |
private Object context; |
40 | 43 |
private Expression filterExpression; |
41 | 44 |
private int featuresToUse; |
42 |
// private AttributeNamesTranslator attributeNamesTranslator; |
|
43 | 45 |
|
44 | 46 |
public DefaultExportProcess() { |
45 | 47 |
|
... | ... | |
59 | 61 |
params.setSourceProjection(this.sourceProjection); |
60 | 62 |
params.setSourceTransformation(this.sourceTransformation); |
61 | 63 |
params.setContext(this.context); |
64 |
|
|
65 |
if (this.sourceFeatureStore != null) { |
|
66 |
try { |
|
67 |
FeatureType ftype = this.sourceFeatureStore.getDefaultFeatureType(); |
|
68 |
if (ftype != null) { |
|
69 |
params.setSourceGeometryFieldName(ftype.getDefaultGeometryAttributeName()); |
|
70 |
} |
|
71 |
} catch (DataException ex) { |
|
72 |
// |
|
73 |
} |
|
74 |
} |
|
62 | 75 |
} |
63 | 76 |
this.parameters.setFilterExpresion(this.filterExpression); |
64 | 77 |
this.parameters.setFeaturesToUse(this.featuresToUse); //valor que use la expression si no es nula |
... | ... | |
74 | 87 |
this.parameters.setContext(this.context); |
75 | 88 |
|
76 | 89 |
this.featuresToUse = this.parameters.getFeaturesToUse(); |
77 |
if (!Objects.equals(this.filterExpression, this.parameters.getFilterExpresion())) { |
|
90 |
if (this.filterExpression == null) { |
|
91 |
this.filterExpression = this.parameters.getFilterExpresion(); |
|
92 |
} else if (this.filterExpression.isEmpty()) { |
|
93 |
this.filterExpression = this.parameters.getFilterExpresion(); |
|
94 |
} else if (!Objects.equals(this.filterExpression, this.parameters.getFilterExpresion())) { |
|
95 |
StringBuilder message = new StringBuilder(); |
|
96 |
message.append(ToolsLocator.getI18nManager().getTranslation("_A_filter_is_already_applied_to_this_export_process")); |
|
97 |
message.append(":\n"); |
|
98 |
message.append(StringUtils.abbreviate(this.filterExpression.getPhrase(), 30)); |
|
99 |
message.append("\n"); |
|
100 |
message.append(ToolsLocator.getI18nManager().getTranslation("_Its_going_to_be_replace_by_the_filter_in_the_parameters")); |
|
101 |
message.append(":\n"); |
|
102 |
if (this.parameters.getFilterExpresion() != null) { |
|
103 |
message.append(StringUtils.abbreviate(this.parameters.getFilterExpresion().getPhrase(), 30)); |
|
104 |
} else { |
|
105 |
message.append("empty filter"); |
|
106 |
} |
|
107 |
message.append("\n"); |
|
108 |
message.append(ToolsLocator.getI18nManager().getTranslation("_Do_you_want_to_keep_the_applied_filter")); |
|
78 | 109 |
int keepFilter = ToolsSwingLocator.getThreadSafeDialogsManager().confirmDialog( |
79 |
ToolsLocator.getI18nManager().getTranslation("_Do_you_want_to_keep_the_applied_filter_and_not_use_the_one_in_the_parameters"), |
|
110 |
message.toString(),//ToolsLocator.getI18nManager().getTranslation("_Do_you_want_to_keep_the_applied_filter_and_not_use_the_one_in_the_parameters"),
|
|
80 | 111 |
ToolsLocator.getI18nManager().getTranslation("_Filter_to_apply"), |
81 | 112 |
JOptionPane.YES_NO_OPTION, |
82 | 113 |
JOptionPane.WARNING_MESSAGE, |
Also available in: Unified diff