return false; } else { if (!amount.equals(other.amount)) return false;
if (amount.getCurrencyCode() == null && !PojoUtil.isEmpty(amount.getContent())) { throw new OrcidValidationException("Please specify a currency code"); } else if (amount.getCurrencyCode() != null && PojoUtil.isEmpty(amount.getContent())) { throw new OrcidValidationException("Please specify an amount or remove the amount tag");
/** * * Note that put-code is not part of hashCode or equals! This is to allow * better de-duplication. * */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((title == null) ? 0 : title.hashCode()); result = prime * result + ((description == null) ? 0 : description.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); result = prime * result + ((organizationDefinedType == null) ? 0 : organizationDefinedType.hashCode()); result = prime * result + ((amount == null) ? 0 : amount.hashCode()); result = prime * result + ((url == null) ? 0 : url.hashCode()); result = prime * result + ((organization == null) ? 0 : organization.hashCode()); result = prime * result + ((visibility == null) ? 0 : visibility.hashCode()); result = prime * result + ((source == null) ? 0 : source.hashCode()); result = prime * result + ((externalIdentifiers == null) ? 0 : externalIdentifiers.hashCode()); result = prime * result + ((contributors == null) ? 0 : contributors.hashCode()); result = prime * result + ((startDate == null) ? 0 : startDate.hashCode()); result = prime * result + ((endDate == null) ? 0 : endDate.hashCode()); return result; }
public Funding toFunding() { Funding result = new Funding(); Amount orcidAmount = new Amount(); if (!PojoUtil.isEmpty(amount)) orcidAmount.setContent(amount.getValue()); if (!PojoUtil.isEmpty(currencyCode)) orcidAmount.setCurrencyCode(currencyCode.getValue()); result.setAmount(orcidAmount); if (!PojoUtil.isEmpty(description))
if (StringUtils.isNotEmpty(funding.getAmount().getContent())) { String cleanNumber = funding.getAmount().getContent().trim(); result.setAmount(Text.valueOf(cleanNumber)); if (funding.getAmount().getCurrencyCode() != null) result.setCurrencyCode(Text.valueOf(funding.getAmount().getCurrencyCode())); else result.setCurrencyCode(new Text());
return false; } else { if (!amount.equals(other.amount)) return false;