@Override public String getDefaultGroup() { return key.value() + "-group"; }
public MockApplicationRole key(String id) { this.key = ApplicationKey.valueOf(id); return this; }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final MockPluginApplicationMetaData that = (MockPluginApplicationMetaData) o; return key.equals(that.key); }
@Override public int hashCode() { return key.hashCode(); } }
public MockApplicationRole(ApplicationKey key) { this(); this.key = key; this.name = key.toString(); }
public boolean isApplicationKeyCorrupted(String key) { return !ApplicationKey.isValid(key); } }
/** * Gets an ApplicationRole from the provided key * * @param key the key of the ApplicationRole to retrieve * @return an ApplicationRole or a ResponseBuilder containing an error response */ private Either<Response.ResponseBuilder, ApplicationRole> getApplicationRole(String key) { if (!ApplicationKey.isValid(key)) { return Either.left(forError(helper.getText("application.role.rest.bad.key", key))); } final ServiceOutcome<ApplicationRole> outcome = service.getRole(ApplicationKey.valueOf(key)); if (!outcome.isValid()) { return Either.left(forCollection(outcome.getErrorCollection())); } return Either.right(outcome.get()); }
@Override public int hashCode() { return key.hashCode(); } }
private void createAuditingRecord(ApplicationKey applicationKey) { log.debug("Creating audit entry for {}. The application will be marked as a default.", applicationKey); final List<ChangedValue> changedValues = ImmutableList.of(new ChangedValueImpl( applicationKey.toString(), "", applicationKey + " (default)") ); migrationLogDao.store(new AuditEntry(this.getClass(), "Setting the application defaults", "Applications were marked as default, based on the product license." + " New users will be created with respect to the default applications selection.", AssociatedItem.Type.APPLICATION_ROLE, applicationKey.toString(), EVENT_SHOWS_IN_CLOUD_LOG, changedValues, AuditEntrySeverity.INFO)); }
private ApplicationKey(final String key) { if (!isValid(key)) { throw new IllegalArgumentException("'key' must match the regular expression '" + ALLOWED_KEYS + "'."); } this.key = key; }
@Override public String toString() { return value(); }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final LoaderKey loaderKey = (LoaderKey) o; if (locale != null ? !locale.equals(loaderKey.locale) : loaderKey.locale != null) { return false; } return !(applicationKey != null ? !applicationKey.equals(loaderKey.applicationKey) : loaderKey.applicationKey != null); }
public ApplicationRoleDataMatcher key(String key) { this.key = ApplicationKey.valueOf(key); return this; }
@Override public final int hashCode() { return key.hashCode(); } }
private Set<ApplicationKey> configureApplicationForLicense(final LicenseDetails licenseDetails, Optional<ApplicationUser> optionalUser) { notNull("licenseDetails", licenseDetails); if (!userManager.hasGroupWritableDirectory()) { log.warn("There are no writable directories to create the default group for the new license."); return Collections.emptySet(); } final Set<ApplicationKey> configuredApps = Sets.newHashSet(); for (final ApplicationKey key : licenseDetails.getLicensedApplications().getKeys()) { if (!doesApplicationHaveActiveDefaultGroupConfigured(key)) { if (configureApplicationWithDefaultGroup(key, optionalUser)) { configuredApps.add(key); } else { log.info("Unable to perform application configuration for {}.", key.toString()); } } else { log.info("Application already configured for {}.", key.toString()); } } return configuredApps; }
public String getKey() { return key.value(); }
@Override public boolean equals(@Nullable final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final MockApplicationRole that = (MockApplicationRole) o; //It is intentional that we only look at id. return key != null ? key.equals(that.key) : that.key == null; }
public MockApplicationRoleDefinition(String key, String name) { this.key = ApplicationKey.valueOf(key); this.name = name; }
@Override public int hashCode() { //It is intentional that we only look at id. return key != null ? key.hashCode() : 0; }