package votorola.s.gwt.stage.talk; // Copyright 2012, Christian Weilbach. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Votorola Software"), to deal in the Votorola Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Votorola Software, and to permit persons to whom the Votorola Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Votorola Software. THE VOTOROLA SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE VOTOROLA SOFTWARE OR THE USE OR OTHER DEALINGS IN THE VOTOROLA SOFTWARE. import java.util.Date; import votorola.g.lang.Equator; import votorola.g.web.gwt.JavaScriptObjectX; import votorola.a.diff.DiffLookJS; import votorola.s.gwt.stage.Message; import votorola.s.gwt.stage.MessageJS; /** * JavaScriptObject from JSON output of {@linkplain votorola.s.wap.HarvestWAP} * representing a serialized * {@linkplain votorola.a.diff.harvest.cache.DiffMessage}. * */ public final class DiffMessageJS extends JavaScriptObjectX { protected DiffMessageJS() { } // precisely one constructor, protected, empty and no arguments public Message message() { return _get("message"); } public DiffLookJS difference() { return _get("difference"); } public String sender() { return _get("sender"); } public String addressee() { return _get("addressee"); } public native double sentDate() /*-{ return this.sentDate; }-*/; public static Equator EQUATOR = new Equator() { public boolean equals(final DiffMessageJS d1, final DiffMessageJS d2) { if(d1 == d2){ return true; } return d1 instanceof DiffMessageJS && d2 instanceof DiffMessageJS && MessageJS.EQUATOR.equals(d1.message(), d2.message()) && DiffLookJS.EQUATOR.equals(d1.difference(), d2.difference()); } }; /** * id in the DB. This allows to query for newly fetched messages, having a * higher id than this message. * * @return id */ public native int id() /*-{ return this.id; }-*/; }