Author: daniele
Date: 2007-02-19 15:03:47 +0100 (Mon, 19 Feb 2007)
New Revision: 4479

Modified:
   trunk/core-api/pom.xml
   
trunk/core-api/src/main/java/no/schibstedsok/searchportal/mode/command/CatalogueSearchCommand.java
   
trunk/core-api/src/main/java/no/schibstedsok/searchportal/result/handler/CatalogueResultHandler.java
Log:
Added client libraries for remote communication to alfa sales administration 
application.




Modified: trunk/core-api/pom.xml
===================================================================
--- trunk/core-api/pom.xml      2007-02-19 13:35:36 UTC (rev 4478)
+++ trunk/core-api/pom.xml      2007-02-19 14:03:47 UTC (rev 4479)
@@ -184,13 +184,13 @@
         <version>4.0.5</version>
       </dependency>       
       
-      <!--dependency>
+      <dependency>
         <groupId>no.schibstedsok.alfa</groupId>
         <artifactId>alfa-remote</artifactId>
         <type>ejb-client</type>
         <version>1.0-SNAPSHOT</version>
-      </dependency-->         
-                
+      </dependency>         
+
         <!-- Testin -->
         <dependency>
             <groupId>schibstedsok</groupId>

Modified: 
trunk/core-api/src/main/java/no/schibstedsok/searchportal/mode/command/CatalogueSearchCommand.java
===================================================================
--- 
trunk/core-api/src/main/java/no/schibstedsok/searchportal/mode/command/CatalogueSearchCommand.java
  2007-02-19 13:35:36 UTC (rev 4478)
+++ 
trunk/core-api/src/main/java/no/schibstedsok/searchportal/mode/command/CatalogueSearchCommand.java
  2007-02-19 14:03:47 UTC (rev 4479)
@@ -38,6 +38,7 @@
     private String queryName = "";
     private boolean searchForName = false;
     private List<String> terms = new ArrayList<String>();
+    private boolean searchForInfoPage = false;
     
     
     /** Creates a new catalogue search command.
@@ -54,7 +55,10 @@
        
                queryTwo = query.getQueryString();
        }
-   
+       
+       if(getSingleParameter("companyid")!=null){
+               searchForInfoPage=true;
+       }
     }
 
     /** TODO comment me. **/
@@ -108,7 +112,7 @@
                // hvis det finnes en ekstra query, legg til denne i søket som 
et filter.       
                query = queryTwo!=null&&queryTwo.length()>0 ? " 
+iypcfgeo:\""+queryTwo.trim()+"\"" : "";
        
-       return query;
+               return query;
     }
     
     /**
@@ -118,13 +122,19 @@
     protected void visitImpl(final LeafClause clause) {
        String transformed = getTransformedTerm(clause);
        terms.add(transformed);
+
+       appendToQueryRepresentation(transformed);
     }
     
     
     @Override
-    public String getTransformedQuery() {
+    public String getTransformedQuery() {      
        String query="";
        
+       if(searchForInfoPage){ 
+               return super.getTransformedQuery();
+       }
+       
        if(!searchForName){
                String query1="(";
                String query2="(";

Modified: 
trunk/core-api/src/main/java/no/schibstedsok/searchportal/result/handler/CatalogueResultHandler.java
===================================================================
--- 
trunk/core-api/src/main/java/no/schibstedsok/searchportal/result/handler/CatalogueResultHandler.java
        2007-02-19 13:35:36 UTC (rev 4478)
+++ 
trunk/core-api/src/main/java/no/schibstedsok/searchportal/result/handler/CatalogueResultHandler.java
        2007-02-19 14:03:47 UTC (rev 4479)
@@ -6,7 +6,7 @@
 
 import javax.naming.InitialContext;
 
-//import no.schibstedsok.alfa.external.service.CompanyService;
+import no.schibstedsok.alfa.external.service.CompanyService;
 import no.schibstedsok.commons.ioc.ContextWrapper;
 import no.schibstedsok.searchportal.result.CatalogueSearchResultItem;
 import no.schibstedsok.searchportal.result.ProductResultItem;
@@ -35,7 +35,7 @@
 
        /**
         * Handle the search result.
-        * 
+        *  
         * @param cxt
         *            the context in which the resulthandler is executed in.
         * @param parameters
@@ -74,38 +74,56 @@
                                                
"org.jboss.naming:org.jnp.interfaces");
                                properties.put("java.naming.provider.url", url);
 
+                               LOG.info("Url: " + url);
+                               LOG.info("JNDI_NAME: " + jndi);
+                               LOG.info("CompanyId: " + intCompanyId);
+
                                InitialContext ctx = new 
InitialContext(properties);
-                               //CompanyService service = (CompanyService) 
ctx.lookup(jndi);
-                               
//no.schibstedsok.alfa.external.dto.ProductSearchResult eksternt = 
(no.schibstedsok.alfa.external.dto.ProductSearchResult) service
-                               //              
.getProductDataForCompany(intCompanyId);
+                               CompanyService service = (CompanyService) 
ctx.lookup(jndi);
+                               
no.schibstedsok.alfa.external.dto.ProductSearchResult eksternt = 
(no.schibstedsok.alfa.external.dto.ProductSearchResult) service
+                                               
.getProductDataForCompany(intCompanyId);
 
-                               
                                /**
                                 * Hent ut alle produkter som er lagt inn på 
infosiden.
                                 * 
                                 */
-                               /*ProductSearchResult internalResult = new 
ProductSearchResult();
+                               ProductSearchResult internalResult = new 
ProductSearchResult();
                                if (eksternt.hasInfoPageProducts()) {
                                        for 
(no.schibstedsok.alfa.external.dto.ProductResultItem prodItem : eksternt
                                                        .getInfoPageProducts()) 
{
                                                ProductResultItem item = new 
ProductSearchResultItem();
-                                               
item.setFields(prodItem.getFields());
+
+                                               if (prodItem.getFields().size() 
> 0) {
+                                                       
item.setFields(prodItem.getFields());
+                                                       LOG.info("Field: " + 
prodItem.getFields());
+                                                       
internalResult.addInfoPageResult(item);
+                                               }
                                        }
-                               }*/
+                               } else {
+                                       LOG.info("Firmaet har ingen info page 
produkter.");
+                               }
 
                                /**
                                 * Hent ut alle produkter som er lagt inn på 
søkeresultatet.
                                 * 
                                 */
-                               /*if (eksternt.hasListingProducts()) {
+                               if (eksternt.hasListingProducts()) {
                                        for 
(no.schibstedsok.alfa.external.dto.ProductResultItem prodItem : eksternt
                                                        .getListingProducts()) {
                                                ProductResultItem item = new 
ProductSearchResultItem();
+
                                                
item.setFields(prodItem.getFields());
+                                               if (prodItem.getFields().size() 
> 0) {
+                                                       LOG.info("Field: " + 
prodItem.getFields());
+                                                       
internalResult.addListingResult(item);
+                                               }
+
                                        }
+                               } else {
+                                       LOG.info("Firmaet har ingen result page 
produkter.");
                                }
 
-                               cat.addProducts(internalResult);*/
+                               cat.addProducts(internalResult);
 
                        } catch (Exception e) {
                                System.out.print(e);

_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits

Reply via email to