本文整理汇总了Java中me.prettyprint.hector.api.beans.Composite类的典型用法代码示例。如果您正苦于以下问题:Java Composite类的具体用法?Java Composite怎么用?Java Composite使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Composite类属于me.prettyprint.hector.api.beans包,在下文中一共展示了Composite类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteInSPOC
import me.prettyprint.hector.api.beans.Composite; //导入依赖的package包/类
/**
* Deletes in SPOC index.
*
* @param rowKey the row key.
* @param ids the triple identifiers
* @throws DataAccessLayerException in case of data access failure.
*/
void deleteInSPOC(final byte[] rowKey, final byte[][]ids) throws DataAccessLayerException {
final Composite poc_col = new Composite();
// predicate
poc_col.addComponent(ids[1], BYTE_SERIALIZER);
// object
poc_col.addComponent(ids[2], BYTE_SERIALIZER);
if (ids.length == 4) {
// context
poc_col.addComponent(ids[3], BYTE_SERIALIZER);
}
_mutators.get().addDeletion(rowKey, S_POC, poc_col, COMPOSITE_SERIALIZER);
}
示例2: doCheckExistingRole
import me.prettyprint.hector.api.beans.Composite; //导入依赖的package包/类
/**
* Checks if the role is existing the role store.
*/
@Override
protected boolean doCheckExistingRole(String roleNameWithTenantDomain) throws UserStoreException {
RoleContext roleContext = createRoleContext(roleNameWithTenantDomain);
boolean isExisting = false;
String roleName = roleContext.getRoleName();
Composite key = new Composite();
key.addComponent(roleName, stringSerializer);
key.addComponent(tenantIdString, stringSerializer);
ColumnQuery<Composite, String, String> getCredentialQuery = HFactory.createColumnQuery(keyspace,
CompositeSerializer.get(), stringSerializer, stringSerializer);
getCredentialQuery.setColumnFamily(CFConstants.UM_ROLES).setKey(key).setName(CFConstants.UM_ROLE_NAME);
HColumn<String, String> result = getCredentialQuery.execute().get();
if (result != null && result.getValue() != null) {
isExisting = true;
}
return isExisting;
}
示例3: doCheckExistingUser
import me.prettyprint.hector.api.beans.Composite; //导入依赖的package包/类
/**
* Checks if the user is existing in the user store.
*/
@Override
protected boolean doCheckExistingUser(String userName) throws UserStoreException {
Boolean isExist = false;
Composite key = new Composite();
key.addComponent(userName, stringSerializer);
key.addComponent(tenantIdString, stringSerializer);
ColumnQuery<Composite, String, String> getCredentialQuery = HFactory.createColumnQuery(keyspace,
CompositeSerializer.get(), stringSerializer, stringSerializer);
getCredentialQuery.setColumnFamily(CFConstants.UM_USER).setKey(key).setName(CFConstants.UM_USER_NAME);
HColumn<String, String> result = getCredentialQuery.execute().get();
if (result != null && result.getValue() != null) {
isExist = true;
}
return isExist;
}
示例4: doAddRole
import me.prettyprint.hector.api.beans.Composite; //导入依赖的package包/类
/**
* Adds a role to the role store.
*/
@Override
public void doAddRole(String roleName, String[] userList, boolean shared) throws UserStoreException {
Mutator<Composite> mutator = HFactory.createMutator(keyspace, CompositeSerializer.get());
Composite composite = new Composite();
composite.addComponent(roleName, stringSerializer);
composite.addComponent(tenantIdString, stringSerializer);
mutator.addInsertion(composite, CFConstants.UM_ROLES,
HFactory.createColumn(CFConstants.UM_ROLE_NAME, roleName, stringSerializer, stringSerializer));
mutator.addInsertion(composite, CFConstants.UM_ROLES,
HFactory.createColumn(CFConstants.UM_TENANT_ID, tenantIdString, stringSerializer, stringSerializer));
if (userList != null && userList.length > 0) {
addRoleToUsersList(userList, roleName, mutator);
}
mutator.execute();
}
示例5: addUserToRoleList
import me.prettyprint.hector.api.beans.Composite; //导入依赖的package包/类
/**
* Maps the users to a role list. Adds the (username, tenantId) -> roleList
* and (role, tenantId) -> userName
*
* @param userName The username of the user the roles need to be added to.
* @param roleList The list of roles that needs to be mapped against the user.
*/
private void addUserToRoleList(String userName, String[] roleList) {
Mutator<Composite> mutator = HFactory.createMutator(keyspace, CompositeSerializer.get());
if (roleList != null) {
for (String role : roleList) {
Composite key = new Composite();
key.addComponent(userName, stringSerializer);
key.addComponent(tenantIdString, stringSerializer);
mutator.addInsertion(key, CFConstants.UM_USER_ROLE, HFactory.createColumn(role, role));
Composite keyRole = new Composite();
keyRole.addComponent(role, stringSerializer);
keyRole.addComponent(tenantIdString, stringSerializer);
mutator.addInsertion(keyRole, CFConstants.UM_ROLE_USER_INDEX, HFactory.createColumn(userName, userName));
}
mutator.execute();
}
}
示例6: addRoleToUsersList
import me.prettyprint.hector.api.beans.Composite; //导入依赖的package包/类
/**
* Maps the role to a user list. Adds the (username, tenantId) -> roleList
* and (role, tenantId) -> userName
*
* @param userNames The username list of the user the role need to be added to.
* @param roleName The role that needs to be mapped against the user list.
* @param mutator Passes the mutator and returns it with the insert statements.
*/
private Mutator<Composite> addRoleToUsersList(String[] userNames, String roleName, Mutator<Composite> mutator) {
if (userNames != null) {
for (String userName : userNames) {
Composite key = new Composite();
key.addComponent(userName, stringSerializer);
key.addComponent(tenantIdString, stringSerializer);
mutator.addInsertion(key, CFConstants.UM_USER_ROLE, HFactory.createColumn(roleName, roleName));
Composite keyRole = new Composite();
keyRole.addComponent(roleName, stringSerializer);
keyRole.addComponent(tenantIdString, stringSerializer);
mutator.addInsertion(keyRole, CFConstants.UM_ROLE_USER_INDEX, HFactory.createColumn(userName, userName));
}
}
return mutator;
}
示例7: doGetUserListOfRole
import me.prettyprint.hector.api.beans.Composite; //导入依赖的package包/类
/**
* Get the list of users mapped to a role.
*/
@Override
public String[] doGetUserListOfRole(String roleName, String filter) throws UserStoreException {
List<String> usersList = new ArrayList<String>();
Composite key = new Composite();
key.addComponent(roleName, stringSerializer);
key.addComponent(tenantIdString, stringSerializer);
SliceQuery<Composite, String, String> query = HFactory
.createSliceQuery(keyspace, CompositeSerializer.get(), StringSerializer.get(), StringSerializer.get())
.setKey(key).setColumnFamily(CFConstants.UM_ROLE_USER_INDEX);
ColumnSliceIterator<Composite, String, String> iterator = new ColumnSliceIterator<Composite, String, String>(
query, null, "\uFFFF", false);
while (iterator.hasNext()) {
HColumn<String, String> column = iterator.next();
usersList.add(column.getValue());
}
return usersList.toArray(new String[usersList.size()]);
}
示例8: doGetExternalRoleListOfUser
import me.prettyprint.hector.api.beans.Composite; //导入依赖的package包/类
/**
* Gets the external role list of a user.
*/
@Override
public String[] doGetExternalRoleListOfUser(String userName, String filter) throws UserStoreException {
List<String> roles = new ArrayList<String>();
int arrayLength = 0;
Composite key = new Composite();
key.addComponent(userName, stringSerializer);
key.addComponent(tenantIdString, stringSerializer);
SliceQuery<Composite, String, String> query = HFactory
.createSliceQuery(keyspace, CompositeSerializer.get(), StringSerializer.get(), StringSerializer.get())
.setKey(key).setColumnFamily(CFConstants.UM_USER_ROLE);
ColumnSliceIterator<Composite, String, String> iterator = new ColumnSliceIterator<Composite, String, String>(
query, null, "\uFFFF", false);
while (iterator.hasNext()) {
HColumn<String, String> column = iterator.next();
roles.add(column.getValue());
}
return roles.toArray(new String[arrayLength]);
}
示例9: mapRow
import me.prettyprint.hector.api.beans.Composite; //导入依赖的package包/类
@Override
public List<ActorSystemEventListener> mapRow(final ColumnFamilyResult<Composite, String> results) {
List<ActorSystemEventListener> resultList = new ArrayList<>(1024);
if(results.hasResults()) {
Collection<String> actorIds = results.getColumnNames();
for (String actorId : actorIds) {
try {
resultList.add(ActorSystemEventListenerDeserializer.get().deserialize(results.getByteArray(actorId)));
} catch(IOException e) {
logger.error("IOException while deserializing ActorSystemEventListener",e);
}
}
}
return resultList;
}
开发者ID:elasticsoftwarefoundation,项目名称:elasticactors,代码行数:17,代码来源:CassandraActorSystemEventListenerRepository.java
示例10: mapRow
import me.prettyprint.hector.api.beans.Composite; //导入依赖的package包/类
@Override
public List<ScheduledMessage> mapRow(final ColumnFamilyResult<Composite, Composite> results) {
List<ScheduledMessage> resultList = new LinkedList<>();
if(results.hasResults()) {
Collection<Composite> scheduledMessages = results.getColumnNames();
for (Composite columnName : scheduledMessages) {
try {
resultList.add(scheduledMessageDeserializer.deserialize(results.getByteArray(columnName)));
} catch(IOException e) {
logger.error(e);
}
}
}
return resultList;
}
开发者ID:elasticsoftwarefoundation,项目名称:elasticactors,代码行数:17,代码来源:CassandraScheduledMessageRepository.java
示例11: deleteInOSPC
import me.prettyprint.hector.api.beans.Composite; //导入依赖的package包/类
/**
* Deletes in OPSC index.
*
* @param rowKey the row key.
* @param ids the triple identifiers
* @throws DataAccessLayerException in case of data access failure.
*/
void deleteInOSPC(final byte[] rowKey, final byte[][]ids) throws DataAccessLayerException {
final Composite spc_col = new Composite();
spc_col.addComponent(ids[0], BYTE_SERIALIZER);
spc_col.addComponent(ids[1], BYTE_SERIALIZER);
if (ids.length == 4) {
spc_col.addComponent(ids[3], BYTE_SERIALIZER);
}
_mutators.get().addDeletion(rowKey, O_SPC, spc_col, COMPOSITE_SERIALIZER);
}
示例12: deleteInPOSC
import me.prettyprint.hector.api.beans.Composite; //导入依赖的package包/类
/**
* Deletes in POSC index.
*
* @param rowKey the row key.
* @param ids the triple identifiers
* @throws DataAccessLayerException in case of data access failure.
*/
void deleteInPOSC(final byte[] rowKey, final byte[][]ids) throws DataAccessLayerException {
final Composite sc_col = new Composite();
// subject
sc_col.addComponent(ids[0], BYTE_SERIALIZER);
if (ids.length == 4) {
// context
sc_col.addComponent(ids[3], BYTE_SERIALIZER);
}
_mutators.get().addDeletion(rowKey, ColumnFamily.PO_SC, sc_col, COMPOSITE_SERIALIZER);
}
示例13: insertInOPSC
import me.prettyprint.hector.api.beans.Composite; //导入依赖的package包/类
/**
* Insert a triple in OPSC index.
*
* @param rowKey the row key.
* @param ids the triple identifiers
* @throws DataAccessLayerException in case of data access failure.
*/
void insertInOPSC(final byte [] rowKey, final byte[][]ids) throws DataAccessLayerException {
final Composite spc_col = new Composite();
spc_col.addComponent(ids[0], BYTE_SERIALIZER);
spc_col.addComponent(ids[1], BYTE_SERIALIZER);
if (ids.length == 4) {
spc_col.addComponent(ids[3], BYTE_SERIALIZER);
}
_mutators.get().addInsertion(rowKey, O_SPC, HFactory.createColumn(spc_col, EMPTY_VAL, COMPOSITE_SERIALIZER, BYTE_SERIALIZER));
}
示例14: insertInPOSC
import me.prettyprint.hector.api.beans.Composite; //导入依赖的package包/类
/**
* Insert a triple in POSC index.
*
* @param rowKey the row key.
* @param ids the triple identifiers
* @throws DataAccessLayerException in case of data access failure.
*/
void insertInPOSC(final byte [] rowKey, final byte[][]ids) throws DataAccessLayerException {
final Composite sc_col = new Composite();
sc_col.addComponent(ids[0], BYTE_SERIALIZER);
if (ids.length == 4) {
sc_col.addComponent(ids[3], BYTE_SERIALIZER);
}
// subject col
_mutators.get()
.addInsertion(rowKey, PO_SC, HFactory.createColumn(sc_col, EMPTY_VAL, COMPOSITE_SERIALIZER, BYTE_SERIALIZER))
.addInsertion(rowKey, PO_SC, HFactory.createColumn(P_COL, ids[1], COMPOSITE_SERIALIZER, BYTE_SERIALIZER));
}
示例15: insertInSPOC
import me.prettyprint.hector.api.beans.Composite; //导入依赖的package包/类
/**
* Insert a triple in SPOC index.
*
* @param rowKey the row key.
* @param ids the triple identifiers
* @throws DataAccessLayerException in case of data access failure.
*/
void insertInSPOC(final byte [] rowKey, final byte[][]ids) throws DataAccessLayerException {
final Composite poc_col = new Composite();
poc_col.addComponent(ids[1], BYTE_SERIALIZER);
poc_col.addComponent(ids[2], BYTE_SERIALIZER);
if (ids.length == 4) {
poc_col.addComponent(ids[3], BYTE_SERIALIZER);
}
_mutators.get().addInsertion(rowKey, S_POC, HFactory.createColumn(poc_col, EMPTY_VAL, COMPOSITE_SERIALIZER, BYTE_SERIALIZER));
}