Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default account configuration and account status support #959

Merged
merged 6 commits into from
Jan 15, 2021

Conversation

schernysh
Copy link
Contributor

No description provided.

@schernysh schernysh requested a review from rpanchyk October 16, 2020 08:54
Copy link
Contributor

@DGarbar DGarbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, probably we can add in documentation that we don't merge inner object (gdpr and analytics-config) we use default OR received.

import org.prebid.server.settings.model.AccountStatus;
import org.springframework.validation.annotation.Validated;

@Validated
Copy link
Contributor

@DGarbar DGarbar Jan 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this annotation required ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. It's been copied along with other annotations that we put on Spring configuration properties POJOs but apparently there are no constraints imposed on any fields in this class so it's redundant. We may put sensible constraints in future and easily overlook adding @Validated annotation though so I'm hesitant about this one.


private Boolean enforceCcpa;

private String gdpr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why cant we use AccountGdprConfig class

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we don't want to add @Data @NoArgsConstructor annotations to AccountGdprConfig, i.e. make it a Spring configuration properties POJO.

Copy link
Contributor

@DGarbar DGarbar Jan 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably you mean AccountAnalyticsConfig because AccountGdprConfig is already have this annotation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. AccountGdprConfig shouldn't have had these annotations in the first place.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably my mistake. I copy from GdprConfig which we get from yaml.
But why we don't want to make this @DaTa ? Because of mutability ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's a convention for value objects throughout PBS codebase to aspire for immutability unless it is impractical.

Another reason to take into consideration - using AccountGdprConfig to represent data in two different places (PBS configuration and account configuration in DB/file/etc) strongly couples these sources and forces changes in one place (account config for example) to affect another place (PBS config) and vice versa. Actually This is what Single Responsibility Principle is called to protect from.


public Account merge(Account another) {
return Account.builder()
.id(ObjectUtils.firstNonNull(id, another.id))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor. i'd rather suggest to use ObjectUtils.defaultIfNull(..) instead since we have only 2 possible values.

@rpanchyk rpanchyk merged commit 220481c into master Jan 15, 2021
@rpanchyk rpanchyk deleted the account-config-retrofit branch January 15, 2021 13:43
nickluck9 pushed a commit that referenced this pull request Aug 9, 2021
* Add support for default account configuration values in application config

* Take into consideration account status

* Update documentation

* Address review comments
nickluck9 pushed a commit that referenced this pull request Aug 10, 2021
* Add support for default account configuration values in application config

* Take into consideration account status

* Update documentation

* Address review comments
nickluck9 pushed a commit that referenced this pull request Aug 10, 2021
* Add support for default account configuration values in application config

* Take into consideration account status

* Update documentation

* Address review comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants