IDEMPIERE-455 Discover and fix FindBugs problems / Eclipse warning - Fixed generic type warning. Drop classes that's not used anywhere.
This commit is contained in:
parent
8c2efa2b6a
commit
7fcd2cba58
|
@ -66,7 +66,7 @@ public class LDAP
|
||||||
// DirContext ctx = new InitialDirContext(env);
|
// DirContext ctx = new InitialDirContext(env);
|
||||||
|
|
||||||
// Test - Get the attributes
|
// Test - Get the attributes
|
||||||
Attributes answer = ctx.getAttributes("");
|
ctx.getAttributes("");
|
||||||
|
|
||||||
// Print the answer
|
// Print the answer
|
||||||
//if (false)
|
//if (false)
|
||||||
|
@ -156,7 +156,8 @@ public class LDAP
|
||||||
* Print Attributes to System.out
|
* Print Attributes to System.out
|
||||||
* @param attrs
|
* @param attrs
|
||||||
*/
|
*/
|
||||||
private static void dump (Attributes attrs)
|
@SuppressWarnings("unused")
|
||||||
|
private static void dump (Attributes attrs)
|
||||||
{
|
{
|
||||||
if (attrs == null)
|
if (attrs == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,212 +0,0 @@
|
||||||
/******************************************************************************
|
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
|
||||||
* by the Free Software Foundation. This program 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 General Public License for more details. *
|
|
||||||
* You should have received a copy of the GNU General Public License along *
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
|
||||||
* For the text or an alternative of this public license, you may reach us *
|
|
||||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
|
||||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
|
||||||
*****************************************************************************/
|
|
||||||
package org.compiere.model;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Value Object
|
|
||||||
*
|
|
||||||
* @author Jorg Janke
|
|
||||||
* @version $Id: VO.java,v 1.3 2006/07/30 00:58:04 jjanke Exp $
|
|
||||||
*/
|
|
||||||
public class VO
|
|
||||||
implements Map, Serializable
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = -8437638669140712217L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
public VO ()
|
|
||||||
{
|
|
||||||
super ();
|
|
||||||
} // VO
|
|
||||||
|
|
||||||
// private static final long serialVersionUID = 8683452581122892189L;
|
|
||||||
|
|
||||||
/** Keys */
|
|
||||||
private ArrayList<String> m_keys = new ArrayList<String>();
|
|
||||||
/** Values */
|
|
||||||
private ArrayList<String> m_values = new ArrayList<String>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Size
|
|
||||||
* @return size
|
|
||||||
*/
|
|
||||||
public int size ()
|
|
||||||
{
|
|
||||||
return m_keys.size();
|
|
||||||
} // size
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Is Empty
|
|
||||||
* @return true if empty
|
|
||||||
*/
|
|
||||||
public boolean isEmpty ()
|
|
||||||
{
|
|
||||||
return m_keys.isEmpty();
|
|
||||||
} // isEmpty
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Contains Key
|
|
||||||
* @param key key
|
|
||||||
* @return true if contains
|
|
||||||
*/
|
|
||||||
public boolean containsKey (Object key)
|
|
||||||
{
|
|
||||||
if (key == null)
|
|
||||||
return false;
|
|
||||||
return m_keys.contains(key);
|
|
||||||
} // containsKey
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Contains Value
|
|
||||||
* @param value value
|
|
||||||
* @return true if contains value
|
|
||||||
*/
|
|
||||||
public boolean containsValue (Object value)
|
|
||||||
{
|
|
||||||
if (value == null)
|
|
||||||
return false;
|
|
||||||
return m_values.contains(value);
|
|
||||||
} // containsValue
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Value with Key
|
|
||||||
* @param key key
|
|
||||||
* @return value or null
|
|
||||||
*/
|
|
||||||
public synchronized Object get (Object key)
|
|
||||||
{
|
|
||||||
if (key == null)
|
|
||||||
return null;
|
|
||||||
int index = m_keys.indexOf(key);
|
|
||||||
if (index != -1)
|
|
||||||
return m_values.get(index);
|
|
||||||
return null;
|
|
||||||
} // get
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Put key/value
|
|
||||||
* @param key key
|
|
||||||
* @param value value
|
|
||||||
* @return previous value or null
|
|
||||||
*/
|
|
||||||
public synchronized Object put (Object key, Object value)
|
|
||||||
{
|
|
||||||
if (key == null)
|
|
||||||
return null;
|
|
||||||
if (value == null)
|
|
||||||
return remove(key);
|
|
||||||
//
|
|
||||||
String stringKey = key.toString();
|
|
||||||
String stringValue = value.toString();
|
|
||||||
int index = m_keys.indexOf(key);
|
|
||||||
if (index != -1)
|
|
||||||
return m_values.set (index, stringValue);
|
|
||||||
m_values.add(stringKey);
|
|
||||||
m_values.add(stringValue);
|
|
||||||
return null;
|
|
||||||
} // put
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove
|
|
||||||
* @param key key
|
|
||||||
* @return previous value or null
|
|
||||||
*/
|
|
||||||
public synchronized Object remove (Object key)
|
|
||||||
{
|
|
||||||
if (key == null)
|
|
||||||
return null;
|
|
||||||
int index = m_keys.indexOf(key);
|
|
||||||
Object old = null;
|
|
||||||
if (index != -1)
|
|
||||||
{
|
|
||||||
old = m_values.get(index);
|
|
||||||
m_keys.remove(index);
|
|
||||||
m_values.remove(index);
|
|
||||||
}
|
|
||||||
return old;
|
|
||||||
} // remove
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Put All
|
|
||||||
* @param t map
|
|
||||||
*/
|
|
||||||
public void putAll (Map t)
|
|
||||||
{
|
|
||||||
Iterator<?> it = t.keySet().iterator();
|
|
||||||
while (it.hasNext())
|
|
||||||
{
|
|
||||||
Object key = it.next();
|
|
||||||
Object value = t.get(key);
|
|
||||||
put(key, value);
|
|
||||||
}
|
|
||||||
} // putAll
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear keys/values
|
|
||||||
*/
|
|
||||||
public void clear ()
|
|
||||||
{
|
|
||||||
m_keys.clear();
|
|
||||||
m_values.clear();
|
|
||||||
} // clear
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Key Set
|
|
||||||
* @return key set
|
|
||||||
*/
|
|
||||||
public Set<String> keySet ()
|
|
||||||
{
|
|
||||||
HashSet<String> set = new HashSet<String>(m_keys);
|
|
||||||
return set;
|
|
||||||
} // keySet
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Values
|
|
||||||
* @return values as collection
|
|
||||||
*/
|
|
||||||
public Collection<?> values ()
|
|
||||||
{
|
|
||||||
return m_values;
|
|
||||||
} // values
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Values Set
|
|
||||||
* @return values set
|
|
||||||
*/
|
|
||||||
public Set<String> entrySet ()
|
|
||||||
{
|
|
||||||
HashSet<String> set = new HashSet<String>(m_values);
|
|
||||||
return set;
|
|
||||||
} // entrySet
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // VO
|
|
|
@ -1,106 +0,0 @@
|
||||||
/******************************************************************************
|
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
|
||||||
* by the Free Software Foundation. This program 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 General Public License for more details. *
|
|
||||||
* You should have received a copy of the GNU General Public License along *
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
|
||||||
* For the text or an alternative of this public license, you may reach us *
|
|
||||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
|
||||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
|
||||||
*****************************************************************************/
|
|
||||||
package org.compiere.util;
|
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import javax.swing.SwingUtilities;
|
|
||||||
|
|
||||||
import org.compiere.process.ProcessInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ASync Worker for starting methods in classes implementing ASyncProcess
|
|
||||||
*
|
|
||||||
* @author Jorg Janke
|
|
||||||
* @version $Id: ASyncWorker.java,v 1.2 2006/07/30 00:51:05 jjanke Exp $
|
|
||||||
*/
|
|
||||||
public class ASyncWorker extends Thread
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Execute method Synchronously
|
|
||||||
* @param parent parent
|
|
||||||
* @param pi process info
|
|
||||||
* @return result
|
|
||||||
*/
|
|
||||||
public static ProcessInfo executeSync (ASyncProcess parent, ProcessInfo pi)
|
|
||||||
{
|
|
||||||
ASyncWorker worker = new ASyncWorker (parent, pi);
|
|
||||||
worker.start();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
worker.join();
|
|
||||||
}
|
|
||||||
catch (InterruptedException e)
|
|
||||||
{
|
|
||||||
log.log(Level.SEVERE, "executeSync", e);
|
|
||||||
}
|
|
||||||
return worker.getResult();
|
|
||||||
} // executeSync
|
|
||||||
|
|
||||||
/** Logger */
|
|
||||||
private static CLogger log = CLogger.getCLogger(ASyncWorker.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
* @param parent Parent Process
|
|
||||||
* @param pi process info
|
|
||||||
*/
|
|
||||||
public ASyncWorker (ASyncProcess parent, ProcessInfo pi)
|
|
||||||
{
|
|
||||||
m_parent = parent;
|
|
||||||
m_pi = pi;
|
|
||||||
} // ASuncWorker
|
|
||||||
|
|
||||||
private ProcessInfo m_pi;
|
|
||||||
private ASyncProcess m_parent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Worker Method
|
|
||||||
*/
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
SwingUtilities.invokeLater(new Runnable()
|
|
||||||
{
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
m_parent.lockUI(m_pi);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//
|
|
||||||
m_parent.executeASync(m_pi);
|
|
||||||
//
|
|
||||||
|
|
||||||
SwingUtilities.invokeLater(new Runnable()
|
|
||||||
{
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
m_parent.unlockUI (m_pi);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} // run
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Result (usually not used as result is returned via unlockUI
|
|
||||||
* @return result
|
|
||||||
*/
|
|
||||||
public ProcessInfo getResult()
|
|
||||||
{
|
|
||||||
return m_pi;
|
|
||||||
} // getResult
|
|
||||||
|
|
||||||
} // ASyncWorker
|
|
|
@ -1,98 +0,0 @@
|
||||||
/******************************************************************************
|
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
|
||||||
* by the Free Software Foundation. This program 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 General Public License for more details. *
|
|
||||||
* You should have received a copy of the GNU General Public License along *
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
|
||||||
* For the text or an alternative of this public license, you may reach us *
|
|
||||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
|
||||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
|
||||||
*****************************************************************************/
|
|
||||||
package org.compiere.apps;
|
|
||||||
|
|
||||||
import org.compiere.process.ProcessInfo;
|
|
||||||
import org.compiere.util.ASyncProcess;
|
|
||||||
import org.compiere.util.ASyncWorker;
|
|
||||||
import org.compiere.util.Env;
|
|
||||||
import org.compiere.util.Msg;
|
|
||||||
import org.compiere.util.Splash;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ASync Process Base Class
|
|
||||||
*
|
|
||||||
* @author Jorg Janke
|
|
||||||
* @version $Id: ASyncProcessBase.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $
|
|
||||||
*/
|
|
||||||
public abstract class ASyncProcessBase implements ASyncProcess
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
* @param pi process info
|
|
||||||
*/
|
|
||||||
public ASyncProcessBase(ProcessInfo pi)
|
|
||||||
{
|
|
||||||
m_pi = pi;
|
|
||||||
} // ASyncProcessBase
|
|
||||||
|
|
||||||
private ProcessInfo m_pi;
|
|
||||||
private boolean m_isLocked = false;
|
|
||||||
private Splash m_splash;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start ASync Worker
|
|
||||||
*/
|
|
||||||
void start()
|
|
||||||
{
|
|
||||||
if (isUILocked()) // don't start twice
|
|
||||||
return;
|
|
||||||
ASyncWorker worker = new ASyncWorker (this, m_pi);
|
|
||||||
worker.start(); // calls lockUI, executeASync, unlockUI
|
|
||||||
} // start
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lock User Interface.
|
|
||||||
* Called from the Worker before processing
|
|
||||||
* @param pi process info
|
|
||||||
*/
|
|
||||||
public void lockUI (ProcessInfo pi)
|
|
||||||
{
|
|
||||||
m_isLocked = true;
|
|
||||||
m_splash = new Splash (Msg.getMsg(Env.getCtx(), "Processing"));
|
|
||||||
m_splash.toFront();
|
|
||||||
} // lockUI
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unlock User Interface.
|
|
||||||
* Called from the Worker when processing is done
|
|
||||||
* @param pi process info
|
|
||||||
*/
|
|
||||||
public void unlockUI (ProcessInfo pi)
|
|
||||||
{
|
|
||||||
m_isLocked = false;
|
|
||||||
m_splash.dispose();
|
|
||||||
m_splash = null;
|
|
||||||
} // unlockUI
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Is the UI locked (Internal method)
|
|
||||||
* @return true, if UI is locked
|
|
||||||
*/
|
|
||||||
public boolean isUILocked()
|
|
||||||
{
|
|
||||||
return m_isLocked;
|
|
||||||
} // isLoacked
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method to be executed async
|
|
||||||
* Called from the Worker
|
|
||||||
* @param pi process info
|
|
||||||
*/
|
|
||||||
public abstract void executeASync (ProcessInfo pi);
|
|
||||||
|
|
||||||
} // ASyncProcessBase
|
|
|
@ -71,15 +71,15 @@ public class TopicImpl<E> implements ITopic<E> {
|
||||||
topic.publish(message);
|
topic.publish(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
class TopicSubscriberAdapter<E> implements MessageListener<E> {
|
class TopicSubscriberAdapter<T> implements MessageListener<T> {
|
||||||
protected ITopicSubscriber<E> subscriber;
|
protected ITopicSubscriber<T> subscriber;
|
||||||
|
|
||||||
protected TopicSubscriberAdapter(ITopicSubscriber<E> subscriber) {
|
protected TopicSubscriberAdapter(ITopicSubscriber<T> subscriber) {
|
||||||
this.subscriber = subscriber;
|
this.subscriber = subscriber;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessage(Message<E> message) {
|
public void onMessage(Message<T> message) {
|
||||||
subscriber.onMessage(message.getMessageObject());
|
subscriber.onMessage(message.getMessageObject());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue