Skip to content

Commit

Permalink
Update Secret.java class to resolve error
Browse files Browse the repository at this point in the history
  • Loading branch information
delinea-rajani authored Aug 30, 2024
1 parent cf48f79 commit bef05a8
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions src/main/java/com/delinea/secrets/server/spring/Secret.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.delinea.secrets.server.spring;

import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;

import com.fasterxml.jackson.annotation.JsonProperty;

Expand All @@ -13,8 +15,14 @@ public class Secret {
* Java representation of an <i>Item</i> of a <i>Secret</i>.
*/
public static class Field {
private int id, fieldId, fileAttachmentId;
private String fieldDescription, fieldName, filename, value, slug;
private int id;
private int fieldId;
private int fileAttachmentId;
private String fieldDescription;
private String fieldName;
private String filename;
private String value;
private String slug;

@JsonProperty("itemId")
public int getId() {
Expand Down Expand Up @@ -55,13 +63,23 @@ void setValue(final String value) {
}
}

private String name, secretTemplateName;
private String name;
private String secretTemplateName;
private String lastHeartBeatStatus;
private Date lastHeartBeatCheck, lastPasswordChangeAttempt;
private int id, folderId, secretTemplateId, siteId;
private boolean active, checkedOut, checkoutEnabled;
private List<Field> fields;

private Date lastHeartBeatCheck;
private Date lastPasswordChangeAttempt;
private int id;
private int folderId;
private int secretTemplateId;
private int siteId;
private boolean active;
private boolean checkedOut;
private boolean checkoutEnabled;

// List of Field objects
private List<Field> fields = new ArrayList<>();

// Getters for the fields
public String getName() {
return name;
}
Expand Down Expand Up @@ -112,12 +130,12 @@ public boolean isCheckoutEnabled() {

@JsonProperty("items")
public List<Field> getFields() {
return fields;
return Collections.unmodifiableList(fields); // Return an unmodifiable view
}

@Override
public String toString() {
return String.format("Secret { id: %d, folderId: %d, name: %s, templateName: %s }", this.id, this.folderId,
this.name, this.secretTemplateName);
return String.format("Secret { id: %d, folderId: %d, name: %s, templateName: %s }",
this.id, this.folderId, this.name, this.secretTemplateName);
}
}

0 comments on commit bef05a8

Please sign in to comment.