/** * @param formData * @throws ProcessingException */ private void storeAnswerChoice(AnswerFormData formData) throws ProcessingException { if (BooleanUtility.nvl(formData.getMultipleChoices())) { if (formData.getChoices().isValueSet() && formData.getChoices().getValue() != null) { for (Long choiceId : formData.getChoices().getValue()) { SQL.insert( " insert into answers_choices (answer_id, choice_id) " + " values (:AnswerNr, :ChoiceId) ", formData, new NVPair("ChoiceId", choiceId)); } } } else { SQL.insert( " insert into answers_choices (answer_id, choice_id) " + " values (:AnswerNr, :Choice) ", formData); } }
@Override public AnswerFormData load(AnswerFormData formData) throws ProcessingException { if (!ACCESS.check(new ReadAnswerPermission())) { throw new VetoException(TEXTS.get("AuthorizationFailed")); } if (formData.getAnswerNr() == null) { throw new ProcessingException("AnswerNr can no be null"); } SQL.selectInto( " select question_id, name " + " from answers " + " where answer_id = :AnswerNr " + " into :QuestionNr, :YourName", formData); if (formData.getQuestionNr().getValue() == null) { throw new ProcessingException("QuestionNr can no be null"); } loadQuestion(formData); if (BooleanUtility.nvl(formData.getMultipleChoices())) { SQL.selectInto( " select choice_id " + " from answers_choices " + " where answer_id = :AnswerNr " + " into :Choices", formData); } else { SQL.selectInto( " select choice_id " + " from answers_choices " + " where answer_id = :AnswerNr " + " into :Choice", formData); } return formData; }
private MqttConnectOptions getConnectOptions( String userName, String password, Boolean clearSession, Integer connectionTimeout, String lwtTopic, String lwtMessage, Integer lwtQos, Boolean lwtRetained) { MqttConnectOptions connectOpts = new MqttConnectOptions(); if (!StringUtility.isNullOrEmpty(userName)) { connectOpts.setUserName(userName); if (!StringUtility.isNullOrEmpty(password)) { connectOpts.setPassword(password.toCharArray()); } } if (clearSession != null) { connectOpts.setCleanSession(clearSession); } if (connectionTimeout != null) { connectOpts.setConnectionTimeout(connectionTimeout); } if (!StringUtility.isNullOrEmpty(lwtTopic) && !StringUtility.isNullOrEmpty(lwtMessage)) { connectOpts.setWill( lwtTopic, lwtMessage.getBytes(), NumberUtility.nvl(lwtQos, 1), BooleanUtility.nvl(lwtRetained, false)); } return connectOpts; }