1 4 package com.openedit.store; 5 6 import java.util.List ; 7 8 12 public abstract class CatalogConverter extends Converter 13 { 14 22 26 protected void saveOutput(Store inStore, List inOutputAllProducts ) throws Exception 27 { 28 for (int i = 0; i < inOutputAllProducts.size(); i++) 29 { 30 Product product = (Product) inOutputAllProducts.get(i); 31 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 public String parseDescription( String 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 out = new StringBuffer (inString.substring(0,start) ); 55 out.append( inString.substring(end+2,inString.length())); 56 return out.toString().trim(); 57 } 58 } 59 60 public String parseKeywords( String 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 |