BindableIdEmbedded(BeanPropertyAssocOne<?> embId, MatchedImportedProperty[] matches) { this.embId = embId; this.props = embId.getProperties(); this.matches = matches; }
/** * Add bindable for the embedded properties to the list. */ public void create(List<Bindable> list, BeanDescriptor<?> desc, DmlMode mode, boolean withLobs) { for (BeanPropertyAssocOne<?> anEmbedded : desc.propertiesEmbedded()) { BeanProperty[] props = anEmbedded.getProperties(); List<Bindable> bindList = new ArrayList<>(props.length); for (BeanProperty prop : props) { Bindable item = factoryProperty.create(prop, mode, withLobs, true); if (item != null) { bindList.add(item); } } list.add(new BindableEmbedded(anEmbedded, bindList)); } }
public void createJoinColumn(String foreignKeyPrefix, DeployTableJoin join, boolean reverse, String sqlFormulaSelect) { if (idProperty == null) { return; } if (idProperty instanceof BeanPropertyAssocOne<?>) { BeanPropertyAssocOne<?> assocOne = (BeanPropertyAssocOne<?>) idProperty; BeanProperty[] props = assocOne.getProperties(); for (BeanProperty prop : props) { addToJoin(foreignKeyPrefix, join, reverse, sqlFormulaSelect, true, prop); } } else { addToJoin(foreignKeyPrefix, join, reverse, sqlFormulaSelect, false, idProperty); } }
@Override public void initialise() { this.idDesc = embIdProperty.getTargetDescriptor(); this.props = embIdProperty.getProperties(); this.idInValueSql = idInExpandedForm ? idInExpanded() : idInCompressed(); }
@Override public void addFkeys(String name) { BeanProperty[] embeddedProps = foreignAssocOne.getProperties(); for (int i = 0; i < imported.length; i++) { String n = name + "." + foreignAssocOne.getName() + "." + embeddedProps[i].getName(); BeanFkeyProperty fkey = new BeanFkeyProperty(n, imported[i].localDbColumn, foreignAssocOne.getDeployOrder()); owner.getBeanDescriptor().add(fkey); } }
/** * Add uniqueId properties. */ public BindableId createId(BeanDescriptor<?> desc) { BeanProperty id = desc.getIdProperty(); if (id == null) { return new BindableIdEmpty(); } if (!id.isEmbedded()) { return new BindableIdScalar(id); } else { BeanPropertyAssocOne<?> embId = (BeanPropertyAssocOne<?>) id; MatchedImportedProperty[] matches = MatchedImportedFactory.build(embId.getProperties(), desc); return new BindableIdEmbedded(embId, matches); } } }
BindableIdEmbedded(BeanPropertyAssocOne<?> embId, MatchedImportedProperty[] matches) { this.embId = embId; this.props = embId.getProperties(); this.matches = matches; }
/** * Visit the property. */ protected void visit(BeanPropertyVisitor pv, BeanProperty p) { if (p instanceof BeanPropertyAssocMany<?>) { // oneToMany or manyToMany pv.visitMany((BeanPropertyAssocMany<?>) p); } else if (p instanceof BeanPropertyAssocOne<?>) { BeanPropertyAssocOne<?> assocOne = (BeanPropertyAssocOne<?>) p; if (assocOne.isEmbedded()) { // Embedded bean pv.visitEmbedded(assocOne); BeanProperty[] embProps = assocOne.getProperties(); for (BeanProperty embProp : embProps) { pv.visitEmbeddedScalar(embProp, assocOne); } } else if (assocOne.isOneToOneExported()) { // associated one exported pv.visitOneExported(assocOne); } else { // associated one imported pv.visitOneImported(assocOne); } } else { // simple scalar type pv.visitScalar(p); } }
public void createJoinColumn(String foreignKeyPrefix, DeployTableJoin join, boolean reverse, String sqlFormulaSelect) { if (idProperty == null) { return; } if (idProperty instanceof BeanPropertyAssocOne<?>) { BeanPropertyAssocOne<?> assocOne = (BeanPropertyAssocOne<?>) idProperty; BeanProperty[] props = assocOne.getProperties(); for (BeanProperty prop : props) { addToJoin(foreignKeyPrefix, join, reverse, sqlFormulaSelect, true, prop); } } else { addToJoin(foreignKeyPrefix, join, reverse, sqlFormulaSelect, false, idProperty); } }
/** * Add bindable for the embedded properties to the list. */ public void create(List<Bindable> list, BeanDescriptor<?> desc, DmlMode mode, boolean withLobs) { for (BeanPropertyAssocOne<?> anEmbedded : desc.propertiesEmbedded()) { BeanProperty[] props = anEmbedded.getProperties(); List<Bindable> bindList = new ArrayList<>(props.length); for (BeanProperty prop : props) { Bindable item = factoryProperty.create(prop, mode, withLobs, true); if (item != null) { bindList.add(item); } } list.add(new BindableEmbedded(anEmbedded, bindList)); } }
@Override public void initialise() { this.idDesc = embIdProperty.getTargetDescriptor(); this.props = embIdProperty.getProperties(); this.idInValueSql = idInExpandedForm ? idInExpanded() : idInCompressed(); }
@Override public void addFkeys(String name) { BeanProperty[] embeddedProps = foreignAssocOne.getProperties(); for (int i = 0; i < imported.length; i++) { String n = name + "." + foreignAssocOne.getName() + "." + embeddedProps[i].getName(); BeanFkeyProperty fkey = new BeanFkeyProperty(n, imported[i].localDbColumn, foreignAssocOne.getDeployOrder()); owner.getBeanDescriptor().add(fkey); } }
/** * Add uniqueId properties. */ public BindableId createId(BeanDescriptor<?> desc) { BeanProperty id = desc.getIdProperty(); if (id == null) { return new BindableIdEmpty(); } if (!id.isEmbedded()) { return new BindableIdScalar(id); } else { BeanPropertyAssocOne<?> embId = (BeanPropertyAssocOne<?>) id; MatchedImportedProperty[] matches = MatchedImportedFactory.build(embId.getProperties(), desc); return new BindableIdEmbedded(embId, matches); } } }
/** * Visit the property. */ protected void visit(BeanPropertyVisitor pv, BeanProperty p) { if (p instanceof BeanPropertyAssocMany<?>) { // oneToMany or manyToMany pv.visitMany((BeanPropertyAssocMany<?>) p); } else if (p instanceof BeanPropertyAssocOne<?>) { BeanPropertyAssocOne<?> assocOne = (BeanPropertyAssocOne<?>) p; if (assocOne.isEmbedded()) { // Embedded bean pv.visitEmbedded(assocOne); BeanProperty[] embProps = assocOne.getProperties(); for (BeanProperty embProp : embProps) { pv.visitEmbeddedScalar(embProp, assocOne); } } else if (assocOne.isOneToOneExported()) { // associated one exported pv.visitOneExported(assocOne); } else { // associated one imported pv.visitOneImported(assocOne); } } else { // simple scalar type pv.visitScalar(p); } }