Examples of DatabaseFactory


Examples of co.cubicode.jdbcframework.DatabaseFactory

  public static Permission findByPrimaryKey(Integer application, Integer objectType, Integer operationType) throws ObjectNotFoundException {
    return findByPrimaryKey(application.toString(), objectType.toString(), operationType.toString());
  }

  public static Permission findByPrimaryKey(String application, String objectType, String operationType) throws ObjectNotFoundException {
    DatabaseFactory instance = DatabaseFactory.getInstance("rbac");
    SQLQuery sql = SQL.getSQL(Permission.class, "findByPrimaryKey");
    sql.setParameter("application", application);
    sql.setParameter("objectType", objectType);
    sql.setParameter("operationType", operationType);
    return instance.query(Permission.class, sql);
  }
View Full Code Here

Examples of co.cubicode.jdbcframework.DatabaseFactory

import co.cubicode.rbacframework.models.pack.RolePermission;

public class RolePermissionBiz {

  public static List<RolePermission> findByRoleAndApplication(Role role, String application) throws ObjectNotFoundException {
    DatabaseFactory instance = DatabaseFactory.getInstance("rbac");
    SQLQuery sql = SQL.getSQL(RolePermission.class, "findByRoleAndApplication");
    sql.setParameter("role", role.getId());
    sql.setParameter("application", application);
    return instance.queryForList(RolePermission.class, sql);
  }
View Full Code Here

Examples of co.cubicode.jdbcframework.DatabaseFactory

import co.cubicode.rbacframework.models.User;

public class UserBiz {

  public static User findByPrimaryKey(Long id) throws ObjectNotFoundException {
    DatabaseFactory instance = DatabaseFactory.getInstance("rbac");
    SQLQuery sql = SQL.getSQL(User.class, "findByPrimaryKey");
    sql.setParameter("id", id);
    return instance.query(User.class, sql);
  }
View Full Code Here

Examples of co.cubicode.jdbcframework.DatabaseFactory

    sql.setParameter("id", id);
    return instance.query(User.class, sql);
  }

  public static List<User> getAll() throws ObjectNotFoundException {
    DatabaseFactory instance = DatabaseFactory.getInstance("rbac");
    SQLQuery sql = SQL.getSQL(User.class, "getAll");
    return instance.queryForList(User.class, sql);
  }
View Full Code Here

Examples of co.cubicode.jdbcframework.DatabaseFactory

    SQLQuery sql = SQL.getSQL(User.class, "getAll");
    return instance.queryForList(User.class, sql);
  }
 
  public static User create(User user) throws ObjectUpdateException {
    DatabaseFactory instance = DatabaseFactory.getInstance("rbac");
    SQLQuery sql = SQL.getSQL(User.class, "create");
    Long id = (Long) instance.update(user, sql);
    if (id == null) {
      throw new DatabaseFactoryException("Ocurrio un error al obtener el id del objeto usuario");
    }
    user.setId(id);
    return user;
View Full Code Here

Examples of co.cubicode.jdbcframework.DatabaseFactory

import co.cubicode.rbacframework.models.Role;

public class RoleBiz {

  public static Role findByPrimaryKey(Integer id) throws ObjectNotFoundException {
    DatabaseFactory instance = DatabaseFactory.getInstance("rbac");
    SQLQuery sql = SQL.getSQL(Role.class, "findByPrimaryKey");
    sql.setParameter("id", id);
    return instance.query(Role.class, sql);
  }
View Full Code Here

Examples of com.btmatthews.maven.plugins.inmemdb.DatabaseFactory

   * to construct an in-memory HSQLDB database.
   *
   * @return The database.
   */
  protected final Database getDatabase() {
    final DatabaseFactory factory = new DatabaseFactory();
    return factory.createDatabase(type, database, username, password);
  }
View Full Code Here

Examples of com.caucho.env.jdbc.DatabaseFactory

                                    location,
                                    DataSourceDefinition.class.getSimpleName(),
                                    className));
    }
   
    DatabaseFactory factory = DatabaseFactory.createBuilder();
    factory.setName(name);
    factory.setDriverClass(driverClass);
   
    if (! "".equals(def.url()))
      factory.setUrl(def.url());
   
    if (! "".equals(def.databaseName()))
      factory.setDatabaseName(def.databaseName());
   
    if (! "".equals(def.user()))
      factory.setUser(def.user());
   
    if (! "".equals(def.password()))
      factory.setPassword(def.password());
   
    return factory.create();
  }
View Full Code Here

Examples of com.yammer.dropwizard.db.DatabaseFactory

  @Override
  protected void initialize(TodoServiceConfiguration configuration,
                            Environment environment) throws Exception {

    final DatabaseFactory factory = new DatabaseFactory(environment);
    Database database = factory.build(configuration.getDatabase(), "todo");

    final TodoDao dao = database.onDemand(TodoDao.class);
    dao.createTableIfNotExists();

    environment.addResource(new TodoResource(dao));
View Full Code Here

Examples of liquibase.database.DatabaseFactory

    public Database createDatabase(ClassLoader classLoader) {
        logParameters();
        validateParameters();
        try {
            DatabaseFactory databaseFactory = DatabaseFactory.getInstance();
            if(databaseClass != null) {
                Database databaseInstance = (Database) ClasspathUtils.newInstance(databaseClass, classLoader, Database.class);
                databaseFactory.register(databaseInstance);
            }

            Driver driver = (Driver) ClasspathUtils.newInstance(getDriver(), classLoader, Driver.class);
            if(driver == null) {
                throw new BuildException("Unable to create Liquibase Database instance. Could not instantiate the JDBC driver.");
            }
            Properties connectionProps = new Properties();
            String user = getUser();
            if(user != null && !user.isEmpty()) {
                connectionProps.setProperty(USER, user);
            }
            String password = getPassword();
            if(password != null && !password.isEmpty()) {
                connectionProps.setProperty(PASSWORD, password);
            }
            if(connectionProperties != null) {
                connectionProps.putAll(connectionProperties.buildProperties());
            }

            Connection connection = driver.connect(getUrl(), connectionProps);
            if(connection == null) {
                throw new BuildException("Unable to create Liquibase Database instance. Could not connect to the database.");
            }
            JdbcConnection jdbcConnection = new JdbcConnection(connection);

            Database database = databaseFactory.findCorrectDatabaseImplementation(jdbcConnection);

            String schemaName = getDefaultSchemaName();
            if (schemaName != null) {
                database.setDefaultSchemaName(schemaName);
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.