Commit b5f1c021 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

method parameter must be final

parent 6b8e255a

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
......@@ -33,7 +33,7 @@ public class CopyAction extends CopyPasteAbstractAction {
* @param speciesList
* - list of species to annotate
*/
public void performAnnotation(CopyPastePlugin plug, PluginListOf speciesList) {
public void performAnnotation(final CopyPastePlugin plug, final PluginListOf speciesList) {
SystemClipboard sc = new SystemClipboard();
int size = speciesList.size();
......@@ -70,7 +70,7 @@ public class CopyAction extends CopyPasteAbstractAction {
if (chosenElement != null) {
try {
sc.setClipboardContents(getCopyString(chosenElement.getAnnotationString(), chosenElement.getNotesString()));
} catch (InvalidXmlSchemaException e) {
} catch (final InvalidXmlSchemaException e) {
logger.warn("Problem with creating copy-paste String", e);
}
}
......
......@@ -40,7 +40,7 @@ public class CopyPasteAbstractAction {
* object to serialize
* @return string representation of {@link MiriamData}
*/
protected String serialize(MiriamData md) {
protected String serialize(final MiriamData md) {
return PREFIX + "\t" + md.getRelationType().getStringRepresentation() + "\t" + md.getDataType().getUris().get(0)
+ "\t" + md.getResource();
}
......@@ -53,7 +53,7 @@ public class CopyPasteAbstractAction {
* string representation of {@link MiriamData}
* @return {@link MiriamData} obtained from input string
*/
protected MiriamData deserialize(String string) {
protected MiriamData deserialize(final String string) {
if (string == null) {
return null;
}
......@@ -88,11 +88,11 @@ public class CopyPasteAbstractAction {
* @throws InvalidXmlSchemaException
* thrown when xmlString is invalid
*/
protected String getCopyString(String annotationString, String notesString) throws InvalidXmlSchemaException {
protected String getCopyString(final String annotationString, final String notesString) throws InvalidXmlSchemaException {
XmlAnnotationParser xap = new XmlAnnotationParser();
Set<MiriamData> set = xap.parse(annotationString, null);
StringBuilder result = new StringBuilder();
for (MiriamData md : set) {
for (final MiriamData md : set) {
result.append(serialize(md) + "\n");
}
result.append(notesString);
......@@ -108,7 +108,7 @@ public class CopyPasteAbstractAction {
*
* @return {@link Pair} of {@link MiriamData} set and notes string
*/
protected Pair<Set<MiriamData>, String> getAnnotationDataFromClipboardString(String value) {
protected Pair<Set<MiriamData>, String> getAnnotationDataFromClipboardString(final String value) {
if (value == null) {
return new Pair<Set<MiriamData>, String>(null, null);
}
......
......@@ -65,14 +65,14 @@ public class CopyPastePlugin extends CellDesignerPlugin {
// create keyboard listener for shortcuts
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(createKeyEventDispatcher());
} catch (Exception exception) {
} catch (final Exception exception) {
logger.error(exception, exception);
}
}
protected KeyEventDispatcher createKeyEventDispatcher() {
return new KeyEventDispatcher() {
public boolean dispatchKeyEvent(KeyEvent e) {
public boolean dispatchKeyEvent(final KeyEvent e) {
switch (e.getID()) {
case KeyEvent.KEY_PRESSED:
if (e.getKeyCode() == java.awt.event.KeyEvent.VK_V
......@@ -101,33 +101,33 @@ public class CopyPastePlugin extends CellDesignerPlugin {
// CHECKSTYLE:OFF
@Override
public void SBaseAdded(PluginSBase arg0) {
public void SBaseAdded(final PluginSBase arg0) {
}
@Override
public void SBaseChanged(PluginSBase arg0) {
public void SBaseChanged(final PluginSBase arg0) {
}
// CHECKSTYLE:ON
@Override
public void SBaseDeleted(PluginSBase arg0) {
public void SBaseDeleted(final PluginSBase arg0) {
}
@Override
public void modelOpened(PluginSBase arg0) {
public void modelOpened(final PluginSBase arg0) {
}
@Override
public void modelSelectChanged(PluginSBase arg0) {
public void modelSelectChanged(final PluginSBase arg0) {
}
@Override
public void modelClosed(PluginSBase arg0) {
public void modelClosed(final PluginSBase arg0) {
}
......
......@@ -39,17 +39,17 @@ public class CopyPluginAction extends PluginAction {
* @param win
* {@link #window}
*/
public CopyPluginAction(CopyPastePlugin plugin, MainWindow win) {
public CopyPluginAction(final CopyPastePlugin plugin, final MainWindow win) {
this.plugin = plugin;
}
@Override
public void myActionPerformed(ActionEvent e) {
public void myActionPerformed(final ActionEvent e) {
try {
CopyAction annotateAction = new CopyAction();
PluginListOf list = getPlugin().getSelectedAllNode();
annotateAction.performAnnotation(getPlugin(), list);
} catch (Exception ex) {
} catch (final Exception ex) {
logger.error(ex, ex);
}
}
......@@ -58,7 +58,7 @@ public class CopyPluginAction extends PluginAction {
return plugin;
}
protected void setPlugin(CopyPastePlugin plugin) {
protected void setPlugin(final CopyPastePlugin plugin) {
this.plugin = plugin;
}
......
......@@ -37,7 +37,7 @@ public class PasteAction extends CopyPasteAbstractAction {
* @param speciesList
* - list of species to annotate
*/
public void performAnnotation(CopyPastePlugin plug, PluginListOf speciesList) {
public void performAnnotation(final CopyPastePlugin plug, final PluginListOf speciesList) {
XmlAnnotationParser xap = new XmlAnnotationParser();
SystemClipboard sc = new SystemClipboard();
......
......@@ -39,17 +39,17 @@ public class PastePluginAction extends PluginAction {
* @param win
* {@link #window}
*/
public PastePluginAction(CopyPastePlugin plugin, MainWindow win) {
public PastePluginAction(final CopyPastePlugin plugin, final MainWindow win) {
this.setPlugin(plugin);
}
@Override
public void myActionPerformed(ActionEvent e) {
public void myActionPerformed(final ActionEvent e) {
try {
PasteAction annotateAction = new PasteAction();
PluginListOf list = getPlugin().getSelectedAllNode();
annotateAction.performAnnotation(plugin, list);
} catch (Exception ex) {
} catch (final Exception ex) {
logger.error(ex, ex);
}
}
......@@ -58,7 +58,7 @@ public class PastePluginAction extends PluginAction {
return plugin;
}
protected void setPlugin(CopyPastePlugin plugin) {
protected void setPlugin(final CopyPastePlugin plugin) {
this.plugin = plugin;
}
......
......@@ -136,7 +136,7 @@ public final class InfoFrame {
JPanel controlArea = new JPanel(new GridLayout(panels, 1));
controlArea.setLayout(new BoxLayout(controlArea, BoxLayout.Y_AXIS));
// for every species create a panel and add it to general form
for (PluginSpeciesAlias sp : this.species) {
for (final PluginSpeciesAlias sp : this.species) {
JPanel panel = getPanelViewForSpecies(sp);
controlArea.add(panel);
}
......@@ -167,7 +167,7 @@ public final class InfoFrame {
* CellDesigner species alias
* @return {@link JPanel} object with information about species
*/
private JPanel getPanelViewForSpecies(PluginSpeciesAlias species) {
private JPanel getPanelViewForSpecies(final PluginSpeciesAlias species) {
JPanel result = new JPanel();
result.setLayout(new BoxLayout(result, BoxLayout.Y_AXIS));
......@@ -214,7 +214,7 @@ public final class InfoFrame {
* @param visible
* should the frame be visible or not
*/
public void setVisible(boolean visible) {
public void setVisible(final boolean visible) {
frame.setVisible(visible);
}
......@@ -224,7 +224,7 @@ public final class InfoFrame {
* @param title
* title of the frame
*/
public void setTitle(String title) {
public void setTitle(final String title) {
frame.setTitle(title);
}
......@@ -243,7 +243,7 @@ public final class InfoFrame {
* @param type
* new {@link JFrame#defaultCloseOperation} value
*/
public void setDefaultCloseOperation(int type) {
public void setDefaultCloseOperation(final int type) {
frame.setDefaultCloseOperation(type);
}
......@@ -253,7 +253,7 @@ public final class InfoFrame {
* @param always
* new {@link JFrame#isAlwaysOnTop()} value
*/
public void setAlwaysOnTop(boolean always) {
public void setAlwaysOnTop(final boolean always) {
frame.setAlwaysOnTop(always);
}
......@@ -267,7 +267,7 @@ public final class InfoFrame {
* @param species
* - species to be shown in the form
*/
public void setSpecies(List<PluginSpeciesAlias> species) {
public void setSpecies(final List<PluginSpeciesAlias> species) {
this.species = species;
updateSpecies();
}
......
......@@ -70,7 +70,7 @@ public class InfoPlugin extends CellDesignerPlugin {
// create keyboard listener for shortcuts
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher() {
public boolean dispatchKeyEvent(KeyEvent e) {
public boolean dispatchKeyEvent(final KeyEvent e) {
if (KeyEvent.KEY_PRESSED == e.getID()) {
// if someone hits CTRL+T then open/hide info window
if (e.getKeyCode() == java.awt.event.KeyEvent.VK_T
......@@ -94,7 +94,7 @@ public class InfoPlugin extends CellDesignerPlugin {
private String selectedElementsId = "";
@Override
public void actionPerformed(ActionEvent arg0) {
public void actionPerformed(final ActionEvent arg0) {
// if there is no open model then getSelectedAllNode() will throw an
// exception...
List<PluginSpeciesAlias> aliasList = getListOfAlias();
......@@ -113,7 +113,7 @@ public class InfoPlugin extends CellDesignerPlugin {
selectedElementsId = newId;
frame.setSpecies(v);
}
} catch (Exception exception) {
} catch (final Exception exception) {
logger.error(exception, exception);
}
......@@ -123,7 +123,7 @@ public class InfoPlugin extends CellDesignerPlugin {
Timer timer = new Timer(DELAY_BETWEEN_ON_SELECT_LISTENER_CHECKS, onChangeSelectListener);
timer.start();
} catch (Exception exception) {
} catch (final Exception exception) {
logger.error("Unhandled exception. ", exception);
}
}
......@@ -134,33 +134,33 @@ public class InfoPlugin extends CellDesignerPlugin {
// CHECKSTYLE:OFF
@Override
public void SBaseAdded(PluginSBase arg0) {
public void SBaseAdded(final PluginSBase arg0) {
}
@Override
public void SBaseChanged(PluginSBase arg0) {
public void SBaseChanged(final PluginSBase arg0) {
}
// CHECKSTYLE:ON
@Override
public void SBaseDeleted(PluginSBase arg0) {
public void SBaseDeleted(final PluginSBase arg0) {
}
@Override
public void modelOpened(PluginSBase arg0) {
public void modelOpened(final PluginSBase arg0) {
}
@Override
public void modelSelectChanged(PluginSBase arg0) {
public void modelSelectChanged(final PluginSBase arg0) {
}
@Override
public void modelClosed(PluginSBase arg0) {
public void modelClosed(final PluginSBase arg0) {
}
......@@ -175,7 +175,7 @@ public class InfoPlugin extends CellDesignerPlugin {
result.add(alias);
}
}
} catch (Exception e) {
} catch (final Exception e) {
}
return result;
}
......
......@@ -56,7 +56,7 @@ public class CdPluginFunctions {
return appender.getFatals();
}
protected PluginListOf createPluginListWithSpecies(int size) {
protected PluginListOf createPluginListWithSpecies(final int size) {
PluginListOf list = Mockito.mock(PluginListOf.class);
Mockito.when(list.size()).thenReturn(size);
......@@ -67,7 +67,7 @@ public class CdPluginFunctions {
return list;
}
protected PluginListOf createPluginListWithReaction(int size) {
protected PluginListOf createPluginListWithReaction(final int size) {
PluginListOf list = Mockito.mock(PluginListOf.class);
Mockito.when(list.size()).thenReturn(size);
......@@ -78,7 +78,7 @@ public class CdPluginFunctions {
return list;
}
protected PluginSpeciesAlias createSpeciesAlias(String id) {
protected PluginSpeciesAlias createSpeciesAlias(final String id) {
PluginSpecies species = Mockito.mock(PluginSpecies.class);
Mockito.when(species.getId()).thenReturn(id);
Mockito.when(species.getAnnotationString()).thenReturn(rdfString);
......@@ -89,7 +89,7 @@ public class CdPluginFunctions {
return speciesAlias;
}
private PluginReaction createReaction(String id) {
private PluginReaction createReaction(final String id) {
PluginReaction reaction = Mockito.mock(PluginReaction.class);
Mockito.when(reaction.getId()).thenReturn("re" + id);
......
......@@ -73,26 +73,26 @@ public final class ApplicationLevelCache implements QueryCacheInterface {
}
@Override
public synchronized Node getXmlNodeByQuery(String query, CacheType type) {
public synchronized Node getXmlNodeByQuery(final String query, final CacheType type) {
Node result = null;
result = cachedQueryNodes.get(type.getId() + "\n" + query);
return result;
}
@Override
public synchronized String getStringByQuery(String query, CacheType type) {
public synchronized String getStringByQuery(final String query, final CacheType type) {
String result = null;
result = cachedQueryString.get(type.getId() + "\n" + query);
return result;
}
@Override
public synchronized void setCachedQuery(String query, CacheType type, Object object) {
public synchronized void setCachedQuery(final String query, final CacheType type, final Object object) {
setCachedQuery(query, type, object, 0);
}
@Override
public synchronized void setCachedQuery(String query, CacheType type, Object object, int validDays) {
public synchronized void setCachedQuery(final String query, final CacheType type, final Object object, final int validDays) {
performMemoryBalance();
if (object instanceof String) {
......@@ -114,13 +114,13 @@ public final class ApplicationLevelCache implements QueryCacheInterface {
}
@Override
public synchronized void removeByQuery(String query, CacheType type) {
public synchronized void removeByQuery(final String query, final CacheType type) {
cachedQueryString.remove(type.getId() + "\n" + query);
cachedQueryNodes.remove(type.getId() + "\n" + query);
}
@Override
public void invalidateByQuery(String query, CacheType type) {
public void invalidateByQuery(final String query, final CacheType type) {
removeByQuery(query, type);
}
......@@ -146,7 +146,7 @@ public final class ApplicationLevelCache implements QueryCacheInterface {
System.gc();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
} catch (final InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
......
......@@ -96,7 +96,7 @@ public class BigFileCache {
* Constructor.
*/
@Autowired
public BigFileCache(BigFileEntryDao bigFileEntryDao, ConfigurationDao configurationDao, DbUtils dbUtils) {
public BigFileCache(final BigFileEntryDao bigFileEntryDao, final ConfigurationDao configurationDao, final DbUtils dbUtils) {
this.bigFileEntryDao = bigFileEntryDao;
this.configurationDao = configurationDao;
this.dbUtils = dbUtils;
......@@ -104,7 +104,7 @@ public class BigFileCache {
// when the main program exits
asyncExecutorService = Executors.newScheduledThreadPool(10, new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
public Thread newThread(final Runnable r) {
Thread t = new Thread(r);
t.setDaemon(true);
return t;
......@@ -112,7 +112,7 @@ public class BigFileCache {
});
syncExecutorService = Executors.newScheduledThreadPool(1, new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
public Thread newThread(final Runnable r) {
Thread t = new Thread(r);
t.setDaemon(true);
return t;
......@@ -145,7 +145,7 @@ public class BigFileCache {
* thrown when file should be in file system, but couldn't be found
* there (somebody manually removed it)
*/
public String getAbsolutePathForFile(String url) throws FileNotFoundException {
public String getAbsolutePathForFile(final String url) throws FileNotFoundException {
BigFileEntry entry = bigFileEntryDao.getByUrl(url);
if (entry == null) {
return null;
......@@ -172,7 +172,7 @@ public class BigFileCache {
* thrown when file should be in file system, but couldn't be found
* there (somebody manually removed it)
*/
public String getLocalPathForFile(String url) throws FileNotFoundException {
public String getLocalPathForFile(final String url) throws FileNotFoundException {
BigFileEntry entry = bigFileEntryDao.getByUrl(url);
if (entry == null) {
return null;
......@@ -204,7 +204,7 @@ public class BigFileCache {
* @throws URISyntaxException
* thrown when url is invalid
*/
public void downloadFile(String url, boolean async, IProgressUpdater updater) throws IOException, URISyntaxException {
public void downloadFile(final String url, final boolean async, final IProgressUpdater updater) throws IOException, URISyntaxException {
Callable<Void> computations = null;
if (url.toLowerCase().startsWith("ftp:")) {
computations = new GetFtpFileTask(url, updater);
......@@ -232,7 +232,7 @@ public class BigFileCache {
* thrown when url is invalid
* @throws IOException
*/
private BigFileEntry createEntryForBigFile(String url) throws URISyntaxException, IOException {
private BigFileEntry createEntryForBigFile(final String url) throws URISyntaxException, IOException {
String localPath = configurationDao.getValueByType(ConfigurationElementType.BIG_FILE_STORAGE_DIR);
BigFileEntry entry = new BigFileEntry();
entry.setDownloadDate(Calendar.getInstance());
......@@ -271,7 +271,7 @@ public class BigFileCache {
* @throws IOException
* thrown when there is a problem with accessing local or remote file
*/
public boolean isLocalFileUpToDate(String url) throws URISyntaxException, IOException {
public boolean isLocalFileUpToDate(final String url) throws URISyntaxException, IOException {
if (url.toLowerCase().startsWith("ftp")) {
return isLocalFtpFileUpToDate(url);
} else if (url.toLowerCase().startsWith("http")) {
......@@ -294,7 +294,7 @@ public class BigFileCache {
* @throws IOException
* thrown when there is a problem with connection to remote server
*/
public boolean isLocalFtpFileUpToDate(String url) throws FileNotFoundException, IOException, URISyntaxException {
public boolean isLocalFtpFileUpToDate(final String url) throws FileNotFoundException, IOException, URISyntaxException {
boolean result = false;
BigFileEntry entry = bigFileEntryDao.getByUrl(url);
if (entry == null) {
......@@ -349,7 +349,7 @@ public class BigFileCache {
* thrown when local file cannot be found or there is a problem with
* accessing remote file
*/
public boolean isLocalHttpFileUpToDate(String url) throws IOException {
public boolean isLocalHttpFileUpToDate(final String url) throws IOException {
boolean result = false;
BigFileEntry entry = bigFileEntryDao.getByUrl(url);
if (entry == null) {
......@@ -377,7 +377,7 @@ public class BigFileCache {
* @throws IOException
* thrown when there is a problem with accessing remote file
*/
long getRemoteHttpFileSize(String url) throws IOException {
long getRemoteHttpFileSize(final String url) throws IOException {
long remoteSize = -1;
HttpURLConnection conn = null;
try {
......@@ -402,9 +402,9 @@ public class BigFileCache {
* @throws IOException
* thrown when there is a problem with deleting file
*/
public void removeFile(String url) throws IOException {
public void removeFile(final String url) throws IOException {
List<BigFileEntry> entries = bigFileEntryDao.getAllByUrl(url);
for (BigFileEntry entry : entries) {
for (final BigFileEntry entry : entries) {
String path = Configuration.getWebAppDir() + entry.getLocalPath();
File f = new File(path);
if (!f.exists()) {
......@@ -432,7 +432,7 @@ public class BigFileCache {
* @throws URISyntaxException
* thrown when url is invalid
*/
public void updateFile(String url, boolean async) throws URISyntaxException, IOException {
public void updateFile(final String url, final boolean async) throws URISyntaxException, IOException {
if (isLocalFileUpToDate(url)) {
logger.warn("File is up to date. Skipping...");
return;
......@@ -456,12 +456,12 @@ public class BigFileCache {
* @throws IOException
* thrown when task finished with {@link IOException}
*/
void executeTask(Future<?> task) throws URISyntaxException, IOException {
void executeTask(final Future<?> task) throws URISyntaxException, IOException {
try {
task.get();
} catch (InterruptedException e) {
} catch (final InterruptedException