Made AVMRepository Springable. Modularized Spring configuration a bit.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3380 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-07-22 20:17:51 +00:00
parent cfa3991bfc
commit ff042f1988
10 changed files with 455 additions and 588 deletions

View File

@@ -18,6 +18,7 @@
package org.alfresco.repo.avm.hibernate;
import org.alfresco.repo.avm.AVMException;
import org.alfresco.repo.avm.IssuerDAO;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
@@ -36,18 +37,28 @@ public class IssuerDAOHibernate extends HibernateDaoSupport implements
super();
}
public Long getContentIssuerValue()
/**
* Get the largest issued id for the named issuer.
* @param The name of the issuer.
* @return The value or null if the issuer is brand new.
* @throws AVMException on an invalid name.
*/
public Long getIssuerValue(String name)
{
return (Long)getSession().createQuery("select max(fc.id) from FileContentImpl fc").uniqueResult();
}
public Long getLayerIssuerValue()
{
return (Long)getSession().createQuery("select max(an.layerID) from AVMNodeImpl an").uniqueResult();
}
public Long getNodeIssuerValue()
{
return (Long)getSession().createQuery("select max(an.id) from AVMNodeImpl an").uniqueResult();
if (name.equals("content"))
{
return (Long)getSession().
createQuery("select max(fc.id) from FileContentImpl fc").uniqueResult();
}
else if (name.equals("layer"))
{
return (Long)getSession().
createQuery("select max(an.layerID) from AVMNodeImpl an").uniqueResult();
}
else if (name.equals("node"))
{
return (Long)getSession().createQuery("select max(an.id) from AVMNodeImpl an").uniqueResult();
}
throw new AVMException("Unknown issuer type: " + name);
}
}