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;
}
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;
}
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)));
}
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()));
}
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()));
}
Aggregations