Changeset 4620
- Timestamp:
- Oct 31, 2008, 9:54:10 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/Metadata.java
r4517 r4620 26 26 import net.sf.basedb.core.data.BasicData; 27 27 import net.sf.basedb.core.data.BatchableData; 28 import net.sf.basedb.core.data.ComponentData; 29 28 30 import java.util.Date; 29 31 import java.util.Collection; … … 35 37 36 38 import org.hibernate.metadata.ClassMetadata; 39 import org.hibernate.type.ComponentType; 37 40 import org.hibernate.EntityMode; 38 41 … … 288 291 if (item == null) throw new InvalidUseOfNullException("item"); 289 292 if (propertyName == null) throw new InvalidUseOfNullException("propertyName"); 290 String[] propertyPath = propertyName.split("\\. ");293 String[] propertyPath = propertyName.split("\\.|\\#"); 291 294 ClassMetadata currentClassMetadata = classMetadata; 292 295 String currentIdProperty = currentClassMetadata.getIdentifierPropertyName(); … … 333 336 currentIdProperty = currentClassMetadata.getIdentifierPropertyName(); 334 337 } 338 335 339 if (propertyPath[i].equals(currentIdProperty)) 336 340 { 337 341 value = currentClassMetadata.getIdentifier(data, EntityMode.POJO); 342 } 343 else if (value instanceof ComponentData) 344 { 345 ComponentType type = (ComponentType)currentClassMetadata.getPropertyType(propertyPath[i-1]); 346 data = value; 347 // There is no get-by-name method, we need to find the index 348 String[] subProperties = type.getPropertyNames(); 349 for (int index = 0; index < subProperties.length; ++index) 350 { 351 if (subProperties[index].equals(propertyPath[i])) 352 { 353 value = type.getPropertyValue(data, index, EntityMode.POJO); 354 break; 355 } 356 } 338 357 } 339 358 else … … 392 411 return value; 393 412 } 394 413 395 414 public String toString() 396 415 { -
trunk/src/core/net/sf/basedb/core/data/ColoringData.java
r4517 r4620 32 32 */ 33 33 public class ColoringData 34 implements ComponentData 34 35 { 35 36 -
trunk/src/core/net/sf/basedb/core/query/Hql.java
r4516 r4620 54 54 55 55 /** 56 A property can only contain the characters a-zA-Z0-9 and period(.) 57 It cannot begin or end with a period and cannot have two periods in a sequence. 58 */ 59 public static final Pattern PROPERTY_REGEXP = Pattern.compile("[a-zA-Z0-9]+(\\.[a-zA-Z0-9]+)*"); 56 A property can only contain the characters a-zA-Z0-9, period(.) or hash (#) 57 It cannot begin or end with a period/hash and cannot have two periods/hashes in a sequence. 58 A hash indicates a path to a component while a period indicates a path to another 59 entity. 60 */ 61 public static final Pattern PROPERTY_REGEXP = Pattern.compile("[a-zA-Z0-9]+((\\.|\\#)[a-zA-Z0-9]+)*"); 60 62 61 63 /** -
trunk/src/core/net/sf/basedb/core/query/HqlElementsExpression.java
r4516 r4620 63 63 if (query.getQueryType() == QueryType.HQL) 64 64 { 65 return "elements("+(alias == null ? query.getRootAlias() : alias) + (property == null ? "" : "." +property)+")"; 65 return "elements("+(alias == null ? query.getRootAlias() : alias) + 66 (property == null ? "" : "." +property.replace("#", "."))+")"; 66 67 } 67 68 else -
trunk/src/core/net/sf/basedb/core/query/HqlIndexExpression.java
r4516 r4620 62 62 if (query.getQueryType() == QueryType.HQL) 63 63 { 64 return "index("+(alias == null ? query.getRootAlias() : alias) + (property == null ? "" : "." +property)+")"; 64 return "index("+(alias == null ? query.getRootAlias() : alias) + 65 (property == null ? "" : "." +property.replace("#", "."))+")"; 65 66 } 66 67 else -
trunk/src/core/net/sf/basedb/core/query/HqlInnerJoin.java
r4516 r4620 72 72 // Count queries can't use the fetch parameter; they are not selecting the root item 73 73 return "INNER JOIN " + (fetch && !query.isCounting() ? "FETCH " : "") + 74 (alias == null ? query.getRootAlias() : alias) + "." + property + " " + joinedAlias +74 (alias == null ? query.getRootAlias() : alias) + "." + property.replace("#", ".") + " " + joinedAlias + 75 75 (on == null ? "" : " WITH " + on.toQl(query, dc)); 76 76 } -
trunk/src/core/net/sf/basedb/core/query/HqlLeftJoin.java
r4516 r4620 72 72 { 73 73 return "LEFT JOIN " + (fetch && !query.isCounting() ? "FETCH " : "") + 74 (alias == null ? query.getRootAlias() : alias) + "." + property + " " + joinedAlias +74 (alias == null ? query.getRootAlias() : alias) + "." + property.replace("#", ".") + " " + joinedAlias + 75 75 (on == null ? "" : " WITH " + on.toQl(query, dc)); 76 76 } -
trunk/src/core/net/sf/basedb/core/query/HqlPropertyExpression.java
r4600 r4620 61 61 if (query.getQueryType() == QueryType.HQL) 62 62 { 63 return (alias == null ? query.getRootAlias() : alias) + (property == null ? "" : "." +property); 63 return (alias == null ? query.getRootAlias() : alias) + 64 (property == null ? "" : "." +property.replace("#", ".")); 64 65 } 65 66 else -
trunk/src/core/net/sf/basedb/core/query/HqlSizeExpression.java
r4516 r4620 64 64 { 65 65 return "size("+(alias == null ? query.getRootAlias() : alias) + 66 (property == null ? "" : "." +property )+")";66 (property == null ? "" : "." +property.replace("#", "."))+")"; 67 67 } 68 68 else -
trunk/src/core/net/sf/basedb/core/query/ReporterListExpression.java
r4516 r4620 101 101 else if (query.getQueryType() == QueryType.HQL && hqlMode) 102 102 { 103 return tableAlias + "." + property ;103 return tableAlias + "." + property.replace("#", "."); 104 104 } 105 105 else -
trunk/www/views/formulas/list_formulas.jsp
r4578 r4620 97 97 try 98 98 { 99 final ItemQuery<Formula> query = Base.getConfiguredQuery( cc, false, Formula.getQuery(), mode);99 final ItemQuery<Formula> query = Base.getConfiguredQuery(dc, cc, true, Formula.getQuery(), mode); 100 100 formulas = query.iterate(dc); 101 101 } … … 107 107 int numListed = 0; 108 108 %> 109 109 110 <base:page title="<%=title==null ? "Formulas" : title%>" type="<%=mode.getPageType()%>"> 110 111 <base:head scripts="menu.js,table.js" styles="menu.css,table.css"> … … 298 299 <tbl:columndef 299 300 id="useColors" 300 property="coloring .usingColors"301 property="coloring#usingColors" 301 302 datatype="boolean" 302 303 title="Use colors" … … 307 308 <tbl:columndef 308 309 id="logarithmic" 309 property="coloring .logarithmic"310 property="coloring#logarithmic" 310 311 datatype="boolean" 311 312 title="Logarithmic" 312 313 sortable="true" 313 314 filterable="true" 314 exportable=" false"315 exportable="true" 315 316 /> 316 317 <tbl:columndef 317 318 id="minValue" 318 property="coloring .minValue"319 property="coloring#minValue" 319 320 datatype="float" 320 321 title="Min value" … … 325 326 <tbl:columndef 326 327 id="midValue" 327 property="coloring .midValue"328 property="coloring#midValue" 328 329 datatype="float" 329 330 title="Mid value" … … 334 335 <tbl:columndef 335 336 id="maxValue" 336 property="coloring .maxValue"337 property="coloring#maxValue" 337 338 datatype="float" 338 339 title="Max value"
Note: See TracChangeset
for help on using the changeset viewer.