00001 /* 00002 * OpenMobileIS - a free Java(TM) Framework for mobile applications Java(TM) 00003 * Copyright (C) 2004-2005 Philippe Delrieu 00004 * All rights reserved. 00005 * Contact: openmobileis@e-care.fr 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00020 * USA 00021 * 00022 * Author : Philippe Delrieu 00023 * 00024 */ 00025 00026 package org.openmobileis.synchro.openmsp.protocol; 00027 00038 public class Result extends ResponseCommand implements Element { 00043 final static long serialVersionUID = 1L; 00044 00045 00046 00047 protected String meta; 00048 protected String targetRef; 00049 protected String sourceRef; 00050 00051 00052 00053 protected Result () { 00054 super(AbstractCommand.RESULT); 00055 } 00056 00057 public Result(int cmdRef, String sourceRef, String targetRef) { 00058 super (AbstractCommand.RESULT ,cmdRef); 00059 this.sourceRef = sourceRef; 00060 this.targetRef = targetRef; 00061 } 00062 00063 00064 public String getMetaInformation() { 00065 return meta; 00066 } 00067 00068 public String getTargetRef() { 00069 return targetRef; 00070 } 00071 00072 public String getSourceRef() { 00073 return sourceRef; 00074 } 00075 00076 public String toString() { 00077 return super.toString() + "meta : " + meta + " sourceRef " + sourceRef + " targetRef " + targetRef; 00078 } 00079 00080 /*** Implements Element interface **/ 00081 public void setSourceRef(String source){ 00082 sourceRef = source; 00083 } 00084 00085 public void setTargetRef(String target){ 00086 targetRef = target; 00087 } 00088 00089 public void setMetaInformation (String meta) { 00090 this.meta = meta; 00091 } 00092 00093 public void writeContent(StringBuffer buffer) { 00094 super.writeContent(buffer); 00095 if (meta != null) { 00096 MessageFactory.writeElement(buffer, MessageFactory.TAG_META, meta); 00097 buffer.append("\n"); 00098 } 00099 if (sourceRef != null) { 00100 MessageFactory.writeElement(buffer, MessageFactory.TAG_SOURCE_REF, sourceRef); 00101 buffer.append("\n"); 00102 } 00103 if (targetRef != null) { 00104 MessageFactory.writeElement(buffer, MessageFactory.TAG_TARGET_REF, targetRef); 00105 buffer.append("\n"); 00106 } 00107 } 00108 00109 }