Skip to content

LeftForLinkForMaster does not limit query to last version #277

@nicolasdemauroy

Description

@nicolasdemauroy

When Left For Link For Master searches for an object, it does not limit itself to objects in their latest versions. This can cause renumbering between versions to cause the loader not to be able to find the correct item.

Proposed correction: add specifically a filter on last version. This is OK to be systematic as the link to master only exists for versioned objects.

Class concerned: LeftforlinktomasterFlatFileLoader

				// contraint : load object
				G[] rightobjecttable = null;
				AndQueryCondition allconstraintsquery = null;
				TableAlias maintablealias = linkobjectdefinition.getAlias(NumberedQueryHelper.SINGLEOBJECT);
				for (int k = 0; k < linktomasterpropertydef.getConstraintOnLinkToMasterNumber(); k++) {
					ConstraintOnLinkToMaster<E, G> constraintonlinkobject = linktomasterpropertydef
							.getConstraintOnLinkToMaster(k);
					if (constraintonlinkobject != null) {
						QueryCondition conditiononlinkconstraint = constraintonlinkobject
								.generateQueryFilter(maintablealias, leftid);
						if (allconstraintsquery == null)
							allconstraintsquery = new AndQueryCondition();
						allconstraintsquery.addCondition(conditiononlinkconstraint);
					}
				}

				if (linktomasterpropertydef.getConstraintOnLinkToMasterNumber() > 0) {
					rightobjecttable = NumberedQueryHelper.get().getobjectbynumber(thisrightobjectnumber,
							allconstraintsquery, rightobjectdefinition, rightobjectnumberproperty);

				} else {
					rightobjecttable = NumberedQueryHelper.get().getobjectbynumber(thisrightobjectnumber,
							rightobjectdefinition, rightobjectnumberproperty);

				}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions