private AccountsSettings getSettings() { return configurationService.getSettings(AccountsSettings.class); } }
private String getActiveThemeId(Tenant tenant) { ThemeSettings settings = configurationService.getSettings(ThemeSettings.class, tenant); logger.debug("Get active theme id, {}, {}", tenant, settings.getActive().getValue()); return settings.getActive().getValue(); } }
@Override public boolean isEnabledInContext() { InvoicingSettings settings = configurationService.getSettings(InvoicingSettings.class); return settings.getEnabled().getValue(); }
@Override public DateTime deserialize(JsonParser parser, DeserializationContext ctxt) throws IOException, JsonProcessingException { String str = parser.getText().trim(); if (Strings.isNullOrEmpty(str)) { return null; } ConfigurationService configurationService = Utils.getComponent(ConfigurationService.class); GeneralSettings settings = configurationService.getSettings(GeneralSettings.class); return new DateTime(str, DateTimeZone.forTimeZone(settings.getTime().getTimeZone().getValue())); } }
private Locale getTenantDefaultLocale() { return context.getSettings(GeneralSettings.class).getLocales().getMainLocale().getValue(); } }
@Override public void serialize(Configurable value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { provider.defaultSerializeValue(value.getValue(), jgen); } }
public Theme getDefaultTheme() { return getTheme(themeSettings.getActive().getDefaultValue(), Optional.<Tenant>absent(), Collections.<Level>emptyList()); }
@JsonIgnore public T getValue() { if (value == null) { return this.getDefaultValue(); } return value; } }
private String getTenantDomainName(String domainName, Tenant tenant) { if (!multitenancySettings.isActivated() || tenant == null) { return domainName; } else { } return Strings.isNullOrEmpty(tenant.getDefaultHost()) ? tenant.getSlug() + "." + domainName : tenant.getDefaultHost(); }
public String getTenantPlatformDomain(Tenant tenant) { return getTenantDomainName(siteSettings.getDomainName(), tenant); }
@JsonIgnore @ValidationMethod(message = "Configurable values cannot be invisible") public boolean isNotConfigurableAndInvisible() { return !(this.isConfigurable() && !this.isVisible()); }
public String getTenantWebDomain(Tenant tenant) { if (siteSettings.getWebDomainName().isPresent()) { return getTenantDomainName(siteSettings.getWebDomainName().get(), tenant); } return getTenantPlatformDomain(tenant); }
public URL getTenantBackOfficeURL(Tenant tenant, String path) { String backOfficeDomain; String realPath; if (siteSettings.getBackOfficeDomainName().isPresent()) { backOfficeDomain = siteSettings.getBackOfficeDomainName().get(); realPath = path; } else { backOfficeDomain = getTenantPlatformDomain(tenant); realPath = "/admin" + (path.startsWith("/") ? "" : "/") + path; } return getURL(backOfficeDomain, realPath); }
public String hashPassword(String password) { return BCrypt.hashpw(password, BCrypt.gensalt(configuration.getPasswordSaltLogRounds())); }
private void registerJerseyClient(AbstractSettings settings, Environment environment) { final Client client = new JerseyClientBuilder(environment).using(settings.getJerseyClientConfiguration()) .build(getName()); DefaultComponentDescriptor<Client> cd = new DefaultComponentDescriptor<Client>(); cd.setRoleType(Client.class); componentManager.registerComponent(cd, client); }
private Strategy getActiveStrategy() { ShippingSettings settings = configurationService.getSettings(ShippingSettings.class); return settings.getStrategy().getValue(); }
private Optional<Rate> getRateDefinition(final String rate) { return FluentIterable.from(taxesSettings.getVat().getValue().getOtherRates()).filter(new Predicate<Rate>() { public boolean apply(Rate input) { return input.getId().equals(rate); } }).first(); }
private TaxesSettings getTaxesSettings() { return configurationService.getSettings(TaxesSettings.class); } }
public void notifyHook(final Webhook event, final Object payload) { WebhooksSettings hooksSettings = configurationService.getSettings(WebhooksSettings.class); List<Hook> hooks = FluentIterable.from(hooksSettings.getHooks().getValue()).filter(hookMatchesEvent(event)).toList(); for (final Hook hook : hooks) { Executors.newSingleThreadExecutor().submit(new Callable<Void>() { @Override public Void call() throws Exception { doNotifyHook(event, hook, payload); return null; } }); } }
@Override public NewCookie[] getCookies(String username, String password, boolean remember) throws EncryptionException { AccountsSettings accountsSettings = configurationService.getSettings(AccountsSettings.class); int ageWhenRemember = 60 * (context.getRequest().isApiRequest() ? accountsSettings.getApiSessionDuration().getValue() : accountsSettings.getWebSessionDuration().getValue()); NewCookie newUserCookie = new NewCookie("username", crypter.encrypt(username), "/", null, null, remember ? ageWhenRemember : -1, false); NewCookie newPassCookie = new NewCookie("password", crypter.encrypt(password), "/", null, null, remember ? ageWhenRemember : -1, false); return new NewCookie[]{ newUserCookie, newPassCookie }; } }