001 /*
002 GRANITE DATA SERVICES
003 Copyright (C) 2012 GRANITE DATA SERVICES S.A.S.
004
005 This file is part of Granite Data Services.
006
007 Granite Data Services is free software; you can redistribute it and/or modify
008 it under the terms of the GNU Library General Public License as published by
009 the Free Software Foundation; either version 2 of the License, or (at your
010 option) any later version.
011
012 Granite Data Services is distributed in the hope that it will be useful, but
013 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
014 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
015 for more details.
016
017 You should have received a copy of the GNU Library General Public License
018 along with this library; if not, see <http://www.gnu.org/licenses/>.
019 */
020
021 package org.granite.client.tide.data.spi;
022
023 import java.util.Collection;
024 import java.util.List;
025 import java.util.Map;
026 import java.util.Set;
027
028 import org.granite.client.tide.data.Identifiable;
029 import org.granite.client.tide.data.spi.DataManager.ChangeKind;
030 import org.granite.client.tide.server.TrackingContext;
031
032 /**
033 * @author William DRAI
034 */
035 public interface DirtyCheckContext {
036
037 public void setTrackingContext(TrackingContext trackingContext);
038
039 public void clear(boolean notify);
040
041 public void markNotDirty(Object object, Identifiable entity);
042
043 public boolean checkAndMarkNotDirty(MergeContext mergeContext, Object local, Object received, Object parent);
044
045 public void fixRemovalsAndPersists(MergeContext mergeContext, List<Object> removals, List<Object> persists);
046
047 public boolean isUnsaved(Object object);
048
049 public boolean isEntityChanged(Object entity);
050
051 public boolean isEntityDeepChanged(Object entity);
052
053 public Map<String, Object> getSavedProperties(Object localEntity);
054
055 public void addUnsaved(Identifiable entity);
056
057 public void resetEntity(MergeContext mergeContext, Object entity, Identifiable parent, Set<Object> cache);
058
059 public void resetAllEntities(MergeContext mergeContext, Set<Object> cache);
060
061 public void entityPropertyChangeHandler(Object owner, Object target, String property, Object oldValue, Object newValue);
062
063 public void entityCollectionChangeHandler(Object owner, String property, Collection<?> coll, ChangeKind kind, Integer location, Object[] items);
064
065 public void entityMapChangeHandler(Object owner, String property, Map<?, ?> map, ChangeKind kind, Object[] items);
066
067 }