Generate Billing Reports for a Specific Buyer's Team

@param   buyerTeamReference Buyer team reference
@param   params Parameters
@throws	JSONException If error occurred
@return	{@link JSONObject}
977894
public JSONObject getByBuyersTeam(String buyerTeamReference, HashMap<String, String> params) throws JSONException {
        return oClient.get("/finreports/v2/buyer_teams/" + buyerTeamReference + "/billings", params);
    }
1313080
public JSONObject getList(HashMap<String, String> params) throws JSONException {
        return oClient.get("/offers/v1/clients/offers", params);
    }
991732
public static Reference getReference(Serializable object) throws NamingException
    {
        ByteArrayOutputStream outStream;
        try
        {
            outStream = new ByteArrayOutputStream();
            ObjectOutputStream out = new ObjectOutputStream(outStream);
            out.writeObject(object);
            out.close();
        }
        catch (IOException e)
        {
            throw new NamingException(e.getMessage());
        }

        BinaryRefAddr handle = new BinaryRefAddr("com.impetus.kundera.persistence.jta", outStream.toByteArray());
        Reference ret = new Reference(object.getClass().getName(), handle, UserTransactionFactory.class.getName(), null);
        return ret;
    }
977551
public JSONObject getList(String company, String team) throws JSONException {
        return _getByType(company, team, null);
    }
1226111
public JSONObject getRoomByContract(String company, String contractId, HashMap<String, String> params) throws JSONException {
        return oClient.get("/messages/v3/" + company + "/rooms/contracts/" + contractId, params);
    }
201377
public JSONObject actions(String reference, HashMap<String, String> params) throws JSONException {
        return oClient.post("/offers/v1/contractors/offers/" + reference, params);
    }
1211963
public static final void chkBMTFromXML(List<ContainerTransaction> tranAttrList, EnterpriseBean enterpriseBean, J2EEName j2eeName)
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "chkBMTFromXML");

        if (tranAttrList != null && enterpriseBean != null) {
            if (isTraceOn && tc.isDebugEnabled())
                Tr.debug(tc, "tranAttrList non-null");

            // Elements of highestStyleOnMethod[] are initialized to zero by Java rules.

            // i : TranAttrList loop
            // j : MethodElements loop

            for (int i = 0; i < tranAttrList.size(); ++i) {
                ContainerTransaction methodTransaction = tranAttrList.get(i);
                List<com.ibm.ws.javaee.dd.ejb.Method> methodElements = methodTransaction.getMethodElements();
                for (int j = 0; j < methodElements.size(); ++j) {
                    com.ibm.ws.javaee.dd.ejb.Method me = methodElements.get(j);
                    if (isTraceOn && tc.isDebugEnabled()) {
                        trace(me, me.getInterfaceTypeValue() == com.ibm.ws.javaee.dd.ejb.Method.INTERFACE_TYPE_UNSPECIFIED ?
                                        "Interface type unspecified" :
                                        "Interface type: " + me.getInterfaceTypeValue());
                    }
                    if (enterpriseBean.getName().equals(me.getEnterpriseBeanName())) {

                        Tr.warning(tc, "BMT_DEFINES_CMT_ATTRIBUTES_CNTR0067W", new Object[] { j2eeName });

                    } // enterpriseBean name matches parm in methodExtension
                } // methodElements loop (j)
            } // tranAttrList loop (i)

        } // tranAttrList != nullcd

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "chkBMTFromXML");

        return;
    }
1369784
@Override
    public List<Team> getBoards() {
        int count = 0;
        int startAt = 0;
        boolean isLast = false;
        List<Team> result = new ArrayList<>();
        while (!isLast) {
            String url = featureSettings.getJiraBaseUrl() + (featureSettings.getJiraBaseUrl().endsWith("/") ? "" : "/")
                    + BOARD_TEAMS_REST_SUFFIX + "?startAt=" + startAt;
            try {
                ResponseEntity<String> responseEntity = makeRestCall(url);
                String responseBody = responseEntity.getBody();
                JSONObject teamsJson = (JSONObject) parser.parse(responseBody);

                if (teamsJson != null) {
                    JSONArray valuesArray = (JSONArray) teamsJson.get("values");
                    if (!CollectionUtils.isEmpty(valuesArray)) {
                        for (Object obj : valuesArray) {
                            JSONObject jo = (JSONObject) obj;
                            String teamId = getString(jo, "id");
                            String teamName = getString(jo, "name");
                            String teamType = getString(jo, "type");
                            Team team = new Team(teamId, teamName);
                            team.setTeamType(teamType);
                            team.setChangeDate("");
                            team.setAssetState("Active");
                            team.setIsDeleted("False");
                            result.add(team);
                            count = count + 1;
                        }
                        isLast = (boolean) teamsJson.get("isLast");
                        LOGGER.info("JIRA Collector collected " + count + " boards");
                        if (!isLast) {
                            startAt += JIRA_BOARDS_PAGING;
                        }
                    } else {
                        isLast = true;
                    }
                } else {
                    isLast = true;
                }
            } catch (ParseException pe) {
                isLast = true;
                LOGGER.error("Parser exception when parsing teams", pe);
            } catch (HygieiaException | HttpClientErrorException | HttpServerErrorException e) {
                isLast = true;
                LOGGER.error("Error in calling JIRA API: " + url , e.getMessage());
            }
        }
        return result;
    }
98264
public JSONObject getByCompany(String company, HashMap<String, String> params) throws JSONException {
        return _getByType(company, null, null, params, false);
    }
958550
@Override
	public JsonSimple parseMessage(JsonSimple message)
			throws TransactionException {
		log.debug("\n{}", message.toString(true));

		// A standard harvest event
		JsonObject harvester = message.getObject("harvester");
		String repoType= message.getString("", "indexer", "params", "repository.type");
		if (harvester != null && !"Attachment".equalsIgnoreCase(repoType)) {
			try {
				String oid = message.getString(null, "oid");
				JsonSimple response = new JsonSimple();
				audit(response, oid, "Tool Chain");

				// Standard transformers... ie. not related to curation
				scheduleTransformers(message, response);

				// Solr Index
				JsonObject order = newIndex(response, oid);
				order.put("forceCommit", true);

				// Send a message back here
				createTask(response, oid, "clear-render-flag");
				return response;
			} catch (Exception ex) {
				throw new TransactionException(ex);
			}
		} else {
			log.debug("Is type attachment, ignoring...");
		}

		// It's not a harvest, what else could be asked for?
		String task = message.getString(null, "task");
		if (task != null) {
			String oid = message.getString(null, "oid");

			// ######################
			// Workflow related events
			if (task.equals("workflow-curation")) {
				JsonSimple response = new JsonSimple();
				workflowCuration(response, message);
				return response;
			}
			if (task.equals("workflow")) {
				JsonSimple response = new JsonSimple();

				String eventType = message.getString(null, "eventType");
				String newStep = message.getString(null, "newStep");
				// The workflow has altered data, run the tool chain
				if (newStep != null || eventType.equals("ReIndex")) {
					// For housekeeping, we need to alter the
					// Solr index fairly speedily
					boolean quickIndex = message
							.getBoolean(false, "quickIndex");
					if (quickIndex) {
						JsonObject order = newIndex(response, oid);
						order.put("forceCommit", true);
					}

					// send a copy to the audit log
					JsonObject order = newSubscription(response, oid);
					JsonObject audit = (JsonObject) order.get("message");
					audit.putAll(message.getJsonObject());

					// Then business as usual
					reharvest(response, message);

					// Once the dust settles come back here
					createTask(response, oid, "workflow-curation");

					// A traditional Subscriber message for audit logs
				} else {
					JsonObject order = newSubscription(response, oid);
					JsonObject audit = (JsonObject) order.get("message");
					audit.putAll(message.getJsonObject());
				}
				return response;
			}

			// ######################
			// Start a reharvest for this object
			if (task.equals("reharvest")) {
				JsonSimple response = new JsonSimple();
				reharvest(response, message);
				return response;
			}

			// ######################
			// Tool chain, clear render flag
			if (task.equals("clear-render-flag")) {
				if (oid != null) {
					clearRenderFlag(oid);
				} else {
					log.error("Cannot clear render flag without an OID!");
				}
			}

			// ######################
			// Curation
			if (task.startsWith("curation")) {
				try {
					if (oid != null) {
						JsonSimple response = curation(message, task, oid);

						// We should always index afterwards
						JsonObject order = newIndex(response, oid);
						order.put("forceCommit", true);
						return response;

					} else {
						log.error("We need an OID to curate!");
					}
				} catch (Exception ex) {
					JsonSimple response = new JsonSimple();
					log.error("Error during curation: ", ex);
					emailObjectLink(response, oid,
							"An unknown error occurred curating this object. "
									+ "Please check the system logs.");
					return response;
				}
			}

			// ######################
			// Publication
			if (task.startsWith("publish")) {
				try {
					if (oid == null) {
						oid = idToOid(message.getString(null, "identifier"));
						// Update out message so the reharvest function gets OID
						if (oid != null) {
							message.getJsonObject().put("oid", oid);
						}
					}
					if (oid != null) {
						JsonSimple response = publish(message, oid);
						// We should always go through the tool chain afterwards
						reharvest(response, message);
						return response;

					} else {
						log.error("We need an OID to publish!");
					}
				} catch (Exception ex) {
					JsonSimple response = new JsonSimple();
					log.error("Error during publication: ", ex);
					emailObjectLink(response, oid,
							"An unknown error occurred publishing this object."
									+ " Please check the system logs.");
					return response;
				}
			}
		}

		// Do nothing
		return new JsonSimple();
	}
504593
protected void jSONSuccess(PMStrutsContext ctx, Object object) throws PMForwardException {
        final String toJson = new Gson().toJson(object);
        ctx.put(PM_VOID_TEXT, toJson);
        success(ctx, "converters/void.jsp", false);
    }
1046822
public JSONObject assignToEngagement(String engagement_ref, HashMap<String, String> params) throws JSONException {
        return oClient.put("/tasks/v2/tasks/contracts/" + engagement_ref, params);
    }
268467
@Override
    public final Integer getCost(final AdvancementTeam team) {
        Integer valoration;

        checkNotNull(team, "Received a null pointer as the team");

        valoration = team.getCash();
        for (final AdvancementTeamPlayer player : team.getPlayers().values()) {
            valoration += player.getValoration();
        }

        valoration += team.getCoachingDice() * getCostDie();
        valoration += team.getDreadballCards() * getCostCard();
        valoration += team.getCheerleaders() * getCostCheerleader();

        if (team.getDefensiveCoachingStaff()) {
            valoration += getCostCoaching();
        }
        if (team.getOffensiveCoachingStaff()) {
            valoration += getCostCoaching();
        }
        if (team.getSupportCoachingStaff()) {
            valoration += getCostCoaching();
        }

        return valoration;
    }
1213542
public JSONObject getByFreelancerLimited(String freelancerId, HashMap<String, String> params) throws JSONException {
        return oClient.get("/timereports/v1/providers/" + freelancerId + "/hours", params);
    }
1267156
public Team getTeam() throws HelloSignException {
        return new Team(httpClient.withAuth(auth).get(BASE_URI + TEAM_URI).asJson());
    }
635881
public JSONObject assign(String company, String team, String engagement, HashMap<String, String> params) throws JSONException {
        return oClient.put("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/engagements/" + engagement + "/tasks", params);
    }
1250762
static List<String> getFQDNValueListCMS(JSONObject jObj,
            String projectionStr) throws JSONException {
        final List<String> labelList = new ArrayList<String>();

        if (!jObj.has("result")) {
            logger.error("!!CMS_ERROR! result key is not in jOBJ in getFQDNValueListCMS!!: \njObj:"
                    + PcStringUtils.renderJson(jObj));

            return labelList;
        }
        JSONArray jArr = (JSONArray) jObj.get("result");
        if (jArr == null || jArr.length() == 0) {
            return labelList;
        }
        for (int i = 0; i < jArr.length(); ++i) {
            JSONObject agentObj = jArr.getJSONObject(i);
            // properties can be null

            if (!agentObj.has(projectionStr)) {
                continue;
            }
            String label = (String) agentObj.get(projectionStr);

            if (label != null && !label.trim().isEmpty()) {
                labelList.add(label);
            }
        }

        return labelList;
    }