implemented internals of ConferenceManager (ConferenceAccessObject), database
operations, attributes of ConferenceImpl and LinkedConferenceImpl
This commit is contained in:
parent
a6286c3842
commit
d5809b205b
|
@ -20,14 +20,19 @@ package com.silverwrist.venice.conf.iface;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.silverwrist.dynamo.except.DatabaseException;
|
import com.silverwrist.dynamo.except.DatabaseException;
|
||||||
import com.silverwrist.dynamo.iface.DynamicObject;
|
import com.silverwrist.dynamo.iface.DynamicObject;
|
||||||
|
import com.silverwrist.dynamo.iface.DynamoUser;
|
||||||
import com.silverwrist.venice.iface.VeniceCommunity;
|
import com.silverwrist.venice.iface.VeniceCommunity;
|
||||||
|
|
||||||
public interface ConferenceAccessObject extends DynamicObject
|
public interface ConferenceAccessObject extends DynamicObject
|
||||||
{
|
{
|
||||||
public List getConferences(VeniceCommunity comm) throws DatabaseException;
|
public List getConferences(DynamoUser user, VeniceCommunity comm) throws DatabaseException;
|
||||||
|
|
||||||
public VeniceConference getConference(int confid) throws DatabaseException;
|
public VeniceConference getConference(int confid) throws DatabaseException;
|
||||||
|
|
||||||
public VeniceConference getConference(String alias) throws DatabaseException;
|
public VeniceConference getConference(String alias) throws DatabaseException;
|
||||||
|
|
||||||
|
public VeniceLinkedConference getLinkedConference(VeniceCommunity comm, int confid) throws DatabaseException;
|
||||||
|
|
||||||
|
public VeniceLinkedConference getLinkedConference(VeniceCommunity comm, String alias) throws DatabaseException;
|
||||||
|
|
||||||
} // end interface ConferenceAccessObject
|
} // end interface ConferenceAccessObject
|
||||||
|
|
|
@ -33,16 +33,28 @@ class ConferenceImpl implements VeniceConference
|
||||||
|
|
||||||
private DynamicImplConference m_dobj;
|
private DynamicImplConference m_dobj;
|
||||||
private ConferenceOps m_ops;
|
private ConferenceOps m_ops;
|
||||||
|
private int m_confid;
|
||||||
|
private java.util.Date m_createdate;
|
||||||
|
private java.util.Date m_lastupdate;
|
||||||
|
private int m_hosts_gid;
|
||||||
|
private int m_aclid;
|
||||||
|
private String m_name;
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Constructor
|
* Constructor
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ConferenceImpl(ConferenceOps ops)
|
ConferenceImpl(ConferenceOps ops, Map params)
|
||||||
{
|
{
|
||||||
m_dobj = new DynamicImplConference(this);
|
m_dobj = new DynamicImplConference(this);
|
||||||
m_ops = ops;
|
m_ops = ops;
|
||||||
|
m_confid = ((Integer)(params.get(ConferenceManagerOps.KEY_CONFID))).intValue();
|
||||||
|
m_createdate = (java.util.Date)(params.get(ConferenceManagerOps.KEY_CREATE_DATE));
|
||||||
|
m_lastupdate = (java.util.Date)(params.get(ConferenceManagerOps.KEY_LAST_UPDATE));
|
||||||
|
m_hosts_gid = ((Integer)(params.get(ConferenceManagerOps.KEY_HOSTS_GID))).intValue();
|
||||||
|
m_aclid = ((Integer)(params.get(ConferenceManagerOps.KEY_ACLID))).intValue();
|
||||||
|
m_name = (String)(params.get(ConferenceManagerOps.KEY_NAME));
|
||||||
|
|
||||||
} // end constructor
|
} // end constructor
|
||||||
|
|
||||||
|
@ -93,9 +105,9 @@ class ConferenceImpl implements VeniceConference
|
||||||
*/
|
*/
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return null; // TEMP
|
return m_name;
|
||||||
|
|
||||||
}
|
} // end getName
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Implementations from interface ObjectProvider
|
* Implementations from interface ObjectProvider
|
||||||
|
@ -194,9 +206,9 @@ class ConferenceImpl implements VeniceConference
|
||||||
|
|
||||||
public int getConfID()
|
public int getConfID()
|
||||||
{
|
{
|
||||||
return -1; // TEMP
|
return m_confid;
|
||||||
|
|
||||||
}
|
} // end getConfID
|
||||||
|
|
||||||
public void setName(DynamoUser caller, String name) throws DatabaseException, DynamoSecurityException
|
public void setName(DynamoUser caller, String name) throws DatabaseException, DynamoSecurityException
|
||||||
{
|
{
|
||||||
|
@ -204,15 +216,15 @@ class ConferenceImpl implements VeniceConference
|
||||||
|
|
||||||
public java.util.Date getCreatedDate()
|
public java.util.Date getCreatedDate()
|
||||||
{
|
{
|
||||||
return null; // TEMP
|
return m_createdate;
|
||||||
|
|
||||||
}
|
} // end getCreatedDate
|
||||||
|
|
||||||
public java.util.Date getLastUpdateDate()
|
public java.util.Date getLastUpdateDate()
|
||||||
{
|
{
|
||||||
return null; // TEMP
|
return m_lastupdate;
|
||||||
|
|
||||||
}
|
} // end getLastUpdateDate
|
||||||
|
|
||||||
public void setLastUpdateDate(DynamoUser caller, java.util.Date date)
|
public void setLastUpdateDate(DynamoUser caller, java.util.Date date)
|
||||||
throws DatabaseException, DynamoSecurityException
|
throws DatabaseException, DynamoSecurityException
|
||||||
|
@ -221,9 +233,9 @@ class ConferenceImpl implements VeniceConference
|
||||||
|
|
||||||
public int getHostsGID()
|
public int getHostsGID()
|
||||||
{
|
{
|
||||||
return -1; // TEMP
|
return m_hosts_gid;
|
||||||
|
|
||||||
}
|
} // end getHostsGID
|
||||||
|
|
||||||
public DynamoGroup getHosts() throws DatabaseException
|
public DynamoGroup getHosts() throws DatabaseException
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,10 +17,13 @@
|
||||||
*/
|
*/
|
||||||
package com.silverwrist.venice.conf.impl;
|
package com.silverwrist.venice.conf.impl;
|
||||||
|
|
||||||
|
import java.security.acl.AclNotFoundException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import org.apache.commons.collections.*;
|
||||||
import com.silverwrist.dynamo.except.*;
|
import com.silverwrist.dynamo.except.*;
|
||||||
import com.silverwrist.dynamo.iface.*;
|
import com.silverwrist.dynamo.iface.*;
|
||||||
import com.silverwrist.venice.iface.*;
|
import com.silverwrist.venice.iface.*;
|
||||||
|
import com.silverwrist.venice.conf.ConfNamespaces;
|
||||||
import com.silverwrist.venice.conf.iface.*;
|
import com.silverwrist.venice.conf.iface.*;
|
||||||
import com.silverwrist.venice.conf.obj.*;
|
import com.silverwrist.venice.conf.obj.*;
|
||||||
|
|
||||||
|
@ -34,6 +37,7 @@ public class ConferenceManager implements ConferenceAccessObject
|
||||||
private DynamicImplConferenceAccess m_dobj;
|
private DynamicImplConferenceAccess m_dobj;
|
||||||
private UseCount m_uc;
|
private UseCount m_uc;
|
||||||
private ConferenceManagerOps m_ops;
|
private ConferenceManagerOps m_ops;
|
||||||
|
private ReferenceMap m_confs;
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -56,8 +60,30 @@ public class ConferenceManager implements ConferenceAccessObject
|
||||||
|
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
|
m_confs = new ReferenceMap(ReferenceMap.HARD,ReferenceMap.SOFT);
|
||||||
|
|
||||||
} // end constructor
|
} // end constructor
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Internal operations
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
private final ConferenceImpl loadConference(Map params)
|
||||||
|
{
|
||||||
|
Integer key = (Integer)(params.get(ConferenceManagerOps.KEY_CONFID));
|
||||||
|
ConferenceImpl rc = (ConferenceImpl)(m_confs.get(key));
|
||||||
|
if (rc==null)
|
||||||
|
{ // create a new conference implementation object and save it
|
||||||
|
rc = new ConferenceImpl(m_ops.getConferenceOps(),params);
|
||||||
|
m_confs.put(key,rc);
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
} // end loadConference
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Implementations from interface DynamicObject
|
* Implementations from interface DynamicObject
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
|
@ -98,24 +124,113 @@ public class ConferenceManager implements ConferenceAccessObject
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public List getConferences(VeniceCommunity comm) throws DatabaseException
|
public List getConferences(DynamoUser user, VeniceCommunity comm) throws DatabaseException
|
||||||
{
|
{
|
||||||
return Collections.EMPTY_LIST; // TEMP
|
boolean show_hidden = false;
|
||||||
|
try
|
||||||
|
{ // do we want to show hidden conferences?
|
||||||
|
show_hidden = comm.getAcl().testPermission(user,ConfNamespaces.PERMISSIONS_NAMESPACE,"see.hidden");
|
||||||
|
|
||||||
|
} // end try
|
||||||
|
catch (AclNotFoundException e)
|
||||||
|
{ // convert the AclNotFoundException
|
||||||
|
DatabaseException de = new DatabaseException(ConferenceManager.class,"ConferenceMessages","no.community.acl",e);
|
||||||
|
de.setParameter(0,comm.getName());
|
||||||
|
throw de;
|
||||||
|
|
||||||
|
} // end catch
|
||||||
|
|
||||||
|
List in_list = m_ops.getConferences(comm.getCID());
|
||||||
|
if (in_list.isEmpty())
|
||||||
|
return Collections.EMPTY_LIST;
|
||||||
|
|
||||||
|
ArrayList rc = new ArrayList();
|
||||||
|
Iterator it = in_list.iterator();
|
||||||
|
while (it.hasNext())
|
||||||
|
{ // get each data element and convert it
|
||||||
|
Map d = (Map)(it.next());
|
||||||
|
if (show_hidden || !(((Boolean)(d.get(ConferenceManagerOps.KEY_HIDE))).booleanValue()))
|
||||||
|
{ // skip hidden conferences if we don't have the "show hidden" permission
|
||||||
|
ConferenceImpl conf = loadConference(d);
|
||||||
|
rc.add(new LinkedConferenceImpl(m_ops.getLinkedConferenceOps(),conf,comm,d));
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
|
} // end while
|
||||||
|
|
||||||
|
if (rc.isEmpty())
|
||||||
|
return Collections.EMPTY_LIST;
|
||||||
|
rc.trimToSize();
|
||||||
|
return Collections.unmodifiableList(rc);
|
||||||
|
|
||||||
} // end getConferences
|
} // end getConferences
|
||||||
|
|
||||||
public VeniceConference getConference(int confid) throws DatabaseException
|
public VeniceConference getConference(int confid) throws DatabaseException
|
||||||
{
|
{
|
||||||
return null; // TEMP
|
Map d = m_ops.getConferenceData(confid);
|
||||||
|
if (d==null)
|
||||||
|
{ // throw the not-found exception
|
||||||
|
DatabaseException de = new DatabaseException(ConferenceManager.class,"ConferenceMessages","confid.notfound");
|
||||||
|
de.setParameter(0,String.valueOf(confid));
|
||||||
|
throw de;
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
|
return loadConference(d);
|
||||||
|
|
||||||
} // end getConference
|
} // end getConference
|
||||||
|
|
||||||
public VeniceConference getConference(String alias) throws DatabaseException
|
public VeniceConference getConference(String alias) throws DatabaseException
|
||||||
{
|
{
|
||||||
return null; // TEMP
|
Map d = m_ops.getConferenceData(alias);
|
||||||
|
if (d==null)
|
||||||
|
{ // throw the not-found exception
|
||||||
|
DatabaseException de = new DatabaseException(ConferenceManager.class,"ConferenceMessages","confalias.notfound");
|
||||||
|
de.setParameter(0,alias);
|
||||||
|
throw de;
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
|
return loadConference(d);
|
||||||
|
|
||||||
} // end getConference
|
} // end getConference
|
||||||
|
|
||||||
|
public VeniceLinkedConference getLinkedConference(VeniceCommunity comm, int confid) throws DatabaseException
|
||||||
|
{
|
||||||
|
Map d = m_ops.getConferenceData(comm.getCID(),confid);
|
||||||
|
if (d==null)
|
||||||
|
{ // throw the not-found exception
|
||||||
|
DatabaseException de = new DatabaseException(ConferenceManager.class,"ConferenceMessages",
|
||||||
|
"confid.comm.notfound");
|
||||||
|
de.setParameter(0,String.valueOf(confid));
|
||||||
|
de.setParameter(1,comm.getName());
|
||||||
|
throw de;
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
|
ConferenceImpl conf = loadConference(d);
|
||||||
|
return new LinkedConferenceImpl(m_ops.getLinkedConferenceOps(),conf,comm,d);
|
||||||
|
|
||||||
|
} // end getLinkedConference
|
||||||
|
|
||||||
|
public VeniceLinkedConference getLinkedConference(VeniceCommunity comm, String alias) throws DatabaseException
|
||||||
|
{
|
||||||
|
Map d = m_ops.getConferenceData(comm.getCID(),alias);
|
||||||
|
if (d==null)
|
||||||
|
{ // throw the not-found exception
|
||||||
|
DatabaseException de = new DatabaseException(ConferenceManager.class,"ConferenceMessages",
|
||||||
|
"confalias.comm.notfound");
|
||||||
|
de.setParameter(0,alias);
|
||||||
|
de.setParameter(1,comm.getName());
|
||||||
|
throw de;
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
|
ConferenceImpl conf = loadConference(d);
|
||||||
|
return new LinkedConferenceImpl(m_ops.getLinkedConferenceOps(),conf,comm,d);
|
||||||
|
|
||||||
|
} // end getLinkedConference
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* External operations
|
* External operations
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
|
|
|
@ -24,6 +24,20 @@ import com.silverwrist.dynamo.iface.*;
|
||||||
|
|
||||||
abstract class ConferenceManagerOps extends OpsBase
|
abstract class ConferenceManagerOps extends OpsBase
|
||||||
{
|
{
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Static data members
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
static final String KEY_CONFID = "confid";
|
||||||
|
static final String KEY_CREATE_DATE = "createdate";
|
||||||
|
static final String KEY_LAST_UPDATE = "lastupdate";
|
||||||
|
static final String KEY_HOSTS_GID = "hosts_gid";
|
||||||
|
static final String KEY_ACLID = "aclid";
|
||||||
|
static final String KEY_NAME = "name";
|
||||||
|
static final String KEY_SEQUENCE = "sequence";
|
||||||
|
static final String KEY_HIDE = "hide";
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Attributes
|
* Attributes
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
|
@ -69,6 +83,16 @@ abstract class ConferenceManagerOps extends OpsBase
|
||||||
|
|
||||||
protected abstract LinkedConferenceOps createLinkedConferenceOps(DBConnectionPool pool);
|
protected abstract LinkedConferenceOps createLinkedConferenceOps(DBConnectionPool pool);
|
||||||
|
|
||||||
|
abstract List getConferences(int cid) throws DatabaseException;
|
||||||
|
|
||||||
|
abstract Map getConferenceData(int confid) throws DatabaseException;
|
||||||
|
|
||||||
|
abstract Map getConferenceData(int cid, int confid) throws DatabaseException;
|
||||||
|
|
||||||
|
abstract Map getConferenceData(String alias) throws DatabaseException;
|
||||||
|
|
||||||
|
abstract Map getConferenceData(int cid, String alias) throws DatabaseException;
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* External operations
|
* External operations
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
|
|
|
@ -26,6 +26,13 @@ import com.silverwrist.dynamo.util.*;
|
||||||
|
|
||||||
public class ConferenceManagerOps_mysql extends ConferenceManagerOps
|
public class ConferenceManagerOps_mysql extends ConferenceManagerOps
|
||||||
{
|
{
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Attributes
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
private DBUtilities m_utils;
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Constructor
|
* Constructor
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
|
@ -34,9 +41,22 @@ public class ConferenceManagerOps_mysql extends ConferenceManagerOps
|
||||||
public ConferenceManagerOps_mysql(DBConnectionPool pool)
|
public ConferenceManagerOps_mysql(DBConnectionPool pool)
|
||||||
{
|
{
|
||||||
super(pool);
|
super(pool);
|
||||||
|
m_utils = (DBUtilities)(pool.queryService(DBUtilities.class));
|
||||||
|
|
||||||
} // end constructor
|
} // end constructor
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Overrides from class ConferenceManagerOps
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void dispose()
|
||||||
|
{
|
||||||
|
m_utils = null;
|
||||||
|
super.dispose();
|
||||||
|
|
||||||
|
} // end dispose
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Abstract implementations from class ConferenceManagerOps
|
* Abstract implementations from class ConferenceManagerOps
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
|
@ -54,4 +74,246 @@ public class ConferenceManagerOps_mysql extends ConferenceManagerOps
|
||||||
|
|
||||||
} // end createLinkedConferenceOps
|
} // end createLinkedConferenceOps
|
||||||
|
|
||||||
|
List getConferences(int cid) throws DatabaseException
|
||||||
|
{
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
try
|
||||||
|
{ // get a connection
|
||||||
|
conn = getConnection();
|
||||||
|
|
||||||
|
// create and execute the statement
|
||||||
|
stmt = conn.prepareStatement("SELECT c.confid, c.createdate, c.lastupdate, c.hosts_gid, c.aclid, c.name, "
|
||||||
|
+ "l.sequence, l.hide FROM conferences c, conf_links l WHERE c.confid = l.confid "
|
||||||
|
+ "AND l.cid = ? ORDER by l.sequence;");
|
||||||
|
stmt.setInt(1,cid);
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
|
||||||
|
// prepare the return value (a list of maps)
|
||||||
|
ArrayList rc = new ArrayList();
|
||||||
|
while (rs.next())
|
||||||
|
{ // load the fields into the HashMaps
|
||||||
|
HashMap tmp = new HashMap();
|
||||||
|
tmp.put(KEY_CONFID,new Integer(rs.getInt(1)));
|
||||||
|
tmp.put(KEY_CREATE_DATE,m_utils.getDateTime(rs,2));
|
||||||
|
java.util.Date d = m_utils.getDateTime(rs,3);
|
||||||
|
if (d!=null)
|
||||||
|
tmp.put(KEY_LAST_UPDATE,d);
|
||||||
|
tmp.put(KEY_HOSTS_GID,new Integer(rs.getInt(4)));
|
||||||
|
tmp.put(KEY_ACLID,new Integer(rs.getInt(5)));
|
||||||
|
tmp.put(KEY_NAME,rs.getString(6));
|
||||||
|
tmp.put(KEY_SEQUENCE,new Integer(rs.getInt(7)));
|
||||||
|
tmp.put(KEY_HIDE,(rs.getInt(8)==1) ? Boolean.TRUE : Boolean.FALSE);
|
||||||
|
rc.add(tmp);
|
||||||
|
|
||||||
|
} // end while
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
} // end try
|
||||||
|
catch (SQLException e)
|
||||||
|
{ // translate to a general DatabaseException
|
||||||
|
throw generalException(e);
|
||||||
|
|
||||||
|
} // end catch
|
||||||
|
finally
|
||||||
|
{ // shut everything down
|
||||||
|
SQLUtils.shutdown(rs);
|
||||||
|
SQLUtils.shutdown(stmt);
|
||||||
|
SQLUtils.shutdown(conn);
|
||||||
|
|
||||||
|
} // end finally
|
||||||
|
|
||||||
|
} // end getConferences
|
||||||
|
|
||||||
|
Map getConferenceData(int confid) throws DatabaseException
|
||||||
|
{
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
try
|
||||||
|
{ // get a connection
|
||||||
|
conn = getConnection();
|
||||||
|
|
||||||
|
// create and execute the statement
|
||||||
|
stmt = conn.prepareStatement("SELECT createdate, lastupdate, hosts_gid, aclid, name FROM conferences "
|
||||||
|
+ "WHERE confid = ?");
|
||||||
|
stmt.setInt(1,confid);
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
if (!(rs.next()))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// prepare the return value
|
||||||
|
HashMap rc = new HashMap();
|
||||||
|
rc.put(KEY_CONFID,new Integer(confid));
|
||||||
|
rc.put(KEY_CREATE_DATE,m_utils.getDateTime(rs,1));
|
||||||
|
java.util.Date d = m_utils.getDateTime(rs,2);
|
||||||
|
if (d!=null)
|
||||||
|
rc.put(KEY_LAST_UPDATE,d);
|
||||||
|
rc.put(KEY_HOSTS_GID,new Integer(rs.getInt(3)));
|
||||||
|
rc.put(KEY_ACLID,new Integer(rs.getInt(4)));
|
||||||
|
rc.put(KEY_NAME,rs.getString(5));
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
} // end try
|
||||||
|
catch (SQLException e)
|
||||||
|
{ // translate to a general DatabaseException
|
||||||
|
throw generalException(e);
|
||||||
|
|
||||||
|
} // end catch
|
||||||
|
finally
|
||||||
|
{ // shut everything down
|
||||||
|
SQLUtils.shutdown(rs);
|
||||||
|
SQLUtils.shutdown(stmt);
|
||||||
|
SQLUtils.shutdown(conn);
|
||||||
|
|
||||||
|
} // end finally
|
||||||
|
|
||||||
|
} // end getConferenceData
|
||||||
|
|
||||||
|
Map getConferenceData(int cid, int confid) throws DatabaseException
|
||||||
|
{
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
try
|
||||||
|
{ // get a connection
|
||||||
|
conn = getConnection();
|
||||||
|
|
||||||
|
// create and execute the statement
|
||||||
|
stmt = conn.prepareStatement("SELECT c.createdate, c.lastupdate, c.hosts_gid, c.aclid, c.name, l.sequence, "
|
||||||
|
+ "l.hide FROM conferences c, conf_links l WHERE c.confid = ? "
|
||||||
|
+ "AND c.confid = l.confid AND l.cid = ?");
|
||||||
|
stmt.setInt(1,confid);
|
||||||
|
stmt.setInt(2,cid);
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
if (!(rs.next()))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// prepare the return value
|
||||||
|
HashMap rc = new HashMap();
|
||||||
|
rc.put(KEY_CONFID,new Integer(confid));
|
||||||
|
rc.put(KEY_CREATE_DATE,m_utils.getDateTime(rs,1));
|
||||||
|
java.util.Date d = m_utils.getDateTime(rs,2);
|
||||||
|
if (d!=null)
|
||||||
|
rc.put(KEY_LAST_UPDATE,d);
|
||||||
|
rc.put(KEY_HOSTS_GID,new Integer(rs.getInt(3)));
|
||||||
|
rc.put(KEY_ACLID,new Integer(rs.getInt(4)));
|
||||||
|
rc.put(KEY_NAME,rs.getString(5));
|
||||||
|
rc.put(KEY_SEQUENCE,new Integer(rs.getInt(6)));
|
||||||
|
rc.put(KEY_HIDE,(rs.getInt(7)==1) ? Boolean.TRUE : Boolean.FALSE);
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
} // end try
|
||||||
|
catch (SQLException e)
|
||||||
|
{ // translate to a general DatabaseException
|
||||||
|
throw generalException(e);
|
||||||
|
|
||||||
|
} // end catch
|
||||||
|
finally
|
||||||
|
{ // shut everything down
|
||||||
|
SQLUtils.shutdown(rs);
|
||||||
|
SQLUtils.shutdown(stmt);
|
||||||
|
SQLUtils.shutdown(conn);
|
||||||
|
|
||||||
|
} // end finally
|
||||||
|
|
||||||
|
} // end getConferenceData
|
||||||
|
|
||||||
|
Map getConferenceData(String alias) throws DatabaseException
|
||||||
|
{
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
try
|
||||||
|
{ // get a connection
|
||||||
|
conn = getConnection();
|
||||||
|
|
||||||
|
// create and execute the statement
|
||||||
|
stmt = conn.prepareStatement("SELECT c.confid, c.createdate, c.lastupdate, c.hosts_gid, c.aclid, c.name "
|
||||||
|
+ "FROM conferences c, conf_alias a WHERE c.confid = a.confid AND a.alias = ?;");
|
||||||
|
stmt.setString(1,alias);
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
if (!(rs.next()))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// prepare the return value
|
||||||
|
HashMap rc = new HashMap();
|
||||||
|
rc.put(KEY_CONFID,new Integer(rs.getInt(1)));
|
||||||
|
rc.put(KEY_CREATE_DATE,m_utils.getDateTime(rs,2));
|
||||||
|
java.util.Date d = m_utils.getDateTime(rs,3);
|
||||||
|
if (d!=null)
|
||||||
|
rc.put(KEY_LAST_UPDATE,d);
|
||||||
|
rc.put(KEY_HOSTS_GID,new Integer(rs.getInt(4)));
|
||||||
|
rc.put(KEY_ACLID,new Integer(rs.getInt(5)));
|
||||||
|
rc.put(KEY_NAME,rs.getString(6));
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
} // end try
|
||||||
|
catch (SQLException e)
|
||||||
|
{ // translate to a general DatabaseException
|
||||||
|
throw generalException(e);
|
||||||
|
|
||||||
|
} // end catch
|
||||||
|
finally
|
||||||
|
{ // shut everything down
|
||||||
|
SQLUtils.shutdown(rs);
|
||||||
|
SQLUtils.shutdown(stmt);
|
||||||
|
SQLUtils.shutdown(conn);
|
||||||
|
|
||||||
|
} // end finally
|
||||||
|
|
||||||
|
} // end getConferenceData
|
||||||
|
|
||||||
|
Map getConferenceData(int cid, String alias) throws DatabaseException
|
||||||
|
{
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
try
|
||||||
|
{ // get a connection
|
||||||
|
conn = getConnection();
|
||||||
|
|
||||||
|
// create and execute the statement
|
||||||
|
stmt = conn.prepareStatement("SELECT c.confid, c.createdate, c.lastupdate, c.hosts_gid, c.aclid, c.name, "
|
||||||
|
+ "l.sequence, l.hide FROM conferences c, conf_alias a, conf_links l "
|
||||||
|
+ "WHERE c.confid = a.confid AND a.alias = ? AND c.confid = l.confid "
|
||||||
|
+ "AND l.cid = ?;");
|
||||||
|
stmt.setString(1,alias);
|
||||||
|
stmt.setInt(2,cid);
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
if (!(rs.next()))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// prepare the return value
|
||||||
|
HashMap rc = new HashMap();
|
||||||
|
rc.put(KEY_CONFID,new Integer(rs.getInt(1)));
|
||||||
|
rc.put(KEY_CREATE_DATE,m_utils.getDateTime(rs,2));
|
||||||
|
java.util.Date d = m_utils.getDateTime(rs,3);
|
||||||
|
if (d!=null)
|
||||||
|
rc.put(KEY_LAST_UPDATE,d);
|
||||||
|
rc.put(KEY_HOSTS_GID,new Integer(rs.getInt(4)));
|
||||||
|
rc.put(KEY_ACLID,new Integer(rs.getInt(5)));
|
||||||
|
rc.put(KEY_NAME,rs.getString(6));
|
||||||
|
rc.put(KEY_SEQUENCE,new Integer(rs.getInt(7)));
|
||||||
|
rc.put(KEY_HIDE,(rs.getInt(8)==1) ? Boolean.TRUE : Boolean.FALSE);
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
} // end try
|
||||||
|
catch (SQLException e)
|
||||||
|
{ // translate to a general DatabaseException
|
||||||
|
throw generalException(e);
|
||||||
|
|
||||||
|
} // end catch
|
||||||
|
finally
|
||||||
|
{ // shut everything down
|
||||||
|
SQLUtils.shutdown(rs);
|
||||||
|
SQLUtils.shutdown(stmt);
|
||||||
|
SQLUtils.shutdown(conn);
|
||||||
|
|
||||||
|
} // end finally
|
||||||
|
|
||||||
|
} // end getConferenceData
|
||||||
|
|
||||||
} // end class ConferenceManagerOps_mysql
|
} // end class ConferenceManagerOps_mysql
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
# The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||||
|
# (the "License"); you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||||
|
#
|
||||||
|
# Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||||
|
# WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||||
|
# language governing rights and limitations under the License.
|
||||||
|
#
|
||||||
|
# The Original Code is the Venice Web Communities System.
|
||||||
|
#
|
||||||
|
# The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||||
|
# for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||||
|
# Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Contributor(s):
|
||||||
|
# ---------------------------------------------------------------------------------
|
||||||
|
# This file has been localized for the en_US locale
|
||||||
|
no.community.acl=The community ACL for community "{0}" could not be found.
|
||||||
|
confid.notfound=No conference was found with conference ID #{0}.
|
||||||
|
confalias.notfound=No conference was found with conference alias "{0}."
|
||||||
|
confid.comm.notfound=No conference was found with conference ID #{0} in community "{1}."
|
||||||
|
confalias.comm.notfound=No conference was found with conference alias "{0}" in community "{1}."
|
|
@ -36,18 +36,22 @@ class LinkedConferenceImpl implements VeniceLinkedConference
|
||||||
private LinkedConferenceOps m_ops;
|
private LinkedConferenceOps m_ops;
|
||||||
private ConferenceImpl m_conf;
|
private ConferenceImpl m_conf;
|
||||||
private VeniceCommunity m_comm;
|
private VeniceCommunity m_comm;
|
||||||
|
private int m_sequence;
|
||||||
|
private boolean m_hide;
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Constructor
|
* Constructor
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
LinkedConferenceImpl(LinkedConferenceOps ops, ConferenceImpl conf, VeniceCommunity comm)
|
LinkedConferenceImpl(LinkedConferenceOps ops, ConferenceImpl conf, VeniceCommunity comm, Map params)
|
||||||
{
|
{
|
||||||
m_dobj = new DynamicImplLinkedConference(this);
|
m_dobj = new DynamicImplLinkedConference(this);
|
||||||
m_ops = ops;
|
m_ops = ops;
|
||||||
m_conf = conf;
|
m_conf = conf;
|
||||||
m_comm = comm;
|
m_comm = comm;
|
||||||
|
m_sequence = ((Integer)(params.get(ConferenceManagerOps.KEY_SEQUENCE))).intValue();
|
||||||
|
m_hide = ((Boolean)(params.get(ConferenceManagerOps.KEY_HIDE))).booleanValue();
|
||||||
|
|
||||||
} // end constructor
|
} // end constructor
|
||||||
|
|
||||||
|
@ -295,9 +299,9 @@ class LinkedConferenceImpl implements VeniceLinkedConference
|
||||||
|
|
||||||
public int getSequence()
|
public int getSequence()
|
||||||
{
|
{
|
||||||
return -1; // TEMP
|
return m_sequence;
|
||||||
|
|
||||||
}
|
} // end getSequence
|
||||||
|
|
||||||
public void setSequence(DynamoUser caller, int sequence) throws DatabaseException, DynamoSecurityException
|
public void setSequence(DynamoUser caller, int sequence) throws DatabaseException, DynamoSecurityException
|
||||||
{
|
{
|
||||||
|
@ -305,9 +309,9 @@ class LinkedConferenceImpl implements VeniceLinkedConference
|
||||||
|
|
||||||
public boolean isHidden()
|
public boolean isHidden()
|
||||||
{
|
{
|
||||||
return false; // TEMP
|
return m_hide;
|
||||||
|
|
||||||
}
|
} // end isHidden
|
||||||
|
|
||||||
public void setHidden(DynamoUser caller, boolean flag) throws DatabaseException, DynamoSecurityException
|
public void setHidden(DynamoUser caller, boolean flag) throws DatabaseException, DynamoSecurityException
|
||||||
{
|
{
|
||||||
|
|
|
@ -138,6 +138,7 @@ class Controller implements CommunityServiceController
|
||||||
DynamoAcl acl = comm.getAcl();
|
DynamoAcl acl = comm.getAcl();
|
||||||
helper.addPermission(hostuser,acl,hostgroup,false,ConfNamespaces.PERMISSIONS_NAMESPACE,"create");
|
helper.addPermission(hostuser,acl,hostgroup,false,ConfNamespaces.PERMISSIONS_NAMESPACE,"create");
|
||||||
helper.addPermission(hostuser,acl,hostgroup,false,ConfNamespaces.PERMISSIONS_NAMESPACE,"manage.order");
|
helper.addPermission(hostuser,acl,hostgroup,false,ConfNamespaces.PERMISSIONS_NAMESPACE,"manage.order");
|
||||||
|
helper.addPermission(hostuser,acl,hostgroup,false,ConfNamespaces.PERMISSIONS_NAMESPACE,"see.hidden");
|
||||||
|
|
||||||
} // end try
|
} // end try
|
||||||
catch (AclNotFoundException e)
|
catch (AclNotFoundException e)
|
||||||
|
@ -171,6 +172,7 @@ class Controller implements CommunityServiceController
|
||||||
DynamoAcl acl = comm.getAcl();
|
DynamoAcl acl = comm.getAcl();
|
||||||
helper.stripPermission(hostuser,acl,ConfNamespaces.PERMISSIONS_NAMESPACE,"create");
|
helper.stripPermission(hostuser,acl,ConfNamespaces.PERMISSIONS_NAMESPACE,"create");
|
||||||
helper.stripPermission(hostuser,acl,ConfNamespaces.PERMISSIONS_NAMESPACE,"manage.order");
|
helper.stripPermission(hostuser,acl,ConfNamespaces.PERMISSIONS_NAMESPACE,"manage.order");
|
||||||
|
helper.stripPermission(hostuser,acl,ConfNamespaces.PERMISSIONS_NAMESPACE,"see.hidden");
|
||||||
|
|
||||||
} // end try
|
} // end try
|
||||||
catch (AclNotFoundException e)
|
catch (AclNotFoundException e)
|
||||||
|
|
|
@ -69,9 +69,10 @@ public class DynamicImplConferenceAccess extends DynamicObjectImpl
|
||||||
{ // call the getConferences method
|
{ // call the getConferences method
|
||||||
try
|
try
|
||||||
{ // verify the parameters and call the method
|
{ // verify the parameters and call the method
|
||||||
verifyParameterLength(method_name,parameters,1);
|
verifyParameterLength(method_name,parameters,2);
|
||||||
verifyParameterType(method_name,parameters,0,VeniceCommunity.class);
|
verifyParameterType(method_name,parameters,0,DynamoUser.class);
|
||||||
return m_impl.getConferences((VeniceCommunity)(parameters[0]));
|
verifyParameterType(method_name,parameters,1,VeniceCommunity.class);
|
||||||
|
return m_impl.getConferences((DynamoUser)(parameters[0]),(VeniceCommunity)(parameters[0]));
|
||||||
|
|
||||||
} // end try
|
} // end try
|
||||||
catch (DatabaseException e)
|
catch (DatabaseException e)
|
||||||
|
@ -101,6 +102,26 @@ public class DynamicImplConferenceAccess extends DynamicObjectImpl
|
||||||
|
|
||||||
} // end if
|
} // end if
|
||||||
|
|
||||||
|
if (method_name.equals("getLinkedConference"))
|
||||||
|
{ // call one of the getLinkedConference methods
|
||||||
|
try
|
||||||
|
{ // verify the parameters and call the method
|
||||||
|
verifyParameterLength(method_name,parameters,2);
|
||||||
|
verifyParameterType(method_name,parameters,0,VeniceCommunity.class);
|
||||||
|
if ((parameters[1]==null) || (parameters[1] instanceof String))
|
||||||
|
return m_impl.getLinkedConference((VeniceCommunity)(parameters[0]),(String)(parameters[1]));
|
||||||
|
int foo = getIntValue(method_name,parameters,1);
|
||||||
|
return m_impl.getLinkedConference((VeniceCommunity)(parameters[0]),foo);
|
||||||
|
|
||||||
|
} // end try
|
||||||
|
catch (DatabaseException e)
|
||||||
|
{ // reflect the exception back up
|
||||||
|
throw callFailed(e);
|
||||||
|
|
||||||
|
} // end catch
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
return super.call(method_name,parameters);
|
return super.call(method_name,parameters);
|
||||||
|
|
||||||
} // end call
|
} // end call
|
||||||
|
|
Loading…
Reference in New Issue
Block a user