mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-01-26 09:19:12 +01:00
use converter createShema method of converter objects
This commit is contained in:
@@ -43,7 +43,6 @@ import sonia.scm.group.Group;
|
||||
import sonia.scm.group.GroupDAO;
|
||||
import sonia.scm.orientdb.AbstractOrientDBModelDAO;
|
||||
import sonia.scm.orientdb.OrientDBUtil;
|
||||
import sonia.scm.user.orientdb.UserConverter;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
@@ -76,7 +75,6 @@ public class OrientDBGroupDAO extends AbstractOrientDBModelDAO<Group>
|
||||
public OrientDBGroupDAO(Provider<ODatabaseDocumentTx> connectionProvider)
|
||||
{
|
||||
super(connectionProvider, GroupConverter.INSTANCE);
|
||||
init();
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
@@ -110,24 +108,4 @@ public class OrientDBGroupDAO extends AbstractOrientDBModelDAO<Group>
|
||||
return OrientDBUtil.executeSingleResultQuery(connection, QUERY_SINGLE_BYID,
|
||||
id);
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
private void init()
|
||||
{
|
||||
ODatabaseDocumentTx connection = connectionProvider.get();
|
||||
|
||||
try
|
||||
{
|
||||
UserConverter.INSTANCE.createShema(connection);
|
||||
}
|
||||
finally
|
||||
{
|
||||
OrientDBUtil.close(connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ public abstract class AbstractOrientDBModelDAO<T extends ModelObject>
|
||||
{
|
||||
this.connectionProvider = connectionProvider;
|
||||
this.converter = converter;
|
||||
createShema();
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
@@ -317,6 +318,26 @@ public abstract class AbstractOrientDBModelDAO<T extends ModelObject>
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
private void createShema()
|
||||
{
|
||||
ODatabaseDocumentTx connection = connectionProvider.get();
|
||||
|
||||
try
|
||||
{
|
||||
converter.createShema(connection);
|
||||
}
|
||||
finally
|
||||
{
|
||||
OrientDBUtil.close(connection);
|
||||
}
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
|
||||
@@ -79,7 +79,6 @@ public class OrientDBRepositoryDAO extends AbstractOrientDBModelDAO<Repository>
|
||||
public OrientDBRepositoryDAO(Provider<ODatabaseDocumentTx> connectionProvider)
|
||||
{
|
||||
super(connectionProvider, RepositoryConverter.INSTANCE);
|
||||
init();
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
@@ -163,30 +162,6 @@ public class OrientDBRepositoryDAO extends AbstractOrientDBModelDAO<Repository>
|
||||
id);
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
*/
|
||||
private void init()
|
||||
{
|
||||
ODatabaseDocumentTx connection = connectionProvider.get();
|
||||
|
||||
try
|
||||
{
|
||||
RepositoryConverter.INSTANCE.createShema(connection);
|
||||
PermissionConverter.INSTANCE.createShema(connection);
|
||||
}
|
||||
finally
|
||||
{
|
||||
OrientDBUtil.close(connection);
|
||||
}
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
@@ -75,7 +75,6 @@ public class OrientDBUserDAO extends AbstractOrientDBModelDAO<User>
|
||||
public OrientDBUserDAO(Provider<ODatabaseDocumentTx> connectionProvider)
|
||||
{
|
||||
super(connectionProvider, UserConverter.INSTANCE);
|
||||
init();
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
@@ -109,24 +108,4 @@ public class OrientDBUserDAO extends AbstractOrientDBModelDAO<User>
|
||||
return OrientDBUtil.executeSingleResultQuery(connection, QUERY_SINGLE_BYID,
|
||||
id);
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
private void init()
|
||||
{
|
||||
ODatabaseDocumentTx connection = connectionProvider.get();
|
||||
|
||||
try
|
||||
{
|
||||
UserConverter.INSTANCE.createShema(connection);
|
||||
}
|
||||
finally
|
||||
{
|
||||
OrientDBUtil.close(connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user