Java Code Examples for com.mongodb.WriteConcern#NORMAL

The following examples show how to use com.mongodb.WriteConcern#NORMAL . 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: BatchJobWriteConcernResolver.java    From secure-data-service with Apache License 2.0 5 votes vote down vote up
@Override
public WriteConcern resolve(MongoAction action) {

    Class<?> entityClass = action.getEntityClass();
    if (entityClass != null && "Error".equals(entityClass.getSimpleName())) {
        return WriteConcern.NORMAL;
    }

    return WriteConcern.SAFE;
}
 
Example 2
Source File: DefaultDataSourceCreater.java    From tangyuan2 with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
private WriteConcern getWriteConcern(String writeConcern) {
	if ("ACKNOWLEDGED".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.ACKNOWLEDGED;
	}
	if ("W1".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.W1;
	}
	if ("W2".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.W2;
	}
	if ("W3".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.W3;
	}
	if ("UNACKNOWLEDGED".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.UNACKNOWLEDGED;
	}
	if ("FSYNCED".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.FSYNCED;
	}
	if ("REPLICA_ACKNOWLEDGED".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.REPLICA_ACKNOWLEDGED;
	}
	if ("NORMAL".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.NORMAL;
	}
	if ("SAFE".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.SAFE;
	}
	if ("MAJORITY".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.MAJORITY;
	}
	if ("FSYNC_SAFE".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.FSYNC_SAFE;
	}
	if ("JOURNAL_SAFE".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.JOURNAL_SAFE;
	}
	if ("REPLICAS_SAFE".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.REPLICAS_SAFE;
	}
	return WriteConcern.ACKNOWLEDGED;
}