/**
SpagoBI - The Business Intelligence Free Platform
Copyright (C) 2005 Engineering Ingegneria Informatica S.p.A.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
**/
package it.eng.spagobi.tools.dataset.common.decorator;
import java.util.Iterator;
import it.eng.spagobi.tools.dataset.common.datastore.IDataStore;
import it.eng.spagobi.tools.dataset.common.datastore.IRecord;
/**
* @author Andrea Gioia (andrea.gioia@eng.it)
*
*/
public abstract class AbstractDataStoreDecorator implements IDataStoreDecorator {
IDataStoreDecorator nextDecoratr;
public void decorate(IDataStore dataStore) {
Iterator<IRecord> it = dataStore.iterator();
while(it.hasNext()) {
IRecord record = it.next();
updateDecoration(dataStore, record);
}
}
public void updateDecoration(IDataStore dataStore, IRecord record) {
if( getNextDecoratr() != null) {
getNextDecoratr().updateDecoration(dataStore, record);
}
this.doUpdateDecoration(dataStore, record);
}
abstract void doUpdateDecoration(IDataStore dataStore, IRecord record);
public IDataStoreDecorator getNextDecoratr() {
return nextDecoratr;
}
public void setNextDecoratr(IDataStoreDecorator nextDecoratr) {
this.nextDecoratr = nextDecoratr;
}
}