Improved: Refactoring ContactMechWorker.get[Entity]ContactMechValueMaps function to improve processing speed (OFBIZ-10514) ContactMechWorker.get[Entity]ContactMechValueMaps are old historic functions that resolve all contact mech context related to an Entity (Party, Facility, Order, WorkEffort). The problem that they create too many db call during their execution that decrease OFBiz performance when the contactMech history grow.
A solution use to improve the process speed was replace all db call through *GenericValue.getRelated* function by *Delegator.makeValidValue* to instanciate each GenericValue needed after an unique search call on a viewEntity. For the four entities : Party, Facility, Order and WorkEffort, I use the same view structure with a sub view entity on ContactMechDetail. This offer more genericity and permit to slim code.
This commit introduce a regression on genericValue resolved for ContactMechType and ContactMechPurposeType that currently lost their description, it's actually not awkward because theses genericValue use the function .get("description", locale) to resolve the description so call directly the label system.
For Order and WorkEffort, I merged the resolving process in one function, that can be extend later easily for some other entity like Invoice or Quote. The new FtpAddress wasn't managed by this worker so I introduce it to keep the coherence.
Last improvement, I use getPartyContactMechValueMaps(Delegator delegator, String partyId, Timestamp date, String contactMechTypeId) instead of getPartyContactMechValueMaps(Delegator delegator, String partyId, boolean showOld, String contactMechTypeId) to offert also more possibility to resolve at date instead just use now or all.
icing on the cake, I added groovy test to control this worker