| /** |
| * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Florian Pirchner - Initial implementation |
| */ |
| package org.eclipse.osbp.runtime.common.state; |
| |
| import org.eclipse.osbp.runtime.common.hash.HashUtil; |
| |
| /** |
| * Different participants may share data. |
| * <p> |
| * For instance an {@link IDataState}. In a business application groups of views |
| * may share the same data like beans. And other groups of views will share |
| * their own data. A shared environment is an abstraction above this group. |
| * Views may share the {@link ISharedStateContext} and will also share their |
| * properties and data. |
| * |
| */ |
| public interface ISharedStateContext { |
| |
| /** |
| * Returns the unique id of the environment. |
| * |
| * @return the id |
| */ |
| String getId(); |
| |
| /** |
| * Set and key value pair to be shared in the environment. |
| * |
| * @param key |
| * the key |
| * @param value |
| * the value |
| */ |
| void setProperty(Object key, Object value); |
| |
| /** |
| * Returns the value for the key or <code>null</code> if no value |
| * registered. |
| * |
| * @param key |
| * the key |
| * @return the property |
| */ |
| Object getProperty(Object key); |
| |
| /** |
| * Returns all keys that are registered in the environment. |
| * |
| * @return the property keys |
| */ |
| Object[] getPropertyKeys(); |
| |
| /** |
| * Returns the dirty state that contains all dirty objects for the shared |
| * state. |
| * |
| * @return the dirty state |
| */ |
| IDataState getDirtyState(); |
| |
| /** |
| * Returns the "used state" that contains all objects that are currently |
| * used for the shared state. |
| * |
| * @return the global data state |
| */ |
| IDataState getGlobalDataState(); |
| |
| /** |
| * Returns an immutable compound state that handles the global and dirty |
| * state. |
| * |
| * @return the dirty aware global state |
| */ |
| IDataState getDirtyAwareGlobalState(); |
| |
| /** |
| * Makes the given dto undirty. |
| * |
| * @param key |
| * the key |
| * @param dto |
| * the dto |
| */ |
| void makeUndirty(Object key, Object dto); |
| |
| /** |
| * Adds a new "not persistent" entry. The key will be calculated using the |
| * {@link HashUtil}. |
| * <p> |
| * The object will be put into the dirtyState but not the global state. |
| * |
| * @param newEntry |
| * the new entry |
| */ |
| void addNewTransient(Object newEntry); |
| |
| } |