public boolean isAccountTypeUnique(Integer entityId, String name, boolean isNew) { List<AccountTypeDTO> accountTypeDTOList = new AccountTypeDAS().findAll(entityId); List<String> descriptionList = new ArrayList<String>(); for (AccountTypeDTO accountType1 : accountTypeDTOList) { descriptionList.add(accountType1.getDescription()); } if (isNew) { return !descriptionList.contains(name); } else { return Collections.frequency(descriptionList, name) < 2; } }
public static final AccountTypeWS getWS(AccountTypeDTO dto) { return getWS( dto.getId(), dto.getCompany().getId(), dto.getInvoiceDesign(), dto.getDateCreated(), dto.getCreditNotificationLimit1(), dto.getCreditNotificationLimit2(), dto.getCreditLimit(), dto.getInvoiceDeliveryMethod(), dto.getCurrencyId(), dto.getLanguageId(), dto.getDescription(), UserBL.convertMainSubscriptionToWS(dto.getBillingCycle()), dto.getInformationTypes(), dto.getPaymentMethodTypes(), dto.getPreferredNotificationAitId()); }