}
else {
//
// get a record template for the current window.
//
BusinessQuery criteria = this.getRecordTemplate();
criteria.clearConstraints(false);
//
// store original criteria before changing it.
//
BusinessQuery previousCriteria = criteria.getQuery(assocNum);
//
// Minimize the number of queries we need to run.
// Temporarily remove the old criteria from other associations.
//
Array_Of_BusinessQuery<BusinessQuery> tmpForeignClasses = criteria.getForeignClasses();
criteria.setForeignClasses(null);
//
// Request the linked window's data. Merge the current criteria
// for businessClass 'AssocNum' with that found in 'template'.
//
criteria.addAttr(assocNum, template);
if (previousCriteria != null) {
criteria.addAttr(assocNum, previousCriteria);
// merge
}
if (this.getRecordIndex() != null && this.getCurRec() != null && this.getCurRec().getInstanceKey() != null) {
//
// Add keys for current record so will reselect this record.
//
for (int i = 1; i <= this.getRecordTemplate().getNumKeyAttrs(); i++) {
criteria.addConstraint(i, ConstraintOperation.OP_EQ, this.getCurRec().getInstanceKey().getValues().get(i-1));
}
//
// find the record (and it's associated records)
//
try {
if (this.getBusinessClient().transActive()) {
newData = this.getBusinessClient().select(criteria, ConcurrencyMgr.TR_CONTINUE);
}
else {
newData = this.getBusinessClient().select(criteria, ConcurrencyMgr.TR_START);
}
//
// restore original criteria for foreign classes
//
}
catch (Throwable qq_ElseException) {
criteria.setForeignClasses(tmpForeignClasses);
throw (RuntimeException)qq_ElseException;
}
}
//
// replace the given records with the fully fetched records
//
data.clear();
if (newData != null && newData.get(0) != null) {
if ((criteria.getForeignAttrMult(assocNum)&BusinessQuery.ASSOC_MULT_TO_MANY) > 0) {
Array_Of_BusinessClass<BusinessClass> a = null;
// ------------------------------
// Parameters for call to GetAttr
// ------------------------------
ParameterHolder_BusinessClass_Array qq_value = new ParameterHolder_BusinessClass_Array();
newData.get(0).getAttr(assocNum, qq_value);
a = (Array_Of_BusinessClass<BusinessClass>)qq_value.getObject();
if (a != null) {
for (BusinessClass rec : a) {
data.add(rec);
}
}
}
else {
BusinessClass b = null;
// ------------------------------
// Parameters for call to GetAttr
// ------------------------------
ParameterHolder_BusinessClass qq_value = new ParameterHolder_BusinessClass();
newData.get(0).getAttr(assocNum, qq_value);
b = (BusinessClass)qq_value.getObject();
// bug 37299 c : BusinessClass;
// bug 37299 GetCurRec().GetAttr(AssocNum, c );
// bug 37299 if c = NIL then
this.getCurRec().setAttr(assocNum, b);
// bug 37299 end if;
data.add(b);
}
}
//
// restore original criteria
//
criteria.setForeignClasses(tmpForeignClasses);
}
//
// if this window does not have access to a manager, pass
// this request for dependent data to its parent.
//
}
else {
if (assocNum == 0) {
if (LogMgr.getInstance().test(Framework.Constants.SP_MT_DEBUG, Framework.Constants.SP_ST_EX, 30, 110)) {
Logger.getLogger("task.part.logmgr").info(this.getWindowName());
Logger.getLogger("task.part.logmgr").info(".GetDependentData2: calling ");
Logger.getLogger("task.part.logmgr").info(this.getWindowInfo().getParentWindow().getWindowName());
Logger.getLogger("task.part.logmgr").info(".GetDependentData");
}
data = this.getWindowInfo().getParentWindow().getDependentData(data, template, this.getWindowInfo().getAssocNum());
}
else {
newData = new Array_Of_BusinessClass<BusinessClass>();
newData.set(0, this.getCurRec());
//
// Clone this window's current record so we don't modify the
// actual current record when it gets passed to GetDependentData
// below.
//
if (newData.get(0) != null) {
if (LogMgr.getInstance().test(Framework.Constants.SP_MT_DEBUG, Framework.Constants.SP_ST_EX, 30, 110)) {
Logger.getLogger("task.part.logmgr").info(this.getWindowName());
Logger.getLogger("task.part.logmgr").info(".GetDependentData: doing newData[1].Clone()");
}
newData.set(0, CloneHelper.clone(newData.get(0), false));
//
// Also clone the to-many (array) reference attributes.
//
for (int i = 1; i <= this.getRecordTemplate().getNumAttrs(BusinessQuery.ATTR_FOREIGN); i++) {
if ((this.getRecordTemplate().getForeignAttrMult(i+10000)&BusinessQuery.ASSOC_MULT_TO_MANY) > 0) {
Array_Of_BusinessClass<BusinessClass> tmpAry = null;
// ------------------------------
// Parameters for call to GetAttr
// ------------------------------
ParameterHolder_BusinessClass_Array qq_value = new ParameterHolder_BusinessClass_Array();
newData.get(0).getAttr(i+10000, qq_value);
tmpAry = (Array_Of_BusinessClass<BusinessClass>)qq_value.getObject();
if (tmpAry != null) {
tmpAry = CloneHelper.clone(tmpAry, false);
newData.get(0).setAttr(i+10000, tmpAry);
}
}
}
}
//
// As long as the current record in this window has not been
// recently inserted, pass it to its parent to see if the
// parent can find the missing columns.
//
if (newData.get(0) != null && newData.get(0).getInstanceStatus() != BusinessClass.ST_INSERT && newData.get(0).getInstanceStatus() != BusinessClass.ST_EMPTY) {
BusinessQuery criteria = this.getRecordTemplate();
criteria.clearConstraints(false);
BusinessClass curRec = newData.get(0);
//
// store original criteria before changing it.
//
BusinessQuery previousCriteria = criteria.getQuery(assocNum);
//
// Minimize the number of queries we need to run.
// Temporarily remove the old criteria from other associations.
//