// CREATE COLUMN FAMILY IF NOT EXISTS private void createColumnFamily(File configureFile, String organizationId) throws InvalidRequestException, SchemaDisagreementException, TException, Exception { boolean flag; messageConfiguration = (HL7MessageConfiguration) streamSerializer.fromXML(configureFile); flag = cassandraConnector.checkcolumnFamily( messageConfiguration.getMetaInfo().getArtifactID(), organizationId); if (flag) { cassandraConnector.createColumnFamily( messageConfiguration.getMetaInfo().getArtifactID(), organizationId); } }
// SAVE ARCHIVE MESSAGE IN CASSANDRA private void saveArchiveMessage( String rowKey, MessageVO messageVO, List<ArchiveIndexFieldsVO> indexFields) throws Exception { String messageXML = messageVO.getMessage(); HashMap<String, String> columnValueMap = new HashMap<String, String>(); String messageId = "", responsiblePartyName = "", program = ""; columnValueMap.put("ROWKEY", rowKey); columnValueMap.put("MESSAGE", messageXML); Iterator<ArchiveIndexFieldsVO> iterator = indexFields.iterator(); while (iterator.hasNext()) { ArchiveIndexFieldsVO indexFieldsVO = iterator.next(); if (indexFieldsVO.getName().equals("program")) { program = indexFieldsVO.getValue(); } else if (indexFieldsVO.getName().equals("responsiblePartyName")) { responsiblePartyName = indexFieldsVO.getValue(); } columnValueMap.put(indexFieldsVO.getName(), indexFieldsVO.getValue()); } cassandraConnector.saveStandardColumnFamily( columnValueMap, messageConfiguration.getMetaInfo().getArtifactID(), messageVO.getOrganizationId()); statisticsService.insertIntoIndex(messageXML, rowKey, program, responsiblePartyName); }