Java Code Examples for com.datastax.driver.core.BoundStatement#setSet()

The following examples show how to use com.datastax.driver.core.BoundStatement#setSet() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: arcusplatform   File: SceneDaoImpl.java    License: Apache License 2.0 6 votes vote down vote up
protected Statement prepareUpsert(SceneDefinition sd, Date ts) {
   BoundStatement bs = upsert.bind();
   bs.setUUID(Column.PLACE_ID.columnName(), sd.getPlaceId());
   bs.setInt(Column.ID.columnName(), sd.getSequenceId());
   bs.setTimestamp(Column.CREATED.columnName(), sd.getCreated());
   bs.setTimestamp(Column.MODIFIED.columnName(), sd.getModified());
   bs.setString(Column.NAME.columnName(), sd.getName());
   bs.setString(Column.DESCRIPTION.columnName(), sd.getDescription());
   bs.setSet(Column.TAGS.columnName(), sd.getTags());
   bs.setString(SceneColumn.TEMPLATE.columnName(), sd.getTemplate());
   bs.setBool(SceneColumn.SATISFIABLE.columnName(), sd.isSatisfiable());
   bs.setBool(SceneColumn.NOTIFICATION.columnName(), sd.isNotification());
   bs.setTimestamp(SceneColumn.LAST_FIRE_TIME.columnName(), sd.getLastFireTime());
   bs.setString(SceneColumn.LAST_FIRE_STATE.columnName(), sd.getLastFireState());
   bs.setBool(SceneColumn.ENABLED.columnName(),sd.isEnabled());

   if(sd.getAction() != null) {
      bs.setBytes(ActionColumn.ACTION.columnName(), ByteBuffer.wrap(sd.getAction()));
   }
   else {
      bs.setBytes(ActionColumn.ACTION.columnName(), ByteBuffer.wrap(new byte [] {}));
   }
   return bs;
}
 
Example 2
Source Project: glowroot   File: SchemaUpgrade.java    License: Apache License 2.0 6 votes vote down vote up
private void updateRoles() throws Exception {
    PreparedStatement insertPS =
            session.prepare("insert into role (name, permissions) values (?, ?)");
    ResultSet results = session.read("select name, permissions from role");
    for (Row row : results) {
        String name = row.getString(0);
        Set<String> permissions = row.getSet(1, String.class);
        Set<String> upgradedPermissions = upgradePermissions(permissions);
        if (upgradedPermissions == null) {
            continue;
        }
        BoundStatement boundStatement = insertPS.bind();
        boundStatement.setString(0, name);
        boundStatement.setSet(1, upgradedPermissions, String.class);
        session.write(boundStatement);
    }
}
 
Example 3
Source Project: glowroot   File: SchemaUpgrade.java    License: Apache License 2.0 6 votes vote down vote up
private void addSyntheticMonitorAndAlertPermissions() throws Exception {
    PreparedStatement insertPS =
            session.prepare("insert into role (name, permissions) values (?, ?)");
    ResultSet results = session.read("select name, permissions from role");
    for (Row row : results) {
        String name = row.getString(0);
        Set<String> permissions = row.getSet(1, String.class);
        Set<String> permissionsToBeAdded = upgradePermissions2(permissions);
        if (permissionsToBeAdded.isEmpty()) {
            continue;
        }
        permissions.addAll(permissionsToBeAdded);
        BoundStatement boundStatement = insertPS.bind();
        boundStatement.setString(0, name);
        boundStatement.setSet(1, permissions, String.class);
        session.write(boundStatement);
    }
}
 
Example 4
@Override
public void upsert(AlarmIncident incident) {
   PreparedStatement pStmt = incident.isCleared() ? upsertWithTtl : upsert;
   BoundStatement bound = new BoundStatement(pStmt);
   bound.setUUID(Column.placeid.name(), incident.getPlaceId());
   bound.setUUID(Column.incidentid.name(), incident.getId());
   bound.setString(Column.alertstate.name(), incident.getAlertState().name());
   if(incident.getPlatformAlertState() == null) {
      bound.setString(Column.platformstate.name(), incident.getAlertState().name());
   }
   else {
      bound.setString(Column.platformstate.name(), incident.getPlatformAlertState().name());
   }
   if(incident.getHubAlertState() == null) {
      bound.setToNull(Column.hubstate.name());
   }
   else {
      bound.setString(Column.hubstate.name(), incident.getHubAlertState().name());
   }
   bound.setSet(Column.activealerts.name(), incident.getActiveAlerts());
   bound.setSet(Column.additionalalerts.name(), incident.getAdditionalAlerts().stream().map(AlertType::name).collect(Collectors.toSet()));
   bound.setString(Column.alert.name(), incident.getAlert().name());
   bound.setString(Column.cancelledby.name(), incident.getCancelledBy() == null ? null : incident.getCancelledBy().getRepresentation());
   bound.setTimestamp(Column.prealertendtime.name(), incident.getPrealertEndTime());
   bound.setTimestamp(Column.endtime.name(), incident.getEndTime());
   bound.setString(Column.monitoringstate.name(), incident.getMonitoringState().name());
   bound.setList(Column.tracker.name(), incident.getTracker().stream().map((te) -> JSON.toJson(te.toMap())).collect(Collectors.toList()));
   bound.setBool(Column.mockincident.name(), incident.isMockIncident());
   bound.setBool(Column.monitored.name(), incident.isMonitored());
   bound.setBool(Column.confirmed.name(),  incident.isConfirmed());
   session.execute(bound);
}
 
Example 5
Source Project: arcusplatform   File: ActionDaoImpl.java    License: Apache License 2.0 5 votes vote down vote up
protected Statement prepareUpsert(ActionDefinition ad, Date ts) {
   // note this method does not update lastExecuted
   BoundStatement bs = upsert.bind();
   bs.setUUID(Column.PLACE_ID.columnName(), ad.getPlaceId());
   bs.setInt(Column.ID.columnName(), ad.getSequenceId());
   bs.setTimestamp(Column.CREATED.columnName(), ad.getCreated());
   bs.setTimestamp(Column.MODIFIED.columnName(), ad.getModified());
   bs.setString(Column.NAME.columnName(), ad.getName());
   bs.setString(Column.DESCRIPTION.columnName(), ad.getDescription());
   bs.setSet(Column.TAGS.columnName(), ad.getTags());
   bs.setBytes(ActionColumn.ACTION.columnName(), ByteBuffer.wrap(ad.getAction()));
   return bs;
}
 
Example 6
Source Project: arcusplatform   File: RuleDaoImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected Statement prepareUpsert(RuleDefinition definition, Date ts) {
   // note this method does not update lastExecuted
   BoundStatement bs = upsert.bind();
   bs.setUUID(Column.PLACE_ID.columnName(), definition.getPlaceId());
   bs.setInt(Column.ID.columnName(), definition.getSequenceId());
   bs.setTimestamp(Column.CREATED.columnName(), definition.getCreated());
   bs.setTimestamp(Column.MODIFIED.columnName(), definition.getModified());
   bs.setString(Column.NAME.columnName(), definition.getName());
   bs.setString(Column.DESCRIPTION.columnName(), definition.getDescription());
   bs.setSet(Column.TAGS.columnName(), definition.getTags());
   bs.setBool(RuleColumn.DISABLED.columnName(), definition.isDisabled());
   bs.setBool(RuleColumn.SUSPENDED.columnName(), definition.isSuspended());
   bs.setString(RuleColumn.TEMPLATE2.columnName(), definition.getRuleTemplate());
   bs.setString(RuleColumn.VARIABLES.columnName(), JSON.toJson(definition.getVariables()));

   if((definition instanceof StatefulRuleDefinition)) {
      StatefulRuleDefinition stateful = (StatefulRuleDefinition)definition;
      bs.setString(RuleColumn.ACTIONCONFIG.columnName(), JSON.toJson(stateful.getAction()));
      bs.setString(RuleColumn.CONDITIONCONFIG.columnName(),JSON.toJson(stateful.getCondition()));
      bs.setToNull(RuleColumn.EXPRESSIONS.columnName());
   }

   if((definition instanceof LegacyRuleDefinition)) {
      bs.setToNull(RuleColumn.ACTIONCONFIG.columnName());
      bs.setToNull(RuleColumn.CONDITIONCONFIG.columnName());
      bs.setString(RuleColumn.EXPRESSIONS.columnName(), JSON.toJson(((LegacyRuleDefinition) definition).getExpressions()));
   }

   return bs;
}
 
Example 7
Source Project: glowroot   File: UserDao.java    License: Apache License 2.0 5 votes vote down vote up
UserDao(Session session, ClusterManager clusterManager) throws Exception {
    this.session = session;

    boolean createAnonymousUser = session.getTable("user") == null;

    session.createTableWithLCS("create table if not exists user (username varchar, ldap"
            + " boolean, password_hash varchar, roles set<varchar>, primary key (username))");

    readPS = session.prepare("select username, ldap, password_hash, roles from user");
    insertIfNotExistsPS = session.prepare("insert into user (username, ldap, password_hash,"
            + " roles) values (?, ?, ?, ?) if not exists");
    insertPS = session.prepare(
            "insert into user (username, ldap, password_hash, roles) values (?, ?, ?, ?)");
    deletePS = session.prepare("delete from user where username = ?");

    if (createAnonymousUser) {
        // don't use "if not exists" here since it's not needed and has more chance to fail,
        // leaving the schema in a bad state (with the user table created, but no anonymous
        // user)
        BoundStatement boundStatement = insertPS.bind();
        int i = 0;
        boundStatement.setString(i++, "anonymous");
        boundStatement.setBool(i++, false);
        boundStatement.setString(i++, "");
        boundStatement.setSet(i++, ImmutableSet.of("Administrator"));
        session.write(boundStatement);
    }

    allUserConfigsCache = clusterManager.createSelfBoundedCache("allUserConfigsCache",
            new AllUsersCacheLoader());
}
 
Example 8
Source Project: glowroot   File: UserDao.java    License: Apache License 2.0 5 votes vote down vote up
private static void bindInsert(BoundStatement boundStatement, UserConfig userConfig) {
    int i = 0;
    boundStatement.setString(i++, userConfig.username());
    boundStatement.setBool(i++, userConfig.ldap());
    boundStatement.setString(i++, userConfig.passwordHash());
    boundStatement.setSet(i++, userConfig.roles());
}
 
Example 9
Source Project: glowroot   File: SchemaUpgrade.java    License: Apache License 2.0 5 votes vote down vote up
private void updateRolePermissionName() throws Exception {
    PreparedStatement insertPS =
            session.prepare("insert into role (name, permissions) values (?, ?)");
    ResultSet results = session.read("select name, permissions from role");
    for (Row row : results) {
        String name = row.getString(0);
        Set<String> permissions = row.getSet(1, String.class);
        boolean updated = false;
        Set<String> upgradedPermissions = new HashSet<>();
        for (String permission : permissions) {
            PermissionParser parser = new PermissionParser(permission);
            parser.parse();
            if (parser.getPermission().equals("agent:alert")) {
                upgradedPermissions.add("agent:"
                        + PermissionParser.quoteIfNeededAndJoin(parser.getAgentRollupIds())
                        + ":incident");
                updated = true;
            } else {
                upgradedPermissions.add(permission);
            }
        }
        if (updated) {
            BoundStatement boundStatement = insertPS.bind();
            boundStatement.setString(0, name);
            boundStatement.setSet(1, upgradedPermissions, String.class);
            session.write(boundStatement);
        }
    }
}
 
Example 10
Source Project: glowroot   File: SchemaUpgrade.java    License: Apache License 2.0 5 votes vote down vote up
private void rewriteRoleTablePart1() throws Exception {
    dropTableIfExists("role_temp");
    session.updateSchemaWithRetry("create table if not exists role_temp (name varchar,"
            + " permissions set<varchar>, primary key (name))");
    PreparedStatement insertTempPS =
            session.prepare("insert into role_temp (name, permissions) values (?, ?)");
    ResultSet results = session.read("select name, permissions from role");
    for (Row row : results) {
        BoundStatement boundStatement = insertTempPS.bind();
        boundStatement.setString(0, row.getString(0));
        boundStatement.setSet(1, row.getSet(1, String.class));
        session.write(boundStatement);
    }
}
 
Example 11
Source Project: glowroot   File: RoleDao.java    License: Apache License 2.0 5 votes vote down vote up
RoleDao(Session session, ClusterManager clusterManager) throws Exception {
    this.session = session;

    boolean createAnonymousRole = session.getTable("role") == null;

    session.createTableWithLCS("create table if not exists role (name varchar, permissions"
            + " set<varchar>, primary key (name))");

    readPS = session.prepare("select name, permissions from role");
    insertIfNotExistsPS =
            session.prepare("insert into role (name, permissions) values (?, ?) if not exists");
    insertPS = session.prepare("insert into role (name, permissions) values (?, ?)");
    deletePS = session.prepare("delete from role where name = ?");

    readOnePS = session.prepare("select name, permissions from role where name = ?");

    if (createAnonymousRole) {
        // don't use "if not exists" here since it's not needed and has more chance to fail,
        // leaving the schema in a bad state (with the role table created, but no Administrator
        // role)
        BoundStatement boundStatement = insertPS.bind();
        int i = 0;
        boundStatement.setString(i++, "Administrator");
        boundStatement.setSet(i++,
                ImmutableSet.of("agent:*:transaction", "agent:*:error", "agent:*:jvm",
                        "agent:*:syntheticMonitor", "agent:*:incident", "agent:*:config",
                        "admin"));
        session.write(boundStatement);
    }

    roleConfigCache = clusterManager.createSelfBoundedCache("roleConfigCache",
            new RoleConfigCacheLoader());
    allRoleConfigsCache = clusterManager.createSelfBoundedCache("allRoleConfigsCache",
            new AllRolesCacheLoader());
}
 
Example 12
@Override
@SuppressWarnings("unchecked")
protected Statement setStatementParameters(PreparedStatement updateCommand, Object tuple) throws DriverException
{
  final BoundStatement boundStmnt = new BoundStatement(updateCommand);
  final int size = columnDataTypes.size();
  for (int i = 0; i < size; i++) {
    final DataType type = columnDataTypes.get(i);
    switch (type.getName()) {
      case UUID:
        final UUID id = ((Getter<Object, UUID>)getters.get(i)).get(tuple);
        boundStmnt.setUUID(i, id);
        break;
      case ASCII:
      case VARCHAR:
      case TEXT:
        final String ascii = ((Getter<Object, String>)getters.get(i)).get(tuple);
        boundStmnt.setString(i, ascii);
        break;
      case BOOLEAN:
        final boolean bool = ((GetterBoolean<Object>)getters.get(i)).get(tuple);
        boundStmnt.setBool(i, bool);
        break;
      case INT:
        final int intValue = ((GetterInt<Object>)getters.get(i)).get(tuple);
        boundStmnt.setInt(i, intValue);
        break;
      case BIGINT:
      case COUNTER:
        final long longValue = ((GetterLong<Object>)getters.get(i)).get(tuple);
        boundStmnt.setLong(i, longValue);
        break;
      case FLOAT:
        final float floatValue = ((GetterFloat<Object>)getters.get(i)).get(tuple);
        boundStmnt.setFloat(i, floatValue);
        break;
      case DOUBLE:
        final double doubleValue = ((GetterDouble<Object>)getters.get(i)).get(tuple);
        boundStmnt.setDouble(i, doubleValue);
        break;
      case DECIMAL:
        final BigDecimal decimal = ((Getter<Object, BigDecimal>)getters.get(i)).get(tuple);
        boundStmnt.setDecimal(i, decimal);
        break;
      case SET:
        Set<?> set = ((Getter<Object, Set<?>>)getters.get(i)).get(tuple);
        boundStmnt.setSet(i, set);
        break;
      case MAP:
        final Map<?,?> map = ((Getter<Object, Map<?,?>>)getters.get(i)).get(tuple);
        boundStmnt.setMap(i, map);
        break;
      case LIST:
        final List<?> list = ((Getter<Object, List<?>>)getters.get(i)).get(tuple);
        boundStmnt.setList(i, list);
        break;
      case TIMESTAMP:
        final Date date = ((Getter<Object, Date>)getters.get(i)).get(tuple);
        boundStmnt.setDate(i, LocalDate.fromMillisSinceEpoch(date.getTime()));
        break;
      default:
        throw new RuntimeException("unsupported data type " + type.getName());
    }
  }
  return boundStmnt;
}
 
Example 13
Source Project: glowroot   File: SyntheticResultDaoImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void store(String agentRollupId, String syntheticMonitorId,
        String syntheticMonitorDisplay, long captureTime, long durationNanos,
        @Nullable String errorMessage) throws Exception {
    int ttl = getTTLs().get(0);
    long maxCaptureTime = 0;
    BoundStatement boundStatement = insertResultPS.get(0).bind();
    maxCaptureTime = Math.max(captureTime, maxCaptureTime);
    int adjustedTTL = Common.getAdjustedTTL(ttl, captureTime, clock);
    int i = 0;
    boundStatement.setString(i++, agentRollupId);
    boundStatement.setString(i++, syntheticMonitorId);
    boundStatement.setTimestamp(i++, new Date(captureTime));
    boundStatement.setDouble(i++, durationNanos);
    boundStatement.setLong(i++, 1);
    if (errorMessage == null) {
        boundStatement.setToNull(i++);
    } else {
        Stored.ErrorInterval errorInterval = Stored.ErrorInterval.newBuilder()
                .setFrom(captureTime)
                .setTo(captureTime)
                .setCount(1)
                .setMessage(errorMessage)
                .setDoNotMergeToTheLeft(false)
                .setDoNotMergeToTheRight(false)
                .build();
        boundStatement.setBytes(i++, Messages.toByteBuffer(ImmutableList.of(errorInterval)));
    }
    boundStatement.setInt(i++, adjustedTTL);
    List<Future<?>> futures = new ArrayList<>();
    futures.add(session.writeAsync(boundStatement));
    futures.addAll(syntheticMonitorIdDao.insert(agentRollupId, captureTime, syntheticMonitorId,
            syntheticMonitorDisplay));

    // wait for success before inserting "needs rollup" records
    MoreFutures.waitForAll(futures);

    // insert into synthetic_needs_rollup_1
    List<RollupConfig> rollupConfigs = configRepository.getRollupConfigs();
    long intervalMillis = rollupConfigs.get(1).intervalMillis();
    long rollupCaptureTime = CaptureTimes.getRollup(captureTime, intervalMillis);
    int needsRollupAdjustedTTL =
            Common.getNeedsRollupAdjustedTTL(adjustedTTL, configRepository.getRollupConfigs());
    boundStatement = insertNeedsRollup.get(0).bind();
    i = 0;
    boundStatement.setString(i++, agentRollupId);
    boundStatement.setTimestamp(i++, new Date(rollupCaptureTime));
    boundStatement.setUUID(i++, UUIDs.timeBased());
    boundStatement.setSet(i++, ImmutableSet.of(syntheticMonitorId));
    boundStatement.setInt(i++, needsRollupAdjustedTTL);
    session.write(boundStatement);
}
 
Example 14
Source Project: glowroot   File: SchemaUpgrade.java    License: Apache License 2.0 4 votes vote down vote up
private void rewriteRoleTablePart2() throws Exception {
    if (!tableExists("role_temp")) {
        // previously failed mid-upgrade prior to updating schema version
        return;
    }
    dropTableIfExists("role");
    session.createTableWithLCS("create table if not exists role (name varchar, permissions"
            + " set<varchar>, primary key (name))");
    PreparedStatement insertPS =
            session.prepare("insert into role (name, permissions) values (?, ?)");
    Map<String, V09AgentRollup> v09AgentRollups = getV09AgentRollupsFromAgentRollupTable();
    ResultSet results = session.read("select name, permissions from role_temp");
    for (Row row : results) {
        Set<String> v09Permissions = row.getSet(1, String.class);
        Set<String> permissions = Sets.newLinkedHashSet();
        for (String v09Permission : v09Permissions) {
            if (!v09Permission.startsWith("agent:")) {
                // non-agent permission, no need for conversion
                permissions.add(v09Permission);
                continue;
            }
            if (v09Permission.equals("agent:") || v09Permission.startsWith("agent::")
                    || v09Permission.equals("agent:*")
                    || v09Permission.startsWith("agent:*:")) {
                // special cases, no need for conversion
                permissions.add(v09Permission);
                continue;
            }
            PermissionParser parser = new PermissionParser(v09Permission);
            parser.parse();
            List<String> v09AgentRollupIds = parser.getAgentRollupIds();
            String perm = parser.getPermission();
            if (v09AgentRollupIds.isEmpty()) {
                // this shouldn't happen since v09Permission doesn't start with "agent::"
                // (see condition above)
                logger.warn("found agent permission without any agents: {}", v09Permission);
                continue;
            }
            List<String> agentRollupIds = new ArrayList<>();
            for (String v09AgentRollupId : v09AgentRollupIds) {
                V09AgentRollup v09AgentRollup = v09AgentRollups.get(v09AgentRollupId);
                if (v09AgentRollup == null) {
                    // v09AgentRollupId was manually deleted (via the UI) from the
                    // agent_rollup table in which case its parent is no longer known
                    // and best to ignore
                    continue;
                }
                agentRollupIds.add(v09AgentRollup.agentRollupId());
            }
            if (agentRollupIds.isEmpty()) {
                // all v09AgentRollupIds were manually deleted (see comment above)
                continue;
            }
            if (perm.isEmpty()) {
                permissions.add(
                        "agent:" + PermissionParser.quoteIfNeededAndJoin(v09AgentRollupIds));
            } else {
                permissions.add("agent:" + PermissionParser.quoteIfNeededAndJoin(agentRollupIds)
                        + ":" + perm.substring("agent:".length()));
            }
        }
        if (permissions.isEmpty()) {
            // all v09AgentRollupIds for all permissions were manually deleted (see comments
            // above)
            continue;
        }
        BoundStatement boundStatement = insertPS.bind();
        boundStatement.setString(0, row.getString(0));
        boundStatement.setSet(1, permissions);
        session.write(boundStatement);
    }
    dropTableIfExists("role_temp");
}
 
Example 15
Source Project: glowroot   File: SchemaUpgrade.java    License: Apache License 2.0 4 votes vote down vote up
private void updateRolePermissionName2() throws Exception {
    PreparedStatement insertPS =
            session.prepare("insert into role (name, permissions) values (?, ?)");
    ResultSet results = session.read("select name, permissions from role");
    for (Row row : results) {
        String name = row.getString(0);
        Set<String> permissions = row.getSet(1, String.class);
        boolean updated = false;
        Set<String> upgradedPermissions = new HashSet<>();
        for (String permission : permissions) {
            PermissionParser parser = new PermissionParser(permission);
            parser.parse();
            if (parser.getPermission().equals("agent:transaction:profile")) {
                upgradedPermissions.add("agent:"
                        + PermissionParser.quoteIfNeededAndJoin(parser.getAgentRollupIds())
                        + ":transaction:threadProfile");
                updated = true;
            } else if (parser.getPermission().equals("agent:config:edit:gauge")) {
                upgradedPermissions.add("agent:"
                        + PermissionParser.quoteIfNeededAndJoin(parser.getAgentRollupIds())
                        + ":config:edit:gauges");
                updated = true;
            } else if (parser.getPermission().equals("agent:config:edit:syntheticMonitor")) {
                upgradedPermissions.add("agent:"
                        + PermissionParser.quoteIfNeededAndJoin(parser.getAgentRollupIds())
                        + ":config:edit:syntheticMonitors");
                updated = true;
            } else if (parser.getPermission().equals("agent:config:edit:alert")) {
                upgradedPermissions.add("agent:"
                        + PermissionParser.quoteIfNeededAndJoin(parser.getAgentRollupIds())
                        + ":config:edit:alerts");
                updated = true;
            } else if (parser.getPermission().equals("agent:config:edit:plugin")) {
                upgradedPermissions.add("agent:"
                        + PermissionParser.quoteIfNeededAndJoin(parser.getAgentRollupIds())
                        + ":config:edit:plugins");
                updated = true;
            } else if (parser.getPermission().equals("agent:config:edit:ui")) {
                upgradedPermissions.add("agent:"
                        + PermissionParser.quoteIfNeededAndJoin(parser.getAgentRollupIds())
                        + ":config:edit:uiDefaults");
                updated = true;
            } else {
                upgradedPermissions.add(permission);
            }
        }
        if (updated) {
            BoundStatement boundStatement = insertPS.bind();
            boundStatement.setString(0, name);
            boundStatement.setSet(1, upgradedPermissions, String.class);
            session.write(boundStatement);
        }
    }
}
 
Example 16
Source Project: glowroot   File: RoleDao.java    License: Apache License 2.0 4 votes vote down vote up
private static void bindInsert(BoundStatement boundStatement, RoleConfig userConfig) {
    int i = 0;
    boundStatement.setString(i++, userConfig.name());
    boundStatement.setSet(i++, userConfig.permissions());
}