List of usage examples for org.apache.commons.collections4 CollectionUtils isEmpty
public static boolean isEmpty(final Collection<?> coll)
From source file:org.apache.syncope.client.console.wizards.any.ConnObjectPanel.java
public ConnObjectPanel(final String id, final Pair<ConnObjectTO, ConnObjectTO> connObjectTOs, final boolean view) { super(id);//from w w w. j a va2 s. c o m final IModel<List<String>> formProps = new LoadableDetachableModel<List<String>>() { private static final long serialVersionUID = 5275935387613157437L; @Override protected List<String> load() { List<AttrTO> right = new ArrayList<>( connObjectTOs == null || connObjectTOs.getRight() == null ? Collections.<AttrTO>emptyList() : connObjectTOs.getRight().getAttrs()); List<AttrTO> left = new ArrayList<>( connObjectTOs == null || connObjectTOs.getLeft() == null ? Collections.<AttrTO>emptyList() : connObjectTOs.getLeft().getAttrs()); final List<String> schemas = ListUtils.sum( right.stream().map(AttrTO::getSchema).collect(Collectors.toList()), left.stream().map(AttrTO::getSchema).collect(Collectors.toList())); Collections.sort(schemas); return schemas; } }; final Map<String, AttrTO> beforeProfile = connObjectTOs == null || connObjectTOs.getLeft() == null ? null : EntityTOUtils.buildAttrMap(connObjectTOs.getLeft().getAttrs()); final Map<String, AttrTO> afterProfile = connObjectTOs == null || connObjectTOs.getRight() == null ? null : EntityTOUtils.buildAttrMap(connObjectTOs.getRight().getAttrs()); final ListView<String> propView = new ListView<String>("propView", formProps) { private static final long serialVersionUID = 3109256773218160485L; @Override protected void populateItem(final ListItem<String> item) { final String prop = item.getModelObject(); final Fragment valueFragment; final AttrTO before = beforeProfile == null ? null : beforeProfile.get(prop); final AttrTO after = afterProfile == null ? null : afterProfile.get(prop); valueFragment = new Fragment("value", "doubleValue", ConnObjectPanel.this); Panel oldAttribute = getValuePanel("oldAttribute", prop, before); oldAttribute.setOutputMarkupPlaceholderTag(true); oldAttribute.setVisible(!view); valueFragment.add(oldAttribute); valueFragment.add(getValuePanel("newAttribute", prop, after)); if (before == null || after == null || (CollectionUtils.isNotEmpty(after.getValues()) && CollectionUtils.isEmpty(before.getValues())) || (CollectionUtils.isEmpty(after.getValues()) && CollectionUtils.isNotEmpty(before.getValues())) || (CollectionUtils.isNotEmpty(after.getValues()) && CollectionUtils.isNotEmpty(before.getValues()) && after.getValues().size() != before.getValues().size()) || (CollectionUtils.isNotEmpty(after.getValues()) && CollectionUtils.isNotEmpty(before.getValues()) && !after.getValues().equals(before.getValues()))) { valueFragment.add(new Behavior() { private static final long serialVersionUID = 3109256773218160485L; @Override public void onComponentTag(final Component component, final ComponentTag tag) { tag.put("class", "highlight"); } }); } item.add(valueFragment); } }; add(propView); }
From source file:org.apache.syncope.client.console.wizards.any.ConnObjectPanel.java
/** * Get panel for attribute value (not remote status). * * @param id component id to be replaced with the fragment content. * @param attrTO remote attribute.//from w ww. j a va 2s . c om * @return fragment. */ private Panel getValuePanel(final String id, final String schemaName, final AttrTO attrTO) { Panel field; if (attrTO == null) { field = new AjaxTextFieldPanel(id, schemaName, new Model<>()); } else if (CollectionUtils.isEmpty(attrTO.getValues())) { field = new AjaxTextFieldPanel(id, schemaName, new Model<>()); } else if (ConnIdSpecialName.PASSWORD.equals(schemaName)) { field = new AjaxTextFieldPanel(id, schemaName, new Model<>("********")); } else if (attrTO.getValues().size() == 1) { field = new AjaxTextFieldPanel(id, schemaName, new Model<>(attrTO.getValues().get(0))); } else { field = new MultiFieldPanel.Builder<>(new ListModel<>(attrTO.getValues())).build(id, schemaName, new AjaxTextFieldPanel("panel", schemaName, new Model<>())); } field.setEnabled(false); return field; }
From source file:org.apache.syncope.client.console.wizards.any.GroupHandler.java
public String getUDynMembershipCond() { if (CollectionUtils.isEmpty(this.uDynClauses)) { return this.anyTO.getUDynMembershipCond(); } else {// w ww. ja v a 2s . c o m return getFIQLString(this.uDynClauses, SyncopeClient.getUserSearchConditionBuilder()); } }
From source file:org.apache.syncope.client.console.wizards.any.GroupWrapper.java
public String getUDynMembershipCond() { if (CollectionUtils.isEmpty(this.uDynClauses)) { return null; } else {/*from w ww .java 2 s . co m*/ return SearchUtils.buildFIQL(this.uDynClauses, SyncopeClient.getUserSearchConditionBuilder()); } }
From source file:org.apache.syncope.client.console.wizards.role.RoleHandler.java
public String getDynMembershipCond() { if (CollectionUtils.isEmpty(this.dynClauses)) { return this.roleTO.getDynMembershipCond(); } else {//from w w w . j a v a 2 s . c o m return getFIQLString(this.dynClauses, SyncopeClient.getUserSearchConditionBuilder()); } }
From source file:org.apache.syncope.client.console.wizards.role.RoleWrapper.java
public String getDynMembershipCond() { if (CollectionUtils.isEmpty(this.dynClauses)) { return null; } else {/* w w w . j a v a2s . c o m*/ return SearchUtils.buildFIQL(this.dynClauses, SyncopeClient.getUserSearchConditionBuilder()); } }
From source file:org.apache.wicket.util.tester.WicketTester.java
/** * Asserts that the <code>Component</code> a the given path has a behavior of the given type. * * @param path// ww w. j a v a2s . com * path to <code>Component</code> * @param expectedBehaviorClass * expected <code>Behavior</code> class */ public void assertBehavior(String path, Class<? extends Behavior> expectedBehaviorClass) { Args.notNull(expectedBehaviorClass, "expectedBehaviorClass"); Component component = assertExists(path); List<? extends Behavior> behaviors = component.getBehaviors(expectedBehaviorClass); final String message = String.format("Component '%s' has no behaviors of type '%s'", component.getPageRelativePath(), expectedBehaviorClass); assertResult(new Result(CollectionUtils.isEmpty(behaviors), message)); }
From source file:org.axe.util.CollectionUtil.java
/** * Collection ? */ public static boolean isEmpty(Collection<?> collection) { return CollectionUtils.isEmpty(collection); }
From source file:org.blocks4j.feature.toggle.parameters.ParametersToggleHandler.java
public boolean isOn(Method method, Object[] args, String featureName) { List<TogglableParameter> togglableParameters = this.paramsMethodsCache.get(method); if (CollectionUtils.isEmpty(togglableParameters)) { return true; }/* w w w .j av a 2s. c o m*/ for (TogglableParameter togglableParameter : togglableParameters) { if (!this.isParamOn(args, featureName, togglableParameter)) { return false; } } return true; }
From source file:org.blocks4j.reconf.client.config.update.ConfigurationItemUpdateResult.java
public static int countSuccess(Collection<ConfigurationItemUpdateResult> arg) { if (CollectionUtils.isEmpty(arg)) { return 0; }//from ww w .ja v a 2s .co m int result = 0; for (ConfigurationItemUpdateResult proc : arg) { if (proc.getType() != Type.error) { ++result; } } return result; }