(convert to Long) mapping
@param constraints constraints
@return new created mapping
344276
public static Mapping<Long> longv(Constraint... constraints) {
        return new FieldMapping(
                InputMode.SINGLE,
                mkSimpleConverter(s ->
                    isEmptyStr(s) ? 0l : Long.parseLong(s)
                ), new MappingMeta(MAPPING_LONG, Long.class)
            ).constraint(checking(Long::parseLong, "error.long", true))
                .constraint(constraints);
        }
1195425
public final ChildSelector<T> child(ElementConstraint...constraints) {
        return new ChildSelector<T>(getContext(), getCurrentSelector(),
                Arrays.asList(constraints));
    }
303735
public Mapper<K, V> constraint(Restraint<K, V> constraint) {
		return addConstraint(constraint);
	}
721542
public void setSizeConstraints(java.util.Collection<SizeConstraint> sizeConstraints) {
        if (sizeConstraints == null) {
            this.sizeConstraints = null;
            return;
        }

        this.sizeConstraints = new java.util.ArrayList<SizeConstraint>(sizeConstraints);
    }
571601
private Stream<IndexConstraintNodeInfo> indexesAndConstraintsForNode(Map<String,Object> config) {

        SchemaConfig schemaConfig = new SchemaConfig(config);
        Set<String> includeLabels = schemaConfig.getLabels();
        Set<String> excludeLabels = schemaConfig.getExcludeLabels();

        try ( Statement ignore = tx.acquireStatement() ) {
            TokenRead tokenRead = tx.tokenRead();
            TokenNameLookup tokens = new SilentTokenNameLookup(tokenRead);

            SchemaRead schemaRead = tx.schemaRead();
            Iterable<IndexReference> indexesIterator;
            Iterable<ConstraintDescriptor> constraintsIterator;

            if (includeLabels.isEmpty()) {
                Iterable<IndexReference> allIndex = () -> schemaRead.indexesGetAll();
                indexesIterator = StreamSupport.stream(allIndex.spliterator(),false)
                        .filter(index -> Arrays.stream(index.schema().getEntityTokenIds()).noneMatch(id -> {
                            try {
                                return excludeLabels.contains(tokenRead.nodeLabelName(id));
                            } catch (LabelNotFoundKernelException e) {
                                return false;
                            }
                        })).collect(Collectors.toList());

                Iterable<ConstraintDescriptor> allConstraints = () -> schemaRead.constraintsGetAll();
                constraintsIterator = StreamSupport.stream(allConstraints.spliterator(),false)
                        .filter(constraint -> Arrays.stream(constraint.schema().getEntityTokenIds()).noneMatch(id -> {
                            try {
                                return excludeLabels.contains(tokenRead.nodeLabelName(id));
                            } catch (LabelNotFoundKernelException e) {
                                return false;
                            }
                            }))
                            .collect(Collectors.toList());
            } else {
                constraintsIterator = includeLabels.stream()
                        .filter(label -> !excludeLabels.contains(label) && tokenRead.nodeLabel(label) != -1)
                        .flatMap(label -> {
                            Iterable<ConstraintDescriptor> indexesForLabel = () -> schemaRead.constraintsGetForLabel(tokenRead.nodeLabel(label));
                            return StreamSupport.stream(indexesForLabel.spliterator(), false);
                        })
                        .collect(Collectors.toList());

                indexesIterator = includeLabels.stream()
                        .filter(label -> !excludeLabels.contains(label) && tokenRead.nodeLabel(label) != -1)
                        .flatMap(label -> {
                            Iterable<IndexReference> indexesForLabel = () -> schemaRead.indexesGetForLabel(tokenRead.nodeLabel(label));
                            return StreamSupport.stream(indexesForLabel.spliterator(), false);
                        })
                        .collect(Collectors.toList());
            }


            Stream<IndexConstraintNodeInfo> constraintNodeInfoStream = StreamSupport.stream(constraintsIterator.spliterator(), false)
                    .filter(constraintDescriptor -> constraintDescriptor.type().equals(ConstraintDescriptor.Type.EXISTS))
                    .map(constraintDescriptor -> this.nodeInfoFromConstraintDescriptor(constraintDescriptor, tokens))
                    .sorted(Comparator.comparing(i -> i.label));

            Stream<IndexConstraintNodeInfo> indexNodeInfoStream = StreamSupport.stream(indexesIterator.spliterator(), false)
                    .map(indexReference -> this.nodeInfoFromIndexDefinition(indexReference, schemaRead, tokens))
                    .sorted(Comparator.comparing(i -> i.label));

            return Stream.of(constraintNodeInfoStream, indexNodeInfoStream).flatMap(e -> e);
        }
    }
693951
public static Mapping<Boolean> bool(Constraint... constraints) {
        return new FieldMapping(
                InputMode.SINGLE,
                mkSimpleConverter(s ->
                    isEmptyStr(s) ? false : Boolean.parseBoolean(s)
                ), new MappingMeta(MAPPING_BOOLEAN, Boolean.class)
            ).constraint(checking(Boolean::parseBoolean, "error.boolean", true))
                .constraint(constraints);
        }
1223168
private void addConstraintNameToList(String constraintName) {
		validateStringValue(constraintName);
		Set<String> currentValues = getConstraintNameList();
		currentValues.add(constraintName);
		setProperty(ConstraintContextProperty.ALL_CONSTRAINTS, ArrayUtils.toString(currentValues.toArray()));
	}
220071
@Override
	public void addSecurityConstraintMappings(
			final SecurityConstraintMappingModel model) {
		final ServletContextHandler context = server.getOrCreateContext(model);
		final SecurityHandler securityHandler = context.getSecurityHandler();
		if (securityHandler == null) {
			throw new IllegalStateException(
					"Internal error: Cannot find the security handler. Please report.");
		}
		String mappingMethod = model.getMapping();
		String constraintName = model.getConstraintName();
		String url = model.getUrl();
		String dataConstraint = model.getDataConstraint();
		List<String> roles = model.getRoles();
		boolean authentication = model.isAuthentication();

		ConstraintMapping newConstraintMapping = new ConstraintMapping();
		newConstraintMapping.setMethod(mappingMethod);
		newConstraintMapping.setPathSpec(url);
		Constraint constraint = new Constraint();
		constraint.setAuthenticate(authentication);
		constraint.setName(constraintName);
		constraint.setRoles(roles.toArray(new String[roles.size()]));

		if (dataConstraint == null || "NONE".equals(dataConstraint)) {
			constraint.setDataConstraint(Constraint.DC_NONE);
		} else if ("INTEGRAL".equals(dataConstraint)) {
			constraint.setDataConstraint(Constraint.DC_INTEGRAL);
		} else if ("CONFIDENTIAL".equals(dataConstraint)) {
			constraint.setDataConstraint(Constraint.DC_CONFIDENTIAL);
		} else {
			LOG.warn("Unknown user-data-constraint:" + dataConstraint);
			constraint.setDataConstraint(Constraint.DC_CONFIDENTIAL);
		}

		newConstraintMapping.setConstraint(constraint);

		((ConstraintSecurityHandler) securityHandler)
				.addConstraintMapping(newConstraintMapping);
	}
242974
public Rules add(PropertyConstraint constraint) {
		CompoundPropertyConstraint and = (CompoundPropertyConstraint)propertiesConstraints.get(constraint
				.getPropertyName());
		if (and == null) {
			putPropertyConstraint(constraint);
		}
		else {
			and.add(constraint);
		}
		return this;
	}
916916
public static Constraint required() {
		return new Constraint("required", simplePayload("required")) {
			public boolean isValid(Object actualValue) {
				return !(actualValue == null || StringUtils.isBlank(actualValue.toString()));
			}
		};
	}
190667
public static Long toLong(Object value, Long defaultValue) {
		return convert(Long.class, value, defaultValue);
	}
1327229
public void addConstraint(Constraint constraint) {
        if ( ConstraintType.ALPHA.equals(constraint.getType())) {
            this.addAlphaConstraint( (AlphaNodeFieldConstraint) constraint );
        } else if ( ConstraintType.BETA.equals(constraint.getType())) {
            this.addBetaConstraint( (BetaNodeFieldConstraint) constraint );
        } else {
            throw new RuntimeException( "Constraint type MUST be known in advance.");
        }
    }
1001609
public static Constraint
            mkSimpleConstraint(Function3<String, String, Messages, String> validate,
                               ExtensionMeta meta) {
        return mkConstraintWithMeta(
            (name, data, messages, options) -> {
                if (options._inputMode() != InputMode.SINGLE) {
                    throw new IllegalArgumentException("The constraint should only be used to SINGLE INPUT mapping!");
                } else {
                    String label = getLabel(name, messages, options);
                    String error = validate.apply(label, data.get(name), messages);
                    return isEmptyStr(error) ? Collections.emptyList()
                            : Arrays.asList(entry(name, error));
                }
            }, meta);
        }
736167
public static Constraint build(String cname, Map<String, Object> payload) {
		if (cname != null && payload != null) {
			if ("min".equals(cname) && payload.containsKey("value")) {
				return min(NumberUtils.toLong(payload.get("value") + "", 0));
			} else if ("max".equals(cname) && payload.containsKey("value")) {
				return max(NumberUtils.toLong(payload.get("value") + "", Config.DEFAULT_LIMIT));
			} else if ("size".equals(cname) && payload.containsKey("min") && payload.containsKey("max")) {
				return size(NumberUtils.toLong(payload.get("min") + "", 0),
						NumberUtils.toLong(payload.get("max") + "", Config.DEFAULT_LIMIT));
			} else if ("digits".equals(cname) && payload.containsKey("integer") && payload.containsKey("fraction")) {
				return digits(NumberUtils.toLong(payload.get("integer") + "", 0),
					NumberUtils.toLong(payload.get("fraction") + "", 0));
			} else if ("pattern".equals(cname) && payload.containsKey("value")) {
				return pattern(payload.get("value"));
			} else {
				return SIMPLE_CONSTRAINTS.get(cname);
			}
		}
		return null;
	}
202600
public void add(String propertyName, Constraint[] valueConstraints) {
		add(new PropertyValueConstraint(propertyName, all(valueConstraints)));
	}
61466
Constraint getUniqueConstraintForColumns(int[] cols) {

        for (int i = 0, size = constraintList.length; i < size; i++) {
            Constraint c = constraintList[i];

            if (c.isUniqueWithColumns(cols)) {
                return c;
            }
        }

        return null;
    }
1117122
public static Mapping<Integer> intv(Constraint... constraints) {
        return new FieldMapping(
                InputMode.SINGLE,
                mkSimpleConverter(s ->
                    isEmptyStr(s) ? 0 : Integer.parseInt(s)
                ), new MappingMeta(MAPPING_INT, Integer.class)
            ).constraint(checking(Integer::parseInt, "error.number", true))
                .constraint(constraints);
        }