|
Author: hansbak
Date: Mon Jan 25 06:26:23 2010 New Revision: 902716 URL: http://svn.apache.org/viewvc?rev=902716&view=rev Log: function leave feedback and screen - function auto relist item and screen - Get feedback data from ebay site and save into ofbiz. - Add rate pictures into framework/images/webapp/images - screen for show awaiting feedback and recent feedback from buyer - help screens are provided Added: ofbiz/trunk/framework/images/webapp/images/rate/ ofbiz/trunk/framework/images/webapp/images/rate/starActive.gif (with props) ofbiz/trunk/framework/images/webapp/images/rate/starDefault.gif (with props) ofbiz/trunk/framework/images/webapp/images/rate/starHover.gif (with props) ofbiz/trunk/specialpurpose/ebay/data/EbayScheduledJobs.xml ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_AutoPref.xml ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_Feedback.xml ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_LeaveFeedback.xml ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayEvents.java ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayFeedback.java ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/automationPreferences/ ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/automationPreferences/GetEbayJobsandbox.groovy ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/feedback/ ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/feedback/FeedbackList.groovy ofbiz/trunk/specialpurpose/ebay/webapp/ebay/feedback/ ofbiz/trunk/specialpurpose/ebay/webapp/ebay/feedback/LeaveFeedback.ftl Modified: ofbiz/trunk/specialpurpose/ebay/config/EbayUiLabels.xml ofbiz/trunk/specialpurpose/ebay/data/EbayHelpData.xml ofbiz/trunk/specialpurpose/ebay/ofbiz-component.xml ofbiz/trunk/specialpurpose/ebay/servicedef/services.xml ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayStore.java ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/controller.xml ofbiz/trunk/specialpurpose/ebay/widget/EbayForms.xml ofbiz/trunk/specialpurpose/ebay/widget/EbayMenus.xml ofbiz/trunk/specialpurpose/ebay/widget/EbayScreens.xml Added: ofbiz/trunk/framework/images/webapp/images/rate/starActive.gif URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/rate/starActive.gif?rev=902716&view=auto ============================================================================== Binary file - no diff available. Propchange: ofbiz/trunk/framework/images/webapp/images/rate/starActive.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: ofbiz/trunk/framework/images/webapp/images/rate/starDefault.gif URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/rate/starDefault.gif?rev=902716&view=auto ============================================================================== Binary file - no diff available. Propchange: ofbiz/trunk/framework/images/webapp/images/rate/starDefault.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: ofbiz/trunk/framework/images/webapp/images/rate/starHover.gif URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/rate/starHover.gif?rev=902716&view=auto ============================================================================== Binary file - no diff available. Propchange: ofbiz/trunk/framework/images/webapp/images/rate/starHover.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Modified: ofbiz/trunk/specialpurpose/ebay/config/EbayUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/config/EbayUiLabels.xml?rev=902716&r1=902715&r2=902716&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/config/EbayUiLabels.xml (original) +++ ofbiz/trunk/specialpurpose/ebay/config/EbayUiLabels.xml Mon Jan 25 06:26:23 2010 @@ -688,4 +688,25 @@ <property key="EbayUserPreference"> <value xml:lang="en">User Preference</value> </property> + <property key="EbayAutomationRelistItems"> + <value xml:lang="en">Automation Re-list Items</value> + </property> + + <property key="EbayBoughtLeaveFeedback"> + <value xml:lang="en">Bought</value> + </property> + + <property key="EbayFeedback"> + <value xml:lang="en">Feedback</value> + <value xml:lang="th">à¸à¸¥à¸à¸à¸à¸£à¸±à¸</value> + </property> + <property key="EbayFeedbackStore"> + <value xml:lang="en">Feedback Store</value> + </property> + <property key="EbayLeaveFeedback"> + <value xml:lang="en">Leave Feedback</value> + </property> + <property key="EbaySoldLeaveFeedback"> + <value xml:lang="en">Sold</value> + </property> </resource> Modified: ofbiz/trunk/specialpurpose/ebay/data/EbayHelpData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/data/EbayHelpData.xml?rev=902716&r1=902715&r2=902716&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/data/EbayHelpData.xml (original) +++ ofbiz/trunk/specialpurpose/ebay/data/EbayHelpData.xml Mon Jan 25 06:26:23 2010 @@ -105,4 +105,20 @@ <Content contentId="EBAY_ExpCatToEbay" contentTypeId="DOCUMENT" contentName="EBay export categories to store" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_ExpCatToEbay" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>/> <ContentAssoc contentId="HELP_EBAY" contentIdTo="EBAY_ExpCatToEbay" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000" mapKey="EBAY_exportCategoryEbayStore"/> + <!-- ebay feedback --> + <DataResource dataResourceId="EBAY_LeaveFeedback" localeString="en" dataResourceTypeId="OFBIZ_FILE" + objectInfo="specialpurpose/ebay/data/helpdata/HELP_EBAY_LeaveFeedback.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Ebay" mimeTypeId="text/xml" isPublic="Y" /> + <Content contentId="EBAY_LeaveFeedback" contentTypeId="DOCUMENT" contentName="EBay Leave Feedback" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_LeaveFeedback" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>/> + <ContentAssoc contentId="HELP_EBAY" contentIdTo="EBAY_LeaveFeedback" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000" mapKey="EBAY_LeaveFeedback"/> + + <DataResource dataResourceId="EBAY_Feedback" localeString="en" dataResourceTypeId="OFBIZ_FILE" + objectInfo="specialpurpose/ebay/data/helpdata/HELP_EBAY_Feedback.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Ebay" mimeTypeId="text/xml" isPublic="Y" /> + <Content contentId="EBAY_Feedback" contentTypeId="DOCUMENT" contentName="EBay Feedback" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_Feedback" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>/> + <ContentAssoc contentId="HELP_EBAY" contentIdTo="EBAY_Feedback" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000" mapKey="EBAY_Feedback"/> + + <DataResource dataResourceId="EBAY_AutoPref" localeString="en" dataResourceTypeId="OFBIZ_FILE" + objectInfo="specialpurpose/ebay/data/helpdata/HELP_EBAY_AutoPref.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Ebay" mimeTypeId="text/xml" isPublic="Y" /> + <Content contentId="EBAY_AutoPref" contentTypeId="DOCUMENT" contentName="EBay Automation Preferences" templateDataResourceId="HELP_TEMPL" dataResourceId="EBAY_AutoPref" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/>/> + <ContentAssoc contentId="HELP_EBAY" contentIdTo="EBAY_AutoPref" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000" mapKey="EBAY_AutomationPreferences"/> + </entity-engine-xml> Added: ofbiz/trunk/specialpurpose/ebay/data/EbayScheduledJobs.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/data/EbayScheduledJobs.xml?rev=902716&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/data/EbayScheduledJobs.xml (added) +++ ofbiz/trunk/specialpurpose/ebay/data/EbayScheduledJobs.xml Mon Jan 25 06:26:23 2010 @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<entity-engine-xml> + <!-- Automatic Re-list items when they are sold and out of quantity every day --> + <TemporalExpression tempExprId="EBAY_RELIST_ITEMS" tempExprTypeId="FREQUENCY" integer1="5" integer2="1"/> + <JobSandbox jobId="EBAY_RELIST_ITEMS" jobName="Ebay Relist Items" runTime="2000-01-01 00:00:00.000" serviceName="automaticEbayRelistSoldItems" poolId="pool" runAsUser="system" tempExprId="EBAY_RELIST_ITEMS" maxRecurrenceCount="-1"/> +</entity-engine-xml> Added: ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_AutoPref.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_AutoPref.xml?rev=902716&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_AutoPref.xml (added) +++ ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_AutoPref.xml Mon Jan 25 06:26:23 2010 @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to you under the Apache License, Version + 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by + applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the + License. +--> +<section xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + version="5.0" xmlns:xl="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" + xsi:schemaLocation="http://docbook.org/ns/docbook ../../../content/dtd/docbook.xsd" + xmlns="http://docbook.org/ns/docbook"> + <title>Ebay Store Detail screen.</title> + <para> + This section contains all Auto setting of specify Account. + </para> + <section> + <title>Fields Description : </title> + <section> + <title> + Automation Re-list Items + </title> + <para> + Automation Re-list Items is setting when items are sold or quantity empty or don't active and then auto re-listing those items. + </para> + <section> + <orderedlist> + <listitem><para>Start Date have to start before today or finish date. Format: yyyy-MM-dd HH:mm:ss.SSS"</para></listitem> + </orderedlist> + <orderedlist> + <listitem><para>Finish Date have to is after start date. Format: yyyy-MM-dd HH:mm:ss.SSS"</para></listitem> + </orderedlist> + </section> + <section> + <title>Note :</title> + <para>If you don't set finish date Automation Re-list continue to do.</para> + </section> + </section> + </section> +</section> + Added: ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_Feedback.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_Feedback.xml?rev=902716&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_Feedback.xml (added) +++ ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_Feedback.xml Mon Jan 25 06:26:23 2010 @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to you under the Apache License, Version + 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by + applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the + License. +--> +<section xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + version="5.0" xmlns:xl="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" + xsi:schemaLocation="http://docbook.org/ns/docbook ../../../content/dtd/docbook.xsd" + xmlns="http://docbook.org/ns/docbook"> + <title>EBay Feedback help screen.</title> + <para> + This screen show + </para> + <section> + <title>Items Awaiting Feedback</title> + <section> + <para>This section list Items, they are sold or bought and have link to Leave Feedback screen. + This list you can see itemId, title, user and link to leave feedback to buyer or seller. + <link xl:href="http://developer.ebay.com/DevZone/support/knowledgebase/">See more info</link></para> + </section> + </section> + <section> + <title>Recent Feedback</title> + <section> + <para>This section list recent feedback message from commentator (buyer) who do transaction with this account.</para> + </section> + </section> +</section> \ No newline at end of file Added: ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_LeaveFeedback.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_LeaveFeedback.xml?rev=902716&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_LeaveFeedback.xml (added) +++ ofbiz/trunk/specialpurpose/ebay/data/helpdata/HELP_EBAY_LeaveFeedback.xml Mon Jan 25 06:26:23 2010 @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to you under the Apache License, Version + 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 Unless required by + applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the + License. +--> +<section xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + version="5.0" xmlns:xl="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" + xsi:schemaLocation="http://docbook.org/ns/docbook ../../../content/dtd/docbook.xsd" + xmlns="http://docbook.org/ns/docbook"> + <title>EBay Leave Feedback help screen.</title> + <section> + <section> + <para> + This screen have 3 tab button All, bought, sold. "All" = bought and sold, "bought" = this account is buyer, "sold" = this account is seller. + All item in the list can leave message to buyer and seller multi action that mean each item is seperated. If item is bought it have 3 options to select + and then when select "Positive", "Neutral" and "Negative" a rating section appear,add rating to seller, and comment, if select "I'll leave Feedback later" a rating section disappear. + If item is sold it have 2 options to select and then when select "Positive" a comment box appear to add comment text to buyer, if select "I'll leave Feedback later" this comment box will disappear. + </para> + </section> + <section> + <title> + Note : + </title> + <para> + If you don't add comment in text box, leave feedback don't send. + </para> + </section> + </section> +</section> \ No newline at end of file Modified: ofbiz/trunk/specialpurpose/ebay/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/ofbiz-component.xml?rev=902716&r1=902715&r2=902716&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/ofbiz-component.xml (original) +++ ofbiz/trunk/specialpurpose/ebay/ofbiz-component.xml Mon Jan 25 06:26:23 2010 @@ -32,6 +32,7 @@ <entity-resource type="data" reader-name="seed" loader="main" location="data/EbayHelpData.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/EbayPortletData.xml"/> <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoEbayData.xml"/> + <entity-resource type="data" reader-name="demo" loader="main" location="data/EbayScheduledJobs.xml"/> <service-resource type="model" loader="main" location="servicedef/services.xml"/> <service-resource type="eca" loader="main" location="servicedef/secas.xml"/> Modified: ofbiz/trunk/specialpurpose/ebay/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/servicedef/services.xml?rev=902716&r1=902715&r2=902716&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/servicedef/services.xml (original) +++ ofbiz/trunk/specialpurpose/ebay/servicedef/services.xml Mon Jan 25 06:26:23 2010 @@ -276,4 +276,53 @@ <attribute name="productStoreId" mode="IN" type="String" optional="false"/> <attribute name="userPreferenceList" mode="OUT" type="List" optional="true"/> </service> + <!-- eBay Feedback --> + <service name="loadFeedback" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebay.EbayFeedback" invoke="loadFeedback" auth="true"> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + </service> + <service name="getItemsAwaitingFeedback" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebay.EbayFeedback" invoke="getItemsAwaitingFeedback" auth="true"> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + <attribute name="itemsAwaitingFeedback" mode="OUT" type="List" optional="true"/> + </service> + <service name="leaveFeedback" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebay.EbayFeedback" invoke="leaveFeedback" auth="true"> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + <attribute name="transactionId" mode="IN" type="String" optional="false"/> + <attribute name="itemId" mode="IN" type="String" optional="false"/> + <attribute name="targetUser" mode="IN" type="String" optional="false"/> + <attribute name="commentingUser" mode="IN" type="String" optional="false"/> + <attribute name="role" mode="IN" type="String" optional="false"/> + <attribute name="commentType" mode="IN" type="String" optional="false"/> + <attribute name="commentText" mode="IN" type="String" optional="false"/> + <attribute name="ratingItem" mode="IN" type="String" optional="true"/> + <attribute name="ratingComm" mode="IN" type="String" optional="true"/> + <attribute name="ratingShip" mode="IN" type="String" optional="true"/> + <attribute name="ratingShipHand" mode="IN" type="String" optional="true"/> + <attribute name="AqItemAsDescribedId" mode="IN" type="String" optional="true"></attribute> + </service> + <service name="getEbayActiveItems" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebay.EbayStore" invoke="getEbayActiveItems" auth="true"> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + <attribute name="activeItems" mode="OUT" type="List" optional="true"/> + </service> + <service name="getEbaySoldItems" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebay.EbayStore" invoke="getEbaySoldItems" auth="true"> + <attribute name="productStoreId" mode="IN" type="String" optional="false"/> + <attribute name="soldItems" mode="OUT" type="List" optional="true"/> + </service> + <service name="automaticEbayRelistSoldItems" engine="java" transaction-timeout="3600" + location="org.ofbiz.ebay.EbayStore" invoke="automaticEbayRelistSoldItems" auth="true"> + </service> + <service name="createEbayAutomaticRelistItems" engine="entity-auto" default-entity-name="JobSandbox" invoke="create"> + <description>create eBay automatic re-list items</description> + <auto-attributes mode="IN" include="pk"/> + <auto-attributes mode="IN" optional="true" include="nonpk"/> + </service> + <service name="updateEbayAutomaticRelistItems" engine="entity-auto" default-entity-name="JobSandbox" invoke="update"> + <description>create eBay automatic re-list items</description> + <auto-attributes mode="IN" include="pk"/> + <auto-attributes mode="IN" optional="true" include="nonpk"/> + </service> </services> \ No newline at end of file Added: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayEvents.java?rev=902716&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayEvents.java (added) +++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayEvents.java Mon Jan 25 06:26:23 2010 @@ -0,0 +1,70 @@ +package org.ofbiz.ebay; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import javolution.util.FastMap; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilHttp; +import org.ofbiz.entity.GenericValue; +import org.ofbiz.service.GenericServiceException; +import org.ofbiz.service.LocalDispatcher; +import org.ofbiz.webapp.taglib.ServiceTag; + +public class EbayEvents { + + public static final String module = ServiceTag.class.getName(); + + public static String sendLeaveFeedback(HttpServletRequest request, HttpServletResponse response) { + HttpSession session = request.getSession(true); + LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); + Map requestParams = UtilHttp.getParameterMap(request); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); + int feedbackSize = Integer.parseInt((String)requestParams.get("feedbackSize")); + String productStoreId = (String)requestParams.get("productStoreId"); + for(int i=1;i<=feedbackSize;i++){ + String commentType = (String)requestParams.get("commentType"+i); + String commentText = (String)requestParams.get("commentText"+i); + if(!commentType.equals("none") && commentText != null){ + String itemId = (String)requestParams.get("itemId"+i); + String transactionId = (String)requestParams.get("transactionId"+i); + String targetUser = (String)requestParams.get("targetUser"+i); + String commentingUser = (String)requestParams.get("commentingUser"+i); + String role = (String)requestParams.get("role"+i); + String ratingItem = (String)requestParams.get("ratingItem"+i); + String ratingComm = (String)requestParams.get("ratingComm"+i); + String ratingShip = (String)requestParams.get("ratingShip"+i); + String ratingShipHand = (String)requestParams.get("ratingShipHand"+i); + String AqItemAsDescribedId = (String)requestParams.get("AqItemAsDescribedId"+i); + + Map leavefeedback = FastMap.newInstance(); + leavefeedback.put("productStoreId", productStoreId); + leavefeedback.put("userLogin", userLogin); + leavefeedback.put("itemId", itemId); + leavefeedback.put("transactionId", transactionId); + leavefeedback.put("targetUser", targetUser); + leavefeedback.put("commentingUser", commentingUser); + leavefeedback.put("role", role); + leavefeedback.put("commentText", commentText); + leavefeedback.put("commentType", commentType); + leavefeedback.put("ratingItem", ratingItem); + leavefeedback.put("ratingComm", ratingComm); + leavefeedback.put("ratingShip", ratingShip); + leavefeedback.put("ratingShipHand", ratingShipHand); + leavefeedback.put("AqItemAsDescribedId", AqItemAsDescribedId); + // Call service + try{ + Map result = dispatcher.runSync("leaveFeedback", leavefeedback); + } catch (GenericServiceException e) { + Debug.logError(e, module); + return "error"; + } + } + } + return "success"; + } + +} Added: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayFeedback.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayFeedback.java?rev=902716&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayFeedback.java (added) +++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayFeedback.java Mon Jan 25 06:26:23 2010 @@ -0,0 +1,367 @@ +package org.ofbiz.ebay; + +import org.ofbiz.base.util.UtilDateTime; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.entity.Delegator; +import org.ofbiz.entity.GenericValue; + +import java.util.*; + +import org.ofbiz.service.DispatchContext; +import org.ofbiz.service.LocalDispatcher; +import org.ofbiz.service.ServiceUtil; + +import com.ebay.sdk.ApiContext; +import com.ebay.sdk.ApiException; +import com.ebay.sdk.SdkException; +import com.ebay.sdk.call.GetFeedbackCall; +import com.ebay.sdk.call.GetItemsAwaitingFeedbackCall; +import com.ebay.sdk.call.GetUserCall; +import com.ebay.sdk.call.LeaveFeedbackCall; +import com.ebay.soap.eBLBaseComponents.CommentTypeCodeType; +import com.ebay.soap.eBLBaseComponents.DetailLevelCodeType; +import com.ebay.soap.eBLBaseComponents.FeedbackDetailType; +import com.ebay.soap.eBLBaseComponents.FeedbackRatingDetailCodeType; +import com.ebay.soap.eBLBaseComponents.ItemRatingDetailArrayType; +import com.ebay.soap.eBLBaseComponents.ItemRatingDetailsType; +import com.ebay.soap.eBLBaseComponents.PaginatedTransactionArrayType; +import com.ebay.soap.eBLBaseComponents.SiteCodeType; +import com.ebay.soap.eBLBaseComponents.TransactionArrayType; +import com.ebay.soap.eBLBaseComponents.TransactionType; + +import javolution.util.FastList; +import javolution.util.FastMap; + +public class EbayFeedback { + + public static final String resource = "EbayUiLabels"; + private static final String module = EbayFeedback.class.getName(); + + public static Map<String, Object> loadFeedback(DispatchContext dctx, Map<String, ? extends Object> context){ + Map<String, Object> result = FastMap.newInstance(); + LocalDispatcher dispatcher = dctx.getDispatcher(); + GenericValue userLogin = (GenericValue) context.get("userLogin"); + Delegator delegator = dctx.getDelegator(); + Locale locale = (Locale) context.get("locale"); + String productStoreId = (String) context.get("productStoreId"); + + ApiContext apiContext = EbayHelper.getApiContext(productStoreId, locale, delegator); + try { + Map<String, Object> inMap = FastMap.newInstance(); + inMap.put("productStoreId", productStoreId); + inMap.put("userLogin", userLogin); + Map<String, Object> resultUser = dispatcher.runSync("getEbayStoreUser", inMap); + String userID = (String)resultUser.get("userLoginId"); + GetFeedbackCall feedbackCall = new GetFeedbackCall(); + feedbackCall.setApiContext(apiContext); + SiteCodeType SiteCodeType = EbayHelper.getSiteCodeType(productStoreId,locale, delegator); + feedbackCall.setSite(SiteCodeType.US); + feedbackCall.setUserID(userID); + DetailLevelCodeType[] detailLevelCodeType = {DetailLevelCodeType.RETURN_ALL}; + feedbackCall.setDetailLevel(detailLevelCodeType); + FeedbackDetailType[] feedback = feedbackCall.getFeedback(); + if(feedback != null){ + String partyId = null; + GenericValue userLoginEx = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", userID)); + if(userLoginEx == null){ + //Party + GenericValue party = delegator.makeValue("Party"); + partyId = delegator.getNextSeqId("Party"); + party.put("partyId", partyId); + party.put("partyTypeId", "PERSON"); + party.create(); + //UserLogin + userLoginEx = delegator.makeValue("UserLogin"); + userLoginEx.put("userLoginId", userID); + userLoginEx.put("partyId", partyId); + userLoginEx.create(); + }else{ + partyId = userLoginEx.getString("partyId"); + } + //PartyRole For eBay User + List partyRoles = delegator.findByAnd("PartyRole", UtilMisc.toMap("partyId", partyId, "roleTypeId", "OWNER")); + if(partyRoles.size() == 0){ + GenericValue partyRole = delegator.makeValue("PartyRole"); + partyRole.put("partyId", partyId); + partyRole.put("roleTypeId", "OWNER"); + partyRole.create(); + } + int feedbackLength = feedback.length; + for(int i=0;i<feedbackLength;i++){ + //convert to ofbiz + String contentId = feedback[i].getFeedbackID(); + Date eBayDateTime = feedback[i].getCommentTime().getTime(); + GenericValue contentCheck = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", contentId)); + if(contentCheck != null){ + continue; + } + String textData = feedback[i].getCommentText(); + String commentingUserId= feedback[i].getCommentingUser(); + String commentingPartyId = null; + List CommentingUserLogins = delegator.findByAnd("UserLogin", UtilMisc.toMap("userLoginId", commentingUserId)); + if(CommentingUserLogins.size() == 0){ + //Party + GenericValue party = delegator.makeValue("Party"); + commentingPartyId = delegator.getNextSeqId("Party"); + party.put("partyId", commentingPartyId); + party.put("partyTypeId", "PERSON"); + party.create(); + //UserLogin + userLoginEx = delegator.makeValue("UserLogin"); + userLoginEx.put("userLoginId", commentingUserId); + userLoginEx.put("partyId", commentingPartyId); + userLoginEx.create(); + }else{ + userLoginEx = (GenericValue)CommentingUserLogins.get(0); + commentingPartyId = userLoginEx.getString("partyId"); + } + //DataResource + GenericValue dataResource = delegator.makeValue("DataResource"); + String dataResourceId = delegator.getNextSeqId("DataResource"); + dataResource.put("dataResourceId", dataResourceId); + dataResource.put("dataResourceTypeId", "ELECTRONIC_TEXT"); + dataResource.put("mimeTypeId", "text/html"); + dataResource.create(); + //ElectronicText + GenericValue electronicText = delegator.makeValue("ElectronicText"); + electronicText.put("dataResourceId", dataResourceId); + electronicText.put("textData", textData); + electronicText.create(); + //Content + GenericValue content = delegator.makeValue("Content"); + content.put("contentId", contentId); + content.put("contentTypeId", "DOCUMENT"); + content.put("dataResourceId", dataResourceId); + content.put("createdDate", UtilDateTime.toTimestamp(eBayDateTime)); + content.create(); + //ContentPurpose + GenericValue contentPurpose = delegator.makeValue("ContentPurpose"); + contentPurpose.put("contentId", contentId); + contentPurpose.put("contentPurposeTypeId", "FEEDBACK"); + contentPurpose.create(); + //PartyRole For eBay Commentator + List commentingPartyRoles = delegator.findByAnd("PartyRole", UtilMisc.toMap("partyId", commentingPartyId, "roleTypeId", "COMMENTATOR")); + if(commentingPartyRoles.size() == 0){ + GenericValue partyRole = delegator.makeValue("PartyRole"); + partyRole.put("partyId", commentingPartyId); + partyRole.put("roleTypeId", "COMMENTATOR"); + partyRole.create(); + } + //ContentRole for eBay User + List contentRoles = delegator.findByAnd("ContentRole", UtilMisc.toMap("partyId", partyId, "roleTypeId", "OWNER", "contentId", contentId)); + if(contentRoles.size() == 0){ + GenericValue contentRole = delegator.makeValue("ContentRole"); + contentRole.put("contentId", contentId); + contentRole.put("partyId", partyId); + contentRole.put("roleTypeId", "OWNER"); + contentRole.put("fromDate", UtilDateTime.nowTimestamp()); + contentRole.create(); + } + //ContentRole for Commentator + List commentingContentRoles = delegator.findByAnd("ContentRole", UtilMisc.toMap("partyId", commentingPartyId, "roleTypeId", "COMMENTATOR", "contentId", contentId)); + if(commentingContentRoles.size() == 0){ + GenericValue contentRole = delegator.makeValue("ContentRole"); + contentRole.put("contentId", contentId); + contentRole.put("partyId", commentingPartyId); + contentRole.put("roleTypeId", "COMMENTATOR"); + contentRole.put("fromDate", UtilDateTime.nowTimestamp()); + contentRole.create(); + } + } + } + } catch (ApiException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SdkException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + String successMsg = "Load eBay Feedback Successfull."; + result = ServiceUtil.returnSuccess(successMsg); + return result; + } + public static Map<String, Object> getItemsAwaitingFeedback(DispatchContext dctx, Map<String, ? extends Object> context){ + Map<String, Object> result = FastMap.newInstance(); + LocalDispatcher dispatcher = dctx.getDispatcher(); + GenericValue userLogin = (GenericValue) context.get("userLogin"); + Delegator delegator = dctx.getDelegator(); + Locale locale = (Locale) context.get("locale"); + String productStoreId = (String) context.get("productStoreId"); + ApiContext apiContext = EbayHelper.getApiContext(productStoreId, locale, delegator); + List itemsResult = FastList.newInstance(); + try{ + GetItemsAwaitingFeedbackCall awaitingFeedbackCall = new GetItemsAwaitingFeedbackCall(); + awaitingFeedbackCall.setApiContext(apiContext); + awaitingFeedbackCall.getItemsAwaitingFeedback(); + PaginatedTransactionArrayType itemsAwaitingFeedback = awaitingFeedbackCall.getReturnedItemsAwaitingFeedback(); + TransactionArrayType items = itemsAwaitingFeedback.getTransactionArray(); + GetUserCall getUserCall = new GetUserCall(apiContext); + String commentingUser = getUserCall.getUser().getUserID(); + for(int i = 0;i<items.getTransactionLength();i++){ + Map<String, Object> entry = FastMap.newInstance(); + TransactionType transection = items.getTransaction(i); + entry.put("itemID", transection.getItem().getItemID()); + entry.put("commentingUser", commentingUser); + entry.put("title", transection.getItem().getTitle()); + entry.put("transactionID", transection.getTransactionID()); + if(transection.getBuyer() != null){ + entry.put("userID", transection.getBuyer().getUserID()); + entry.put("role", "buyer"); + } + + if(transection.getItem().getSeller() != null){ + entry.put("userID", transection.getItem().getSeller().getUserID()); + entry.put("role", "seller"); + } + if(transection.getShippingDetails()!=null){ + entry.put("shippingCost", transection.getShippingDetails().getDefaultShippingCost().getValue()); + entry.put("shippingCurrency", transection.getShippingDetails().getDefaultShippingCost().getCurrencyID().name()); + } + + if(transection.getFeedbackLeft() != null){ + entry.put("commentType", transection.getFeedbackLeft().getCommentType().name()); + } + itemsResult.add(entry); + } + result.put("itemsAwaitingFeedback", itemsResult); + } catch (ApiException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SdkException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return result; + } + public static Map<String, Object> leaveFeedback(DispatchContext dctx, Map<String, ? extends Object> context){ + Map<String, Object>result = FastMap.newInstance(); + Delegator delegator = dctx.getDelegator(); + Locale locale = (Locale) context.get("locale"); + String productStoreId = (String) context.get("productStoreId"); + ApiContext apiContext = EbayHelper.getApiContext(productStoreId, locale, delegator); + + String itemId = (String) context.get("itemId"); + String targetUser = (String) context.get("targetUser"); + String transactionId = (String) context.get("transactionId"); + String commentingUser = (String) context.get("commentingUser"); + String role = (String) context.get("role"); + String commentType = (String) context.get("commentType"); + String commentText = (String) context.get("commentText"); + String AqItemAsDescribed = null; + String ratingItem = (String) context.get("ratingItem"); + String ratingComm = (String) context.get("ratingComm"); + String ratingShip = (String) context.get("ratingShip"); + String ratingShipHand = (String) context.get("ratingShipHand"); + try{ + if(commentType != null){ + LeaveFeedbackCall leaveFeedbackCall = new LeaveFeedbackCall(); + leaveFeedbackCall.setApiContext(apiContext); + leaveFeedbackCall.setTargetUser(targetUser); + leaveFeedbackCall.setTransactionID(transactionId); + + if(role.equals("seller")){ + ItemRatingDetailArrayType sellerItemRatingDetailArray = new ItemRatingDetailArrayType(); + + //The item description + ItemRatingDetailsType itemRatingDetailsType1 = new ItemRatingDetailsType(); + int ratingItemValue = 0; + if(UtilValidate.isInteger(ratingItem)){ + ratingItemValue = Integer.parseInt(ratingItem); + } + if(ratingItemValue<3){ + int AqItemAsDescribedId = Integer.parseInt((String) context.get("AqItemAsDescribedId")); + switch (AqItemAsDescribedId) { + case 5: + AqItemAsDescribed = "ItemNotReceived"; + break; + case 6: + AqItemAsDescribed = "ItemBadQuality"; + break; + case 2: + AqItemAsDescribed = "ItemDamaged"; + break; + case 1: + AqItemAsDescribed = "ItemIneligible"; + break; + case 3: + AqItemAsDescribed = "ItemLost"; + break; + default: + AqItemAsDescribed = "Other"; + break; + } + } + itemRatingDetailsType1.setRating(ratingItemValue); + itemRatingDetailsType1.setRatingDetail(FeedbackRatingDetailCodeType.ITEM_AS_DESCRIBED); + + //The seller's communication + ItemRatingDetailsType itemRatingDetailsType2 = new ItemRatingDetailsType(); + int ratingCommValue = 0; + if(UtilValidate.isInteger(ratingComm)){ + ratingCommValue = Integer.parseInt(ratingComm); + } + itemRatingDetailsType2.setRating(ratingCommValue); + itemRatingDetailsType2.setRatingDetail(FeedbackRatingDetailCodeType.COMMUNICATION); + + //the seller ship the item + ItemRatingDetailsType itemRatingDetailsType3 = new ItemRatingDetailsType(); + int ratingShipValue = 0; + if(UtilValidate.isInteger(ratingShip)){ + ratingShipValue = Integer.parseInt(ratingShip); + } + itemRatingDetailsType3.setRating(ratingShipValue); + itemRatingDetailsType3.setRatingDetail(FeedbackRatingDetailCodeType.SHIPPING_TIME); + + //the shipping and handling charges + ItemRatingDetailsType itemRatingDetailsType4 = new ItemRatingDetailsType(); + int ratingShipHandValue = 0; + if(UtilValidate.isInteger(ratingShipHand)){ + ratingShipHandValue = Integer.parseInt(ratingShipHand); + } + itemRatingDetailsType4.setRating(ratingShipHandValue); + itemRatingDetailsType4.setRatingDetail(FeedbackRatingDetailCodeType.SHIPPING_AND_HANDLING_CHARGES); + + //Rating Summary + ItemRatingDetailsType[] itemRatingDetailsType = {itemRatingDetailsType1, itemRatingDetailsType2, itemRatingDetailsType3, itemRatingDetailsType4}; + sellerItemRatingDetailArray.setItemRatingDetails(itemRatingDetailsType); + + leaveFeedbackCall.setSellerItemRatingDetailArray(sellerItemRatingDetailArray); + } + FeedbackDetailType feedbackDetail = new FeedbackDetailType(); + feedbackDetail.setItemID(itemId); + feedbackDetail.setCommentingUser(commentingUser); + feedbackDetail.setCommentText(commentText); + feedbackDetail.setCommentTime(Calendar.getInstance()); + if(commentType.equals("positive")){ + feedbackDetail.setCommentType(CommentTypeCodeType.POSITIVE); + }else if(commentType.equals("neutral")){ + feedbackDetail.setCommentType(CommentTypeCodeType.NEUTRAL); + }else if(commentType.equals("negative")){ + feedbackDetail.setCommentType(CommentTypeCodeType.NEGATIVE); + } + leaveFeedbackCall.setFeedbackDetail(feedbackDetail); + leaveFeedbackCall.leaveFeedback(); + } + } catch (ApiException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SdkException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + result = ServiceUtil.returnSuccess(); + return result; + } + +} \ No newline at end of file Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayStore.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayStore.java?rev=902716&r1=902715&r2=902716&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayStore.java (original) +++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayStore.java Mon Jan 25 06:26:23 2010 @@ -99,6 +99,17 @@ import com.ebay.soap.eBLBaseComponents.StoreThemeArrayType; import com.ebay.soap.eBLBaseComponents.StoreThemeType; import com.ebay.soap.eBLBaseComponents.StoreType; +import java.sql.Timestamp; +import java.util.TimeZone; + +import com.ebay.soap.eBLBaseComponents.DetailLevelCodeType; +import com.ebay.soap.eBLBaseComponents.ItemArrayType; +import com.ebay.soap.eBLBaseComponents.ItemListCustomizationType; +import com.ebay.soap.eBLBaseComponents.ItemType; +import com.ebay.soap.eBLBaseComponents.MerchDisplayCodeType; +import com.ebay.soap.eBLBaseComponents.PaginatedItemArrayType; +import com.ebay.soap.eBLBaseComponents.SellingManagerSoldOrderType; +import com.ebay.soap.eBLBaseComponents.SellingManagerSoldTransactionType; public class EbayStore { private static final String resource = "EbayUiLabels"; @@ -1358,4 +1369,240 @@ } return result; } + + public static Map<String, Object> getEbayActiveItems(DispatchContext dctx, Map<String, ? extends Object> context){ + Map<String, Object>result = FastMap.newInstance(); + LocalDispatcher dispatcher = dctx.getDispatcher(); + GenericValue userLogin = (GenericValue) context.get("userLogin"); + Delegator delegator = dctx.getDelegator(); + Locale locale = (Locale) context.get("locale"); + String productStoreId = (String) context.get("productStoreId"); + List activeItems = FastList.newInstance(); + try { + Map<String, Object> inMap = FastMap.newInstance(); + inMap.put("productStoreId", productStoreId); + inMap.put("userLogin", userLogin); + Map<String, Object> resultUser = dispatcher.runSync("getEbayStoreUser", inMap); + String userID = (String)resultUser.get("userLoginId"); + ApiContext apiContext = EbayHelper.getApiContext(productStoreId, locale, delegator); + GetMyeBaySellingCall getMyeBaySellingCall = new GetMyeBaySellingCall(apiContext); + ItemListCustomizationType activeList = new ItemListCustomizationType(); + getMyeBaySellingCall.setActiveList(activeList ); + DetailLevelCodeType[] level = {DetailLevelCodeType.RETURN_ALL}; + getMyeBaySellingCall.setDetailLevel(level); + getMyeBaySellingCall.getMyeBaySelling(); + PaginatedItemArrayType itemListCustomizationType = getMyeBaySellingCall.getReturnedActiveList(); + if(itemListCustomizationType != null){ + ItemArrayType itemArrayType = itemListCustomizationType.getItemArray(); + int itemArrayTypeSize = itemArrayType.getItemLength(); + for(int i=0; i<itemArrayTypeSize; i++){ + Map<String, Object> entry = FastMap.newInstance(); + ItemType item = itemArrayType.getItem(i); + entry.put("itemId",item.getItemID()); + entry.put("title",item.getTitle()); + if(item.getPictureDetails() != null){ + String url[] = item.getPictureDetails().getPictureURL(); + if(url.length != 0){ + entry.put("pictureURL",url[0]); + }else{ + entry.put("pictureURL", null); + } + }else{ + entry.put("pictureURL", null); + } + entry.put("timeLeft",item.getTimeLeft()); + if(item.getBuyItNowPrice() != null){ + entry.put("buyItNowPrice",item.getBuyItNowPrice().getValue()); + }else{ + entry.put("buyItNowPrice", null); + } + if(item.getStartPrice() != null){ + entry.put("startPrice",item.getStartPrice().getValue()); + }else{ + entry.put("startPrice", null); + } + if(item.getListingDetails() != null){ + entry.put("relistedItemId",item.getListingDetails().getRelistedItemID()); + }else{ + entry.put("relistedItemId", null); + } + if(item.getListingType() != null){ + entry.put("listingType", item.getListingType().value()); + }else{ + entry.put("listingType", null); + } + activeItems.add(entry); + } + } + result.put("activeItems", activeItems); + } catch (Exception e) { + // TODO Auto-generated catch block + return ServiceUtil.returnError(e.getMessage()); + } + return result; + } + public static Map<String, Object> getEbaySoldItems(DispatchContext dctx, Map<String, ? extends Object> context){ + Map<String, Object>result = FastMap.newInstance(); + LocalDispatcher dispatcher = dctx.getDispatcher(); + GenericValue userLogin = (GenericValue) context.get("userLogin"); + Delegator delegator = dctx.getDelegator(); + Locale locale = (Locale) context.get("locale"); + String productStoreId = (String) context.get("productStoreId"); + List soldItems = FastList.newInstance(); + try { + Map<String, Object> inMap = FastMap.newInstance(); + inMap.put("productStoreId", productStoreId); + inMap.put("userLogin", userLogin); + Map<String, Object> resultUser = dispatcher.runSync("getEbayStoreUser", inMap); + String userID = (String)resultUser.get("userLoginId"); + ApiContext apiContext = EbayHelper.getApiContext(productStoreId, locale, delegator); + GetSellingManagerSoldListingsCall sellingManagerSoldListings = new GetSellingManagerSoldListingsCall(apiContext); + sellingManagerSoldListings.getSellingManagerSoldListings(); + SellingManagerSoldOrderType[] sellingManagerSoldOrders = sellingManagerSoldListings.getReturnedSaleRecord(); + if(sellingManagerSoldOrders != null){ + int soldOrderLength = sellingManagerSoldOrders.length; + for(int i=0; i<soldOrderLength; i++){ + SellingManagerSoldOrderType sellingManagerSoldOrder = sellingManagerSoldOrders[i]; + if(sellingManagerSoldOrder != null){ + SellingManagerSoldTransactionType[] sellingManagerSoldTransactions = sellingManagerSoldOrder.getSellingManagerSoldTransaction(); + int sellingManagerSoldTransactionLength = sellingManagerSoldTransactions.length; + for(int j=0;j<sellingManagerSoldTransactionLength;j++){ + Map<String, Object> entry = FastMap.newInstance(); + SellingManagerSoldTransactionType sellingManagerSoldTransaction = sellingManagerSoldTransactions[j]; + entry.put("itemId",sellingManagerSoldTransaction.getItemID()); + entry.put("title",sellingManagerSoldTransaction.getItemTitle()); + if(soldItems!=null){ + int soldItemsLength = soldItems.size(); + boolean checkStatus = false; + for(int check=0;check<soldItemsLength;check++){ + Map checkMap = (Map)soldItems.get(check); + if(checkMap.get("itemId").equals(entry.get("itemId"))){ + checkStatus = true; + } + } + if(!checkStatus){ + soldItems.add(entry); + } + }else{ + soldItems.add(entry); + } + } + } + } + } + result.put("soldItems", soldItems); + } catch (Exception e) { + // TODO Auto-generated catch block + return ServiceUtil.returnError(e.getMessage()); + } + return result; + } + public static Map<String, Object> automaticEbayRelistSoldItems(DispatchContext dctx, Map<String, ? extends Object> context){ + Map<String, Object>result = FastMap.newInstance(); + LocalDispatcher dispatcher = dctx.getDispatcher(); + GenericValue userLogin = (GenericValue) context.get("userLogin"); + Delegator delegator = dctx.getDelegator(); + Locale locale = (Locale) context.get("locale"); + try { + Map<String, Object>serviceMap = FastMap.newInstance(); + serviceMap.put("userLogin", userLogin); + List<GenericValue>stores = delegator.findByAnd("ProductStore", UtilMisc.toMap()); + for(int storeCount=0;storeCount<stores.size();storeCount++){ + String productStoreId = stores.get(storeCount).getString("productStoreId"); + serviceMap.put("productStoreId", productStoreId); + Map eBayUserLogin = dispatcher.runSync("getEbayStoreUser", serviceMap); + String eBayUserLoginId = (String)eBayUserLogin.get("userLoginId"); + if(eBayUserLoginId != null){ + List<GenericValue>jobs = delegator.findByAnd("JobSandbox", UtilMisc.toMap("authUserLoginId", eBayUserLoginId)); + if(jobs.size() != 0){ + GenericValue job = jobs.get(0); + Timestamp startDateTime = (Timestamp)job.get("startDateTime"); + Timestamp finishDateTime = (Timestamp)job.get("finishDateTime"); + //check can re-list items by eBay account setting + boolean canRelistItems = false; + Timestamp nowTime = UtilDateTime.nowTimestamp(); + if(startDateTime!=null&&finishDateTime!=null){ + if(startDateTime.before(nowTime) && finishDateTime.after(nowTime)){ + canRelistItems = true; + } + }else if(startDateTime!=null&&finishDateTime==null){ + if(startDateTime.before(nowTime)){ + canRelistItems = true; + } + } + if(canRelistItems){ + //save sold items to OFbBiz product entity + Map resultService = dispatcher.runSync("getEbaySoldItems", serviceMap); + List soldItems = (List)resultService.get("soldItems"); + if(soldItems.size()!=0){ + for(int itemCount=0;itemCount<soldItems.size();itemCount++){ + Map soldItemMap = (Map)soldItems.get(itemCount); + if(UtilValidate.isNotEmpty(soldItemMap.get("itemId"))){ + GenericValue productCheck = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", soldItemMap.get("itemId"))); + if(productCheck == null){ + GenericValue product = delegator.makeValue("Product"); + product.set("productId", soldItemMap.get("itemId")); + product.set("internalName", soldItemMap.get("title")); + product.set("productTypeId", "EBAY_ITEM"); + product.create(); + } + } + } + } + //check active items + serviceMap = FastMap.newInstance(); + serviceMap.put("userLogin", userLogin); + serviceMap.put("productStoreId", productStoreId); + resultService = dispatcher.runSync("getEbayActiveItems", serviceMap); + List activeItems = (List)resultService.get("activeItems"); + List<String> activeItemMaps = FastList.newInstance(); + if(activeItems.size()!=0){ + for(int itemCount=0;itemCount<activeItems.size();itemCount++){ + Map activeItemMap = (Map)activeItems.get(itemCount); + if(UtilValidate.isNotEmpty(activeItemMap.get("itemId"))){ + activeItemMaps.add((String)activeItemMap.get("itemId")); + } + } + } + List andExpr = FastList.newInstance(); + EntityCondition activeItemCond = EntityCondition.makeCondition("productId", EntityOperator.NOT_IN, activeItemMaps); + andExpr.add(activeItemCond); + EntityCondition productTypeCond = EntityCondition.makeCondition("productTypeId", EntityOperator.EQUALS, "EBAY_ITEM"); + andExpr.add(productTypeCond); + EntityCondition isVirtualCond = EntityCondition.makeCondition("isVirtual", EntityOperator.EQUALS, null); + andExpr.add(isVirtualCond); + EntityCondition andCond = EntityCondition.makeCondition(andExpr, EntityOperator.AND); + + List itemsToRelist = delegator.findList("Product", andCond, null, null, null, false); + if(itemsToRelist.size() != 0){ + //re-list sold items and not active + Map<String, Object> inMap = FastMap.newInstance(); + inMap.put("productStoreId", productStoreId); + inMap.put("userLogin", userLogin); + Map<String, Object> resultUser = dispatcher.runSync("getEbayStoreUser", inMap); + String userID = (String)resultUser.get("userLoginId"); + ApiContext apiContext = EbayHelper.getApiContext(productStoreId, locale, delegator); + for(int itemRelist=0;itemRelist<itemsToRelist.size();itemRelist++){ + RelistItemCall relistItemCall = new RelistItemCall(apiContext); + ItemType itemToBeRelisted = new ItemType(); + GenericValue product = (GenericValue)itemsToRelist.get(itemRelist); + itemToBeRelisted.setItemID(product.getString("productId")); + relistItemCall.setItemToBeRelisted(itemToBeRelisted); + relistItemCall.relistItem(); + GenericValue productStore = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", product.getString("productId"))); + productStore.set("isVirtual", "Y"); + productStore.store(); + Debug.logInfo("Relisted Item - "+product.getString("productId"), module); + } + } + } + } + } + } + } catch (Exception e) { + return ServiceUtil.returnError(e.getMessage()); + } + return ServiceUtil.returnSuccess(); + } + } \ No newline at end of file Added: ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/automationPreferences/GetEbayJobsandbox.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/automationPreferences/GetEbayJobsandbox.groovy?rev=902716&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/automationPreferences/GetEbayJobsandbox.groovy (added) +++ ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/automationPreferences/GetEbayJobsandbox.groovy Mon Jan 25 06:26:23 2010 @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.ofbiz.base.util.*; + +jobSandboxs = delegator.findByAnd("JobSandbox", UtilMisc.toMap("authUserLoginId", userLoginId)); +job = null +jobId = null; +if(jobSandboxs){ + job = jobSandboxs.get(0); +}else{ + jobId = delegator.getNextSeqId("JobSandbox"); +} +context.jobId = jobId; +context.job = job; \ No newline at end of file Added: ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/feedback/FeedbackList.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/feedback/FeedbackList.groovy?rev=902716&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/feedback/FeedbackList.groovy (added) +++ ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/feedback/FeedbackList.groovy Mon Jan 25 06:26:23 2010 @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.ofbiz.base.util.*; +import org.ofbiz.entity.condition.*; +import java.sql.Timestamp; +import java.util.Map; + +import javolution.util.FastMap; + +partyId = null +inMap = FastMap.newInstance(); +inMap.put("productStoreId", parameters.productStoreId); +inMap.put("userLogin", context.get("userLogin")); +resultUser = dispatcher.runSync("getEbayStoreUser", inMap); +ownerUser = resultUser.get("userLoginId"); +userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", ownerUser)); +if(userLogin){ + partyId = userLogin.get("partyId"); +} +expr = [] +cond = null; + +contentId = request.getParameter("contentId"); +fromDate = request.getParameter("fromDate"); +thruDate = request.getParameter("thruDate"); +if(contentId){ + expr.add(EntityCondition.makeCondition("contentId",EntityOperator.EQUALS, contentId)); +} +if(fromDate && thruDate){ + exprSub = []; + condSub = null; + exprSub.add(EntityCondition.makeCondition("createdDate",EntityOperator.GREATER_THAN, UtilDateTime.getDayStart(Timestamp.valueOf(fromDate + " 00:00:00.000")))); + exprSub.add(EntityCondition.makeCondition("createdDate",EntityOperator.LESS_THAN, UtilDateTime.getDayEnd(Timestamp.valueOf(thruDate + " 23:59:59.999")))); + condSub = EntityCondition.makeCondition(exprSub, EntityOperator.AND); + expr.add(condSub); +}else if(fromDate && !thruDate){ + expr.add(EntityCondition.makeCondition("createdDate",EntityOperator.GREATER_THAN, UtilDateTime.getDayStart(Timestamp.valueOf(fromDate + " 00:00:00.000")))); +}else if(!fromDate && thruDate){ + expr.add(EntityCondition.makeCondition("createdDate",EntityOperator.LESS_THAN, UtilDateTime.getDayEnd(Timestamp.valueOf(thruDate + " 23:59:59.999")))); +} +contentRoles = delegator.findByAnd("ContentRole", UtilMisc.toMap("roleTypeId","OWNER", "partyId", partyId)); +contentIds = []; +contentRoles.each{content-> + contentIds.add(content.getString("contentId")); +} +expr.add(EntityCondition.makeCondition("contentId", EntityOperator.IN, contentIds)); +cond = EntityCondition.makeCondition(expr, EntityOperator.AND); +contents = delegator.findList("Content", cond, null, null, null, false); + +recentFeedbackList = []; +ownerUser = null; +commentator = null; +contents.each{content-> + commentatorContents = delegator.findByAnd("ContentRole", UtilMisc.toMap("contentId",content.contentId, "roleTypeId","COMMENTATOR")); + if(commentatorContents){ + commentatorPartyId = commentatorContents.get(0).get("partyId"); + commentatorUsers = delegator.findByAnd("UserLogin", UtilMisc.toMap("partyId", commentatorPartyId)); + if(commentatorUsers){ + commentator = commentatorUsers.get(0).get("userLoginId"); + } + } + entry = [contentId : content.contentId, + dataResourceId : content.dataResourceId, + createdDate : content.createdDate, + ownerUser : ownerUser, + commentator : commentator]; + recentFeedbackList.add(entry); +} +context.recentFeedbackList = recentFeedbackList; \ No newline at end of file Modified: ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/controller.xml?rev=902716&r1=902715&r2=902716&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/controller.xml (original) +++ ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/controller.xml Mon Jan 25 06:26:23 2010 @@ -208,7 +208,40 @@ <response name="success" type="view" value="ebayStoreDetail"/> <response name="error" type="view" value="ebayStoreDetail"/> </request-map> + <!-- Feedback --> + <request-map uri="Feedback"> + <security https="true" auth="true"/> + <response name="success" type="view" value="Feedback"/> + </request-map> + <request-map uri="LeaveFeedback"> + <security https="true" auth="true"/> + <response name="success" type="view" value="LeaveFeedback"/> + </request-map> + <request-map uri="sendLeaveFeedback"> + <security https="true" auth="true"/> + <event type="java" path="org.ofbiz.ebay.EbayEvents" invoke="sendLeaveFeedback"/> + <response name="success" type="view" value="LeaveFeedback"/> + <response name="error" type="view" value="LeaveFeedback"/> + </request-map> + + <!-- Automation Preferences --> + <request-map uri="automationPreferences"> + <security auth="true" https="true"/> + <response name="success" type="view" value="AutomationPreferences"/> + </request-map> + <request-map uri="createEbayAutomaticRelistItems"> + <security auth="true" https="true"/> + <event type="service" invoke="createEbayAutomaticRelistItems"/> + <response name="success" type="view" value="AutomationPreferences"/> + <response name="error" type="view" value="AutomationPreferences"/> + </request-map> + <request-map uri="updateEbayAutomaticRelistItems"> + <security auth="true" https="true"/> + <event type="service" invoke="updateEbayAutomaticRelistItems"/> + <response name="success" type="view" value="AutomationPreferences"/> + <response name="error" type="view" value="AutomationPreferences"/> + </request-map> <!-- end of request mappings --> <!-- View Mappings --> @@ -231,5 +264,13 @@ <!-- ebay account --> <view-map name="NewEbayAccount" type="screen" page="component://ebay/widget/EbayScreens.xml#NewEbayAccount"/> <view-map name="EbayAccount" type="screen" page="component://ebay/widget/EbayScreens.xml#EbayAccount"/> + + <!-- feedback --> + <view-map name="FeedbackStore" type="screen" page="component://ebay/widget/EbayScreens.xml#FeedbackStore"/> + <view-map name="Feedback" type="screen" page="component://ebay/widget/EbayScreens.xml#Feedback"/> + <view-map name="LeaveFeedback" type="screen" page="component://ebay/widget/EbayScreens.xml#LeaveFeedback"/> + + <!-- AutomationPreferences --> + <view-map name="AutomationPreferences" type="screen" page="component://ebay/widget/EbayScreens.xml#EbayAutomationPreferences"/> <!-- end of view mappings --> </site-conf> |
| Free forum by Nabble | Edit this page |
