1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.db;
14 import java.util.Collection;
16 import org.simantics.db.event.ChangeEvent;
17 import org.simantics.db.event.ChangeListener;
18 import org.simantics.db.request.Write;
19 import org.simantics.db.request.WriteOnly;
20 import org.simantics.db.service.GraphChangeListenerSupport;
23 * A representation of a set of changes that have been performed into the graph
24 * database using a write request ({@link Write}, {@link WriteOnly}).
27 * The change information is allowed to be inexact in the sense that these
28 * changes may represent what is attempted to commit into the database but some
29 * of the changes may turn out to be null operations in the end: a claimed
30 * statement may have already existed or a denied statement may not exist in the
31 * first place. Hence, a ChangeSet tells what statement changes have possibly
32 * been performed and what resource-bound values have possibly changed.
34 * @author Tuukka Lehtonen
36 * @see GraphChangeListenerSupport
40 public interface ChangeSet {
42 public interface StatementChange extends Statement {
44 * @return <code>true</code> if the statement was claimed,
45 * <code>false</code> if denied.
51 * TODO: specify whether the collection is considered a set or a list
52 * (duplicate statements allowed or not)
54 * The returned collection may be shared internal state of the
55 * implementation and must not be modified by the client.
57 * @return the set of changed statements, each either claimed or denied
59 Collection<StatementChange> changedStatements();
62 * TODO: specify whether the collection is considered a set or a list
63 * (duplicate statements allowed or not)
65 * The returned collection may be shared internal state of the
66 * implementation and must not be modified by the client.
68 * @return the set of changed values, either claimed or denied
70 Collection<Resource> changedValues();
72 Collection<Resource> changedResources();
75 * @return <code>true</code> if this change set contains 0 operations,
76 * <code>false</code> otherwise