
com.hpe.dna.common.mongodb.EMongoResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common Show documentation
Show all versions of common Show documentation
Common Library used in HPE DnA Project
The newest version!
package com.hpe.dna.common.mongodb;
import com.mongodb.client.result.DeleteResult;
import com.mongodb.client.result.UpdateResult;
/**
* @author [email protected]
*/
public enum EMongoResult {
CREATED_FAILED, ENTITY_NOT_FOUND, UPDATE_FAILED, DELETE_FAILED, SUCCESS;
public static EMongoResult of(UpdateResult updateResult) {
if (updateResult.getMatchedCount() == 0)
return ENTITY_NOT_FOUND;
if (updateResult.getModifiedCount() >= 0)
return SUCCESS;
return UPDATE_FAILED;
}
public static EMongoResult of(DeleteResult deleteResult) {
if (deleteResult.getDeletedCount() > 0)
return SUCCESS;
return DELETE_FAILED;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy