MergeNode(String fullPath, BeanPropertyAssoc<?> property) { this.fullPath = fullPath; this.targetDescriptor = property.getTargetDescriptor(); }
/** * Return the property path given the db table and column. */ public String findBeanPath(String tableName, String columnName) { if (tableName.isEmpty() || tableName.equalsIgnoreCase(baseTable)) { return columnPath.get(columnName); } BeanPropertyAssoc<?> assocProperty = tablePath.get(tableName); if (assocProperty != null) { String relativePath = assocProperty.getTargetDescriptor().findBeanPath(tableName, columnName); if (relativePath != null) { return SplitName.add(assocProperty.getName(), relativePath); } } return null; }
private DLoadBeanContext createBeanContext(String path, int batchSize, OrmQueryProperties queryProps) { BeanPropertyAssoc<?> p = (BeanPropertyAssoc<?>) getBeanProperty(rootDescriptor, path); BeanDescriptor<?> targetDescriptor = p.getTargetDescriptor(); return new DLoadBeanContext(this, targetDescriptor, path, batchSize, queryProps); }
/** * Return true if the unique id properties are all not null for this bean. */ public boolean hasId(EntityBean bean) { BeanDescriptor<?> targetDesc = getTargetDescriptor(); BeanProperty idProp = targetDesc.getIdProperty(); if (idProp != null) { Object value = idProp.getValue(bean); if (value == null) { return false; } } // all the unique properties are non-null return true; }
/** * Add a PathProperties for an embedded 'many' property (at the root level). */ private void prepare(String prop, BeanPropertyAssoc<?> embProp) { BeanDescriptor<?> targetDesc = embProp.getTargetDescriptor(); PathProperties manyRootPath = new PathProperties(); manyRootPath.addToPath(null, targetDesc.getIdProperty().getName()); manyRootPath.addNested(prop, embedded.get(prop)); manyRoot.put(prop, manyRootPath); } }
/** * Return the bean property traversing the object graph and taking into * account inheritance. */ @Override public BeanProperty findPropertyFromPath(String path) { BeanDescriptor<?> other = this; while (true) { String[] split = SplitName.splitBegin(path); if (split[1] == null) { return other._findBeanProperty(split[0]); } BeanPropertyAssoc<?> assocProp = (BeanPropertyAssoc<?>) other._findBeanProperty(split[0]); BeanDescriptor<?> targetDesc = assocProp.getTargetDescriptor(); path = split[1]; other = targetDesc; } }
/** * Return the BeanDescriptor for a given path of Associated One or Many beans. */ public BeanDescriptor<?> getBeanDescriptor(String path) { BeanDescriptor<?> result = this; while (true) { if (path == null) { return result; } String[] splitBegin = SplitName.splitBegin(path); BeanProperty beanProperty = result.findProperty(splitBegin[0]); if (beanProperty instanceof BeanPropertyAssoc<?>) { BeanPropertyAssoc<?> assocProp = (BeanPropertyAssoc<?>) beanProperty; path = splitBegin[1]; result = assocProp.getTargetDescriptor(); } else { throw new PersistenceException("Invalid path " + path + " from " + result.getFullName()); } } }
/** * Create a ElPropertyValue for a *ToOne or *ToMany. */ protected ElPropertyValue createElPropertyValue(String propName, String remainder, ElPropertyChainBuilder chain, boolean propertyDeploy) { // associated or embedded bean BeanDescriptor<?> embDesc = getTargetDescriptor(); if (chain == null) { chain = new ElPropertyChainBuilder(isEmbedded(), propName); } chain.add(this); if (containsMany()) { chain.setContainsMany(); } return embDesc.buildElGetValue(remainder, chain, propertyDeploy); }
private String parseProperty(Property p) { String propName = p.getProperty(); ElPropertyValue el = desc.getElGetValue(propName); if (el == null) { return p.toStringFormat(); } BeanProperty beanProperty = el.getBeanProperty(); if (beanProperty instanceof BeanPropertyAssoc<?>) { BeanPropertyAssoc<?> ap = (BeanPropertyAssoc<?>) beanProperty; IdBinder idBinder = ap.getTargetDescriptor().getIdBinder(); return idBinder.getOrderBy(el.getElName(), p.isAscending()); } return p.toStringFormat(); } }
MergeNode(String fullPath, BeanPropertyAssoc<?> property) { this.fullPath = fullPath; this.targetDescriptor = property.getTargetDescriptor(); }
BeanProperty beanProperty = elGetValue.getBeanProperty(); if (beanProperty instanceof BeanPropertyAssoc<?>) { desc = ((BeanPropertyAssoc<?>) beanProperty).getTargetDescriptor();
private DLoadBeanContext createBeanContext(String path, int batchSize, OrmQueryProperties queryProps) { BeanPropertyAssoc<?> p = (BeanPropertyAssoc<?>) getBeanProperty(rootDescriptor, path); BeanDescriptor<?> targetDescriptor = p.getTargetDescriptor(); return new DLoadBeanContext(this, targetDescriptor, path, batchSize, queryProps); }
/** * Return the property path given the db table and column. */ public String findBeanPath(String tableName, String columnName) { if (tableName.isEmpty() || tableName.equalsIgnoreCase(baseTable)) { return columnPath.get(columnName); } BeanPropertyAssoc<?> assocProperty = tablePath.get(tableName); if (assocProperty != null) { String relativePath = assocProperty.getTargetDescriptor().findBeanPath(tableName, columnName); if (relativePath != null) { return SplitName.add(assocProperty.getName(), relativePath); } } return null; }
/** * Return true if the unique id properties are all not null for this bean. */ public boolean hasId(EntityBean bean) { BeanDescriptor<?> targetDesc = getTargetDescriptor(); BeanProperty idProp = targetDesc.getIdProperty(); if (idProp != null) { Object value = idProp.getValue(bean); if (value == null) { return false; } } // all the unique properties are non-null return true; }
/** * Add a PathProperties for an embedded 'many' property (at the root level). */ private void prepare(String prop, BeanPropertyAssoc<?> embProp) { BeanDescriptor<?> targetDesc = embProp.getTargetDescriptor(); PathProperties manyRootPath = new PathProperties(); manyRootPath.addToPath(null, targetDesc.getIdProperty().getName()); manyRootPath.addNested(prop, embedded.get(prop)); manyRoot.put(prop, manyRootPath); } }
/** * Return the bean property traversing the object graph and taking into * account inheritance. */ @Override public BeanProperty findPropertyFromPath(String path) { BeanDescriptor<?> other = this; while (true) { String[] split = SplitName.splitBegin(path); if (split[1] == null) { return other._findBeanProperty(split[0]); } BeanPropertyAssoc<?> assocProp = (BeanPropertyAssoc<?>) other._findBeanProperty(split[0]); BeanDescriptor<?> targetDesc = assocProp.getTargetDescriptor(); path = split[1]; other = targetDesc; } }
/** * Return the BeanDescriptor for a given path of Associated One or Many beans. */ public BeanDescriptor<?> getBeanDescriptor(String path) { BeanDescriptor<?> result = this; while (true) { if (path == null) { return result; } String[] splitBegin = SplitName.splitBegin(path); BeanProperty beanProperty = result.findProperty(splitBegin[0]); if (beanProperty instanceof BeanPropertyAssoc<?>) { BeanPropertyAssoc<?> assocProp = (BeanPropertyAssoc<?>) beanProperty; path = splitBegin[1]; result = assocProp.getTargetDescriptor(); } else { throw new PersistenceException("Invalid path " + path + " from " + result.getFullName()); } } }
/** * Create a ElPropertyValue for a *ToOne or *ToMany. */ protected ElPropertyValue createElPropertyValue(String propName, String remainder, ElPropertyChainBuilder chain, boolean propertyDeploy) { // associated or embedded bean BeanDescriptor<?> embDesc = getTargetDescriptor(); if (chain == null) { chain = new ElPropertyChainBuilder(isEmbedded(), propName); } chain.add(this); if (containsMany()) { chain.setContainsMany(); } return embDesc.buildElGetValue(remainder, chain, propertyDeploy); }
private String parseProperty(Property p) { String propName = p.getProperty(); ElPropertyValue el = desc.getElGetValue(propName); if (el == null) { return p.toStringFormat(); } BeanProperty beanProperty = el.getBeanProperty(); if (beanProperty instanceof BeanPropertyAssoc<?>) { BeanPropertyAssoc<?> ap = (BeanPropertyAssoc<?>) beanProperty; IdBinder idBinder = ap.getTargetDescriptor().getIdBinder(); return idBinder.getOrderBy(el.getElName(), p.isAscending()); } return p.toStringFormat(); } }
BeanProperty beanProperty = elGetValue.getBeanProperty(); if (beanProperty instanceof BeanPropertyAssoc<?>) { desc = ((BeanPropertyAssoc<?>) beanProperty).getTargetDescriptor();