List of usage examples for org.springframework.util CollectionUtils isEmpty
public static boolean isEmpty(@Nullable Map<?, ?> map)
From source file:com.sybase365.mobiliser.custom.project.jobs.event.handler.blacklist.BlacklistEventHandler.java
private Boolean sendNotification(final Customer customer, final String template, Map attr) { // Check if customer is a merchant or consumer final CustomerType ctype = customer.getCustomerType(); if (ctype == null) { if (LOG.isInfoEnabled()) { LOG.info("Customer #{} is neither a consumer nor a merchant." + " No customer type available! " + "Not sending out any notification.", customer.getId()); }//from w w w . ja v a2 s . c o m return Boolean.FALSE; } if (ctype.getId().intValue() != 2 && ctype.getId().intValue() != 3) { if (LOG.isInfoEnabled()) { LOG.info( "Customer #{} is neither a consumer nor a merchant." + " Customertype is #{}! " + "Not sending out any notification.", new Object[] { customer.getId(), ctype.getId().toString() }); } return Boolean.FALSE; } final List<String> emails = this.notificationLogic.getCustomersNotificationEmail(customer, 0); if (!CollectionUtils.isEmpty(emails)) { final Locale locale = getLocale(customer); final Receiver receiver = new Receiver(); receiver.setValue(emails.get(0)); final MessageDetails details = new MessageDetails(); details.setLocale(locale); details.setTemplate(template); // use default channel final TemplateMessage msg = new TemplateMessage(); msg.setType(MSG_TYPE_EMAIL); msg.setDetails(details); msg.setParameters(attr); msg.getReceiver().add(receiver); final SendTemplateRequest request = new SendTemplateRequest(); request.setMessage(msg); final SendTemplateResponse response = this.messagingService.sendTemplate(request); if (response == null || response.getStatus() == null) { LOG.warn("Problem occurred when trying to send notification of transaction " + (response == null ? "no response returned" : "no status set in response")); return null; } if (response.getStatus().getCode() != 0) { LOG.warn( "Problem occurred when trying to send notification of transaction. Messaging gateway returned status code {}", Integer.toString(response.getStatus().getCode())); } } final List<String> msisdns = this.notificationLogic.getCustomersMsisdn(customer, 0); if (!CollectionUtils.isEmpty(msisdns)) { final Locale locale = getLocale(customer); final Receiver receiver = new Receiver(); receiver.setValue(msisdns.get(0)); final MessageDetails details = new MessageDetails(); details.setLocale(locale); details.setTemplate(template); // use default channel final TemplateMessage msg = new TemplateMessage(); msg.setDetails(details); msg.setParameters(attr); msg.getReceiver().add(receiver); msg.setType(MSG_TYPE_SMS); final SendTemplateRequest request = new SendTemplateRequest(); request.setMessage(msg); final SendTemplateResponse response = this.messagingService.sendTemplate(request); if (response == null || response.getStatus() == null) { LOG.warn("Problem occurred when trying to send notification of transaction " + (response == null ? "no response returned" : "no status set in response")); return null; } if (response.getStatus().getCode() != 0) { LOG.warn( "Problem occurred when trying to send notification of transaction. Messaging gateway returned status code {}", Integer.toString(response.getStatus().getCode())); } } return Boolean.TRUE; }
From source file:com.github.cric.app.ui.SettingPanel.java
private JButton submitButton() { JButton b = new JButton("Submit"); b.setToolTipText("Schedule for score updates via popup"); parentFrame.getRootPane().setDefaultButton(b); b.addActionListener(e -> {// ww w . j a v a 2s.c o m if (!validatedInputFields()) { return; } if (CollectionUtils.isEmpty(matchList)) { System.setProperty(API_KEY_PROP, apiKeyField.getText()); populateMatchList(); } else { submitted(); } }); return b; }
From source file:org.agatom.springatom.cmp.wizards.data.result.WizardResult.java
public WizardResult setErrors(final Set<Throwable> errors) { if (CollectionUtils.isEmpty(errors)) { return this; }/* ww w.j ava 2 s .c o m*/ if (this.errors == null) { this.errors = errors; } else { this.errors.addAll(errors); } return this; }
From source file:nl.surfnet.coin.selfservice.filter.ApiOAuthFilter.java
private boolean groupsContains(String teamId, List<Group20> groups) { if (CollectionUtils.isEmpty(groups)) { return false; }//from w ww .j a v a2 s .c om for (Group20 group20 : groups) { if (group20.getId().equalsIgnoreCase(teamId)) { return true; } } return false; }
From source file:com.excilys.ebi.bank.util.Asserts.java
public static void notEmpty(Map<?, ?> map, String messagePattern, Object arg) { if (CollectionUtils.isEmpty(map)) { throw new IllegalArgumentException(MessageFormatter.format(messagePattern, arg).getMessage()); }//from w w w . j ava 2s .com }
From source file:com.gst.portfolio.client.service.ClientReadPlatformServiceImpl.java
@Override public ClientData retrieveTemplate(final Long officeId, final boolean staffInSelectedOfficeOnly) { this.context.authenticatedUser(); final Long defaultOfficeId = defaultToUsersOfficeIfNull(officeId); AddressData address = null;// w w w.java2 s.co m final Collection<OfficeData> offices = this.officeReadPlatformService.retrieveAllOfficesForDropdown(); final Collection<SavingsProductData> savingsProductDatas = this.savingsProductReadPlatformService .retrieveAllForLookupByType(null); final GlobalConfigurationPropertyData configuration = this.configurationReadPlatformService .retrieveGlobalConfiguration("Enable-Address"); final Boolean isAddressEnabled = configuration.isEnabled(); if (isAddressEnabled) { address = this.addressReadPlatformService.retrieveTemplate(); } Collection<StaffData> staffOptions = null; final boolean loanOfficersOnly = false; if (staffInSelectedOfficeOnly) { staffOptions = this.staffReadPlatformService.retrieveAllStaffForDropdown(defaultOfficeId); } else { staffOptions = this.staffReadPlatformService .retrieveAllStaffInOfficeAndItsParentOfficeHierarchy(defaultOfficeId, loanOfficersOnly); } if (CollectionUtils.isEmpty(staffOptions)) { staffOptions = null; } final List<CodeValueData> genderOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.GENDER)); final List<CodeValueData> clientTypeOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.CLIENT_TYPE)); final List<CodeValueData> clientClassificationOptions = new ArrayList<>(this.codeValueReadPlatformService .retrieveCodeValuesByCode(ClientApiConstants.CLIENT_CLASSIFICATION)); final List<CodeValueData> clientNonPersonConstitutionOptions = new ArrayList<>( this.codeValueReadPlatformService .retrieveCodeValuesByCode(ClientApiConstants.CLIENT_NON_PERSON_CONSTITUTION)); final List<CodeValueData> clientNonPersonMainBusinessLineOptions = new ArrayList<>( this.codeValueReadPlatformService .retrieveCodeValuesByCode(ClientApiConstants.CLIENT_NON_PERSON_MAIN_BUSINESS_LINE)); final List<EnumOptionData> clientLegalFormOptions = ClientEnumerations.legalForm(LegalForm.values()); final List<DatatableData> datatableTemplates = this.entityDatatableChecksReadService .retrieveTemplates(StatusEnum.CREATE.getCode().longValue(), EntityTables.CLIENT.getName(), null); return ClientData.template(defaultOfficeId, new LocalDate(), offices, staffOptions, null, genderOptions, savingsProductDatas, clientTypeOptions, clientClassificationOptions, clientNonPersonConstitutionOptions, clientNonPersonMainBusinessLineOptions, clientLegalFormOptions, address, isAddressEnabled, datatableTemplates); }
From source file:net.sf.sze.service.impl.zeugnis.ZeugnisFormularServiceImpl.java
/** * * {@inheritDoc}/*from ww w .j av a 2 s . co m*/ */ @Override public ZeugnisFormular getLastZeugnisFormular(final Schulhalbjahr shj, Klasse klasse) { final Halbjahr currentHalbjahr = shj.getHalbjahr(); final int currentSchuljahr = shj.getJahr(); final ZeugnisFormular lastZeugnisFormular; if (Halbjahr.Erstes_Halbjahr.equals(currentHalbjahr)) { final List<ZeugnisFormular> lastZeugnisFormulareList = zeugnisFormularDao .findAllBySchulhalbjahrJahrAndSchulhalbjahrHalbjahrAndKlasseJahrgang(currentSchuljahr - 1, Halbjahr.Beide_Halbjahre, klasse.getJahrgang() - 1); if (!CollectionUtils.isEmpty(lastZeugnisFormulareList)) { lastZeugnisFormular = lastZeugnisFormulareList.get(0); } else { lastZeugnisFormular = null; } } else if (Halbjahr.Beide_Halbjahre.equals(currentHalbjahr)) { lastZeugnisFormular = zeugnisFormularDao.findBySchulhalbjahrJahrAndSchulhalbjahrHalbjahrAndKlasse( currentSchuljahr, Halbjahr.Erstes_Halbjahr, klasse); } else { throw new IllegalStateException("Unltiges Halbjahr " + currentHalbjahr); } return lastZeugnisFormular; }
From source file:com.iana.dver.controller.DverAdminController.java
@RequestMapping(value = "/admin/rejected/filter", produces = "application/json", method = RequestMethod.GET) public @ResponseBody String filterRejectedDversByScacOrDot( @RequestParam(value = "sEcho", required = false, defaultValue = "1") String sEcho, @RequestParam(value = "sSearch", required = false) String sSearch, @RequestParam(value = "sColumns", required = false) String sColumns, @RequestParam(value = "iDisplayStart", required = false, defaultValue = "0") String iDisplayStart, @RequestParam(value = "iDisplayLength", required = false, defaultValue = "10") String iDisplayLength, @RequestParam(value = "iColumns", required = false, defaultValue = "8") String iColumns, @RequestParam(value = "iepDotFilter", required = false, defaultValue = "") String iepDotFilter, @RequestParam(value = "mcDotFilter", required = false, defaultValue = "") String mcDotFilter, @RequestParam(value = "reportNoFilter", required = false, defaultValue = "") String reportNoFilter) { try {//from w w w. ja va 2s.co m Map<String, String> filtermap = new HashMap<String, String>(); if (StringUtils.hasLength(iepDotFilter)) { filtermap.put("iepDotFilter", iepDotFilter + "%"); } if (StringUtils.hasLength(mcDotFilter)) { filtermap.put("mcDotFilter", mcDotFilter + "%"); } if (StringUtils.hasLength(reportNoFilter)) { filtermap.put("reportNoFilter", reportNoFilter + "%"); } List<DverDetailsVO> rejectedDvers = this.dverDetailsService.getFilteredRejectedDvers(filtermap, Integer.parseInt(iDisplayStart), Integer.parseInt(iDisplayLength)); if (CollectionUtils.isEmpty(rejectedDvers)) { rejectedDvers = new ArrayList<DverDetailsVO>(); } int iTotalRecords = rejectedDvers.size(); int iTotalDisplayRecords = this.dverDetailsService.countFilteredRejectedDvers(filtermap); JsonObject jsonResponse = new JsonObject(); jsonResponse.addProperty("sEcho", sEcho); jsonResponse.addProperty("iTotalRecords", iTotalRecords); jsonResponse.addProperty("iTotalDisplayRecords", iTotalDisplayRecords); Gson gson = new Gson(); jsonResponse.add("aaData", gson.toJsonTree(rejectedDvers)); return jsonResponse.toString(); } catch (Exception ex) { DVERUtil.sendExceptionEmails("filterRejectedDversByScacOrDot method of DverAdminController \n " + ex); logger.error("Error in filterRejectedDversByScacOrDot....." + ex); return "error"; } }
From source file:com.deloitte.smt.service.SignalDetectionService.java
private void saveSmqPt(SignalDetection signalDetection, Smq smq) { List<Pt> pts = smq.getPts(); if (!CollectionUtils.isEmpty(pts)) { for (Pt pt : pts) { pt.setSmqId(smq.getId());/* ww w.j a v a 2s . c om*/ pt.setDetectionId(signalDetection.getId()); } ptRepository.save(pts); } }
From source file:com.epam.catgenome.manager.FeatureIndexManager.java
/** * Searches gene IDs, affected by variations in specified VCF files in a specified project * * @param gene a prefix of a gene ID to search * @param vcfFileIds a {@code List} of IDs of VCF files in project to search for gene IDs * @return a {@code Set} of gene IDs, that are affected by some variations in specified VCf files * @throws IOException//from w ww .j a v a2 s .com */ public Set<String> searchGenesInVcfFilesInProject(long projectId, String gene, List<Long> vcfFileIds) throws IOException { Project project = projectManager.loadProject(projectId); List<VcfFile> vcfFiles = project.getItems().stream() .filter(i -> i.getBioDataItem().getFormat() == BiologicalDataItemFormat.VCF) .map(i -> (VcfFile) i.getBioDataItem()).collect(Collectors.toList()); List<VcfFile> selectedVcfFiles; if (CollectionUtils.isEmpty(vcfFileIds)) { selectedVcfFiles = vcfFiles; } else { selectedVcfFiles = vcfFiles.stream().filter(f -> vcfFileIds.contains(f.getId())) .collect(Collectors.toList()); } return featureIndexDao.searchGenesInVcfFiles(gene, selectedVcfFiles); }