KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > store > CatalogConverter


1 /*
2  * Created on Sep 15, 2004
3  */

4 package com.openedit.store;
5
6 import java.util.List JavaDoc;
7
8 /**
9  * @author cburkey
10  *
11  */

12 public abstract class CatalogConverter extends Converter
13 {
14     /*
15     protected ProductArchive fieldProductArchive;
16     
17     public File productDirectory()
18     {
19         return new File( getStore().getStoreDirectory(),"products");
20     }
21 */

22     /**
23      *
24      * @param inOutputAllProducts
25      */

26     protected void saveOutput(Store inStore, List JavaDoc inOutputAllProducts ) throws Exception JavaDoc
27     {
28         for (int i = 0; i < inOutputAllProducts.size(); i++)
29         {
30             Product product = (Product) inOutputAllProducts.get(i);
31             //product
32
if ( product.getOrdering() == -1)
33             {
34                 product.setOrdering(i);
35             }
36             product.setAvailable(true);
37             inStore.getProductArchive().saveProduct( product );
38             inStore.getProductArchive().saveBlankProductDescription(product);
39         }
40     }
41     
42     //This was used to break up a description into two parts
43
//this it is not used anymore
44
public String JavaDoc parseDescription( String JavaDoc inString )
45     {
46         int start = inString.indexOf("[[");
47         int end = inString.indexOf("]]");
48         if ( start == -1 || end == -1 )
49         {
50             return inString;
51         }
52         else
53         {
54             StringBuffer JavaDoc out = new StringBuffer JavaDoc(inString.substring(0,start) );
55             out.append( inString.substring(end+2,inString.length()));
56             return out.toString().trim();
57         }
58     }
59     
60     public String JavaDoc parseKeywords( String JavaDoc inString )
61     {
62         int start = inString.indexOf("[[");
63         int end = inString.indexOf("]]");
64         if ( start == -1 || end == -1 )
65         {
66             return null;
67         }
68         else
69         {
70             return inString.substring(start+2,end).trim();
71         }
72     }
73
74
75 }
76
Popular Tags