Java Code Examples for me.prettyprint.hector.api.beans.Composite#addComponent()

The following examples show how to use me.prettyprint.hector.api.beans.Composite#addComponent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CassandraUserStoreManager.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
/**
 * 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()]);
}
 
Example 2
Source File: CassandraUserStoreManager.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
/**
 * 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();
    }
}
 
Example 3
Source File: CassandraUserStoreManager.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
/**
 * 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;

}
 
Example 4
Source File: Cassandra12xTripleIndexDAO.java    From cumulusrdf with Apache License 2.0 6 votes vote down vote up
/**
 * 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);	
}
 
Example 5
Source File: Cassandra12xTripleIndexDAO.java    From cumulusrdf with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 6
Source File: CassandraUserStoreManager.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
@Override
public void doUpdateCredentialByAdmin(String userName, Object newCredential) throws UserStoreException {
    if (!checkUserPasswordValid(newCredential)) {
        throw new UserStoreException(
                "Credential not valid. Credential must be a non null string with following format, "
                        + realmConfig.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_JAVA_REG_EX));

    }

    String saltValue = null;
    if (TRUE.equalsIgnoreCase(realmConfig.getUserStoreProperties().get(JDBCRealmConstants.STORE_SALTED_PASSWORDS))) {
        saltValue = Util.getSaltValue();
    }
    String password = Util.preparePassword((String) newCredential, saltValue);
    Mutator<Composite> mutator = HFactory.createMutator(keyspace, CompositeSerializer.get());
    Composite key = new Composite();
    key.addComponent(userName, stringSerializer);
    key.addComponent(tenantIdString, stringSerializer);
    mutator.addInsertion(key, CFConstants.UM_USER,
            HFactory.createColumn(CFConstants.UM_SECRET, password, stringSerializer, stringSerializer));
    mutator.addInsertion(key, CFConstants.UM_USER,
            HFactory.createColumn(CFConstants.UM_SALT_VALUE, saltValue, stringSerializer, stringSerializer));
    try {
        mutator.execute();
        if (log.isDebugEnabled()) {
            log.debug("Changed password for user " + userName + "successfully");
        }
    } catch (HectorException e) {
        throw new UserStoreException("Change Password failed.", e);
    }
}
 
Example 7
Source File: CassandraUserStoreManager.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
/**
 * Deletes a user by userName.
 */
@Override
public void doDeleteUser(String userName) throws UserStoreException {

    Mutator<Composite> mutator = HFactory.createMutator(keyspace, CompositeSerializer.get());
    String[] roles = doGetExternalRoleListOfUser(userName, "");
    for (String role : roles) {
        Composite key = new Composite();
        key.addComponent(role, stringSerializer);
        key.addComponent(tenantIdString, stringSerializer);
        ColumnFamilyTemplate<Composite, String> userCFTemplate = new ThriftColumnFamilyTemplate<Composite, String>(
                keyspace, CFConstants.UM_ROLE_USER_INDEX, CompositeSerializer.get(), StringSerializer.get());
        try {
            userCFTemplate.deleteColumn(key, userName);
        } catch (HectorException e) {
            log.error("Error during deletion ", e);
        }
    }

    Composite userKey = new Composite();
    userKey.addComponent(userName, stringSerializer);
    userKey.addComponent(tenantIdString, stringSerializer);
    mutator.addDeletion(userKey, CFConstants.UM_USER_ROLE, null, CompositeSerializer.get());
    mutator.addDeletion(userKey, CFConstants.UM_USER, null, CompositeSerializer.get());
    mutator.execute();

    if (log.isDebugEnabled()) {
        log.debug("Deleted user " + userName + " successfully");
    }
}
 
Example 8
Source File: CassandraUserStoreManager.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
/**
 * Authenticates a user given the user name and password against the user
 * store.
 */
@Override
public boolean doAuthenticate(String userName, Object credential) throws UserStoreException {

    String password = (String) credential;
    boolean isAuthed = false;
    if (!checkUserNameValid(userName)) {
        log.error("Invalid Username");
        return false;
    }

    if (!checkUserPasswordValid(credential)) {
        log.error("Invalid password");
        return false;
    }

    if (UserCoreUtil.isRegistryAnnonymousUser(userName)) {
        log.error("Anonnymous user trying to login");
        return false;
    }

    Composite key = new Composite();
    key.addComponent(userName, stringSerializer);
    key.addComponent(tenantIdString, stringSerializer);

    ColumnFamilyTemplate<Composite, String> userCFTemplate = new ThriftColumnFamilyTemplate<Composite, String>(
            keyspace, CFConstants.UM_USER, CompositeSerializer.get(), StringSerializer.get());

    ColumnFamilyResult<Composite, String> result = userCFTemplate.queryColumns(key);
    String saltVallue = result.getString(CFConstants.UM_SALT_VALUE);
    String storedPassword = result.getString(CFConstants.UM_SECRET);

    if (TRUE.equalsIgnoreCase(realmConfig.getUserStoreProperty(JDBCRealmConstants.STORE_SALTED_PASSWORDS))) {
        password = Util.preparePassword(password, saltVallue);
        if ((storedPassword != null) && (storedPassword.equals(password))) {
            isAuthed = true;
        }
    }
    return isAuthed;
}
 
Example 9
Source File: Cassandra12xQuadIndexDAO.java    From cumulusrdf with Apache License 2.0 5 votes vote down vote up
@Override
public void insertTriple(final byte[][] ids) throws DataAccessLayerException {
	super.insertTriple(ids);
	// Insert in OC_PS
	// Key: O + C
	byte[] oc_row = _dictionary.compose(ids[2], ids[3]);
	
	final Composite sp_col = new Composite();
	sp_col.addComponent(ids[1], BYTE_SERIALIZER);
	sp_col.addComponent(ids[0], BYTE_SERIALIZER);

	// subject + predicate col
	_mutators.get().addInsertion(oc_row, OC_PS, HFactory.createColumn(sp_col, EMPTY_VAL, COMPOSITE_SERIALIZER, BYTE_SERIALIZER));

	// context col
	_mutators.get().addInsertion(oc_row, OC_PS, HFactory.createColumn(C_COL, ids[3], COMPOSITE_SERIALIZER, BYTE_SERIALIZER));

	// Insert in SC_OP
	// Key: S + C
	final byte[] sc_row = _dictionary.compose(ids[0], ids[3]);
	
	final Composite op_col = new Composite();
	op_col.addComponent(ids[2], BYTE_SERIALIZER);
	op_col.addComponent(ids[1], BYTE_SERIALIZER);

	_mutators.get().addInsertion(sc_row, SC_OP, HFactory.createColumn(op_col, EMPTY_VAL, COMPOSITE_SERIALIZER, BYTE_SERIALIZER));

	// Insert in SPC_O
	// Key: S + P + C
	byte[] spc_row = _dictionary.compose(ids[0], ids[1], ids[3]);
	byte[] pc_val = _dictionary.compose(ids[1], ids[3]);
	
	final Composite o_col = new Composite();
	o_col.addComponent(ids[2], BYTE_SERIALIZER);

	// object col
	_mutators.get().addInsertion(spc_row, SPC_O, HFactory.createColumn(o_col, EMPTY_VAL, COMPOSITE_SERIALIZER, BYTE_SERIALIZER));
	// predicate + context col
	_mutators.get().addInsertion(spc_row, SPC_O, HFactory.createColumn(PC_COL, pc_val, COMPOSITE_SERIALIZER, BYTE_SERIALIZER));		
}
 
Example 10
Source File: Cassandra12xTripleIndexDAO.java    From cumulusrdf with Apache License 2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example 11
Source File: CassandraScheduledMessageRepository.java    From elasticactors with Apache License 2.0 5 votes vote down vote up
private Composite createColumnName(ScheduledMessageKey scheduledMessageKey) {
    final Composite columnName = new Composite();
    columnName.addComponent(scheduledMessageKey.getFireTime(), LongSerializer.get());
    UUID id = scheduledMessageKey.getId();
    final com.eaio.uuid.UUID timeUuid = new com.eaio.uuid.UUID(id.getMostSignificantBits(),id.getLeastSignificantBits());
    columnName.addComponent(timeUuid, TimeUUIDSerializer.get());
    return columnName;
}
 
Example 12
Source File: Cassandra12xTripleIndexDAO.java    From cumulusrdf with Apache License 2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example 13
Source File: Cassandra12xTripleIndexDAO.java    From cumulusrdf with Apache License 2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example 14
Source File: Cassandra12xTripleIndexDAO.java    From cumulusrdf with Apache License 2.0 5 votes vote down vote up
/**
 * 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);		
}
 
Example 15
Source File: Cassandra12xQuadIndexDAO.java    From cumulusrdf with Apache License 2.0 4 votes vote down vote up
@Override
public List<byte[][]> deleteTriples(
		final Iterator<byte[][]> nodes,
		final int batchSize, 
		final boolean rangesEnabled) throws DataAccessLayerException {
	
	final List<byte[][]> deleted = new ArrayList<byte[][]>(batchSize);
	
	final SecondaryIndexDeletionBuffer cColDeletionTest = new SecondaryIndexDeletionBuffer(batchSize);
	final SecondaryIndexDeletionBuffer pcColDeletionTest = new SecondaryIndexDeletionBuffer(batchSize);
	final SecondaryIndexDeletionBuffer pColDeletionTest = new SecondaryIndexDeletionBuffer(batchSize);

	while (nodes.hasNext()) {

		for (int i = 0; (i < batchSize) && nodes.hasNext(); i++) {

			byte[][] ids = nodes.next();

			// check if valid triple or quad
			if ((ids == null) || (ids.length < 3)) {
				continue;
			}

			// Triple indexes.
			internalDelete(ids, pColDeletionTest, rangesEnabled);

			// Delete from SC_OP index
			byte[] sc_row = _dictionary.compose(ids[0], ids[3]);

			final Composite op_col = new Composite();
			op_col.addComponent(ids[2], BYTE_SERIALIZER);
			op_col.addComponent(ids[1], BYTE_SERIALIZER);

			_mutators.get().addDeletion(sc_row, SC_OP, op_col, COMPOSITE_SERIALIZER);

			// Delete from OC_PS index
			byte[] oc_row = _dictionary.compose(ids[2], ids[3]);
			final Composite sp_col = new Composite();
			sp_col.addComponent(ids[1], BYTE_SERIALIZER);
			sp_col.addComponent(ids[0], BYTE_SERIALIZER);

			// subject + predicate col
			_mutators.get().addDeletion(oc_row, OC_PS, sp_col, COMPOSITE_SERIALIZER);
			cColDeletionTest.add(new SecondaryIndexDeletionCandidate(oc_row, new byte[][] {null, null, ids[2], ids[3]}));

			// Delete from SPC_O
			byte[] spc_row = _dictionary.compose(ids[0], ids[1], ids[3]);
			final Composite o_col = new Composite();
			o_col.addComponent(ids[2], BYTE_SERIALIZER);

			// spc col
			_mutators.get().addDeletion(spc_row, SPC_O, o_col, COMPOSITE_SERIALIZER);
			pcColDeletionTest.add(new SecondaryIndexDeletionCandidate(spc_row, new byte[][] {ids[0], ids[1], null, ids[3]}));
			
			deleted.add(ids);
		}
		
		_mutators.get().execute();
		
		// Flush buffer only if this is the last chance or it is full.
		if (nodes.hasNext()) {
			cColDeletionTest.flushIfFull(_mutators.get(), OC_PS, C_COL, COMPOSITE_SERIALIZER, this);
			pcColDeletionTest.flushIfFull(_mutators.get(), SPC_O, PC_COL, COMPOSITE_SERIALIZER, this);
			pColDeletionTest.flushIfFull(_mutators.get(), PO_SC, P_COL, COMPOSITE_SERIALIZER, this);
		} else {
			cColDeletionTest.flush(_mutators.get(), OC_PS, C_COL, COMPOSITE_SERIALIZER, this);
			pcColDeletionTest.flush(_mutators.get(), SPC_O, PC_COL, COMPOSITE_SERIALIZER, this);
			pColDeletionTest.flush(_mutators.get(), PO_SC, P_COL, COMPOSITE_SERIALIZER, this);
		}

		_mutators.get().execute();
	}
	
	return deleted;
}
 
Example 16
Source File: CassandraUserStoreManager.java    From carbon-identity with Apache License 2.0 4 votes vote down vote up
/**
 * Adds the user to the user store.
 */
@Override
public void doAddUser(String userName, Object credential, String[] roleList, Map<String, String> claims,
                      String profileName, boolean requirePasswordChange) throws UserStoreException {

    String userId = UUID.randomUUID().toString();
    String saltValue = null;

    if (TRUE.equalsIgnoreCase(realmConfig.getUserStoreProperties().get(JDBCRealmConstants.STORE_SALTED_PASSWORDS))) {
        saltValue = Util.getSaltValue();
    }

    String password = Util.preparePassword((String) credential, saltValue);

    if (doCheckExistingUser(userName)) {

        String message = "User with credentials " + userName + "exists";

        UserStoreException userStoreException = new UserStoreException(message);
        log.error(message, userStoreException);
        throw userStoreException;
    } else {

        Mutator<Composite> mutator = HFactory.createMutator(keyspace, CompositeSerializer.get());

        Composite key = new Composite();
        key.addComponent(userName, stringSerializer);
        key.addComponent(tenantIdString, stringSerializer);

        // add user ID
        mutator.addInsertion(key, CFConstants.UM_USER,
                HFactory.createColumn(CFConstants.UM_USER_ID, userId, stringSerializer, stringSerializer));
        mutator.addInsertion(key, CFConstants.UM_USER,
                HFactory.createColumn(CFConstants.UM_USER_NAME, userName, stringSerializer, stringSerializer));
        mutator.addInsertion(key, CFConstants.UM_USER,
                HFactory.createColumn(CFConstants.UM_SECRET, password, stringSerializer, stringSerializer));
        mutator.addInsertion(key, CFConstants.UM_USER,
                HFactory.createColumn(CFConstants.UM_SALT_VALUE, saltValue, stringSerializer, stringSerializer));
        mutator.addInsertion(key, CFConstants.UM_USER, HFactory.createColumn(CFConstants.UM_REQUIRE_CHANGE_BOOLEAN,
                "false", stringSerializer, stringSerializer));
        mutator.addInsertion(key, CFConstants.UM_USER,
                HFactory.createColumn(CFConstants.UM_TENANT_ID, tenantIdString, stringSerializer, stringSerializer));
        mutator = addUserToRoleList(userName, roleList, mutator);

        if (claims != null) {
            mutator = addClaimsForUser(userId, claims, mutator);
        }

        try {
            mutator.execute();
            if (log.isDebugEnabled()) {
                log.debug("Added user " + userName + " successfully");
            }
        } catch (HectorException e) {
            // TODO- research and check how to identify cassandra failure
            // and handle it efficiently.
            throw new UserStoreException("Adding user failed.", e);
        }
        mutator.execute();

    }
}
 
Example 17
Source File: CassandraUserStoreManager.java    From carbon-identity with Apache License 2.0 4 votes vote down vote up
/**
 * Update the user list mapped to a role.
 */
@Override
public void doUpdateUserListOfRole(String roleName, String[] deletedUsers, String[] newUsers)
        throws UserStoreException {

    Mutator<Composite> mutator = HFactory.createMutator(keyspace, CompositeSerializer.get());
    RoleContext ctx = createRoleContext(roleName);
    roleName = ctx.getRoleName();
    boolean isShared = ctx.isShared();
    if (!isShared) {
        //TODO TO BE Implemented
    }
    if (deletedUsers != null && deletedUsers.length > 0) {
        if (isShared) {
            //TODO TO BE Implemented
        } else {
            if (deletedUsers.length > 0) {
                Composite key = new Composite();
                key.addComponent(roleName, stringSerializer);
                key.addComponent(tenantIdString, stringSerializer);

                for (String user : deletedUsers) {

                    Composite userKey = new Composite();
                    userKey.addComponent(user, stringSerializer);
                    userKey.addComponent(tenantIdString, stringSerializer);

                    ColumnFamilyTemplate<Composite, String> userCFTemplate = new ThriftColumnFamilyTemplate<Composite, String>(
                            keyspace, CFConstants.UM_USER_ROLE, CompositeSerializer.get(), StringSerializer.get());
                    ColumnFamilyTemplate<Composite, String> roleCFTemplate = new ThriftColumnFamilyTemplate<Composite, String>(
                            keyspace, CFConstants.UM_ROLE_USER_INDEX, CompositeSerializer.get(),
                            StringSerializer.get());
                    try {
                        roleCFTemplate.deleteColumn(mutator, key, user);
                        userCFTemplate.deleteColumn(mutator, userKey, roleName);
                    } catch (HectorException e) {
                        log.error(e.getMessage(), e);
                        throw new UserStoreException("Error during the updating of a user's role list");
                    }
                }
            }

        }
    }
    // need to clear user roles cache upon roles update
    clearUserRolesCacheByTenant(this.tenantId);

    if (newUsers != null && newUsers.length > 0) {
        if (isShared) {
            //TODO TO BE Implemented
        } else {
            addRoleToUsersList(newUsers, roleName, mutator);
        }
    }
    mutator.execute();

}
 
Example 18
Source File: Cassandra12xTripleIndexDAO.java    From cumulusrdf with Apache License 2.0 3 votes vote down vote up
/**
 * Insert a value in RN_POS index.
 * 
 * @param rowKey the row key.
 * @param value the value.
 * @param ids the triple identifiers
 * @throws DataAccessLayerException in case of data access failure.
 */	
void insertInRN_POS(final byte[] rowKey, final byte[][] ids, final double value) throws DataAccessLayerException {
	final Composite os_col = new Composite();
	os_col.addComponent(value, DOUBLE_SERIALIZER);
	os_col.addComponent(ids[0], BYTE_SERIALIZER);

	_mutators.get().addInsertion(rowKey, RN_PO_S, HFactory.createColumn(os_col, ids[2], COMPOSITE_SERIALIZER, BYTE_SERIALIZER));
}
 
Example 19
Source File: Cassandra12xTripleIndexDAO.java    From cumulusrdf with Apache License 2.0 3 votes vote down vote up
/**
 * Deletes a value in RN_SPO index.
 * 
 * @param rowKey the row key.
 * @param value the value.
 * @param ids the triple identifiers.
 * @throws DataAccessLayerException in case of data access failure.
 */
void deleteInRN_POS(final byte [] rowKey, final byte [][] ids, final double value) throws DataAccessLayerException {
	final Composite os_col = new Composite();
	os_col.addComponent(value, DOUBLE_SERIALIZER);
	os_col.addComponent(ids[0], BYTE_SERIALIZER);
	_mutators.get().addDeletion(rowKey, RN_PO_S, os_col, COMPOSITE_SERIALIZER);
}
 
Example 20
Source File: Cassandra12xTripleIndexDAO.java    From cumulusrdf with Apache License 2.0 3 votes vote down vote up
/**
 * Deletes a value in RDT_POS index.
 * 
 * @param rowKey the row key.
 * @param value the value.
 * @param ids the triple identifiers.
 * @throws DataAccessLayerException in case of data access failure.
 */
void deleteInRDT_POS(final byte [] rowKey, final byte [][] ids, final long value) throws DataAccessLayerException {
	final Composite os_col = new Composite();
	os_col.addComponent(value, LONG_SERIALIZER);
	os_col.addComponent(ids[0], BYTE_SERIALIZER);
	_mutators.get().addDeletion(rowKey, RDT_PO_S, os_col, COMPOSITE_SERIALIZER);
}