|
| 1 | +/* |
| 2 | + * Copyright (C) 2007-2014, GoodData(R) Corporation. All rights reserved. |
| 3 | + */ |
| 4 | +package com.gooddata.md; |
| 5 | + |
| 6 | +import org.codehaus.jackson.annotate.JsonIgnore; |
| 7 | +import org.codehaus.jackson.annotate.JsonProperty; |
| 8 | + |
| 9 | +import static com.gooddata.Validate.noNullElements; |
| 10 | + |
| 11 | +/** |
| 12 | + * Metadata object (common part) |
| 13 | + */ |
| 14 | +public abstract class AbstractObj implements Obj { |
| 15 | + |
| 16 | + @JsonProperty("meta") |
| 17 | + protected final Meta meta; |
| 18 | + |
| 19 | + protected AbstractObj(@JsonProperty("meta") Meta meta) { |
| 20 | + this.meta = meta; |
| 21 | + } |
| 22 | + |
| 23 | + @JsonIgnore |
| 24 | + public String getAuthor() { |
| 25 | + return meta.getAuthor(); |
| 26 | + } |
| 27 | + |
| 28 | + @JsonIgnore |
| 29 | + public String getContributor() { |
| 30 | + return meta.getContributor(); |
| 31 | + } |
| 32 | + |
| 33 | + @JsonIgnore |
| 34 | + public String getCreated() { |
| 35 | + return meta.getCreated(); |
| 36 | + } |
| 37 | + |
| 38 | + @JsonIgnore |
| 39 | + public String getSummary() { |
| 40 | + return meta.getSummary(); |
| 41 | + } |
| 42 | + |
| 43 | + @JsonIgnore |
| 44 | + public String getTitle() { |
| 45 | + return meta.getTitle(); |
| 46 | + } |
| 47 | + |
| 48 | + @JsonIgnore |
| 49 | + public String getUpdated() { |
| 50 | + return meta.getUpdated(); |
| 51 | + } |
| 52 | + |
| 53 | + @JsonIgnore |
| 54 | + public String getCategory() { |
| 55 | + return meta.getCategory(); |
| 56 | + } |
| 57 | + |
| 58 | + @JsonIgnore |
| 59 | + public String getTags() { |
| 60 | + return meta.getTags(); |
| 61 | + } |
| 62 | + |
| 63 | + @JsonIgnore |
| 64 | + public String getUri() { |
| 65 | + return meta.getUri(); |
| 66 | + } |
| 67 | + |
| 68 | + @JsonIgnore |
| 69 | + public String getDeprecated() { |
| 70 | + return meta.getDeprecated(); |
| 71 | + } |
| 72 | + |
| 73 | + @JsonIgnore |
| 74 | + public String getIdentifier() { |
| 75 | + return meta.getIdentifier(); |
| 76 | + } |
| 77 | + |
| 78 | + @JsonIgnore |
| 79 | + public Integer getLocked() { |
| 80 | + return meta.getLocked(); |
| 81 | + } |
| 82 | + |
| 83 | + @JsonIgnore |
| 84 | + public Integer getUnlisted() { |
| 85 | + return meta.getUnlisted(); |
| 86 | + } |
| 87 | + |
| 88 | + /** |
| 89 | + * Get list of URIs of the given {@link Obj}s |
| 90 | + * @param objs metadata objects |
| 91 | + * @return list of URIs |
| 92 | + */ |
| 93 | + @SafeVarargs |
| 94 | + protected static <T extends Obj> String[] uris(T... objs) { |
| 95 | + noNullElements(objs, "objs"); |
| 96 | + final String[] uris = new String[objs.length]; |
| 97 | + for (int i=0; i<objs.length; i++) { |
| 98 | + uris[i] = objs[i].getUri(); |
| 99 | + } |
| 100 | + return uris; |
| 101 | + } |
| 102 | + |
| 103 | +} |
0 commit comments