本文整理匯總了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();
}