Revision 36450 branches/v2_0_0_prep/extensions/extDalTransformJoin/src/org/gvsig/app/join/dal/feature/JoinTransform.java
JoinTransform.java | ||
---|---|---|
32 | 32 |
|
33 | 33 |
public class JoinTransform extends AbstractFeatureStoreTransform { |
34 | 34 |
|
35 |
public static final String PERSISTENCE_DEFINITION_NAME = "JoinTransform"; |
|
36 |
|
|
35 | 37 |
/** |
36 | 38 |
* Store from which the join transform will get the additional attributes |
37 | 39 |
*/ |
... | ... | |
149 | 151 |
for (int i = 0; i < attrs.length; i++) { |
150 | 152 |
addFeatureType(editableFeatureType, featureType2.getAttributeDescriptor(attrs[i]), prefix2, store2NamesMap); |
151 | 153 |
} |
152 |
|
|
154 |
|
|
153 | 155 |
if (this.store2NamesMap.containsKey(keyAttr2)) { |
154 | 156 |
this.attrsForQuery = this.attrs; |
155 | 157 |
} else { |
... | ... | |
179 | 181 |
if ((prefix != null) && (!prefix.equals(""))){ |
180 | 182 |
attName = prefix + "_" + attName; |
181 | 183 |
} |
182 |
|
|
184 |
|
|
183 | 185 |
// If an attribute already exists, calculate an alternate name and add it to our type |
184 | 186 |
int j = 0; |
185 | 187 |
while (targetFeatureType.getIndex(attName) >= 0) { |
... | ... | |
361 | 363 |
} |
362 | 364 |
|
363 | 365 |
public static void registerPersistent() { |
364 |
PersistenceManager manager = ToolsLocator.getPersistenceManager();
|
|
366 |
PersistenceManager persistenceManager = ToolsLocator.getPersistenceManager();
|
|
365 | 367 |
|
366 |
if( manager.getDefinition(AbstractFeatureStoreTransform.class) == null ) {
|
|
368 |
if( persistenceManager.getDefinition(AbstractFeatureStoreTransform.class) == null ) {
|
|
367 | 369 |
AbstractFeatureStoreTransform.registerPersistent(); |
368 | 370 |
} |
369 | 371 |
|
370 |
DynStruct definition = manager.addDefinition( |
|
371 |
JoinTransform.class, |
|
372 |
"JoinTransform", |
|
373 |
"JoinTransform Persistence definition", |
|
374 |
null, |
|
375 |
null |
|
376 |
); |
|
377 |
definition.extend(PersistenceManager.PERSISTENCE_NAMESPACE, |
|
378 |
ABSTRACT_FEATURESTORE_DYNCLASS_NAME); |
|
372 |
DynStruct definition = persistenceManager.getDefinition(PERSISTENCE_DEFINITION_NAME); |
|
379 | 373 |
|
380 |
definition.addDynFieldObject("store2").setClassOfValue(FeatureStore.class).setMandatory(true); |
|
381 |
definition.addDynFieldString("keyAttr1").setMandatory(true); |
|
382 |
definition.addDynFieldString("keyAttr2").setMandatory(true); |
|
383 |
definition.addDynFieldString("prefix1").setMandatory(true); |
|
384 |
definition.addDynFieldString("prefix2").setMandatory(true); |
|
385 |
definition.addDynFieldList("attrs").setClassOfItems(String.class).setMandatory(true); |
|
374 |
if (definition == null){ |
|
375 |
definition = persistenceManager.addDefinition( |
|
376 |
JoinTransform.class, |
|
377 |
PERSISTENCE_DEFINITION_NAME, |
|
378 |
"JoinTransform Persistence definition", |
|
379 |
null, |
|
380 |
null |
|
381 |
); |
|
382 |
definition.extend(PersistenceManager.PERSISTENCE_NAMESPACE, |
|
383 |
ABSTRACT_FEATURESTORE_DYNCLASS_NAME); |
|
384 |
|
|
385 |
definition.addDynFieldObject("store2").setClassOfValue(FeatureStore.class).setMandatory(true); |
|
386 |
definition.addDynFieldString("keyAttr1").setMandatory(true); |
|
387 |
definition.addDynFieldString("keyAttr2").setMandatory(true); |
|
388 |
definition.addDynFieldString("prefix1").setMandatory(true); |
|
389 |
definition.addDynFieldString("prefix2").setMandatory(true); |
|
390 |
definition.addDynFieldList("attrs").setClassOfItems(String.class).setMandatory(true); |
|
391 |
} |
|
386 | 392 |
} |
387 | 393 |
|
388 | 394 |
public void saveToState(PersistentState state) throws PersistenceException { |
Also available in: Unified diff