Skip to content
This repository was archived by the owner on Dec 12, 2018. It is now read-only.

Commit 28a770a

Browse files
committed
1309: checkpoint
1 parent 4a8285c commit 28a770a

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
package com.stormpath.sdk.client;
2+
3+
import com.stormpath.sdk.account.Account;
4+
import com.stormpath.sdk.api.ApiKey;
5+
import com.stormpath.sdk.api.ApiKeyOptions;
6+
import com.stormpath.sdk.api.ApiKeyStatus;
7+
import com.stormpath.sdk.lang.Assert;
8+
import com.stormpath.sdk.tenant.Tenant;
9+
10+
/**
11+
* Created by lhazlewood on 3/9/17.
12+
*/
13+
public class DefaultPairedApiKey implements PairedApiKey {
14+
15+
private final ApiKey primary;
16+
private ApiKey secondary;
17+
18+
public DefaultPairedApiKey(ApiKey primary, ApiKey secondary) {
19+
Assert.notNull(primary, "primary ApiKey cannot be null.");
20+
Assert.notNull(secondary, "secondary ApiKey cannot be null.");
21+
this.primary = primary;
22+
this.secondary = secondary;
23+
}
24+
25+
@Override
26+
public ApiKey getSecondaryApiKey() {
27+
return secondary;
28+
}
29+
30+
@Override
31+
public void setSecondaryApiKey(ApiKey secondary) {
32+
this.secondary = secondary;
33+
}
34+
35+
@Override
36+
public void save() {
37+
this.primary.save();
38+
}
39+
40+
@Override
41+
public void delete() {
42+
this.primary.delete();
43+
}
44+
45+
@Override
46+
public String getHref() {
47+
return this.primary.getHref();
48+
}
49+
50+
@Override
51+
public String getId() {
52+
return this.primary.getId();
53+
}
54+
55+
@Override
56+
public String getSecret() {
57+
return this.primary.getSecret();
58+
}
59+
60+
@Override
61+
public ApiKeyStatus getStatus() {
62+
return this.primary.getStatus();
63+
}
64+
65+
@Override
66+
public void setStatus(ApiKeyStatus status) {
67+
this.primary.setStatus(status);
68+
}
69+
70+
@Override
71+
public Account getAccount() {
72+
return this.primary.getAccount();
73+
}
74+
75+
@Override
76+
public Tenant getTenant() {
77+
return this.primary.getTenant();
78+
}
79+
80+
@Override
81+
public void save(ApiKeyOptions options) {
82+
this.primary.save(options);
83+
}
84+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.stormpath.sdk.client;
2+
3+
import com.stormpath.sdk.api.ApiKey;
4+
5+
/**
6+
* Created for internal implementation purposes only. Please do not use.
7+
*/
8+
public interface PairedApiKey extends ApiKey {
9+
10+
ApiKey getSecondaryApiKey();
11+
12+
void setSecondaryApiKey(ApiKey secondary);
13+
}

0 commit comments

Comments
 (0)