* @throws SQLException
* @throws CapacityExceedException
*/
public static void create(int parentId, AlbumBean obj, int pos, int direction)
throws CapacityExceedException {
Session ssn = getSession();
int order_value = 1;
if (pos > 0) {
AlbumBean friend = getAlbumByID(pos);
order_value = friend.getSortOrder();
}
// ���ڵ�
if (parentId > 0){
AlbumBean parent = (AlbumBean)DAO.getBean(AlbumBean.class, parentId);
if(parent!=null)
obj.setParent(parent);
}
obj.setSortOrder(order_value - ((direction==1) ? 1 : 0));
try {
beginTransaction();
ssn.save(obj);
// ���¶�ȡ�����б�����˳���������
List albums = findNamedAll("LIST_ALBUM",obj.getSite().getId());
if (albums.size() >= ConfigDAO.getMaxAlbumCount(obj.getSite().getId()))
throw new CapacityExceedException(albums.size());
if (albums.size() > 1) {