View Javadoc

1   /*
2    * This file is a part of CAST project.
3    * (c) Copyright 2007, AGH University of Science & Technology
4    * https://caribou.iisg.agh.edu.pl/trac/cast
5    *
6    * Licensed under the Eclipse Public License, Version 1.0 (the "License").
7    * You may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    * http://www.eclipse.org/legal/epl-v10.html
10   */
11  /*
12   * File: AbstractRemover.java
13   * Created: 2007-11-17
14   * Author: entrop
15   * $Id: AbstractRemover.java 2232 2009-01-04 22:59:53Z apohllo $
16   */
17  
18  package pl.edu.agh.cast.model.mapper.internal;
19  
20  import java.util.List;
21  
22  import org.apache.log4j.Logger;
23  
24  import pl.edu.agh.cast.model.base.BasePlugin;
25  import pl.edu.agh.cast.model.base.IDataSet;
26  import pl.edu.agh.cast.model.base.IModel;
27  import pl.edu.agh.cast.model.mapper.Mappable;
28  import pl.edu.agh.cast.model.mapper.Remover;
29  
30  /**
31   * The partial implementation of the remover interface.
32   *
33   * @author AGH CAST Team
34   *
35   */
36  public abstract class AbstractRemover implements Remover {
37  	/**
38  	 * The logger.
39  	 */
40  	protected static Logger log = BasePlugin.getLogger();
41  
42  	/**
43  	 * The model to remove.
44  	 */
45  	protected Mappable primaryObject;
46  
47  	/**
48  	 * The default constructor.
49  	 * @param object The object to remove.
50  	 */
51  	public AbstractRemover(Mappable object) {
52  		primaryObject = object;
53  	}
54  
55  	protected static void removeDataSetFromModel(IDataSet dataSet) {
56  		IModel model = dataSet.getModel();
57  		List<IDataSet> dataSets = model.getDataSets();
58  		dataSets.remove(dataSet);
59  		model.setDataSets(dataSets);
60  	}
61  }