Lines 2838-2846
Link Here
|
2838 |
/** |
2838 |
/** |
2839 |
* Return the mapping for the specified attribute name. |
2839 |
* Return the mapping for the specified attribute name. |
2840 |
*/ |
2840 |
*/ |
2841 |
public DatabaseMapping getMappingForAttributeName(String name) { |
2841 |
public DatabaseMapping getMappingForAttributeName(final String name) { |
2842 |
return getMappingsByAttribute().get(name); |
2842 |
if(this.getMappingsByAttribute().get(name) == null) { |
2843 |
} |
2843 |
// browse mappings on aggregate childs (required when joining) |
|
|
2844 |
final List mappings = this.descriptor.getMappings(); |
2845 |
for (int i = 0; i < mappings.size(); i++) { |
2846 |
final DatabaseMapping mapping = (DatabaseMapping) mappings.get(i); |
2847 |
if (mapping.isAggregateMapping()) { |
2848 |
final List aggMappings = mapping.getReferenceDescriptor() |
2849 |
.getMappings(); |
2850 |
for (int j = 0; j < aggMappings.size(); j++) { |
2851 |
final DatabaseMapping aggMapping = (DatabaseMapping) aggMappings |
2852 |
.get(j); |
2853 |
if(name.equals(aggMapping.getAttributeName())) { |
2854 |
return aggMapping; |
2855 |
} |
2856 |
} |
2857 |
} |
2858 |
} |
2859 |
} |
2860 |
return this.getMappingsByAttribute().get(name); |
2861 |
} |
2844 |
|
2862 |
|
2845 |
/** |
2863 |
/** |
2846 |
* Return al the mapping for the specified field. |
2864 |
* Return al the mapping for the specified field. |
Lines 3122-3142
Link Here
|
3122 |
* attributes can be improved. |
3140 |
* attributes can be improved. |
3123 |
*/ |
3141 |
*/ |
3124 |
public void initializeJoinedAttributes() { |
3142 |
public void initializeJoinedAttributes() { |
3125 |
// For concurrency don't worry about doing this work twice, just make sure |
3143 |
// For concurrency don't worry about doing this work twice, just make |
3126 |
// if it happens don't add the same joined attributes twice. |
3144 |
// sure |
3127 |
List<DatabaseMapping> joinedAttributes = null; |
3145 |
// if it happens don't add the same joined attributes twice. |
3128 |
List mappings = this.descriptor.getMappings(); |
3146 |
List<DatabaseMapping> joinedAttributes = null; |
3129 |
for (int i = 0; i < mappings.size(); i++) { |
3147 |
final List mappings = this.descriptor.getMappings(); |
3130 |
DatabaseMapping mapping = (DatabaseMapping)mappings.get(i); |
3148 |
for (int i = 0; i < mappings.size(); i++) { |
3131 |
if (mapping.isForeignReferenceMapping() && ((ForeignReferenceMapping)mapping).isJoinFetched()) { |
3149 |
final DatabaseMapping mapping = (DatabaseMapping) mappings.get(i); |
3132 |
if (joinedAttributes == null) { |
3150 |
if (mapping.isForeignReferenceMapping() |
3133 |
joinedAttributes = new ArrayList(); |
3151 |
&& ((ForeignReferenceMapping) mapping).isJoinFetched()) { |
3134 |
} |
3152 |
if (joinedAttributes == null) { |
3135 |
joinedAttributes.add(mapping); |
3153 |
joinedAttributes = new ArrayList(); |
3136 |
} |
3154 |
} |
3137 |
} |
3155 |
joinedAttributes.add(mapping); |
3138 |
this.joinedAttributes = joinedAttributes; |
3156 |
} else if (mapping.isAggregateMapping()) { |
3139 |
} |
3157 |
// browse join mappings on aggregate childs |
|
|
3158 |
final List aggMappings = mapping.getReferenceDescriptor() |
3159 |
.getMappings(); |
3160 |
for (int j = 0; j < aggMappings.size(); j++) { |
3161 |
final DatabaseMapping aggMapping = (DatabaseMapping) aggMappings |
3162 |
.get(j); |
3163 |
if (aggMapping.isForeignReferenceMapping() |
3164 |
&& ((ForeignReferenceMapping) aggMapping) |
3165 |
.isJoinFetched()) { |
3166 |
if (joinedAttributes == null) { |
3167 |
joinedAttributes = new ArrayList(); |
3168 |
} |
3169 |
joinedAttributes.add(aggMapping); |
3170 |
} |
3171 |
} |
3172 |
} |
3173 |
} |
3174 |
this.joinedAttributes = joinedAttributes; |
3175 |
} |
3140 |
|
3176 |
|
3141 |
/** |
3177 |
/** |
3142 |
* INTERNAL: |
3178 |
* INTERNAL: |