/*
This method is used to get Budget XMLObject and set the data to it from
ProposalYnq based on questionId and answers.
355312
private Budget getBudget() {
		Budget budget = Budget.Factory.newInstance();
		Map<Integer, String> budgetMap = new HashMap<>();

		for (AnswerContract questionnaireAnswer : getPropDevQuestionAnswerService().getQuestionnaireAnswers(pdDoc.getDevelopmentProposal().getProposalNumber(), getNamespace(), getFormName())) {
			String answer = questionnaireAnswer.getAnswer();
			if (answer != null) {
				switch (getQuestionAnswerService().findQuestionById(questionnaireAnswer.getQuestionId()).getQuestionSeqId()) {
				case SENIOR_FELL:
					budgetMap.put(SENIOR_FELL, answer);
					break;
                case OTHER_SUPP_SOURCE:
                    budgetMap.put(OTHER_SUPP_SOURCE, answer);
                    break;
				case SUPP_SOURCE:
					budgetMap.put(SUPP_SOURCE, answer);
					break;
				case SUPP_FUNDING_AMT:
					budgetMap.put(SUPP_FUNDING_AMT, answer);
					break;
				case SUPP_MONTHS:
					budgetMap.put(SUPP_MONTHS, answer);
					break;
				case SUPP_TYPE:
					budgetMap.put(SUPP_TYPE, answer);
					break;
				case SALARY_MONTH:
					budgetMap.put(SALARY_MONTH, answer);
					break;
				case ACAD_PERIOD:
					budgetMap.put(ACAD_PERIOD, answer);
					break;
				case BASE_SALARY:
					budgetMap.put(BASE_SALARY, answer);
					break;
				default:
					break;
				}
			}
		}
		budget.setTuitionAndFeesRequested(YesNoDataType.N_NO);
		if(getInstitutionalBaseSalary(budgetMap)!=null){
		    budget.setInstitutionalBaseSalary(getInstitutionalBaseSalary(budgetMap));
		}
		budget.setFederalStipendRequested(getFederalStipendRequested());
		if(getSupplementationFromOtherSources(budgetMap)!=null){
		    budget.setSupplementationFromOtherSources(getSupplementationFromOtherSources(budgetMap));
		}
		setTutionRequestedYears(budget);
		return budget;
	}
1028524
public void setBudgetedAndActualAmountsList(java.util.Collection<BudgetedAndActualAmounts> budgetedAndActualAmountsList) {
        if (budgetedAndActualAmountsList == null) {
            this.budgetedAndActualAmountsList = null;
            return;
        }

        this.budgetedAndActualAmountsList = new java.util.ArrayList<BudgetedAndActualAmounts>(budgetedAndActualAmountsList);
    }
495319
private static Long createBudget(AdWordsServicesInterface adWordsServices, AdWordsSession session)
      throws RemoteException, ApiException {
    // Get the BudgetService.
    BudgetServiceInterface budgetService =
        adWordsServices.get(session, BudgetServiceInterface.class);

    // Create the campaign budget.
    Budget budget = new Budget();
    budget.setName("Interplanetary Cruise App Budget #" + System.currentTimeMillis());
    Money budgetAmount = new Money();
    budgetAmount.setMicroAmount(50000000L);
    budget.setAmount(budgetAmount);
    budget.setDeliveryMethod(BudgetBudgetDeliveryMethod.STANDARD);

    // Universal app campaigns don't support shared budgets.
    budget.setIsExplicitlyShared(false);
    BudgetOperation budgetOperation = new BudgetOperation();
    budgetOperation.setOperand(budget);
    budgetOperation.setOperator(Operator.ADD);

    // Add the budget
    Budget addedBudget = budgetService.mutate(new BudgetOperation[] {budgetOperation}).getValue(0);
    System.out.printf(
        "Budget with name '%s' and ID %d was created.%n",
        addedBudget.getName(), addedBudget.getBudgetId());
    return addedBudget.getBudgetId();
  }
1187123
public FlyWeightFlatXmlDataSet build(InputStream xmlInputStream) throws DataSetException {
        InputSource inputSource = new InputSource(xmlInputStream);
        return buildInternal(inputSource);
    }
801212
private SupplementationFromOtherSources getSupplementationFromOtherSources(
			Map<Integer, String> budgetMap) {
	    SupplementationFromOtherSources supplementationFromOtherSources=null;
		if (budgetMap.get(OTHER_SUPP_SOURCE) != null
				&& budgetMap.get(OTHER_SUPP_SOURCE).equals(
						YnqConstant.YES.code())) {
	        supplementationFromOtherSources = SupplementationFromOtherSources.Factory.newInstance();
			if (budgetMap.get(SUPP_SOURCE) != null) {
				supplementationFromOtherSources.setSource(budgetMap.get(
						SUPP_SOURCE));
			}
			if (budgetMap.get(SUPP_FUNDING_AMT) != null) {
				supplementationFromOtherSources.setAmount(new BigDecimal(
						budgetMap.get(SUPP_FUNDING_AMT)));
			}else{
			    supplementationFromOtherSources.setAmount(null);
			}
			if (budgetMap.get(SUPP_MONTHS) != null) {
				supplementationFromOtherSources
						.setNumberOfMonths(new BigDecimal(budgetMap.get(
								SUPP_MONTHS)));
			}
			if (budgetMap.get(SUPP_TYPE) != null) {
				supplementationFromOtherSources.setType(budgetMap
						.get(SUPP_TYPE));
			}
		}
		return supplementationFromOtherSources;
	}
1193476
private static void setIncomeBudgetPeriods(PHS398Checklist13 phsChecklist,
											   List<? extends BudgetProjectIncomeContract> projectIncomes) {
		if (projectIncomes.isEmpty()) {
			phsChecklist.setProgramIncome(YesNoDataType.N_NO);
		} else {
			phsChecklist.setProgramIncome(YesNoDataType.Y_YES);
		}
		phsChecklist.setIncomeBudgetPeriodArray(getIncomeBudgetPeriod(projectIncomes));
	}
660750
private void put(Object obj, XmlParser.Node node) throws NoSuchMethodException,
            ClassNotFoundException, InvocationTargetException, IllegalAccessException
    {
        if (!(obj instanceof Map))
                throw new IllegalArgumentException("Object for put is not a Map: " + obj);
        Map map = (Map) obj;

        String name = node.getAttribute("name");
        Object value = value(obj, node);
        map.put(name, value);
        if (log.isDebugEnabled()) log.debug(obj + ".put(" + name + "+" + value + ")");
    }
621555
@POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_XML})
    public static Collection<Utterance> mapTextWithOptions(final AnalysisRequest r)
            throws IOException, InterruptedException, JAXBException, SQLException, ParserConfigurationException,
                   SAXException {

        System.out.println(r);

        // metamap options
        final Collection<Option> opts = new ArrayList<>();
        final Set<String> optionNames = new HashSet<>();
        for (final String o : r.getOptions()) {
            final Option opt = MetaMapOptions.strToOpt(o);
            if (opt != null) {
                optionNames.add(opt.name());
                if (!opt.useProcessorDefault()) opts.add(opt);
            }
        }
        // always make sure we have a restrict_to_sources option
        if (!optionNames.contains(new RestrictToSources().name())) opts.add(new RestrictToSources());

        // tmp files for metamap in/out
        final File infile = File.createTempFile("metamap-input-", ".txt");
        final File outfile = File.createTempFile("metamap-output-", ".xml");
        final String s = r.getText() + (r.getText().endsWith("\n") ? "" : "\n");
        final String ascii = MetaMap.decomposeToAscii(URLDecoder.decode(s, "UTF-8"));
        Files.write(ascii, infile, Charsets.UTF_8);
        // we don't want too much data for a free service
        if (infile.length() > MAX_DATA_BYTES) {
            throw new WebApplicationException(
                    Response.status(Responses.NOT_ACCEPTABLE)
                            .entity("Too much data, currently limited to " + MAX_DATA_BYTES + " bytes.")
                            .type("text/plain").build()
            );
        }

        // process the data with MetaMap
        final MetaMap metaMap = new MetaMap(PUBLIC_MM_DIR, opts);
        if (!metaMap.process(infile, outfile)) {
            throw new WebApplicationException(Response.status(INTERNAL_SERVER_ERROR)
                                                      .entity("Processing failed, aborting.")
                                                      .type("text/plain").build());
        }

        // look up the SNOMED codes from the UMLS CUI code/description combinations returned by MetaMap
        final MMOs root = JaxbLoader.loadXml(outfile);
        try (final SnomedLookup snomedLookup = new SnomedLookup(DB_PATH)) {
            snomedLookup.enrichXml(root);
        }

        //noinspection ResultOfMethodCallIgnored
        infile.delete();
        //noinspection ResultOfMethodCallIgnored
        outfile.delete();

        return destructiveFilter(root);
    }
315926
private function setObjectData()
    {
        //====================================================================//
        // Walk on All Requested Fields
        //====================================================================//
        $fields = is_a($this->in, "ArrayObject") ? $this->in->getArrayCopy() : $this->in;
        foreach ($fields as $fieldName => $fieldData) {
            //====================================================================//
            // Write Requested Fields
            foreach ($this->identifySetMethods() as $method) {
                $this->{$method}($fieldName, $fieldData);
            }
        }

        //====================================================================//
        // Verify Requested Fields List is now Empty => All Fields Writen Successfully
        //====================================================================//
        if (count($this->in)) {
            foreach ($this->in as $fieldName => $fieldData) {
                Splash::log()->err("ErrLocalWrongField", __CLASS__, __FUNCTION__, $fieldName);
            }

            return false;
        }

        return true;
    }
644944
def get_payee_by_id(budget_id, payee_id, opts = {})
      data, _status_code, _headers = get_payee_by_id_with_http_info(budget_id, payee_id, opts)
      data
    end
608527
protected void getSupplementationFromOtherSources(Budget budget, Map<Integer, String> hmBudgetQuestions) {

        if (!hmBudgetQuestions.isEmpty()) {
            if (hmBudgetQuestions.get(OTHER_SUPP_SOURCE) != null) {
                if (hmBudgetQuestions.get(OTHER_SUPP_SOURCE).toString().toUpperCase().equals("Y")) {
                    SupplementationFromOtherSources supplementationFromOtherSources = budget
                            .addNewSupplementationFromOtherSources();
                    if (hmBudgetQuestions.get(SUPP_SOURCE) != null) {
                        supplementationFromOtherSources.setSource(hmBudgetQuestions.get(SUPP_SOURCE).toString());
                        supplementationFromOtherSources.setAmount(new BigDecimal(hmBudgetQuestions.get(SUPP_FUNDING_AMT).toString()));
                        try {
                            supplementationFromOtherSources.setNumberOfMonths(new BigDecimal(hmBudgetQuestions.get(SUPP_MONTHS).toString()));
                        } catch (Exception ex) {
                        }
                        supplementationFromOtherSources.setType(hmBudgetQuestions.get(SUPP_TYPE).toString());

                    }
                }
            }
        }
    }
850512
@Override
	public HTTaxinvoiceXMLResponse getXML(String CorpNum, String NTSConfirmNum,
			String UserID) throws PopbillException {
		if ( NTSConfirmNum.length() != 24 )
			throw new PopbillException(-99999999, "국세청승인번호가 올바르지 않았습니다.");
		return httpget("/HomeTax/Taxinvoice/" +NTSConfirmNum+"?T=xml", CorpNum, UserID, HTTaxinvoiceXMLResponse.class);
	}
295638
def build_request_xml(checks, check_data = {})
      builder = Nokogiri::XML::Builder.new do |xml|
        xml.callvalidate do
          authentication(xml)
          xml.sessions do
            xml.session("RID" => Time.now.to_f) do
              xml.data do
                personal_data(xml, check_data[:personal_data])
                card_data(xml, check_data[:card_data])
                bank_data(xml, check_data[:bank_data])
                income_data(xml, check_data[:income_data])
                required_checks(xml, checks)
              end
            end
          end
          xml.application @config[:application_name]
        end
      end
      builder.doc
    end
535133
public boolean setXML(String strXML)
    {
        Node node = Utility.convertXMLToDOM(strXML);
        return this.setDOM(node);
    }
1141948
protected void setTuitionRequestedYears(Budget budget) {
        ProposalDevelopmentBudgetExtContract pBudget = s2SCommonBudgetService.getBudget(pdDoc.getDevelopmentProposal());
        if (pBudget == null) {
            return;
        }
        ScaleTwoDecimal tuitionTotal = ScaleTwoDecimal.ZERO;
        for (BudgetPeriodContract budgetPeriod : pBudget.getBudgetPeriods()) {
            ScaleTwoDecimal tuition = ScaleTwoDecimal.ZERO;
            for (BudgetLineItemContract budgetLineItem : budgetPeriod.getBudgetLineItems()) {
                if (getCostElementsByParam(ConfigurationConstants.TUITION_COST_ELEMENTS).contains(budgetLineItem.getCostElementBO().getCostElement())) {
                    tuition = tuition.add(budgetLineItem.getLineItemCost());
                }
            }
            tuitionTotal = tuitionTotal.add(tuition);
            switch (budgetPeriod.getBudgetPeriod()) {
                case 1:
                    budget.setTuitionRequestedYear1(tuition.bigDecimalValue());
                    break;
                case 2:
                    budget.setTuitionRequestedYear2(tuition.bigDecimalValue());
                    break;
                case 3:
                    budget.setTuitionRequestedYear3(tuition.bigDecimalValue());
                    break;
                case 4:
                    budget.setTuitionRequestedYear4(tuition.bigDecimalValue());
                    break;
                case 5:
                    budget.setTuitionRequestedYear5(tuition.bigDecimalValue());
                    break;
                case 6:
                    budget.setTuitionRequestedYear6(tuition.bigDecimalValue());
                    break;
                default:
                    break;
            }
        }
        budget.setTuitionRequestedTotal(tuitionTotal.bigDecimalValue());
        if (!tuitionTotal.equals(ScaleTwoDecimal.ZERO)) {
            budget.setTuitionAndFeesRequested(YesNoDataType.Y_YES);
        }
    }
358398
protected boolean validateBudgetForForm(ProposalDevelopmentDocumentContract pdDoc) throws S2SException {
        boolean valid = true;

        ProposalDevelopmentBudgetExtContract budget = s2SCommonBudgetService.getBudget(pdDoc.getDevelopmentProposal());
        if(budget != null) {
            for (BudgetPeriodContract period : budget.getBudgetPeriods()) {
                List<String> participantSupportCode = new ArrayList<>();
                participantSupportCode.add(s2sBudgetCalculatorService.getParticipantSupportCategoryCode());
                List<? extends BudgetLineItemContract> participantSupportLineItems =
                        s2sBudgetCalculatorService.getMatchingLineItems(period.getBudgetLineItems(), participantSupportCode);
                int numberOfParticipants = period.getNumberOfParticipants() == null ? 0 : period.getNumberOfParticipants();
                if (!participantSupportLineItems.isEmpty() && numberOfParticipants == 0) {
                    AuditError auditError= s2SErrorHandlerService.getError(PARTICIPANT_COUNT_REQUIRED, getFormName());
                    AuditError error= new AuditError(auditError.getErrorKey(),
                            auditError.getMessageKey()+period.getBudgetPeriod(),auditError.getLink());
                    getAuditErrors().add(error);
                    valid = false;
                } else if (numberOfParticipants > 0 && participantSupportLineItems.isEmpty()) {
                    getAuditErrors().add(s2SErrorHandlerService.getError(PARTICIPANT_COSTS_REQUIRED, getFormName()));
                    valid = false;
                }
            }
        }
        return valid;
    }
432134
public InputStream getObjectXML(Context context, String pid, String encoding)
            throws ServerException {
        return delegate.getObjectXML(context, pid, encoding);
    }