| Home >> All >> com >> sonoma >> [ objects Javadoc ] |
Source code: com/sonoma/objects/dbNewArticle.java
1 /* 2 * dbArticle.java 3 * 4 * Created on October 4, 2001, 5:37 AM 5 */ 6 package com.sonoma.objects; 7 8 import java.util.*; 9 10 /** 11 * 12 * @author Administrator 13 * @version 14 */ 15 public class dbNewArticle extends Object { 16 private String msGroup; 17 private String msDay; 18 private String msMonth; 19 private String msYear; 20 private String msTime; 21 private String msTimePart; 22 private String msTitle; 23 private String msDescription; 24 private String msURLTitle; 25 private String msURL; 26 private String msPictureFile; 27 private String msContent; 28 /** Creates new dbArticle */ 29 public dbNewArticle() { 30 } 31 public void setGroup(String value){ 32 msGroup = value; 33 } 34 public String getGroup(){ 35 return msGroup; 36 } 37 public void setDay(String value){ 38 msDay = value; 39 } 40 public String getDay(){ 41 return msDay; 42 } 43 public void setMonth(String value){ 44 msMonth = value; 45 } 46 public String getMonth(){ 47 return msMonth; 48 } 49 public void setYear(String value){ 50 msYear = value; 51 } 52 public String getYear(){ 53 return msYear; 54 } 55 public void setTime(String value){ 56 msTime = value; 57 } 58 public String getTime(){ 59 return msTime; 60 } 61 public void setTimePart(String value){ 62 msTimePart = value; 63 } 64 public String getTimePart(){ 65 return msTimePart; 66 } 67 public void setTitle(String value){ 68 msTitle = value; 69 } 70 public String getTitle(){ 71 return msTitle; 72 } 73 public void setDescription(String value){ 74 msDescription = value; 75 } 76 public String getDescription(){ 77 return msDescription; 78 } 79 public void setURLTitle(String value){ 80 msURLTitle = value; 81 } 82 public String getURLTitle(){ 83 return msURLTitle; 84 } 85 public void setURL(String value){ 86 msURL = value; 87 } 88 public String getURL(){ 89 return msURL; 90 } 91 public void setPictureFile(String value){ 92 msPictureFile = value; 93 } 94 public String getPictureFile(){ 95 return msPictureFile; 96 } 97 public void setContent(String value){ 98 msContent = value; 99 } 100 public String getContent(){ 101 return msContent; 102 } 103 public String[] getContentParagraphs(){ 104 Vector v = new Vector(); 105 v = split(msContent,"\n"); 106 int i = v.size(); 107 String[] ar = new String[i]; 108 for (int t=0; t<i;t++){ 109 ar[t] = (String) v.elementAt(t); 110 System.out.println("Adding Split: " + ar[t]); 111 } 112 return ar; 113 } 114 public Vector getSpParagraphVector(){ 115 Vector v = new Vector(); 116 String[] arURL; 117 String[] arURLTitle; 118 String[] arPicture; 119 String[] arContents; 120 String[] arParagraphContent = new String[1]; 121 122 com.sonoma.objects.spParagraph para; 123 arContents = getContentParagraphs(); 124 for(int i=0;i<arContents.length;i++){ 125 para = new com.sonoma.objects.spParagraph(); 126 arURL = new String[1]; 127 arURLTitle = new String[1]; 128 arPicture = new String[1]; 129 arParagraphContent = new String[1]; 130 if (i==0){ 131 arURL[0] = msURL; 132 arURLTitle[0] = msURLTitle; 133 arPicture[0] = msPictureFile; 134 para.setTitle(msTitle); 135 para.setURL (arURL); 136 para.setURLTitle(arURLTitle); 137 para.setPictureFile(arPicture); 138 } 139 arParagraphContent[0] = arContents[i]; 140 para.setContent(arParagraphContent); 141 System.out.println("content: " + arContents[i]); 142 v.add(para); 143 } 144 return v; 145 } 146 147 private Vector split (String str, String delim) 148 { 149 Vector v = new Vector(); 150 int pos_1; 151 int pos_2; 152 153 //Set initial delimiter positions... 154 pos_1 = 0; 155 pos_2 = 0; 156 157 //Start chopping off bits from the string 158 //until left boundary reaches the length of string 159 while ( pos_1 <= str.length() ) 160 { 161 pos_2 = str.indexOf(delim, pos_1); 162 if ( pos_2 < 0 ) 163 pos_2 = str.length(); 164 165 String sub = str.substring (pos_1, pos_2); 166 167 pos_1 = pos_2 + 1; 168 if (sub.length()>2){ 169 v.addElement(sub); 170 } 171 } 172 173 return v; 174 } 175 176 }