All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ca.gc.aafc.dina.repository.meta.AttributeMetaInfoProvider Maven / Gradle / Ivy

There is a newer version: 0.132
Show newest version
package ca.gc.aafc.dina.repository.meta;

import ca.gc.aafc.dina.mapper.IgnoreDinaMapping;
import io.crnk.core.resource.annotations.JsonApiMetaInformation;
import io.crnk.core.resource.meta.MetaInformation;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

/**
 * Abstract class which can be extended by a resource to add meta information to a resource's JSON
 * response through Crnk.
 */
public abstract class AttributeMetaInfoProvider {

  @JsonApiMetaInformation
  @IgnoreDinaMapping
  @Getter
  @Setter
  private DinaJsonMetaInfo meta;

  @Builder
  public static class DinaJsonMetaInfo implements MetaInformation {
    private Map warnings;

    public void setWarnings(Map warnings) {
      this.warnings = warnings;
    }

    public Map getWarnings() {
      return warnings;
    }

    public void setWarnings(String warningKey, Object warningValue) {
      if (warnings == null) {
        warnings = new HashMap<>();
      }
      this.warnings.put(warningKey, warningValue);
    }
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy