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