public void update(CassandraPersistenceSession session, EventSubscriptionEntity entity) { session.addStatement(createUpdateStatement(session, entity), entity.getProcessInstanceId()); for (IndexHandler<EventSubscriptionEntity> index : indexHandlers.values()) { session.addIndexStatement( index.getInsertStatement(session, entity), entity.getProcessInstanceId()); } }
public void delete(CassandraPersistenceSession session, EventSubscriptionEntity entity) { session.addStatement( QueryBuilder.delete() .mapElt("event_subscriptions", entity.getId()) .from(ProcessInstanceTableHandler.TABLE_NAME) .where(eq("id", entity.getProcessInstanceId())), entity.getProcessInstanceId()); for (IndexHandler<EventSubscriptionEntity> index : indexHandlers.values()) { session.addIndexStatement( index.getDeleteStatement(session, entity), entity.getProcessInstanceId()); } }
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())); }