Search in sources :

Example 1 with Days

use of de.carne.certmgr.util.Days in project certmgr by hdecarne.

the class CRLUpdatePeriod method getDefaultSet.

/**
 * Get the standard CRL Update Periods.
 *
 * @param defaultHint The default to return (may be {@code null}). If this period is contained in the default set,
 *        it is also set as the default.
 * @return The standard CRL Update Periods.
 */
public static DefaultSet<CRLUpdatePeriod> getDefaultSet(@Nullable Days defaultHint) {
    DefaultSet<Days> defaultPeriods = SecurityDefaults.getCRLUpdatedPeriods();
    DefaultSet<CRLUpdatePeriod> crlUpdatePeriods = new DefaultSet<>();
    if (defaultHint != null) {
        crlUpdatePeriods.addDefault(new CRLUpdatePeriod(defaultHint));
    } else {
        crlUpdatePeriods.addDefault(new CRLUpdatePeriod(Check.notNull(defaultPeriods.getDefault())));
    }
    for (Days period : defaultPeriods) {
        crlUpdatePeriods.add(new CRLUpdatePeriod(period));
    }
    return crlUpdatePeriods;
}
Also used : DefaultSet(de.carne.jfx.util.DefaultSet) Days(de.carne.certmgr.util.Days)

Example 2 with Days

use of de.carne.certmgr.util.Days in project certmgr by hdecarne.

the class CRTValidityPeriod method getDefaultSet.

/**
 * Get the standard CRT Validity Periods.
 *
 * @param defaultHint The default to return (may be {@code null}). If this period is contained in the default set,
 *        it is also set as the default.
 * @return The standard CRT Validity Periods.
 */
public static DefaultSet<CRTValidityPeriod> getDefaultSet(@Nullable Days defaultHint) {
    DefaultSet<Days> defaultPeriods = SecurityDefaults.getCRTValidityPeriods();
    DefaultSet<CRTValidityPeriod> crlUpdatePeriods = new DefaultSet<>();
    if (defaultHint != null) {
        crlUpdatePeriods.addDefault(new CRTValidityPeriod(defaultHint));
    } else {
        crlUpdatePeriods.addDefault(new CRTValidityPeriod(Check.notNull(defaultPeriods.getDefault())));
    }
    for (Days period : defaultPeriods) {
        crlUpdatePeriods.add(new CRTValidityPeriod(period));
    }
    return crlUpdatePeriods;
}
Also used : DefaultSet(de.carne.jfx.util.DefaultSet) Days(de.carne.certmgr.util.Days)

Example 3 with Days

use of de.carne.certmgr.util.Days in project certmgr by hdecarne.

the class AbstractPeriodStringConverter method fromString.

@Override
public T fromString(@Nullable String string) {
    Matcher stringPatternMatcher = STRING_PATTERN.matcher(Strings.safe(string));
    String periodString = (stringPatternMatcher.matches() ? stringPatternMatcher.group(1) : string);
    return fromDays(new Days(Period.parse(periodString)));
}
Also used : Matcher(java.util.regex.Matcher) Days(de.carne.certmgr.util.Days)

Example 4 with Days

use of de.carne.certmgr.util.Days in project certmgr by hdecarne.

the class StorePreferencesController method initDefCRTValidityPeriods.

private void initDefCRTValidityPeriods() {
    Days defaultHint = null;
    if (this.storePreferencesParam.toOptional().isPresent()) {
        defaultHint = new Days(this.storePreferencesParam.get().defaultCRTValidityPeriod.getInt(0));
    }
    Controls.resetComboBoxOptions(this.ctlDefCRTValidityInput, CRTValidityPeriod.getDefaultSet(defaultHint), (o1, o2) -> o1.days().compareTo(o2.days()));
}
Also used : Days(de.carne.certmgr.util.Days)

Example 5 with Days

use of de.carne.certmgr.util.Days in project certmgr by hdecarne.

the class StorePreferencesController method initDefCRLUpdatePeriods.

private void initDefCRLUpdatePeriods() {
    Days defaultHint = null;
    if (this.storePreferencesParam.toOptional().isPresent()) {
        defaultHint = new Days(this.storePreferencesParam.get().defaultCRLUpdatePeriod.getInt(0));
    }
    Controls.resetComboBoxOptions(this.ctlDefCRLUpdateInput, CRLUpdatePeriod.getDefaultSet(defaultHint), (o1, o2) -> o1.days().compareTo(o2.days()));
}
Also used : Days(de.carne.certmgr.util.Days)

Aggregations

Days (de.carne.certmgr.util.Days)8 Test (org.junit.Test)3 DefaultSet (de.carne.jfx.util.DefaultSet)2 CRLUpdatePeriod (de.carne.certmgr.certs.security.CRLUpdatePeriod)1 CRTValidityPeriod (de.carne.certmgr.certs.security.CRTValidityPeriod)1 Matcher (java.util.regex.Matcher)1