[Yanel-commits] rev 59420 - public/yanel/contributions/realms/konakart-yanel-realm/res-types/product/src/java/org/wyona/yanel/resources/konakart/product

michi at wyona.com michi at wyona.com
Fri Jul 15 20:03:42 CEST 2011


Author: michi
Date: 2011-07-15 20:03:41 +0200 (Fri, 15 Jul 2011)
New Revision: 59420

Modified:
   public/yanel/contributions/realms/konakart-yanel-realm/res-types/product/src/java/org/wyona/yanel/resources/konakart/product/KonakartProductSOAPInfResource.java
Log:
trackable interface implemented in order to separate page type from tags

Modified: public/yanel/contributions/realms/konakart-yanel-realm/res-types/product/src/java/org/wyona/yanel/resources/konakart/product/KonakartProductSOAPInfResource.java
===================================================================
--- public/yanel/contributions/realms/konakart-yanel-realm/res-types/product/src/java/org/wyona/yanel/resources/konakart/product/KonakartProductSOAPInfResource.java	2011-07-15 17:47:42 UTC (rev 59419)
+++ public/yanel/contributions/realms/konakart-yanel-realm/res-types/product/src/java/org/wyona/yanel/resources/konakart/product/KonakartProductSOAPInfResource.java	2011-07-15 18:03:41 UTC (rev 59420)
@@ -4,6 +4,10 @@
 
 package org.wyona.yanel.resources.konakart.product;
 
+import org.wyona.yanel.core.api.attributes.AnnotatableV1;
+import org.wyona.yanel.core.api.attributes.TrackableV1;
+import org.wyona.yanel.core.attributes.viewable.View;
+import org.wyona.yanel.core.attributes.tracking.TrackingInformationV1;
 import org.wyona.yanel.impl.resources.BasicXMLResource;
 import org.wyona.yanel.resources.konakart.shared.KonakartOfflineException;
 import org.wyona.yanel.resources.konakart.shared.SharedResource;
@@ -39,18 +43,18 @@
 import javax.xml.parsers.DocumentBuilder;
 import java.net.URLEncoder;
 
-import org.wyona.yanel.core.attributes.viewable.View;
-
 import javax.servlet.http.HttpServletResponse;
 
 /**
  * A product
  */
-public class KonakartProductSOAPInfResource extends BasicXMLResource implements org.wyona.yanel.core.api.attributes.AnnotatableV1 {
+public class KonakartProductSOAPInfResource extends BasicXMLResource implements AnnotatableV1, TrackableV1 {
     
     private static Logger log = Logger.getLogger(KonakartProductSOAPInfResource.class);
 
     private static String KONAKART_NAMESPACE = "http://www.konakart.com/1.0";
+
+    private TrackingInformationV1 trackInfo;
     
     /**
      * @see org.wyona.yanel.core.api.attributes.ViewableV2#getView(java.lang.String)
@@ -65,7 +69,20 @@
             throw new org.wyona.yanel.core.ResourceNotFoundException("No such product!");
         }
 
-        // All is well
+        if (trackInfo != null) {
+            String[] annotations = getAnnotations();
+            if (annotations != null) {
+                for (int i = 0; i < annotations.length; i++) {
+                    trackInfo.addTag(annotations[i]);
+                }
+            } else {
+                log.error("No annotations!");
+            }
+            trackInfo.setPageType("konakart-product");
+        } else {
+            log.warn("Tracking information bean is null! Check life cycle of resource!");
+        }
+
         return getXMLView(viewId, getContentXML(viewId));
     }
 
@@ -303,7 +320,7 @@
         int languageId = shared.getLanguageId(getContentLanguage());
         int productID = getProductID(kkEngine);
         ProductIf product = kkEngine.getProduct(null, productID, languageId);
-        String[] annotations = {"shop-product", "" + productID, product.getName()};
+        String[] annotations = {"" + productID, product.getName()};
         return annotations;
     }
 
@@ -327,4 +344,11 @@
     public void setAnnotation(String name) throws Exception {
         log.warn("No implemented yet!");
     }
+
+    /**
+     * @see org.wyona.yanel.core.api.attributes.TrackableV1#doTrack(TrackingInformationV1)
+     */
+    public void doTrack(org.wyona.yanel.core.attributes.tracking.TrackingInformationV1 trackInfo) {
+        this.trackInfo = trackInfo;
+    }
 }



More information about the Yanel-commits mailing list