本文整理汇总了Java中com.datastax.driver.core.ResultSet.wasApplied方法的典型用法代码示例。如果您正苦于以下问题:Java ResultSet.wasApplied方法的具体用法?Java ResultSet.wasApplied怎么用?Java ResultSet.wasApplied使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.datastax.driver.core.ResultSet
的用法示例。
在下文中一共展示了ResultSet.wasApplied方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
private Optional<Event> save(EventEntity entity, boolean ifNotExists) {
if (entity.getId() == null) {
entity.setId(UUIDs.timeBased());
}
Insert insert = QueryBuilder.insertInto(getColumnFamilyName())
.value(ModelConstants.ID_PROPERTY, entity.getId())
.value(ModelConstants.EVENT_TENANT_ID_PROPERTY, entity.getTenantId())
.value(ModelConstants.EVENT_ENTITY_TYPE_PROPERTY, entity.getEntityType())
.value(ModelConstants.EVENT_ENTITY_ID_PROPERTY, entity.getEntityId())
.value(ModelConstants.EVENT_TYPE_PROPERTY, entity.getEventType())
.value(ModelConstants.EVENT_UID_PROPERTY, entity.getEventUid())
.value(ModelConstants.EVENT_BODY_PROPERTY, entity.getBody());
if (ifNotExists) {
insert = insert.ifNotExists();
}
ResultSet rs = executeWrite(insert);
if (rs.wasApplied()) {
return Optional.of(DaoUtil.getData(entity));
} else {
return Optional.empty();
}
}
示例2: saveIfNotExist
import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
private Optional<ComponentDescriptor> saveIfNotExist(ComponentDescriptorEntity entity) {
if (entity.getId() == null) {
entity.setId(UUIDs.timeBased());
}
ResultSet rs = executeRead(QueryBuilder.insertInto(getColumnFamilyName())
.value(ModelConstants.ID_PROPERTY, entity.getId())
.value(ModelConstants.COMPONENT_DESCRIPTOR_NAME_PROPERTY, entity.getName())
.value(ModelConstants.COMPONENT_DESCRIPTOR_CLASS_PROPERTY, entity.getClazz())
.value(ModelConstants.COMPONENT_DESCRIPTOR_TYPE_PROPERTY, entity.getType())
.value(ModelConstants.COMPONENT_DESCRIPTOR_SCOPE_PROPERTY, entity.getScope())
.value(ModelConstants.COMPONENT_DESCRIPTOR_CONFIGURATION_DESCRIPTOR_PROPERTY, entity.getConfigurationDescriptor())
.value(ModelConstants.COMPONENT_DESCRIPTOR_ACTIONS_PROPERTY, entity.getActions())
.value(ModelConstants.SEARCH_TEXT_PROPERTY, entity.getSearchText())
.ifNotExists()
);
if (rs.wasApplied()) {
return Optional.of(DaoUtil.getData(entity));
} else {
return Optional.empty();
}
}
示例3: insertTimeline
import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
private boolean insertTimeline(XmTimeline xmTimeline, String table) {
Insert insert = QueryBuilder.insertInto(xmTimeline.getTenant(), table)
.value(LOGIN_COL, xmTimeline.getLogin())
.value(USER_KEY_COL, xmTimeline.getUserKey())
.value(START_DATE_COL, xmTimeline.getStartDate())
.value(RID_COL, xmTimeline.getRid())
.value(TENANT_COL, xmTimeline.getTenant())
.value(MS_NAME_COL, xmTimeline.getMsName())
.value(OPERATION_COL, xmTimeline.getOperationName())
.value(ENTITY_ID_COL, xmTimeline.getEntityId())
.value(ENTITY_KEY_COL, xmTimeline.getEntityKey())
.value(ENTITY_TYPE_KEY_COL, xmTimeline.getEntityTypeKey())
.value(OPERATION_URL_COL, xmTimeline.getOperationUrl())
.value(HTTP_METHOD_COL, xmTimeline.getHttpMethod())
.value(REQUEST_BODY_COL, xmTimeline.getRequestBody())
.value(REQUEST_LENGTH_COL, xmTimeline.getRequestLength())
.value(RESPONSE_BODY_COL, xmTimeline.getResponseBody())
.value(RESPONSE_LENGTH_COL, xmTimeline.getResponseLength())
.value(REQUEST_HEADERS_COL, xmTimeline.getRequestHeaders())
.value(RESPONSE_HEADERS_COL, xmTimeline.getResponseHeaders())
.value(HTTP_STATUS_CODE_COL, xmTimeline.getHttpStatusCode())
.value(CHANNEL_TYPE_COL, xmTimeline.getChannelType())
.value(EXEC_TIME_COL, xmTimeline.getExecTime());
ResultSet resultSet = session.execute(insert);
return resultSet.wasApplied();
}
示例4: insertKeyById
import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
/**
* Insert into cassandra.
*
* @param entityId entity id
* @param entityKey entity key
* @param tenant tenant name
* @return the result of insert
*/
public boolean insertKeyById(Long entityId, String entityKey, String tenant) {
Insert insert = QueryBuilder.insertInto(tenant, TABLE_KEY_ID).value(ENTITY_ID_COL, entityId)
.value(ENTITY_KEY_COL, entityKey);
ResultSet resultSet = session.execute(insert);
return resultSet.wasApplied();
}