1 package org.telscenter.pas.steps.actions; 2 3 import java.awt.event.ActionEvent; 4 import java.util.HashMap; 5 import java.util.Map; 6 7 import net.sf.sail.core.entity.ISock; 8 9 import org.telscenter.pas.steps.Assessment; 10 import org.telscenter.pas.steps.domain.AssessmentItem; 11 import org.telscenter.pas.steps.domain.ResponseDeclaration; 12 13 14 /*** 15 * TODO revisit the factoring of this 16 * 17 * @author aperritano, turadg 18 */ 19 public class NoteSaveAction extends DialogSaveAction { 20 21 private AssessmentItem assessmentItem; 22 23 private Map<ResponseDeclaration, ISock<String>> responseDeclarationToSocks = new HashMap<ResponseDeclaration, ISock<String>>(); 24 25 protected Map<String, Object> responses = new HashMap<String, Object>(); 26 27 protected boolean saved = false; 28 29 public NoteSaveAction() { 30 super("Save Note"); 31 } 32 33 public NoteSaveAction(AssessmentItem assessmentItem, Map<String, Object> responses, Map<ResponseDeclaration, ISock<String>> responseDeclarationToSocks) { 34 super("Save Note"); 35 this.assessmentItem = assessmentItem; 36 this.responses = responses; 37 this.responseDeclarationToSocks = responseDeclarationToSocks; 38 } 39 40 public void actionPerformed(ActionEvent e) { 41 super.actionPerformed(e); 42 doSave(); 43 saved = true; 44 } 45 46 public boolean isSaved() { 47 return saved; 48 } 49 50 /*** 51 * Saves all the responses to rims 52 * 53 * @param clientProperty 54 */ 55 protected void doSave() { 56 Assessment.saveAssessmentItem(assessmentItem, responses, responseDeclarationToSocks); 57 } 58 59 }