private void performAddNewWord(final String pWord, final DictionaryServiceResponse pResponse) { if (mLogger.isDebugEnabled()) { mLogger.debug("Adding new word - " + pWord); } try { DICTIONARY_SERVICE.addWord(pWord); pResponse.setSuccess(true); if (mLogger.isInfoEnabled()) { mLogger.info("Successfully added new word - " + pWord); } } catch (Exception e) { mLogger.warn("failed to add new word(" + pWord + ")", e); pResponse.setSuccess(false); } }
private void performSearchOperation( final String pWord, final int pMaxSuggestedWords, final DictionaryServiceResponse pResponse) { if (mLogger.isDebugEnabled()) { mLogger.debug( "Search for finding right spell of word - " + pWord + " return only " + pMaxSuggestedWords + " words."); } // perform search operation final DictionaryResult result = DICTIONARY_SERVICE.searchWord(pWord, pMaxSuggestedWords); if (result.getProbableMatch() > 0) { pResponse.setSuccess(true); pResponse.setWords(result.getSuggestedWords()); pResponse.addElement(ELEMENT_MATCH_COUNT, String.valueOf(result.getProbableMatch())); } }