forked from gooddata/gooddata-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccount.java
More file actions
56 lines (44 loc) · 1.53 KB
/
Copy pathAccount.java
File metadata and controls
56 lines (44 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* Copyright (C) 2007-2014, GoodData(R) Corporation. All rights reserved.
*/
package com.gooddata.account;
import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonTypeInfo;
import org.codehaus.jackson.annotate.JsonTypeName;
import org.springframework.web.util.UriTemplate;
/**
*/
@JsonTypeName("accountSetting")
@JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Account {
public static final String URI = "/gdc/account/profile/{id}";
public static final UriTemplate TEMPLATE = new UriTemplate(URI);
public static final String LOGIN_URI = "/gdc/account/login/{id}";
public static final UriTemplate LOGIN_TEMPLATE = new UriTemplate(LOGIN_URI);
public static final String CURRENT_ID = "current";
private final Links links;
@JsonCreator
public Account(@JsonProperty("links") Links links) {
this.links = links;
}
public Links getLinks() {
return links;
}
public String getId() {
return TEMPLATE.match(getLinks().getSelf()).get("id");
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static class Links {
private final String self;
@JsonCreator
public Links(@JsonProperty("self") String self) {
this.self = self;
}
public String getSelf() {
return self;
}
}
}