Skip to content

Instantly share code, notes, and snippets.

@mudgen
Created November 19, 2012 20:21
Show Gist options
  • Save mudgen/4113633 to your computer and use it in GitHub Desktop.
Save mudgen/4113633 to your computer and use it in GitHub Desktop.
package com.inductiveautomation.gemsecs;
import simpleorm.dataset.SFieldFlags;
import com.inductiveautomation.ignition.gateway.localdb.persistence.BooleanField;
import com.inductiveautomation.ignition.gateway.localdb.persistence.Category;
import com.inductiveautomation.ignition.gateway.localdb.persistence.EnumField;
import com.inductiveautomation.ignition.gateway.localdb.persistence.FormMeta;
import com.inductiveautomation.ignition.gateway.localdb.persistence.IdentityField;
import com.inductiveautomation.ignition.gateway.localdb.persistence.IntField;
import com.inductiveautomation.ignition.gateway.localdb.persistence.PersistentRecord;
import com.inductiveautomation.ignition.gateway.localdb.persistence.RecordMeta;
import com.inductiveautomation.ignition.gateway.localdb.persistence.StringField;
import com.inductiveautomation.ignition.gateway.web.components.editors.FileUploadEditorSource;
public class EquipmentRecord extends PersistentRecord {
public static final RecordMeta<EquipmentRecord> META =
new RecordMeta<EquipmentRecord>(EquipmentRecord.class, "EquipmentRecord");
public static final IdentityField Id = new IdentityField(META);
public static final StringField Name =
new StringField(META, "Name", SFieldFlags.SMANDATORY,
SFieldFlags.SDESCRIPTIVE);
public static final StringField Description =
new StringField(META, "Description",SFieldFlags.SDESCRIPTIVE);
public static final StringField ActiveIpAddress =
new StringField(META, "ActiveIpAddress");
public static final IntField ActivePort =
new IntField(META, "ActivePort");
public static final StringField PassiveIpAddress =
new StringField(META, "PassiveIpAddress");
public static final IntField PassivePort =
new IntField(META, "PassivePort");
public static final IntField DeviceId =
new IntField(META, "DeviceId");
enum ConnectionMode {
ACTIVE,PASSIVE,ALTERNATING
}
public static final EnumField<ConnectionMode> Mode =
new EnumField<ConnectionMode>(META, "ConnectionMode", ConnectionMode.class, SFieldFlags.SMANDATORY).setDefault(ConnectionMode.ACTIVE);
public static final IntField T3Timeout =
new IntField(META, "T3Timeout").setDefault(45);
public static final IntField T5Timeout =
new IntField(META, "T5Timeout").setDefault(10);
public static final IntField T6Timeout =
new IntField(META, "T6Timeout").setDefault(5);
public static final IntField T7Timeout =
new IntField(META, "T7Timeout").setDefault(10);
public static final IntField T8Timeout =
new IntField(META, "T8Timeout").setDefault(5);
public static final IntField KeepAliveTimeout =
new IntField(META, "KeepAliveTimeout").setDefault(0);
static final Category Main = new Category("EquipmentRecord.Category.Main", 0).include(Name, Description, ActiveIpAddress, ActivePort,
PassiveIpAddress, PassivePort, DeviceId, Mode);
static final Category Timeouts = new Category("EquipmentRecord.Category.Timeouts", 1, true).include(T3Timeout,T5Timeout,T6Timeout,T7Timeout,
T8Timeout,KeepAliveTimeout);
public static final FormMeta SecsDefinitionFile =
new StringField(META, "SecsDefinitionFile",SFieldFlags.SMANDATORY).setDefault("").getFormMeta().
setCategory(Main).setEditorSource(FileUploadEditorSource.getSharedInstance().newEditorComponent(id, editMode, record, formMeta));
@Override
public RecordMeta<?> getMeta() {
return META;
}
public Long getId(){
return getLong(Id);
}
public String getName(){
return getString(Name);
}
public void setName(String name){
setString(Name,name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment