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

michi at wyona.com michi at wyona.com
Fri Jul 15 20:12:13 CEST 2011


Author: michi
Date: 2011-07-15 20:12:13 +0200 (Fri, 15 Jul 2011)
New Revision: 59422

Modified:
   public/yanel/contributions/realms/konakart-yanel-realm/res-types/category/src/java/org/wyona/yanel/resources/konakart/category/KonakartCategorySOAPInfResource.java
Log:
trackable interface implemented in oder to improve page typa and tags

Modified: public/yanel/contributions/realms/konakart-yanel-realm/res-types/category/src/java/org/wyona/yanel/resources/konakart/category/KonakartCategorySOAPInfResource.java
===================================================================
--- public/yanel/contributions/realms/konakart-yanel-realm/res-types/category/src/java/org/wyona/yanel/resources/konakart/category/KonakartCategorySOAPInfResource.java	2011-07-15 18:07:23 UTC (rev 59421)
+++ public/yanel/contributions/realms/konakart-yanel-realm/res-types/category/src/java/org/wyona/yanel/resources/konakart/category/KonakartCategorySOAPInfResource.java	2011-07-15 18:12:13 UTC (rev 59422)
@@ -4,6 +4,10 @@
 
 package org.wyona.yanel.resources.konakart.category;
 
+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;
@@ -42,19 +46,19 @@
 import javax.xml.parsers.DocumentBuilder;
 import java.net.URLEncoder;
 
-import org.wyona.yanel.core.attributes.viewable.View;
-
 import javax.servlet.http.HttpServletResponse;
 
 /**
  * KonaKart category
  */
-public class KonakartCategorySOAPInfResource extends BasicXMLResource implements org.wyona.yanel.core.api.attributes.AnnotatableV1 {
+public class KonakartCategorySOAPInfResource extends BasicXMLResource implements AnnotatableV1, TrackableV1 {
     
     private static Logger log = Logger.getLogger(KonakartCategorySOAPInfResource.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)
      */
@@ -68,7 +72,20 @@
             throw new org.wyona.yanel.core.ResourceNotFoundException("No such product category!");
         }
 
-        // 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-category");
+        } else {
+            log.warn("Tracking information bean is null! Check life cycle of resource!");
+        }
+
         return getXMLView(viewId, getContentXML(viewId));
     }
     
@@ -423,7 +440,7 @@
         int languageId = shared.getLanguageId(getContentLanguage());
         int categoryId = getCategoryId(kkEngine);
         CategoryIf category = kkEngine.getCategory(categoryId, languageId);
-        String[] annotations = {"shop-category", "" + categoryId, category.getName()};
+        String[] annotations = {"" + categoryId, category.getName()};
         return annotations;
     }
 
@@ -447,4 +464,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