Skip to content

Commit dd9cd71

Browse files
committed
Work on #140 and #152
1 parent 232394f commit dd9cd71

1 file changed

Lines changed: 35 additions & 8 deletions

File tree

core/src/main/java/eu/bittrade/libs/steemj/plugins/witness/model/operations/EnableContentEditingOperation.java

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
package eu.bittrade.libs.steemj.plugins.witness.model.operations;
22

3+
import java.security.InvalidParameterException;
4+
35
import org.apache.commons.lang3.builder.ToStringBuilder;
46

57
import com.fasterxml.jackson.annotation.JsonCreator;
68
import com.fasterxml.jackson.annotation.JsonProperty;
79

810
import eu.bittrade.libs.steemj.base.models.AccountName;
911
import eu.bittrade.libs.steemj.base.models.TimePointSec;
12+
import eu.bittrade.libs.steemj.base.models.operations.CustomJsonOperation;
1013
import eu.bittrade.libs.steemj.base.models.operations.CustomJsonOperationPayload;
1114
import eu.bittrade.libs.steemj.enums.ValidationType;
1215

@@ -21,6 +24,19 @@ public class EnableContentEditingOperation extends CustomJsonOperationPayload {
2124
@JsonProperty("relock_time")
2225
private TimePointSec relockTime;
2326

27+
/**
28+
* Use this operation to enable the editing of posts who are already
29+
* disabled.
30+
*
31+
* The {@link CustomJsonOperation} that will carry this operation needs to
32+
* be signed with the active key of the <code>account</code> to prevent
33+
* stolen posting keys from being used to deface old content.
34+
*
35+
* @param account
36+
* The account to enable the editing for.
37+
* @param relockTime
38+
* The time when editing is locked again.
39+
*/
2440
@JsonCreator
2541
public EnableContentEditingOperation(@JsonProperty("account") AccountName account,
2642
@JsonProperty("relock_time") TimePointSec relockTime) {
@@ -29,33 +45,45 @@ public EnableContentEditingOperation(@JsonProperty("account") AccountName accoun
2945
}
3046

3147
/**
32-
* @return the account
48+
* Get the account whose posts are editable again.
49+
*
50+
* @return The account whose posts are editable again.
3351
*/
3452
public AccountName getAccount() {
3553
return account;
3654
}
3755

3856
/**
57+
* Set the <code>account</code> whose posts should be editable again.
58+
*
3959
* @param account
40-
* the account to set
60+
* The account whose posts should be editable again.
61+
* @throws InvalidParameterException
62+
* If the <code>account</code> is <code>null</code>.
4163
*/
4264
public void setAccount(AccountName account) {
43-
this.account = account;
65+
this.account = setIfNotNull(account, "The account cannot be null");
4466
}
4567

4668
/**
47-
* @return the relockTime
69+
* Get the point in time when posts are locked again.
70+
*
71+
* @return The point in time when posts are locked again.
4872
*/
4973
public TimePointSec getRelockTime() {
5074
return relockTime;
5175
}
5276

5377
/**
78+
* Set the point in time when posts are locked again.
79+
*
5480
* @param relockTime
55-
* the relockTime to set
81+
* The point in time when posts are locked again.
82+
* @throws InvalidParameterException
83+
* If the <code>relockTime</code> is <code>null</code>.
5684
*/
5785
public void setRelockTime(TimePointSec relockTime) {
58-
this.relockTime = relockTime;
86+
this.relockTime = setIfNotNull(relockTime, "The relock time cannot be null");
5987
}
6088

6189
@Override
@@ -65,7 +93,6 @@ public String toString() {
6593

6694
@Override
6795
public void validate(ValidationType validationType) {
68-
// TODO Auto-generated method stub
69-
96+
// No additional validation required.
7097
}
7198
}

0 commit comments

Comments
 (0)