/* * SaveAnswer.java * * Created on 21. toukokuuta 2003, 11:38 */ package kottarainenbeans; import java.beans.*; import kotkabeans.*; import java.util.*; /** Purpose is to get questionfields(and their results) with fieldindexes * from db and to save answers * * @author tylonen and tmpoyhon */ public class SaveAnswer extends Question implements java.io.Serializable { /** Holds value of property fieldIndexs. */ private String[] fieldIndexes = new String[0]; /** Holds value of property questions. */ private String[] questions = new String[0]; /** Indexed getter for property fieldIndexs. * @param index Index of the property. * @return Value of the property at index. * */ public int getFieldIndexes(int index) { int i=0; try { i = Integer.parseInt(this.fieldIndexes[index]); } catch (NumberFormatException nfe) { } return i; } /** Getter for property fieldIndexs. * @return Value of property fieldIndexs. * */ public String[] getFieldIndexes() { return this.fieldIndexes; } /** Indexed setter for property fieldIndexs. * @param index Index of the property. * @param fieldIndexs New value of the property at index. * */ public void setFieldIndexes(int index, String fieldIndexes) { this.fieldIndexes[index] = fieldIndexes; } /** Setter for property fieldIndexs. * @param fieldIndexs New value of property fieldIndexs. * */ public void setFieldIndexes(String[] fieldIndexes) { this.fieldIndexes = fieldIndexes; } public void getFieldsAndResults(Properties commonVars) { int howmanyFields=fieldIndexes.length; int i=0; DB db=new DB("Haetaan fieldit ja resultit vastausten tallettamiseksi"); try{ db.connect(); while(iindex. * */ public int getQuestions(int index) { int i=0; try { i = Integer.parseInt(this.questions[index]); } catch (NumberFormatException nfe) {} return i; } /** Getter for property questions. * @return Value of property questions. * */ public String[] getQuestions() { return this.questions; } /** Indexed setter for property questions. * @param index Index of the property. * @param questions New value of the property at index. * */ public void setQuestions(int index, String questions) { this.questions[index] = questions; } /** Setter for property questions. * @param questions New value of property questions. * */ public void setQuestions(String[] questions) { this.questions = questions; } }