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

com.gooddata.md.ProjectDashboard Maven / Gradle / Ivy

There is a newer version: 3.12.0+api3
Show newest version
package com.gooddata.md;

import static com.gooddata.util.Validate.notNull;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

import java.util.Collection;
import java.util.Objects;

/**
 * Project Dashboard of GoodData project.
* Deserialization only. This object is not complete representation of real 'projectDashboard' object. * It contains only dashboard tabs basic definitions (identifier and name). */ @JsonTypeName("projectDashboard") @JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME) @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) public class ProjectDashboard extends AbstractObj implements Queryable { private final Content content; private ProjectDashboard(@JsonProperty("meta") Meta meta, @JsonProperty("content") Content content) { super(meta); this.content = notNull(content, "content"); } @JsonIgnore public Collection getTabs() { return content.tabs; } /** * Returns dashboard tab with the given tab name. * If tab with such name doesn't exist, returns {@code null}. * * @param name tab name * @return *
    *
  • dashboard tab with the given name
  • *
  • {@code null} if tab doesn't exist
  • *
*/ @JsonIgnore public Tab getTabByName(String name) { for (Tab tab : getTabs()) { if (Objects.equals(tab.title, name)) { return tab; } } return null; } @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) private static class Content { private final Collection tabs; @JsonCreator private Content(@JsonProperty("tabs") Collection tabs) { this.tabs = tabs; } } @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) public static class Tab { private final String identifier; private final String title; @JsonCreator private Tab(@JsonProperty("identifier") String identifier, @JsonProperty("title") String title) { this.identifier = identifier; this.title = title; } public String getIdentifier() { return identifier; } public String getTitle() { return title; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy