001: /**
002: * GENERATED CODE: DO NOT MODIFY IT UNDER ANY CIRCUMSTANCES!!!
003: */package com.completex.objective.persistency.examples.ex003a.cpxpos;
004:
005: import com.completex.objective.components.persistency.*;
006: import java.sql.SQLException;
007: import java.util.List;
008: import java.util.ArrayList;
009:
010: public class CpxCustomerPO
011: extends
012: com.completex.objective.persistency.examples.ex003a.domain.Customer
013: implements ICpxCustomer, java.io.Externalizable {
014:
015: public CpxCustomerPO() {
016: }
017:
018: public CpxCustomerPO(Long customerId) {
019: super (customerId);
020: }
021:
022: //
023: // Complex object part:
024: //
025: public static final String CPX_CHILD_CONTACT_REL = "contactRel";
026: protected static final com.completex.objective.components.persistency.type.TracingArrayListCollectionFactory CONTACT_REL_COLLECTION_FACTORY = new com.completex.objective.components.persistency.type.TracingArrayListCollectionFactory();
027: private List contactRels;
028:
029: protected static final int CPX_INDEX_CONTACT_REL = 0;
030:
031: public boolean complex() {
032: return true;
033: }
034:
035: protected Link[] links(QueryFactory queryFactory) {
036: try {
037: Link[] links = new Link[1];
038: Query query;
039: Link link;
040: query = queryFactory
041: .newQuery((PersistentObject) cpxFactoryContactRel());
042: link = new ChainedLink(
043: query,
044: new int[] { CpxCustomerPO.ICOL_CUSTOMER_ID, },
045: new int[] { com.completex.objective.persistency.examples.ex003a.domain.CustomerContactRel.ICOL_CUSTOMER_ID, },
046: CPX_CHILD_CONTACT_REL);
047: link.setLazyRetrieval(true);
048: link.setCascadeInsert(true);
049: link.setCascadeUpdate(true);
050: link.setCascadeDelete(true);
051: link.setInsertBeforeParent(false);
052: query
053: .setMultipleResultFactory(CONTACT_REL_COLLECTION_FACTORY);
054: links[CPX_INDEX_CONTACT_REL] = link;
055: return links;
056: } catch (Exception e) {
057: throw new OdalRuntimePersistencyException(e);
058: }
059: }
060:
061: /**
062: *
063: * @return Child factory
064: */
065: protected com.completex.objective.persistency.examples.ex003a.domain.CustomerContactRel cpxFactoryContactRel() {
066: return new com.completex.objective.persistency.examples.ex003a.domain.CustomerContactRel();
067: }
068:
069: public List getContactRels() {
070: List value = (List) getChildObject(CPX_CHILD_CONTACT_REL,
071: this .contactRels);
072: return (this .contactRels = _ridOfContactRelsNull(value));
073: }
074:
075: public List _getContactRels() {
076: List value = (List) getChildObjectStraight(
077: CPX_CHILD_CONTACT_REL, this .contactRels);
078: return (this .contactRels = _ridOfContactRelsNull(value));
079: }
080:
081: public void setContactRels(List contactRels) {
082: this .contactRels = (List) setChildObjectSafe(
083: CPX_CHILD_CONTACT_REL, contactRels);
084: }
085:
086: public List addContactRels() {
087: List contactRels = (List) CONTACT_REL_COLLECTION_FACTORY
088: .newCollection();
089: java.util.Collection collection = contactRels;
090: handleAddCollection(collection);
091: setContactRels(contactRels);
092: return this .contactRels;
093: }
094:
095: protected List _ridOfContactRelsNull(List value) {
096: if (value == null) {
097: value = lazyContactRels();
098: }
099: return value;
100: }
101:
102: public boolean addContactRel(
103: com.completex.objective.persistency.examples.ex003a.pos.ICustomerContactRel contactRel) {
104: return lazyContactRels().add(contactRel);
105: }
106:
107: protected List lazyContactRels() {
108: if (this .contactRels == null) {
109: addContactRels();
110: }
111: return this .contactRels;
112: }
113:
114: public boolean removeContactRel(
115: com.completex.objective.persistency.examples.ex003a.pos.ICustomerContactRel contactRel) {
116: if (this .contactRels == null) {
117: return false;
118: }
119: return this .contactRels.remove(contactRel);
120: }
121:
122: protected void doUnflatten() {
123: unflatten(toLink(), CPX_CHILD_CONTACT_REL, contactRels);
124: }
125:
126: protected void doFlatten() {
127: flatten(contactRels);
128: }
129:
130: protected void doPreFlatten() {
131: _getContactRels();
132: }
133:
134: //
135: // Compound object part:
136: //
137:
138: public boolean compound() {
139: return false;
140: }
141:
142: }
|