Settings.java

  1. package no.nav.data.team.settings.dto;

  2. import com.fasterxml.jackson.annotation.JsonIgnore;
  3. import lombok.AllArgsConstructor;
  4. import lombok.Builder;
  5. import lombok.Builder.Default;
  6. import lombok.Data;
  7. import lombok.NoArgsConstructor;
  8. import lombok.experimental.FieldNameConstants;
  9. import no.nav.data.common.storage.domain.ChangeStamp;
  10. import no.nav.data.common.storage.domain.DomainObject;
  11. import no.nav.data.common.utils.StringUtils;
  12. import no.nav.data.common.validator.Validated;
  13. import no.nav.data.common.validator.Validator;

  14. import java.util.ArrayList;
  15. import java.util.List;
  16. import java.util.UUID;

  17. @FieldNameConstants
  18. @Data
  19. @Builder
  20. @AllArgsConstructor
  21. @NoArgsConstructor
  22. public class Settings implements Validated, DomainObject {

  23.     @JsonIgnore
  24.     private UUID id;
  25.     private String frontpageMessage;
  26.     @Default
  27.     private List<String> identFilter = new ArrayList<>();
  28.     private ChangeStamp changeStamp;

  29.     @Override
  30.     public void format() {
  31.         setIdentFilter(StringUtils.formatListToUppercase(identFilter, true));
  32.     }

  33.     @Override
  34.     public void validateFieldValues(Validator<?> validator) {

  35.     }

  36.     public boolean isFilteredIdent(String ident) {
  37.         return identFilter.contains(ident.toUpperCase());
  38.     }

  39. }