/** * Accessor for the tags associated with Experiments. */ @Accessor public interface ExperimentTagAccessor { @Query("select * from experiment_tag where app_name = ?") ListenableFuture<Result<ExperimentTagsByApplication>> getExperimentTagsAsync(String appName); @Query("insert into experiment_tag(app_name, exp_id, tags) values (?,?,?)") Statement insert(String appName, UUID experimentId, Set<String> tags); }
@Accessor public interface ObjectTypeAccessor { @Query("SELECT * FROM " + KEY_SPACE + "." + TABLE) Result<ObjectTypeEntity> fetch(); @Query("SELECT * FROM " + KEY_SPACE + "." + TABLE + " WHERE name = :name") ObjectTypeEntity getByName(@Param("name") String name); }
@Accessor public interface FactAccessor { @Query("SELECT * FROM " + KEY_SPACE + "." + FactEntity.TABLE + " WHERE id IN :id") Result<FactEntity> fetchByID(@Param("id") List<UUID> id); @Query("UPDATE " + KEY_SPACE + "." + FactEntity.TABLE + " SET last_seen_timestamp = :timestamp WHERE id = :id") void refreshLastSeenTimestamp(@Param("id") UUID id, @Param("timestamp") long timestamp); @Query("SELECT * FROM " + KEY_SPACE + "." + MetaFactBindingEntity.TABLE + " WHERE fact_id = :id") Result<MetaFactBindingEntity> fetchMetaFactBindings(@Param("id") UUID id); }
@Accessor public interface FactTypeAccessor { @Query("SELECT * FROM " + KEY_SPACE + "." + TABLE) Result<FactTypeEntity> fetch(); @Query("SELECT * FROM " + KEY_SPACE + "." + TABLE + " WHERE name = :name") FactTypeEntity getByName(@Param("name") String name); }
@Accessor public interface FactAclAccessor { @Query("SELECT * FROM " + KEY_SPACE + "." + TABLE + " WHERE fact_id = :id") Result<FactAclEntity> fetch(@Param("id") UUID id); }
@Accessor public interface ObjectAccessor { @Query("SELECT * FROM " + KEY_SPACE + "." + ObjectEntity.TABLE + " WHERE id IN :id") Result<ObjectEntity> fetchByID(@Param("id") List<UUID> id); @Query("SELECT * FROM " + KEY_SPACE + "." + ObjectByTypeValueEntity.TABLE + " WHERE object_type_id = :type AND object_value = :value") ObjectByTypeValueEntity getObjectByTypeValue(@Param("type") UUID objectTypeID, @Param("value") String objectValue); @Query("SELECT * FROM " + KEY_SPACE + "." + ObjectFactBindingEntity.TABLE + " WHERE object_id = :id") Result<ObjectFactBindingEntity> fetchObjectFactBindings(@Param("id") UUID id); }
/** * Accessor interface */ @Accessor public interface UserInfoAccessor { @Query("insert into user_info (user_id, user_email, firstname, lastname) values (?, ?, ?, ?)") ResultSet insertUserInfoBy(String userId, String userEmail, String firstName, String lastName); @Query("select * from user_info where user_id = ?") Result<UserInfo> getUserInfoBy(String userId); @Query("delete from user_info where user_id = ?") ResultSet deleteBy(String userId); }
/** * Accessor interface */ @Accessor public interface StagingAccessor { @Query("insert into staging_v2(time, type, exep , msg) values(now(), ?, ? , ?)") ResultSet insertBy(String type, String exception, String message); @Query("insert into staging_v2(time, type, exep , msg) values(?, ?, ? , ?)") BoundStatement batchInsertBy(UUID time, String type, String exception, String message); @Query("select * from staging_v2 limit ?") ResultSet batchSelectBy(int batchSize); @Query("delete from staging_v2 where time = ?") ResultSet deleteBy(UUID timeUUID); }
@Accessor public interface FactCommentAccessor { @Query("SELECT * FROM " + KEY_SPACE + "." + TABLE + " WHERE fact_id = :id") Result<FactCommentEntity> fetch(@Param("id") UUID id); }
/** * Accessor interface */ @Accessor public interface ExperimentPageAccessor { @Query("insert into experiment_page(page, exp_id, assign) " + "values(?,?,?)") Statement insertBy(String page, UUID experimentId, boolean assign); @Query("delete from experiment_page where page = ? and exp_id = ?") Statement deleteBy(String page, UUID experimentId); @Query("select * from experiment_page where exp_id = ? and page = ?") Result<PageExperimentByAppNamePage> selectBy(UUID experimentId, String page); @Query("select * from experiment_page where exp_id = ?") Result<PageExperimentByAppNamePage> selectBy(UUID experimentId); }
/** * Accessor interface */ @Accessor public interface BucketAssignmentCountAccessor { @Query("UPDATE bucket_assignment_counts SET bucket_assignment_count = bucket_assignment_count + 1 " + "WHERE experiment_id =? and bucket_label = ?") ResultSet incrementCountBy(UUID experimentId, String bucketLabel); @Query("UPDATE bucket_assignment_counts SET bucket_assignment_count = bucket_assignment_count - 1 " + "WHERE experiment_id =? and bucket_label = ?") ResultSet decrementCountBy(UUID experimentId, String bucketLabel); @Query("SELECT * FROM bucket_assignment_counts WHERE experiment_id =?") Result<BucketAssignmentCount> selectBy(UUID experimentId); @Query("SELECT * FROM bucket_assignment_counts WHERE experiment_id =?") ListenableFuture<Result<BucketAssignmentCount>> selectByAsync(UUID experimentId); }
/** * Accessor interface */ @Accessor public interface AppRoleAccessor { @Query("select * from app_roles where app_name = ?") Result<AppRole> getAppRoleByAppName(String appName); @Query("delete from app_roles where app_name = ? and user_id = ?") ResultSet deleteAppRoleBy(String appName, String userId); @Query("insert into app_roles (app_name, user_id, role) values (?, ?, ?)") ResultSet insertAppRoleBy(String appName, String userId, String role); //TODO: this is a hack for multitable batch statement @Query("insert into app_roles (app_name, user_id, role) values (?, ?, ?)") Statement insertAppRoleStatement(String appName, String userId, String role); @Query("delete from app_roles where app_name = ? and user_id = ?") Statement deleteAppRoleStatement(String appName, String userId); }
@Accessor public interface UserRoleAccessor {
@Accessor public interface ExperimentUserIndexAccessor { @Query("insert into experiment_user_index (user_id, context, app_name, experiment_id, bucket)" +
@Accessor public interface ApplicationListAccessor {
@Accessor public interface BucketAuditLogAccessor {
@Accessor public interface ExperimentAuditLogAccessor {
@Accessor public interface ExclusionAccessor {
@Accessor public interface StateExperimentIndexAccessor {
@Accessor public interface UserFeedbackAccessor {