Field in SettingsRecord that isn't viewable/settable from Gateway Configuration interface

Hello, I’m trying to figure out how to add a field to my Gateway module’s SettingsRecord without it appearing in my module’s configuration page in the Gateway Configuration interface.

Is there a way to mark a field as “hidden”?

Here’s what my SettingsRecord class currently looks like. I’m trying to “hide” the SettingsVersion field.

/**
 * Houses all configuration information for the Seeq module.
 */
public class SeeqSettingsRecord extends PersistentRecord {

    public static final RecordMeta<SeeqSettingsRecord> META = new RecordMeta<>(
            SeeqSettingsRecord.class, "SeeqSettingsRecord").setNounKey("SeeqSettingsRecord.Noun")
            .setNounPluralKey("SeeqSettingsRecord.Noun.Plural");

    public static final IdentityField Id = new IdentityField(META);

    public static final BooleanField Enabled = new BooleanField(META, "Enabled")
            .setDefault(true);
    public static final StringField SeeqServerHostname = new StringField(META, "SeeqServerHostname",
            SFieldFlags.SMANDATORY).setDefault(URLComponents.getHostname());
    public static final StringField SeeqServerPort = new StringField(META, "SeeqServerPort",
            SFieldFlags.SMANDATORY).setDefault("34216");
    public static final StringField SeeqServerSecurePort = new StringField(META, "SeeqServerSecurePort")
            .setDefault("");
    public static final StringField AgentKey = new StringField(META, "AgentKey")
            .setDefault("");
    public static final StringField DatasourceName = new StringField(META, "DatasourceName")
            .setDefault("Ignition");
    public static final StringField DatasourceID = new StringField(META, "DatasourceID")
            .setDefault("");
    public static final StringField TagProviders = new StringField(META, "TagProviders")
            .setDefault("*");
    public static final StringField AssetPaths = new StringField(META, "AssetPaths")
            .setDefault("").setMultiLine();
    public static final StringField IndexingNext = new StringField(META, "IndexingNext")
            .setDefault(ZonedDateTime.now().toString());
    public static final StringField IndexingFrequency = new StringField(META, "IndexingFrequency")
            .setDefault("1w");
    public static final BooleanField IndexOnStartupAndConfigChange =
            new BooleanField(META, "IndexOnStartupAndConfigChange")
                    .setDefault(true);
    public static final LongField IndexThrottle = new LongField(META, "IndexThrottle")
            .setDefault(10000L);
    public static final IntField MaxConcurrentRequests = new IntField(META, "MaxConcurrentRequests")
            .setDefault(2);
    public static final IntField MaxResultsPerRequest = new IntField(META, "MaxResultsPerRequest")
            .setDefault(1000000);
    public static final StringField DatabaseMapping = new StringField(META, "DatabaseMapping")
            .setDefault("").setMultiLine();
    public static final StringField Transforms = new StringField(META, "Transforms")
            .setDefault("").setMultiLine();
    public static final IntField SettingsVersion = new IntField(META, "SettingsVersion")
            .setDefault(1);


    // create categories for our record entries, getting titles from the SeeqSettingsRecord.properties, and
    // ordering through integer ranking
    static final Category SeeqServerConfiguration =
            new Category("SeeqSettingsRecord.Category.Configuration", 1000)
                    .include(Enabled, SeeqServerHostname, SeeqServerPort, SeeqServerSecurePort,
                            DatasourceName, DatasourceID, TagProviders, AgentKey, AssetPaths,
                            IndexingNext, IndexingFrequency, IndexOnStartupAndConfigChange, IndexThrottle,
                            MaxConcurrentRequests, MaxResultsPerRequest, DatabaseMapping, Transforms);

    // accessors for our record entries
    public void setEnabled(Boolean enabled) {
        this.setBoolean(Enabled, enabled);
    }

    public boolean getEnabled() {
        return this.getBoolean(Enabled);
    }

    public void setSeeqServerHostname(String hostname) {
        this.setString(SeeqServerHostname, hostname);
    }

    public String getSeeqServerHostname() {
        return this.getString(SeeqServerHostname);
    }

    public void setSeeqServerPort(String port) {
        this.setString(SeeqServerPort, port);
    }

    public String getSeeqServerPort() {
        return this.getString(SeeqServerPort);
    }

    public void setSeeqServerSecurePort(String securePort) {
        this.setString(SeeqServerSecurePort, securePort);
    }

    public String getSeeqServerSecurePort() {
        return this.getString(SeeqServerSecurePort);
    }

    public void setAgentKey(String agentKey) { this.setString(AgentKey, agentKey); }

    public String getAgentKey() { return this.getString(AgentKey); }

    public String getDatasourceName() {
        return this.getString(DatasourceName);
    }

    public void setDatasourceName(String datasourceName) {
        this.setString(DatasourceName, datasourceName);
    }

    public String getDatasourceID() {
        return this.getString(DatasourceID);
    }

    public void setDatasourceID(String datasourceID) {
        this.setString(DatasourceID, datasourceID);
    }

    public String getTagProviders() {
        return this.getString(TagProviders);
    }

    public void setTagProviders(String tagProviders) {
        this.setString(TagProviders, tagProviders);
    }

    public String getAssetPaths() {
        return this.getString(AssetPaths);
    }

    public void setAssetPaths(String assetPaths) {
        this.setString(AssetPaths, assetPaths);
    }

    public String getIndexingNext() {
        return this.getString(IndexingNext);
    }

    public void setIndexingNext(String indexingNext) {
        this.setString(IndexingNext, indexingNext);
    }

    public String getIndexingFrequency() {
        return this.getString(IndexingFrequency);
    }

    public void setIndexingFrequency(String indexingFrequency) {
        this.setString(IndexingFrequency, indexingFrequency);
    }

    public boolean getIndexOnStartupAndConfigChange() {
        return this.getBoolean(IndexOnStartupAndConfigChange);
    }

    public void setIndexOnStartupAndConfigChange(boolean indexOnStartupAndConfigChange) {
        this.setBoolean(IndexOnStartupAndConfigChange, indexOnStartupAndConfigChange);
    }

    public long getIndexThrottle() {
        return this.getLong(IndexThrottle);
    }

    public void setIndexThrottle(long indexThrottle) {
        this.setLong(IndexThrottle, indexThrottle);
    }

    public int getMaxConcurrentRequests() {
        return this.getInt(MaxConcurrentRequests);
    }

    public void setMaxConcurrentRequests(int maxConcurrentRequests) {
        this.setInt(MaxConcurrentRequests, maxConcurrentRequests);
    }

    public int getMaxResultsPerRequest() {
        return this.getInt(MaxResultsPerRequest);
    }

    public void setMaxResultsPerRequest(int maxResultsPerRequest) {
        this.setInt(MaxResultsPerRequest, maxResultsPerRequest);
    }

    public String getDatabaseMapping() {
        return this.getString(DatabaseMapping);
    }

    public void setDatabaseMapping(String databaseMapping) {
        this.setString(DatabaseMapping, databaseMapping);
    }

    public String getTransforms() { return this.getString(Transforms); }

    public void setTransforms(String transforms) { this.setString(Transforms, transforms); }

    public int getSettingsVersion() {
        return this.getInt(SettingsVersion);
    }

    public void setSettingsVersion(int settingsVersion) {
        this.setInt(SettingsVersion, settingsVersion);
    }

    public void setId(Long id) {
        this.setLong(Id, id);
    }

    public Long getId() {
        return this.getLong(Id);
    }

    @Override
    public RecordMeta<?> getMeta() {
        return META;
    }
}

Add something like this:

    static {
        SettingsVersion.getFormMeta().setVisible(false);
    }
1 Like

Works great. Thanks Kevin!