org.salespointframework.core.data.interfaces
Interface NameContext

All Known Implementing Classes:
AbstractCurrency, CatalogImpl, CountingStockImpl, CurrencyImpl, EUROCurrencyImpl, MoneyBagImpl, StockImpl, StoringStockImpl

public interface NameContext

A name context.

Name contexts are a policy to shield rename functions. You can think of a name context as a name space that comes with certain rules that decide validity of names. One rule could be, for example, that names must be unique in a name context.

Since:
v2.0
Version:
2.0 25/05/1999
Author:
Steffen Zschaler

Method Summary
 void checkNameChange(DataBasket db, java.lang.String sOldName, java.lang.String sNewName)
          Check a name change for compliance with the rules of this NameContext.
 java.lang.Object getNCMonitor()
          Return an object that can be used as a monitor to synchronize name changes.
 void nameHasChanged(DataBasket db, java.lang.String sOldName, java.lang.String sNewName)
          Indicate a successful name change.
 

Method Detail

checkNameChange

void checkNameChange(DataBasket db,
                     java.lang.String sOldName,
                     java.lang.String sNewName)
                     throws NameContextException
Check a name change for compliance with the rules of this NameContext.

If the proposed name change is not valid, a NameContextException is thrown. Otherwise, checkNameChange simply returns.

Parameters:
db - the DataBasket relative to which the name change is to take place.
sOldName - the name to be changed.
sNewName - the new name.
Throws:
NameContextException - if the name change would not be valid.

nameHasChanged

void nameHasChanged(DataBasket db,
                    java.lang.String sOldName,
                    java.lang.String sNewName)
Indicate a successful name change.

Calls to this method indicate to the NameContext that a name change has been successful. The NameContext may adjust internal tables or structures here.

Parameters:
db - the DataBasket relative to which the name change has taken place.
sOldName - the old name of the object whose name was changed.
sNewName - the new name of the object.

getNCMonitor

java.lang.Object getNCMonitor()
Return an object that can be used as a monitor to synchronize name changes. All changes that can influence the return value of checkNameChange(org.salespointframework.core.data.interfaces.DataBasket, java.lang.String, java.lang.String) or the execution of nameHasChanged(org.salespointframework.core.data.interfaces.DataBasket, java.lang.String, java.lang.String) must be synchronized on this monitor.