Author: doogie
Date: Fri Mar 27 17:00:39 2009 New Revision: 759250 URL: http://svn.apache.org/viewvc?rev=759250&view=rev Log: Fix lines that *only* have whitespace. Modified: ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/report/ReportHelper.java ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java Modified: ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/report/ReportHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/report/ReportHelper.java?rev=759250&r1=759249&r2=759250&view=diff ============================================================================== --- ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/report/ReportHelper.java (original) +++ ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/report/ReportHelper.java Fri Mar 27 17:00:39 2009 @@ -31,7 +31,7 @@ public class ReportHelper { public static final String module = ReportHelper.class.getName(); - + /** * Calculate conversion rates based on a List of visits and orders. Designed to be used for reporting on * tracking code or marketing campaigns @@ -43,16 +43,16 @@ */ public static List<Map<String, Object>> calcConversionRates(List<GenericValue> visits, List<GenericValue> orders, String keyFieldName) { List<Map<String, Object>> conversionRates = FastList.newInstance(); - + // loop through all the visits for (GenericValue visit: visits) { Map<String, Object> reportValue = FastMap.newInstance(); reportValue.put(keyFieldName, visit.getString(keyFieldName)); reportValue.put("visits", visit.getLong("visitId")); // actually # of visits - + // find the matching entry in orders for the given key field List<GenericValue> ordersForThisKey = EntityUtil.filterByAnd(orders, UtilMisc.toMap(keyFieldName, visit.getString(keyFieldName))); - + // if there are matching orders, then calculate orders, order amount, and conversion rate if ((ordersForThisKey != null) && (ordersForThisKey.size() > 0)) { // note: there should be only one line of order stats per key, so .get(0) should work @@ -76,10 +76,10 @@ reportValue.put("orderAmount", Double.valueOf(0)); reportValue.put("conversionRate", Double.valueOf(0)); } - + conversionRates.add(reportValue); } - + return conversionRates; } } Modified: ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java?rev=759250&r1=759249&r2=759250&view=diff ============================================================================== --- ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java (original) +++ ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java Fri Mar 27 17:00:39 2009 @@ -54,7 +54,7 @@ public static String checkTrackingCodeUrlParam(HttpServletRequest request, HttpServletResponse response) { String trackingCodeId = request.getParameter("autoTrackingCode"); if (UtilValidate.isEmpty(trackingCodeId)) trackingCodeId = request.getParameter("atc"); - + if (UtilValidate.isNotEmpty(trackingCodeId)) { //tracking code is specified on the request, get the TrackingCode value and handle accordingly GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); @@ -65,7 +65,7 @@ Debug.logError(e, "Error looking up TrackingCode with trackingCodeId [" + trackingCodeId + "], ignoring this trackingCodeId", module); return "error"; } - + if (trackingCode == null) { Debug.logError("TrackingCode not found for trackingCodeId [" + trackingCodeId + "], ignoring this trackingCodeId.", module); //this return value will be ignored, but we'll designate this as an error anyway @@ -91,7 +91,7 @@ */ public static String checkPartnerTrackingCodeUrlParam(HttpServletRequest request, HttpServletResponse response) { String trackingCodeId = request.getParameter("ptc"); - + if (UtilValidate.isNotEmpty(trackingCodeId)) { //partner managed tracking code is specified on the request GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); @@ -102,10 +102,10 @@ Debug.logError(e, "Error looking up TrackingCode with trackingCodeId [" + trackingCodeId + "], ignoring this trackingCodeId", module); return "error"; } - + if (trackingCode == null) { //create new TrackingCode with default values from a "dtc" parameter or from a properties file - + String dtc = request.getParameter("dtc"); if (UtilValidate.isEmpty(dtc)) { dtc = UtilProperties.getPropertyValue("general", "partner.trackingCodeId.default"); @@ -117,7 +117,7 @@ } catch (GenericEntityException e) { Debug.logError(e, "Error looking up Default values TrackingCode with trackingCodeId [" + dtc + "], not using the dtc value for new TrackingCode defaults", module); } - + if (defaultTrackingCode != null) { defaultTrackingCode.set("trackingCodeId", trackingCodeId); defaultTrackingCode.set("trackingCodeTypeId", "PARTNER_MGD"); @@ -126,7 +126,7 @@ defaultTrackingCode.set("createdByUserLogin", null); defaultTrackingCode.set("lastModifiedDate", UtilDateTime.nowTimestamp()); defaultTrackingCode.set("lastModifiedByUserLogin", null); - + trackingCode = defaultTrackingCode; try { trackingCode.create(); @@ -136,7 +136,7 @@ } } } - + //if trackingCode is still null then the defaultTrackingCode thing didn't work out, use empty TrackingCode if (trackingCode == null) { trackingCode = delegator.makeValue("TrackingCode"); @@ -152,9 +152,9 @@ trackingCode.set("billableLifetime", Long.valueOf(2592000)); trackingCode.set("comments", "This TrackingCode has default values because no default TrackingCode could be found."); - + Debug.logWarning("No default TrackingCode record was found, using a TrackingCode with hard coded default values: " + trackingCode, module); - + try { trackingCode.create(); } catch (GenericEntityException e) { @@ -173,7 +173,7 @@ private static String processTrackingCode(GenericValue trackingCode, HttpServletRequest request, HttpServletResponse response) { GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); String trackingCodeId = trackingCode.getString("trackingCodeId"); - + //check effective dates java.sql.Timestamp nowStamp = UtilDateTime.nowTimestamp(); if (trackingCode.get("fromDate") != null && nowStamp.before(trackingCode.getTimestamp("fromDate"))) { @@ -184,7 +184,7 @@ if (Debug.infoOn()) Debug.logInfo("The TrackingCode with ID [" + trackingCodeId + "] has expired, ignoring this trackingCodeId", module); return "success"; } - + //persist that info by associating with the current visit GenericValue visit = VisitHandler.getVisit(request.getSession()); if (visit == null) { @@ -200,13 +200,13 @@ } } - + // write trackingCode cookies with the value set to the trackingCodeId // NOTE: just write these cookies and if others exist from other tracking codes they will be overwritten, ie only keep the newest - + // load the properties from the website entity String cookieDomain = null; - + String webSiteId = WebSiteWorker.getWebSiteId(request); if (webSiteId != null) { try { @@ -232,7 +232,7 @@ if (cookieDomain.length() > 0) trackableCookie.setDomain(cookieDomain); response.addCookie(trackableCookie); } - + // if trackingCode.billableLifetime not null and is > 0 write a billable cookie with name in the form: TKCDB_{trackingCode.trackingCodeTypeId} and timeout will be trackingCode.billableLifetime Long billableLifetime = trackingCode.getLong("billableLifetime"); if (billableLifetime != null && (billableLifetime.longValue() > 0 || billableLifetime.longValue() == -1)) { @@ -242,7 +242,7 @@ if (cookieDomain.length() > 0) billableCookie.setDomain(cookieDomain); response.addCookie(billableCookie); } - + // if site id exist in cookies then not req to create it if exist with diffrent site then create it int siteIdCookieAge = (60 * 60 * 24 * 365); // should this be configurable? String siteId = request.getParameter("siteId"); @@ -289,7 +289,7 @@ session.setAttribute("CURRENT_CATALOG_ID", prodCatalogId); CategoryWorker.setTrail(request, new ArrayList()); } - + // if forward/redirect is needed, do a response.sendRedirect and return null to tell the control servlet to not do any other requests/views String redirectUrl = trackingCode.getString("redirectUrl"); if (UtilValidate.isNotEmpty(redirectUrl)) { @@ -300,10 +300,10 @@ } return null; } - + return "success"; } - + /** If attaching TrackingCode Cookies to the visit is desired this event should be added to the list * of events that run on the first hit in a visit. */ @@ -344,7 +344,7 @@ if (Debug.infoOn()) Debug.logInfo("The TrackingCode with ID [" + trackingCodeId + "] has expired, ignoring this trackingCodeId", module); continue; } - + // for each trackingCodeId found in this way attach to the visit with the TKCDSRC_COOKIE sourceEnumId GenericValue trackingCodeVisit = delegator.makeValue("TrackingCodeVisit", UtilMisc.toMap("trackingCodeId", trackingCodeId, "visitId", visit.get("visitId"), @@ -360,7 +360,7 @@ } } } - + return "success"; } @@ -439,7 +439,7 @@ GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); java.sql.Timestamp nowStamp = UtilDateTime.nowTimestamp(); List trackingCodeOrders = new LinkedList(); - + Cookie[] cookies = request.getCookies(); Timestamp affiliateReferredTimeStamp = null; String siteId = null; @@ -478,7 +478,7 @@ isBillable = "N"; trackingCodeId = cookies[i].getValue(); } - + } } GenericValue trackingCode = null; @@ -500,7 +500,7 @@ UtilMisc.toMap("trackingCodeTypeId", trackingCode.get("trackingCodeTypeId"), "trackingCodeId", trackingCodeId, "isBillable", isBillable, "siteId", siteId, "hasExported", "N", "affiliateReferredTimeStamp",affiliateReferredTimeStamp )); - + Debug.logInfo(" trackingCodeOrder is " + trackingCodeOrder, module); trackingCodeOrders.add(trackingCodeOrder); } else { Modified: ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java?rev=759250&r1=759249&r2=759250&view=diff ============================================================================== --- ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java (original) +++ ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java Fri Mar 27 17:00:39 2009 @@ -67,7 +67,7 @@ public class VCard { public static final String module = VCard.class.getName(); - + public static Map<String, Object> importVCard(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = (LocalDispatcher) dctx.getDispatcher(); GenericDelegator delegator = (GenericDelegator) dctx.getDelegator(); @@ -82,11 +82,11 @@ ContactIOFactory ciof = Pim.getContactIOFactory(); ContactUnmarshaller unmarshaller = ciof.createContactUnmarshaller(); Contact[] contacts = unmarshaller.unmarshallContacts(in); - + for (Contact contact: contacts) { PersonalIdentity pid = contact.getPersonalIdentity(); Map<String, Object> serviceCtx = UtilMisc.<String, Object>toMap("firstName", pid.getFirstname(), "lastName", pid.getLastname()); - + for (Iterator iter = contact.getAddresses(); iter.hasNext();) { Address address = (AddressImpl) iter.next(); if (contact.isPreferredAddress(address)) { @@ -113,7 +113,7 @@ EntityCondition.makeCondition("geoName", EntityOperator.LIKE, workAddress.getRegion())), EntityOperator.AND); GenericValue stateGeo = EntityUtil.getFirst(delegator.findList("Geo", condition, null, null, null, true)); serviceCtx.put("stateProvinceGeoId", stateGeo.get("geoId")); - + Communications communications = contact.getCommunications(); for (Iterator iter = communications.getEmailAddresses(); iter.hasNext();) { EmailAddress emailAddress = (EmailAddressImpl) iter.next(); @@ -126,7 +126,7 @@ } } serviceCtx.put("emailAddress", email); - + for (Iterator iter = communications.getPhoneNumbers(); iter.hasNext();) { PhoneNumber phoneNumber = (PhoneNumberImpl) iter.next(); if (phoneNumber.isPreferred()) { @@ -148,7 +148,7 @@ } serviceCtx.put("areaCode", telNumber.substring(0, 3)); serviceCtx.put("contactNumber", telNumber.substring(3)); - + GenericValue userLogin = (GenericValue) context.get("userLogin"); serviceCtx.put("userLogin", userLogin); String serviceName = (String) context.get("serviceName"); @@ -164,7 +164,7 @@ } return result; } - + public static Map<String, Object> exportVCard(DispatchContext dctx, Map<String, ? extends Object> context) { GenericDelegator delegator = (GenericDelegator) dctx.getDelegator(); String partyId = (String) context.get("partyId"); @@ -172,28 +172,28 @@ try { ContactModelFactory cmf = Pim.getContactModelFactory(); Contact contact = cmf.createContact(); - + PersonalIdentity pid = cmf.createPersonalIdentity(); String fullName = PartyHelper.getPartyName(delegator, partyId, false); String[] name = fullName.split("\\s"); pid.setFirstname(name[0]); pid.setLastname(name[1]); contact.setPersonalIdentity(pid); - + GenericValue postalAddress = PartyWorker.findPartyLatestPostalAddress(partyId, delegator); Address address = cmf.createAddress(); address.setStreet(postalAddress.getString("address1")); address.setCity(postalAddress.getString("city")); - + address.setPostalCode(postalAddress.getString("postalCode")); String state = postalAddress.getRelatedOne("StateProvinceGeo").getString("geoName"); address.setRegion(state); - + String country = postalAddress.getRelatedOne("CountryGeo").getString("geoName"); address.setCountry(country); address.setWork(true); // this can be better set by checking contactMechPurposeTypeId contact.addAddress(address); - + Communications communication = cmf.createCommunications(); contact.setCommunications(communication); |
Free forum by Nabble | Edit this page |