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

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

There is a newer version: 3.12.0+api3
Show newest version
/*
 * Copyright (C) 2007-2016, GoodData(R) Corporation. All rights reserved.
 */

package com.gooddata.md;

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

import java.util.Collection;

/**
 * Represents physical data model table.
 * Deserialization only.
 */
@JsonTypeName("table")
@JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME)
public class Table extends AbstractObj implements Queryable {

    private final Content content;

    @JsonCreator
    private Table(@JsonProperty("meta") Meta meta, @JsonProperty("content") Content content) {
        super(meta);
        this.content = content;
    }

    /**
     * @return name of the table in DB
     */
    public String getDBName() {
        return content.getTableDBName();
    }

    /**
     * @return collection of {@link TableDataLoad}'s uris, can return null
     */
    public Collection getDataLoads() {
        return content.getTableDataLoads();
    }

    /**
     * @return table weight, can return null
     */
    public Integer getWeight() {
        return content.getWeight();
    }

    /**
     * @return uri of active {@link TableDataLoad}, can return null
     */
    public String getActiveDataLoad() {
        return content.getActiveDataLoad();
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    private static class Content {

        private final String tableDBName;
        private final String activeDataLoad;
        private final Collection tableDataLoads;
        private final Integer weight;

        @JsonCreator
        private Content(@JsonProperty("tableDBName") String tableDBName, @JsonProperty("activeDataLoad") String activeDataLoad,
                @JsonProperty("tableDataLoad") Collection tableDataLoads, @JsonProperty("weight") Integer weight) {
            this.tableDBName = tableDBName;
            this.activeDataLoad = activeDataLoad;
            this.tableDataLoads = tableDataLoads;
            this.weight = weight;
        }

        public String getTableDBName() {
            return tableDBName;
        }

        public String getActiveDataLoad() {
            return activeDataLoad;
        }

        public Collection getTableDataLoads() {
            return tableDataLoads;
        }

        public Integer getWeight() {
            return weight;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy