check(policySpec);
return generate(policySpec);
}
private PasswordPolicySpec merge(final List<PasswordPolicySpec> ppSpecs) {
PasswordPolicySpec fpps = new PasswordPolicySpec();
fpps.setMinLength(0);
fpps.setMaxLength(1000);
for (PasswordPolicySpec policySpec : ppSpecs) {
if (policySpec.getMinLength() > fpps.getMinLength()) {
fpps.setMinLength(policySpec.getMinLength());
}
if ((policySpec.getMaxLength() != 0) && ((policySpec.getMaxLength() < fpps.getMaxLength()))) {
fpps.setMaxLength(policySpec.getMaxLength());
}
fpps.setPrefixesNotPermitted(policySpec.getPrefixesNotPermitted());
fpps.setSuffixesNotPermitted(policySpec.getSuffixesNotPermitted());
if (!fpps.isNonAlphanumericRequired()) {
fpps.setNonAlphanumericRequired(policySpec.isNonAlphanumericRequired());
}
if (!fpps.isAlphanumericRequired()) {
fpps.setAlphanumericRequired(policySpec.isAlphanumericRequired());
}
if (!fpps.isDigitRequired()) {
fpps.setDigitRequired(policySpec.isDigitRequired());
}
if (!fpps.isLowercaseRequired()) {
fpps.setLowercaseRequired(policySpec.isLowercaseRequired());
}
if (!fpps.isUppercaseRequired()) {
fpps.setUppercaseRequired(policySpec.isUppercaseRequired());
}
if (!fpps.isMustStartWithDigit()) {
fpps.setMustStartWithDigit(policySpec.isMustStartWithDigit());
}
if (!fpps.isMustntStartWithDigit()) {
fpps.setMustntStartWithDigit(policySpec.isMustntStartWithDigit());
}
if (!fpps.isMustEndWithDigit()) {
fpps.setMustEndWithDigit(policySpec.isMustEndWithDigit());
}
if (fpps.isMustntEndWithDigit()) {
fpps.setMustntEndWithDigit(policySpec.isMustntEndWithDigit());
}
if (!fpps.isMustStartWithAlpha()) {
fpps.setMustStartWithAlpha(policySpec.isMustStartWithAlpha());
}
if (!fpps.isMustntStartWithAlpha()) {
fpps.setMustntStartWithAlpha(policySpec.isMustntStartWithAlpha());
}
if (!fpps.isMustStartWithNonAlpha()) {
fpps.setMustStartWithNonAlpha(policySpec.isMustStartWithNonAlpha());
}
if (!fpps.isMustntStartWithNonAlpha()) {
fpps.setMustntStartWithNonAlpha(policySpec.isMustntStartWithNonAlpha());
}
if (!fpps.isMustEndWithNonAlpha()) {
fpps.setMustEndWithNonAlpha(policySpec.isMustEndWithNonAlpha());
}
if (!fpps.isMustntEndWithNonAlpha()) {
fpps.setMustntEndWithNonAlpha(policySpec.isMustntEndWithNonAlpha());
}
if (!fpps.isMustEndWithAlpha()) {
fpps.setMustEndWithAlpha(policySpec.isMustEndWithAlpha());
}
if (!fpps.isMustntEndWithAlpha()) {
fpps.setMustntEndWithAlpha(policySpec.isMustntEndWithAlpha());
}
}
return fpps;
}