001/*
002 * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Max Stepanov
016 *
017 * $Id$
018 */
019
020package org.nuxeo.ecm.platform.domsync.core.events;
021
022/**
023 * @author Max Stepanov
024 */
025public class DOMAttrModifiedEvent extends DOMMutationEvent {
026
027    private static final long serialVersionUID = -1903741037336659664L;
028
029    private final String attrName;
030
031    private final short attrChange;
032
033    private final String newValue;
034
035    public DOMAttrModifiedEvent(String target, String attrName, short attrChange, String newValue) {
036        super(target);
037        this.attrName = attrName;
038        this.attrChange = attrChange;
039        this.newValue = newValue;
040    }
041
042    public String getAttrName() {
043        return attrName;
044    }
045
046    public short getAttrChange() {
047        return attrChange;
048    }
049
050    public String getNewValue() {
051        return newValue;
052    }
053
054    @Override
055    public boolean equals(Object obj) {
056        if (obj instanceof DOMAttrModifiedEvent) {
057            DOMAttrModifiedEvent other = (DOMAttrModifiedEvent) obj;
058            return super.equals(obj) && attrName.equals(other.attrName) && attrChange == other.attrChange
059                    && newValue.equals(other.newValue);
060        }
061        return false;
062    }
063
064    @Override
065    public String toString() {
066        return "DOMAttrModifiedEvent " + super.toString() + " attrName=" + attrName + " attrChange=" + attrChange
067                + " newValue=" + newValue;
068    }
069
070}