I'm trying to write a method that checks for duplicate addresses. You pass it a partyId and an Address1 line, and it checks all of that party's postal addresses. If one of the addresses matches (only on the address1 line) it returns that postal address's contactMech. If it finds no match it returns false/null.

Here's what I have so far.  It won't compile.

public static GenericValue findDuplicateAddress(String partyId, String incomingAddressLine, GenericDelegator delegator, DispatchContext dctx)
{
    GenericDispatcher dispatcher = GenericDispatcher(dctx, delegator);
GenericValue party = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId", partyId)); Map addresses = dispatcher.runSync("getPartyContactMechValueMaps", UtilMisc.toMap("partyId", partyId, "contactMechId", "POSTAL_ADDRESS", "showOld", false));
    // todo
    // foreach address in list
        // compare Address 1 Line
        // if match
            // return contact mech of address in list
        //
    //
    return null;
}

The result is this:
[javac] /home/david/erp/opentaps/hot-deploy/CatalogImport/src/org/opentaps/CatalogImport/CatalogImportServices.java:52: cannot find symbol [javac] symbol : method GenericDispatcher(org.ofbiz.service.DispatchContext,org.ofbiz.entity.GenericDelegator) [javac] location: class org.opentaps.CatalogImport.CatalogImportServices [javac] GenericDispatcher dispatcher = GenericDispatcher(dctx, delegator);

Which is weird, because I do have
import org.ofbiz.service.GenericDispatcher;
at the top.

Any help would be much appreciated.

Reply via email to