本文整理汇总了Java中org.sunbird.common.ElasticSearchUtil.createData方法的典型用法代码示例。如果您正苦于以下问题:Java ElasticSearchUtil.createData方法的具体用法?Java ElasticSearchUtil.createData怎么用?Java ElasticSearchUtil.createData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sunbird.common.ElasticSearchUtil
的用法示例。
在下文中一共展示了ElasticSearchUtil.createData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insertDataToElastic
import org.sunbird.common.ElasticSearchUtil; //导入方法依赖的package包/类
/**
* Method to insert data to ES .
*
* @param index
* @param type
* @param identifier
* @param data
* @return
*/
private boolean insertDataToElastic(String index, String type, String identifier,
Map<String, Object> data) {
ProjectLogger
.log("making call to ES for type ,identifier ,data==" + type + " " + identifier + data);
String response = ElasticSearchUtil.createData(index, type, identifier, data);
ProjectLogger.log("Getting ES save response for type , identiofier==" + type + " " + identifier
+ " " + response);
if (!ProjectUtil.isStringNullOREmpty(response)) {
ProjectLogger.log("Data is saved successfully ES ." + type + " " + identifier);
return true;
}
ProjectLogger.log("unbale to save the data inside ES with identifier " + identifier,
LoggerEnum.INFO.name());
return false;
}
示例2: updateEs
import org.sunbird.common.ElasticSearchUtil; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void updateEs(String userId) {
// get all records from cassandra as list and add that list to user in ElasticSearch ...
Response response = cassandraOperation.getRecordsByProperty(userSkillDbInfo.getKeySpace() , userSkillDbInfo.getTableName(), JsonKey.USER_ID , userId);
List<Map<String,Object>> responseList = (List<Map<String, Object>>) response.get(JsonKey.RESPONSE);
Map<String , Object> esMap = new HashMap<>();
esMap.put(JsonKey.SKILLS , responseList);
Map<String,Object> profile = ElasticSearchUtil.getDataByIdentifier(ProjectUtil.EsIndex.sunbird.getIndexName(), EsType.user.getTypeName(), userId);
if(null!= profile && !profile.isEmpty()){
Map<String,String> visibility = (Map<String, String>) profile.get(JsonKey.PROFILE_VISIBILITY);
if((null!=visibility && !visibility.isEmpty())&& visibility.containsKey(JsonKey.SKILLS)){
Map<String,Object> visibilityMap = ElasticSearchUtil.getDataByIdentifier(ProjectUtil.EsIndex.sunbird.getIndexName(), EsType.userprofilevisibility.getTypeName(), userId);
if (null != visibilityMap && !visibilityMap.isEmpty()) {
visibilityMap.putAll(esMap);
ElasticSearchUtil.createData(ProjectUtil.EsIndex.sunbird.getIndexName(), EsType.userprofilevisibility.getTypeName(), userId , visibilityMap);
}
}else {
ElasticSearchUtil.updateData(ProjectUtil.EsIndex.sunbird.getIndexName(), EsType.user.getTypeName(), userId , esMap);
}
}
}
示例3: insertDataToElastic
import org.sunbird.common.ElasticSearchUtil; //导入方法依赖的package包/类
/**
* Method to cache the course data .
*
* @param index String
* @param type String
* @param identifier String
* @param data Map<String,Object>
* @return boolean
*/
private boolean insertDataToElastic(String index, String type, String identifier,
Map<String, Object> data) {
ProjectLogger
.log("making call to ES for type ,identifier ,data==" + type + " " + identifier + data);
/* if (type.equalsIgnoreCase(ProjectUtil.EsType.user.getTypeName())) {
// now calculate profile completeness and error filed and store it in ES
ProfileCompletenessService service = ProfileCompletenessFactory.getInstance();
Map<String, Object> responsemap = service.computeProfile(data);
data.putAll(responsemap);
}*/
String response = ElasticSearchUtil.createData(index, type, identifier, data);
ProjectLogger.log("Getting ES save response for type , identiofier==" + type + " " + identifier
+ " " + response);
if (!ProjectUtil.isStringNullOREmpty(response)) {
ProjectLogger.log("User Data is saved successfully ES ." + type + " " + identifier);
return true;
}
ProjectLogger.log("unbale to save the data inside ES with identifier " + identifier,
LoggerEnum.INFO.name());
return false;
}
示例4: insertUserDataInCassandraAndEs
import org.sunbird.common.ElasticSearchUtil; //导入方法依赖的package包/类
private static void insertUserDataInCassandraAndEs() {
Map<String , Object> userMap = new HashMap<>();
userMap.put(JsonKey.ID , USER_ID);
userMap.put(JsonKey.ROOT_ORG_ID, ROOT_ORG_ID);
cassandraOperation.insertRecord(userDbInfo.getKeySpace(), userDbInfo.getTableName(), userMap);
userMap.put(JsonKey.USER_ID, USER_ID);
ElasticSearchUtil.createData(EsIndex.sunbird.getIndexName(), EsType.user.getTypeName(), USER_ID, userMap);
Map<String , Object> endorseduserMap = new HashMap<>();
endorseduserMap.put(JsonKey.ID , ENDORSED_USER_ID);
endorseduserMap.put(JsonKey.ROOT_ORG_ID, ROOT_ORG_ID);
cassandraOperation.insertRecord(userDbInfo.getKeySpace(), userDbInfo.getTableName(), endorseduserMap);
endorseduserMap.put(JsonKey.USER_ID , ENDORSED_USER_ID);
ElasticSearchUtil.createData(EsIndex.sunbird.getIndexName(), EsType.user.getTypeName(), ENDORSED_USER_ID, endorseduserMap);
}
示例5: setUp
import org.sunbird.common.ElasticSearchUtil; //导入方法依赖的package包/类
@BeforeClass
public static void setUp(){
Util.checkCassandraDbConnections(JsonKey.SUNBIRD);
system = ActorSystem.create("system");
Map<String , Object> userMap = new HashMap<>();
userMap.put(JsonKey.ID , USER_ID);
//userMap.put(JsonKey.ROOT_ORG_ID, ROOT_ORG_ID);
cassandraOperation.insertRecord(userDbInfo.getKeySpace(), userDbInfo.getTableName(), userMap);
userMap.put(JsonKey.USER_ID, USER_ID);
ElasticSearchUtil
.createData(EsIndex.sunbird.getIndexName(), EsType.user.getTypeName(), USER_ID, userMap);
Map<String , Object> orgMap = new HashMap<String , Object>();
orgMap.put(JsonKey.ID , orgId);
cassandraOperation.insertRecord(orgDbInfo.getKeySpace(), orgDbInfo.getTableName(), orgMap);
}
示例6: insertUserDataToES
import org.sunbird.common.ElasticSearchUtil; //导入方法依赖的package包/类
private static void insertUserDataToES(){
Map<String , Object> userMap = new HashMap<>();
userMap.put(JsonKey.USER_ID , userId);
userMap.put(JsonKey.FIRST_NAME , "alpha");
userMap.put(JsonKey.ID , userId);
userMap.put(JsonKey.ROOT_ORG_ID, "ORG_001");
userMap.put(JsonKey.USERNAME , "alpha-beta");
userMap.put(JsonKey.REGISTERED_ORG_ID, orgId);
userMap.put(JsonKey.EMAIL , "[email protected]");
ElasticSearchUtil.createData(EsIndex.sunbird.getIndexName(),EsType.user.getTypeName() , userId , userMap);
}
示例7: insertUserCoursesDataToES
import org.sunbird.common.ElasticSearchUtil; //导入方法依赖的package包/类
private static void insertUserCoursesDataToES(){
Map<String , Object> userCoursesMap = new HashMap<>();
userCoursesMap.put(JsonKey.ID , batchId+JsonKey.PRIMARY_KEY_DELIMETER+userId);
userCoursesMap.put(JsonKey.BATCH_ID , batchId);
userCoursesMap.put(JsonKey.USER_ID, userId);
userCoursesMap.put(JsonKey.REGISTERED_ORG_ID , orgId);
userCoursesMap.put(JsonKey.PROGRESS , 1);
ElasticSearchUtil.createData(EsIndex.sunbird.getIndexName(),EsType.usercourses.getTypeName() , batchId+JsonKey.PRIMARY_KEY_DELIMETER+userId , userCoursesMap);
}
示例8: insertOrgDataToES
import org.sunbird.common.ElasticSearchUtil; //导入方法依赖的package包/类
private static void insertOrgDataToES(){
Map<String , Object> orgMap = new HashMap<>();
orgMap.put(JsonKey.ID , orgId);
orgMap.put(JsonKey.ORGANISATION_NAME , "IIM");
orgMap.put(JsonKey.ORGANISATION_ID , orgId);
ElasticSearchUtil.createData(EsIndex.sunbird.getIndexName(),EsType.organisation.getTypeName() , batchId , orgMap);
}
示例9: insertUserDataToES
import org.sunbird.common.ElasticSearchUtil; //导入方法依赖的package包/类
private static void insertUserDataToES() {
Map<String, Object> userMap = new HashMap<>();
userMap.put(JsonKey.USER_ID, userId);
userMap.put(JsonKey.FIRST_NAME, "alpha");
userMap.put(JsonKey.ID, userId);
userMap.put(JsonKey.ROOT_ORG_ID, "ORG_001");
userMap.put(JsonKey.USERNAME, "alpha-beta");
userMap.put(JsonKey.EMAIL, "[email protected]");
ElasticSearchUtil.createData(EsIndex.sunbird.getIndexName(), EsType.user.getTypeName(), userId,
userMap);
}
示例10: setUp
import org.sunbird.common.ElasticSearchUtil; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() {
CassandraOperation operation = ServiceFactory.getInstance();
Application.startLocalActorSystem();
system = ActorSystem.create("system");
Util.checkCassandraDbConnections(JsonKey.SUNBIRD);
userManagementDB = Util.dbInfoMap.get(JsonKey.USER_DB);
addressDB = Util.dbInfoMap.get(JsonKey.ADDRESS_DB);
orgTypeDbInfo = Util.dbInfoMap.get(JsonKey.ORG_TYPE_DB);
orgDB = Util.dbInfoMap.get(JsonKey.ORG_DB);
locationDB = Util.dbInfoMap.get(JsonKey.GEO_LOCATION_DB);
Map<String , Object> geoLocation = new HashMap<>();
// need to delete in after class...
geoLocation.put(JsonKey.ID , LOCATION_ID);
//geoLocation.put(JsonKey.LOCATION_ID , LOCATION_ID);
operation.insertRecord(locationDB.getKeySpace(), locationDB.getTableName() ,geoLocation);
Map<String , Object> parentOrg = new HashMap<>();
parentOrg.put(JsonKey.ID , parentOrgId);
operation.upsertRecord(orgDB.getKeySpace() , orgDB.getTableName() , parentOrg);
Map<String , Object> userMap = new HashMap<>();
userMap.put(JsonKey.ID , USER_ID);
//userMap.put(JsonKey.ROOT_ORG_ID, ROOT_ORG_ID);
operation.insertRecord(userDbInfo.getKeySpace(), userDbInfo.getTableName(), userMap);
userMap.put(JsonKey.USER_ID, USER_ID);
ElasticSearchUtil.createData(EsIndex.sunbird.getIndexName(), EsType.user.getTypeName(), USER_ID, userMap);
Map<String , Object> userMap1 = new HashMap<>();
userMap1.put(JsonKey.ID , USER_ID+"01");
//userMap.put(JsonKey.ROOT_ORG_ID, ROOT_ORG_ID);
operation.insertRecord(userDbInfo.getKeySpace(), userDbInfo.getTableName(), userMap1);
userMap1.put(JsonKey.USER_ID, USER_ID+"01");
ElasticSearchUtil.createData(EsIndex.sunbird.getIndexName(), EsType.user.getTypeName(), USER_ID, userMap1);
}
示例11: insertUserDataToES
import org.sunbird.common.ElasticSearchUtil; //导入方法依赖的package包/类
/**
* Method to insert User data to ElasticSearch
*/
private static void insertUserDataToES(){
Map<String , Object> userMap = new HashMap<>();
userMap.put(JsonKey.USER_ID , userId);
userMap.put(JsonKey.FIRST_NAME , "alpha");
userMap.put(JsonKey.ID , userId);
userMap.put(JsonKey.ROOT_ORG_ID, "ORG_001");
userMap.put(JsonKey.USERNAME , "alpha-beta");
ElasticSearchUtil.createData(EsIndex.sunbird.getIndexName(),EsType.user.getTypeName() , userId , userMap);
}
示例12: createUser
import org.sunbird.common.ElasticSearchUtil; //导入方法依赖的package包/类
public void createUser() {
Map<String,Object> userMap = new HashMap<>();
userMap.put(JsonKey.USER_ID, userId);
userMap.put(JsonKey.ORGANISATION_ID, "ORG_001");
userMap.put(JsonKey.ID, usrOrgId);
Response res =ServiceFactory.getInstance().insertRecord(userOrgdbInfo.getKeySpace(), userOrgdbInfo.getTableName(), userMap);
ElasticSearchUtil.createData(ProjectUtil.EsIndex.sunbird.getIndexName(),
ProjectUtil.EsType.user.getTypeName(), userId, userMap);
}
示例13: save
import org.sunbird.common.ElasticSearchUtil; //导入方法依赖的package包/类
@Override
public void save(Map<String, Object> requestedData) {
ElasticSearchUtil.createData(EsIndex.sunbirdDataAudit.getIndexName(),
EsType.history.getTypeName(), ProjectUtil.getUniqueIdFromTimestamp(1), requestedData);
}
示例14: insertBatchDataToES
import org.sunbird.common.ElasticSearchUtil; //导入方法依赖的package包/类
private static void insertBatchDataToES(){
Map<String , Object> batchMap = new HashMap<>();
batchMap.put(JsonKey.ID , batchId);
ElasticSearchUtil.createData(EsIndex.sunbird.getIndexName(),EsType.course.getTypeName() , batchId , batchMap);
}
示例15: setUp
import org.sunbird.common.ElasticSearchUtil; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() {
CassandraOperation operation = ServiceFactory.getInstance();
Application.startLocalActorSystem();
system = ActorSystem.create("system");
Util.checkCassandraDbConnections(JsonKey.SUNBIRD);
//userManagementDB = Util.dbInfoMap.get(JsonKey.USER_DB);
Map<String , Object> userMap = new HashMap<>();
userMap.put(JsonKey.ID , USER_ID);
userMap.put(JsonKey.USER_ID, USER_ID);
//userMap.put(JsonKey.ROOT_ORG_ID, ROOT_ORG_ID);
operation.insertRecord(userDbInfo.getKeySpace(), userDbInfo.getTableName(), userMap);
userMap.put(JsonKey.USER_ID, USER_ID);
userMap.put(JsonKey.ORGANISATION_ID , refOrgId);
ElasticSearchUtil.createData(EsIndex.sunbird.getIndexName(), EsType.user.getTypeName(), USER_ID, userMap);
Map<String , Object> orgMap = new HashMap<>();
orgMap.put(JsonKey.ID , refOrgId);
operation.insertRecord(orgDB.getKeySpace(), orgDB.getTableName(), orgMap);
Map<String , Object> batchMap = new HashMap<>();
batchMap.put(JsonKey.ENROLLMENT_TYPE , JsonKey.INVITE_ONLY);
batchMap.put(JsonKey.ID , batchId);
List<String> courseCreatedFor = new ArrayList<>();
courseCreatedFor.add(refOrgId);
batchMap.put(JsonKey.COURSE_CREATED_FOR ,courseCreatedFor);
batchMap.put(JsonKey.COURSE_ID,"do_212282810555342848180");
batchMap.put(JsonKey.STATUS, ProgressStatus.STARTED.getValue());
operation.insertRecord(batchDbInfo.getKeySpace(), batchDbInfo.getTableName(), batchMap);
batchMap.put(JsonKey.BATCH_ID , batchId);
ElasticSearchUtil.createData(EsIndex.sunbird.getIndexName(), EsType.course.getTypeName(), USER_ID, batchMap);
Map<String , Object> userOrgMap = new HashMap<>();
userOrgMap.put(JsonKey.USER_ID, USER_ID);
userOrgMap.put(JsonKey.ORGANISATION_ID, refOrgId);
userOrgMap.put(JsonKey.ID , USER_ID);
operation.insertRecord(userOrgdbInfo.getKeySpace(), userOrgdbInfo.getTableName(), userOrgMap);
}