public void updateConnection(
     String displayName,
     String profileUrl,
     String imageUrl,
     String accessToken,
     String secret,
     String refreshToken,
     Long expireTime,
     String userId,
     String providerId,
     String providerUserId) {
   try {
     Statement updateConn =
         QueryBuilder.update(keyspace, table)
             .with(QueryBuilder.set("displayName", displayName))
             .and(QueryBuilder.set("profileUrl", profileUrl))
             .and(QueryBuilder.set("imageUrl", imageUrl))
             .and(QueryBuilder.set("accessToken", accessToken))
             .and(QueryBuilder.set("secret", secret))
             .and(QueryBuilder.set("refreshToken", refreshToken))
             .and(QueryBuilder.set("expireTime", expireTime))
             .where(QueryBuilder.eq("userId", userId))
             .and(QueryBuilder.eq("providerId", providerId))
             .and(QueryBuilder.eq("providerUserId", providerUserId));
     session.execute(updateConn);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
  protected Statement createUpdateStatement(
      CassandraPersistenceSession session, EventSubscriptionEntity entity) {
    Session s = session.getSession();
    UDTypeHandler typeHander = session.getTypeHander(EventSubscriptionEntity.class);
    CassandraSerializer<EventSubscriptionEntity> serializer =
        session.getSerializer(EventSubscriptionEntity.class);

    UDTValue value = typeHander.createValue(s);
    serializer.write(value, entity);

    return QueryBuilder.update(ProcessInstanceTableHandler.TABLE_NAME)
        .with(put("event_subscriptions", entity.getId(), value))
        .where(eq("id", entity.getProcessInstanceId()));
  }
Esempio n. 3
0
 public void changePassword(String username, String newPassword) {
   Session session = cluster.connect("ducquak");
   Statement s00;
   s00 = QueryBuilder.select().all().from("ducquak", "users");
   ResultSet rs = session.execute(s00);
   for (Row row : rs) {
     String olduserName = row.getString("userName");
     if (olduserName.equals(username)) {
       Statement s01 =
           QueryBuilder.update("ducquak", "users")
               .with(set("password", username))
               .where(eq("password", olduserName));
       session.execute(s01);
     }
   }
 }