List of usage examples for org.apache.commons.collections4 CollectionUtils isEmpty
public static boolean isEmpty(final Collection<?> coll)
From source file:nc.noumea.mairie.appock.viewmodel.EditStockReferentAchatViewModel.java
@Command public void creeEntreeStock() { if (getSelectedService() == null) { Messagebox.show("Vous devez choisir un service dans la liste des services ci-dessus", "Erreur", Messagebox.OK, Messagebox.ERROR); return;//ww w. j a v a 2s.co m } if (CollectionUtils.isEmpty(getSelectedListeArticleStock())) { Messagebox.show( "Vous devez slectionner un article dans la liste avant de pouvoir effectuer une entre en stock", "Erreur", Messagebox.OK, Messagebox.ERROR); return; } Map<String, Object> args = new HashMap<>(); args.put("selectedListeArticleStock", getSelectedListeArticleStock()); Executions.createComponents("/layout/createEntreeStockPopup.zul", null, args); }
From source file:nc.noumea.mairie.appock.services.impl.CommandeServiceImpl.java
@Override public Commande creeCommandeFromListeDemande(List<Demande> listeDemande) { if (CollectionUtils.isEmpty(listeDemande)) { return null; }/*from w ww .java 2 s .com*/ AppUser currentUser = authHelper.getCurrentUser(); Commande commande = new Commande(); commande.setCreateUser(currentUser.getNomComplet()); commande.setNumero(findNextNumero()); return ajouteListeDemandeACommande(commande, listeDemande); }
From source file:nc.noumea.mairie.appock.services.impl.DemandeServiceImpl.java
@Override public Demande creeDemandeFromListeArticlePanier(List<ArticlePanier> listeArticlePanier) { if (CollectionUtils.isEmpty(listeArticlePanier)) { return null; }/* w w w. ja v a 2 s .c om*/ AppUser currentUser = authHelper.getCurrentUser(); Demande demande = new Demande(); demande.setService(currentUser.getService()); demande.setCreateUser(currentUser.getNomComplet()); demande.setNumero(findNextNumero(currentUser.getService())); for (ArticlePanier articlePanier : listeArticlePanier) { ArticleDemande articleDemande = new ArticleDemande(); articleDemande.setArticleCatalogue(articlePanier.getArticleCatalogue()); articleDemande.setQuantite(articlePanier.getQuantite()); articleDemande.setQuantiteCommande(articlePanier.getQuantite()); articleDemande.setDemande(demande); demande.getListeArticleDemande().add(articleDemande); } return save(demande); }
From source file:co.runrightfast.core.security.cert.CAIssuedX509V3CertRequest.java
private void checkConstraints(final Collection<X509CertExtension> extensions) { if (CollectionUtils.isEmpty(extensions)) { return;/* www .j a va 2 s .c o m*/ } final Extensions exts = new Extensions( extensions.stream().map(X509CertExtension::toExtension).toArray(Extension[]::new)); checkArgument(AuthorityKeyIdentifier.fromExtensions(exts) == null, "AuthorityKeyIdentifier must not be specified as an extension - it is added automatically"); }
From source file:nc.noumea.mairie.appock.viewmodel.EditDemandeViewModel.java
@Command public void transmetDemande() { if (CollectionUtils.isEmpty(entity.getListeArticleDemande())) { Messagebox.show(// w w w.j a va 2 s .co m "Vous ne pouvez pas transmettre une demande qui ne contient pas d'articles. Vous devez annuler cette demande.", "Tranmsission impossible", Messagebox.OK, Messagebox.ERROR); return; } Messagebox.show("Voulez-vous transmettre cette demande pour traitement la section achat ?", "Transmettre la demande", new Messagebox.Button[] { Messagebox.Button.YES, Messagebox.Button.NO }, Messagebox.QUESTION, evt -> { if (evt.getName().equals("onYes")) { entity = demandeRepository.findOne(entity.getId()); demandeService.transmetDemande(entity); rechargeOnglet(); rechargeOngletListeDemande(); rechargeOngletListeReferentAchat(); notifyChange("entity"); showNotificationStandard("Demande transmise"); } }); }
From source file:nc.noumea.mairie.appock.viewmodel.ListeDemandeACommanderViewModel.java
@Command public void ajoutCommande() { if (CollectionUtils.isEmpty(selectedListeDemande)) { Messagebox.show("Vous devez slectionner au moins une demande pour pouvoir l'ajouter une commande", "Cration refuse", Messagebox.OK, Messagebox.INFORMATION); return;//from w ww. j a v a 2 s . com } Map<String, Object> args = new HashMap<>(); args.put("selectedListeDemande", selectedListeDemande); Executions.createComponents("/layout/choixCommandeExistantePopup.zul", null, args); }
From source file:it.gulch.linuxday.android.fragments.TrackScheduleListFragment.java
private void notifyEventSelected(int position) { if (CollectionUtils.isEmpty(events) || position < 0 || (events.size() - 1 > position && CollectionUtils.isEmpty(events.get(position).getPeople()))) { return;//from w w w . jav a 2s . c o m } if (listener != null) { listener.onEventSelected(position, (position == ListView.INVALID_POSITION) ? null : adapter.getItem(position)); } }
From source file:com.evolveum.midpoint.model.impl.scripting.actions.AssignExecutor.java
@Override public PipelineData execute(ActionExpressionType expression, PipelineData input, ExecutionContext context, OperationResult globalResult) throws ScriptExecutionException { ModelExecuteOptions executionOptions = getOptions(expression, input, context, globalResult); boolean dryRun = getParamDryRun(expression, input, context, globalResult); ActionParameterValueType resourceParameterValue = expressionHelper.getArgument(expression.getParameter(), PARAM_RESOURCE, false, false, NAME); ActionParameterValueType roleParameterValue = expressionHelper.getArgument(expression.getParameter(), PARAM_ROLE, false, false, NAME); Collection<ObjectReferenceType> resources; try {/* w w w. j a v a2s. c o m*/ if (resourceParameterValue != null) { PipelineData data = expressionHelper.evaluateParameter(resourceParameterValue, null, input, context, globalResult); resources = data.getDataAsReferences(ResourceType.COMPLEX_TYPE, ResourceType.class, context, globalResult); } else { resources = null; } } catch (CommonException e) { throw new ScriptExecutionException("Couldn't evaluate '" + PARAM_RESOURCE + "' parameter of a scripting expression: " + e.getMessage(), e); } Collection<ObjectReferenceType> roles; try { if (roleParameterValue != null) { PipelineData data = expressionHelper.evaluateParameter(roleParameterValue, null, input, context, globalResult); roles = data.getDataAsReferences(RoleType.COMPLEX_TYPE, AbstractRoleType.class, context, globalResult); // if somebody wants to assign Org, he has to use full reference value (including object type) } else { roles = null; } } catch (CommonException e) { throw new ScriptExecutionException( "Couldn't evaluate '" + PARAM_ROLE + "' parameter of a scripting expression: " + e.getMessage(), e); } if (resources == null && roles == null) { throw new ScriptExecutionException("Nothing to assign: neither resource nor role specified"); } if (CollectionUtils.isEmpty(resources) && CollectionUtils.isEmpty(roles)) { LOGGER.warn("No resources and no roles to assign in a scripting expression"); context.println("Warning: no resources and no roles to assign"); // TODO some better handling? return input; } for (PipelineItem item : input.getData()) { PrismValue value = item.getValue(); OperationResult result = operationsHelper.createActionResult(item, this, context, globalResult); context.checkTaskStop(); if (value instanceof PrismObjectValue && ((PrismObjectValue) value).asObjectable() instanceof FocusType) { @SuppressWarnings({ "unchecked", "raw" }) PrismObject<? extends ObjectType> prismObject = ((PrismObjectValue) value).asPrismObject(); ObjectType objectType = prismObject.asObjectable(); long started = operationsHelper.recordStart(context, objectType); Throwable exception = null; try { operationsHelper.applyDelta(createDelta(objectType, resources, roles), executionOptions, dryRun, context, result); operationsHelper.recordEnd(context, objectType, started, null); } catch (Throwable ex) { operationsHelper.recordEnd(context, objectType, started, ex); exception = processActionException(ex, NAME, value, context); } context.println((exception != null ? "Attempted to modify " : "Modified ") + prismObject.toString() + optionsSuffix(executionOptions, dryRun) + exceptionSuffix(exception)); } else { //noinspection ThrowableNotThrown processActionException(new ScriptExecutionException("Item is not a PrismObject of FocusType"), NAME, value, context); } operationsHelper.trimAndCloneResult(result, globalResult, context); } return input; // TODO updated objects? }
From source file:io.cloudslang.lang.compiler.modeller.transformers.ResultsTransformerTest.java
@Test public void testFillDefaultResultsWhenNoResultsGiven() throws Exception { List<Result> results = resultsTransformer.transform(resultsMapOpNoData).getTransformedData(); Assert.assertTrue(CollectionUtils.isEmpty(results)); }
From source file:io.cloudslang.lang.compiler.scorecompiler.ExecutionPlanBuilder.java
public ExecutionPlan createFlowExecutionPlan(Flow compiledFlow) { ExecutionPlan executionPlan = new ExecutionPlan(); executionPlan.setName(compiledFlow.getName()); executionPlan.setLanguage(CLOUDSLANG_NAME); executionPlan.setFlowUuid(compiledFlow.getId()); executionPlan.setWorkerGroup(compiledFlow.getWorkerGroup()); executionPlan.setBeginStep(FLOW_START_STEP_ID); //flow start step executionPlan.addStep(stepFactory.createStartStep(FLOW_START_STEP_ID, compiledFlow.getPreExecActionData(), compiledFlow.getInputs(), compiledFlow.getName(), ExecutableType.FLOW)); //flow end step executionPlan.addStep(stepFactory.createEndStep(FLOW_END_STEP_ID, compiledFlow.getPostExecActionData(), compiledFlow.getOutputs(), compiledFlow.getResults(), compiledFlow.getName(), ExecutableType.FLOW)); Map<String, Long> stepReferences = getStepReferences(compiledFlow); Deque<Step> steps = compiledFlow.getWorkflow().getSteps(); if (CollectionUtils.isEmpty(steps)) { throw new RuntimeException("Flow: " + compiledFlow.getName() + " has no steps"); }//from w w w. j a va 2 s . com List<ExecutionStep> stepExecutionSteps = buildStepExecutionSteps(steps.getFirst(), stepReferences, steps, compiledFlow); executionPlan.addSteps(stepExecutionSteps); return executionPlan; }