Initial commit

This commit is contained in:
Isaac Parenteau committed 2018-07-07 20:43:51 -05:00
commit 880e39de2e
511 files changed
+38363

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.locusworks</groupId>
<artifactId>portal</artifactId>
<version>1.0.0-RELEASE</version>
</parent>
<artifactId>portal_json</artifactId>
<name>NGAS Portal Json Objects</name>
<description>Json Objects to support the api</description>
</project>
@@ -0,0 +1,118 @@
package net.locusworks.portal.json;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import net.locusworks.common.annotations.MapValue;
@JsonIgnoreProperties(ignoreUnknown=true)
@MapValue
public class ApplicationLogRequest {
@MapValue(ignore=true)
private Integer id;
@MapValue(value="Logged By")
private String loggedBy;
@MapValue(value="Event Type")
private String eventName;
@MapValue(value="Event")
private String event;
@MapValue(value="Severity")
private String severity;
@MapValue(value="IP Address")
private String ipAddress;
@MapValue(value="Timestamp")
private Date timestamp;
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the loggedBy
*/
public String getLoggedBy() {
return loggedBy;
}
/**
* @param loggedBy the loggedBy to set
*/
public void setLoggedBy(String loggedBy) {
this.loggedBy = loggedBy;
}
/**
* @return the eventName
*/
public String getEventName() {
return eventName;
}
/**
* @param eventName the eventName to set
*/
public void setEventName(String eventName) {
this.eventName = eventName;
}
/**
* @return the event
*/
public String getEvent() {
return event;
}
/**
* @param event the event to set
*/
public void setEvent(String event) {
this.event = event;
}
/**
* @return the severity
*/
public String getSeverity() {
return severity;
}
/**
* @param severity the severity to set
*/
public void setSeverity(String severity) {
this.severity = severity;
}
/**
* @return the ipAddress
*/
public String getIpAddress() {
return ipAddress;
}
/**
* @param ipAddress the ipAddress to set
*/
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
/**
* @return the timestamp
*/
public Date getTimestamp() {
return timestamp;
}
/**
* @param timestamp the timestamp to set
*/
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
}
@@ -0,0 +1,183 @@
package net.locusworks.portal.json;
import java.util.Date;
import org.apache.commons.lang3.StringUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/***
* Class that represents an application user (that can be jsonified)
* @author Isaac Parenteau
*
*/
@JsonIgnoreProperties(ignoreUnknown=true)
public class ApplicationUserRequest {
private int id;
private int auId;
private String firstName;
private String lastName;
private String role;
private String username;
private String password;
private String email;
private Date expirationDate;
private Date effectiveDate;
private Boolean enabled;
@JsonIgnore
private boolean isNew;
/**
* @return the enabled
*/
public Boolean getEnabled() {
return enabled;
}
/**
* @param enabled the enabled to set
*/
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
/**
* @return the id
*/
public int getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(int id) {
this.id = id;
}
/**
* @return the auId
*/
public int getAuId() {
return auId;
}
/**
* @param auId the auId to set
*/
public void setAuId(int auId) {
this.auId = auId;
}
/**
* @return the firstName
*/
public String getFirstName() {
return firstName;
}
/**
* @param firstName the firstName to set
*/
public void setFirstName(String firstName) {
this.firstName = firstName;
}
/**
* @return the lastName
*/
public String getLastName() {
return lastName;
}
/**
* @param lastName the lastName to set
*/
public void setLastName(String lastName) {
this.lastName = lastName;
}
/**
* @return the role
*/
public String getRole() {
return role;
}
/**
* @param role the role to set
*/
public void setRole(String role) {
this.role = role;
}
/**
* @return the username
*/
public String getUsername() {
return username;
}
/**
* @param username the username to set
*/
public void setUsername(String username) {
this.username = username;
}
/**
* @return the password
*/
public String getPassword() {
return password;
}
/**
* @param password the password to set
*/
public void setPassword(String password) {
this.password = password;
}
/**
* @return the email
*/
public String getEmail() {
return email;
}
/**
* @param email the email to set
*/
public void setEmail(String email) {
this.email = email;
}
/**
* @return the expirationDate
*/
public Date getExpirationDate() {
return expirationDate;
}
/**
* @param expirationDate the expirationDate to set
*/
public void setExpirationDate(Date expirationDate) {
this.expirationDate = expirationDate;
}
/**
* @return the effectiveDate
*/
public Date getEffectiveDate() {
return effectiveDate;
}
/**
* @param effectiveDate the effectiveDate to set
*/
public void setEffectiveDate(Date effectiveDate) {
this.effectiveDate = effectiveDate;
}
@JsonIgnore
public String getFormalName() {
if (StringUtils.isAnyBlank(this.getFirstName(), this.getLastName())){
return this.getEmail();
}
return String.format("%s %s", this.getFirstName(), this.getLastName());
}
@JsonIgnore
public boolean isNew() {
return isNew;
}
@JsonIgnore
public void setNew(boolean isNew) {
this.isNew = isNew;
}
}
@@ -0,0 +1,162 @@
package net.locusworks.portal.json;
public class ConfigurationRequest {
private String filepath;
private String dbUsername;
private String dbPassword;
private String dbRootUser;
private String dbRootPassword;
private String dbHost;
private int dbPort;
private int userExpirationDays;
private String caCertFile;
private String caCertPassword;
private String aesSeedFile;
private String logLevel;
/**
* @return the file path
*/
public String getFilepath() {
return filepath;
}
/**
* @param filepath the filepath to set
*/
public void setFilepath(String filepath) {
this.filepath = filepath;
}
/**
* @return the dbUsername
*/
public String getDbUsername() {
return dbUsername;
}
/**
* @param dbUsername the dbUsername to set
*/
public void setDbUsername(String dbUsername) {
this.dbUsername = dbUsername;
}
/**
* @return the dbPassword
*/
public String getDbPassword() {
return dbPassword;
}
/**
* @param dbPassword the dbPassword to set
*/
public void setDbPassword(String dbPassword) {
this.dbPassword = dbPassword;
}
/**
* @return the dbRootUser
*/
public String getDbRootUser() {
return dbRootUser;
}
/**
* @param dbRootUser the dbRootUser to set
*/
public void setDbRootUser(String dbRootUser) {
this.dbRootUser = dbRootUser;
}
/**
* @return the dbRootPassword
*/
public String getDbRootPassword() {
return dbRootPassword;
}
/**
* @param dbRootPassword the dbRootPassword to set
*/
public void setDbRootPassword(String dbRootPassword) {
this.dbRootPassword = dbRootPassword;
}
/**
* @return the dbHost
*/
public String getDbHost() {
return dbHost;
}
/**
* @param dbHost the dbHost to set
*/
public void setDbHost(String dbHost) {
this.dbHost = dbHost;
}
/**
* @return the dbPort
*/
public int getDbPort() {
return dbPort;
}
/**
* @param dbPort the dbPort to set
*/
public void setDbPort(int dbPort) {
this.dbPort = dbPort;
}
/**
* @return the userExpirationDays
*/
public int getUserExpirationDays() {
return userExpirationDays;
}
/**
* @param userExpirationDays the userExpirationDays to set
*/
public void setUserExpirationDays(int userExpirationDays) {
this.userExpirationDays = userExpirationDays;
}
/**
* @return the caCertFile
*/
public String getCaCertFile() {
return caCertFile;
}
/**
* @param caCertFile the caCertFile to set
*/
public void setCaCertFile(String caCertFile) {
this.caCertFile = caCertFile;
}
/**
* @return the caCertPassword
*/
public String getCaCertPassword() {
return caCertPassword;
}
/**
* @param caCertPassword the caCertPassword to set
*/
public void setCaCertPassword(String caCertPassword) {
this.caCertPassword = caCertPassword;
}
/**
* @return the aesSeedFile
*/
public String getAesSeedFile() {
return aesSeedFile;
}
/**
* @param aesSeedFile the aesSeedFile to set
*/
public void setAesSeedFile(String aesSeedFile) {
this.aesSeedFile = aesSeedFile;
}
/**
* @return the logLevel
*/
public String getLogLevel() {
return logLevel;
}
/**
* @param logLevel the logLevel to set
*/
public void setLogLevel(String logLevel) {
this.logLevel = logLevel;
}
}
@@ -0,0 +1,93 @@
package net.locusworks.portal.json;
public class CredentialRequest {
private Integer id;
private String uid;
private String name;
private String key;
private String passphrase;
private String username;
private String password;
private String credentialType;
public CredentialRequest() {}
public CredentialRequest(String uuid) {
this(uuid, null, null);
}
public CredentialRequest(String uuid, String userName, String credentialType) {
this.uid = uuid;
this.username = userName;
this.credentialType = credentialType;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getKey() {
return key;
}
public void setKey(String sshKey) {
this.key = sshKey;
}
public String getPassphrase() {
return passphrase;
}
public void setPassphrase(String sshPassphrase) {
this.passphrase = sshPassphrase;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
/**
* @return the credentialType
*/
public String getCredentialType() {
return credentialType;
}
/**
* @param credentialType the credentialType to set
*/
public void setCredentialType(String credentialType) {
this.credentialType = credentialType;
}
}
@@ -0,0 +1,104 @@
package net.locusworks.portal.json;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import static net.locusworks.common.Charsets.UTF_8;
@JsonIgnoreProperties(ignoreUnknown=true)
public class EmailTemplateRequest {
private Integer id;
private String emailName;
private String emailSubject;
private String emailMessage;
private Integer createdBy;
private Date dateCreated;
public EmailTemplateRequest() { }
public EmailTemplateRequest(Integer id, String emailName, String emailSubject, String emailMessage) {
this.id = id;
this.emailMessage = emailMessage;
this.emailName = emailName;
this.emailSubject = emailSubject;
}
public EmailTemplateRequest(Integer id, String emailName, String emailSubject, byte[] emailMessage) {
this(id, emailName, emailSubject, new String(emailMessage, UTF_8));
}
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the emailName
*/
public String getEmailName() {
return emailName;
}
/**
* @param emailName the emailName to set
*/
public void setEmailName(String emailName) {
this.emailName = emailName;
}
/**
* @return the emailSubject
*/
public String getEmailSubject() {
return emailSubject;
}
/**
* @param emailSubject the emailSubject to set
*/
public void setEmailSubject(String emailSubject) {
this.emailSubject = emailSubject;
}
/**
* @return the emailMessage
*/
public String getEmailMessage() {
return emailMessage;
}
/**
* @param emailMessage the emailMessage to set
*/
public void setEmailMessage(String emailMessage) {
this.emailMessage = emailMessage;
}
/**
* @return the createdBy
*/
public Integer getCreatedBy() {
return createdBy;
}
/**
* @param createdBy the createdBy to set
*/
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
/**
* @return the dateCreated
*/
public Date getDateCreated() {
return dateCreated;
}
/**
* @param dateCreated the dateCreated to set
*/
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
}
@@ -0,0 +1,61 @@
package net.locusworks.portal.json;
import java.util.Date;
public class EnvironmentVariableRequest extends ValueRequest {
private Integer createdBy;
private Date lastUpdated;
private Date dateCreated;
private Boolean isNew;
/**
* @return the createdBy
*/
public Integer getCreatedBy() {
return createdBy;
}
/**
* @param createdBy the createdBy to set
*/
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
/**
* @return the lastUpdated
*/
public Date getLastUpdated() {
return lastUpdated;
}
/**
* @param lastUpdated the lastUpdated to set
*/
public void setLastUpdated(Date lastUpdated) {
this.lastUpdated = lastUpdated;
}
/**
* @return the dateCreated
*/
public Date getDateCreated() {
return dateCreated;
}
/**
* @param dateCreated the dateCreated to set
*/
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
/**
* @return the isNew
*/
public Boolean getIsNew() {
return isNew;
}
/**
* @param isNew the isNew to set
*/
public void setIsNew(Boolean isNew) {
this.isNew = isNew;
}
}
@@ -0,0 +1,70 @@
package net.locusworks.portal.json;
import java.util.Date;
public class GitRequest {
private Integer id;
private String name;
private String scm;
private String branch;
private String directory;
private CredentialRequest credentials;
private Date lastUpdated;
private Date createDate;
private String createdBy;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getScm() {
return scm;
}
public void setScm(String scm) {
this.scm = scm;
}
public String getBranch() {
return branch;
}
public void setBranch(String branch) {
this.branch = branch;
}
public String getDirectory() {
return directory;
}
public void setDirectory(String directory) {
this.directory = directory;
}
public CredentialRequest getCredentials() {
return credentials;
}
public void setCredentials(CredentialRequest credentials) {
this.credentials = credentials;
}
public Date getLastUpdated() {
return lastUpdated;
}
public void setLastUpdated(Date lastUpdated) {
this.lastUpdated = lastUpdated;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
}
@@ -0,0 +1,58 @@
package net.locusworks.portal.json;
import java.util.List;
public class PermissionCategoryRequest {
private Integer id;
private String name;
private String displayName;
private List<PermissionRequest> permissions;
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the displayName
*/
public String getDisplayName() {
return displayName;
}
/**
* @param displayName the displayName to set
*/
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
/**
* @return the permissions
*/
public List<PermissionRequest> getPermissions() {
return permissions;
}
/**
* @param permissions the permissions to set
*/
public void setPermissions(List<PermissionRequest> permissions) {
this.permissions = permissions;
}
}
@@ -0,0 +1,46 @@
package net.locusworks.portal.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown=true)
public class PermissionGroupPermissionRequest extends PermissionRequest {
private Integer permissionId;
private Integer permissionGroupId;
private boolean allowed;
/**
* @return the permissionGroupId
*/
public Integer getPermissionGroupId() {
return permissionGroupId;
}
/**
* @param permissionGroupId the permissionGroupId to set
*/
public void setPermissionGroupId(Integer permissionGroupId) {
this.permissionGroupId = permissionGroupId;
}
/**
* @return the permissionId
*/
public Integer getPermissionId() {
return permissionId;
}
/**
* @param permissionId the permissionId to set
*/
public void setPermissionId(Integer permissionId) {
this.permissionId = permissionId;
}
/**
* @return the allowed
*/
public boolean getAllowed() {
return allowed;
}
/**
* @param allowed the allowed to set
*/
public void setAllowed(boolean allowed) {
this.allowed = allowed;
}
}
@@ -0,0 +1,86 @@
package net.locusworks.portal.json;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown=true)
public class PermissionGroupRequest {
private Integer id;
private String name;
private String displayName;
private Boolean enabled;
private List<PermissionGroupPermissionRequest> permissions;
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the displayName
*/
public String getDisplayName() {
return displayName;
}
/**
* @param displayName the displayName to set
*/
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
/**
* @return the enabled
*/
public Boolean getEnabled() {
return enabled;
}
/**
* @param enabled the enabled to set
*/
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
/**
* @return the permissions
*/
public List<PermissionGroupPermissionRequest> getPermissions() {
return permissions;
}
/**
* @param permissions the permissions to set
*/
public void setPermissions(List<PermissionGroupPermissionRequest> permissions) {
this.permissions = permissions;
}
}
@@ -0,0 +1,84 @@
package net.locusworks.portal.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = "type"
)
@JsonSubTypes({
@Type(value = PermissionGroupPermissionRequest.class, name = "PermissionGroupPermission"),
@Type(value = PermissionRequest.class, name = "Permission")
})
@JsonIgnoreProperties(ignoreUnknown=true)
public class PermissionRequest {
private Integer id;
private String name;
private String displayName;
private String permissionCategory;
private String type;
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the displayName
*/
public String getDisplayName() {
return displayName;
}
/**
* @param displayName the displayName to set
*/
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
/**
* @return the permissionCategory
*/
public String getPermissionCategory() {
return permissionCategory;
}
/**
* @param permissionCategory the permissionCategory to set
*/
public void setPermissionCategory(String permissionCategory) {
this.permissionCategory = permissionCategory;
}
/**
* @return the type
*/
public String getType() {
return type;
}
/**
* @param type the type to set
*/
public void setType(String type) {
this.type = type;
}
}
@@ -0,0 +1,42 @@
package net.locusworks.portal.json;
import java.util.Date;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import net.locusworks.common.utils.DateTimeStampDeserializer;
import net.locusworks.common.utils.DateTimeStampSerializer;
public class PurgeLogRequest {
@JsonDeserialize(using=DateTimeStampDeserializer.class)
@JsonSerialize(using=DateTimeStampSerializer.class)
private Date purgeStartDate;
@JsonDeserialize(using=DateTimeStampDeserializer.class)
@JsonSerialize(using=DateTimeStampSerializer.class)
private Date purgeEndDate;
/**
* @return the purgeStartDate
*/
public Date getPurgeStartDate() {
return purgeStartDate;
}
/**
* @param purgeStartDate the purgeStartDate to set
*/
public void setPurgeStartDate(Date purgeStartDate) {
this.purgeStartDate = purgeStartDate;
}
/**
* @return the purgeEndDate
*/
public Date getPurgeEndDate() {
return purgeEndDate;
}
/**
* @param purgeEndDate the purgeEndDate to set
*/
public void setPurgeEndDate(Date purgeEndDate) {
this.purgeEndDate = purgeEndDate;
}
}
@@ -0,0 +1,58 @@
package net.locusworks.portal.json;
import java.util.Date;
public class ResourceFileRequest {
private Integer id;
private String fileName;
private String fileLocation;
private String fileType;
private boolean valid;
private Date dateCreated;
private Integer scriptResultId;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFileLocation() {
return fileLocation;
}
public void setFileLocation(String fileLocation) {
this.fileLocation = fileLocation;
}
public String getFileType() {
return fileType;
}
public void setFileType(String fileType) {
this.fileType = fileType;
}
public boolean isValid() {
return valid;
}
public void setValid(boolean valid) {
this.valid = valid;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public Integer getScriptResultId() {
return scriptResultId;
}
public void setScriptResultId(Integer scriptResultId) {
this.scriptResultId = scriptResultId;
}
}
@@ -0,0 +1,51 @@
package net.locusworks.portal.json;
public class ScriptChainRequest {
private Integer id;
private Integer parentScript;
private Integer childScript;
private Integer executeAfterMin;
private Integer exitStatus;
public ScriptChainRequest() {
super();
}
public ScriptChainRequest(Integer id, Integer parentScript, Integer childScript, Integer executeAfterMin) {
super();
this.id = id;
this.parentScript = parentScript;
this.childScript = childScript;
this.executeAfterMin = executeAfterMin;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getParentScript() {
return parentScript;
}
public void setParentScript(Integer parentScript) {
this.parentScript = parentScript;
}
public Integer getChildScript() {
return childScript;
}
public void setChildScript(Integer childScript) {
this.childScript = childScript;
}
public Integer getExitStatus() {
return exitStatus;
}
public void setExitStatus(Integer exitStatus) {
this.exitStatus = exitStatus;
}
public Integer getExecuteAfterMin() {
return executeAfterMin;
}
public void setExecuteAfterMin(Integer executeAfterMin) {
this.executeAfterMin = executeAfterMin;
}
}
@@ -0,0 +1,53 @@
package net.locusworks.portal.json;
import static net.locusworks.common.Charsets.UTF_8;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown=true)
public class ScriptEmailRequest extends EmailTemplateRequest {
private Integer scriptId;
private List<ApplicationUserRequest> recipients;
public ScriptEmailRequest() { }
public ScriptEmailRequest(Integer id, String emailName, String emailSubject, String emailMessage, Integer scriptId) {
super(id, emailName, emailSubject, emailMessage);
this.scriptId = scriptId;
}
public ScriptEmailRequest(Integer id, String emailName, String emailSubject, byte[] emailMessage, Integer scriptId) {
this(id, emailName, emailSubject, new String(emailMessage, UTF_8), scriptId);
}
/**
* @return the scriptId
*/
public Integer getScriptId() {
return scriptId;
}
/**
* @param scriptId the scriptId to set
*/
public void setScriptId(Integer scriptId) {
this.scriptId = scriptId;
}
/**
* @return the recipients
*/
public List<ApplicationUserRequest> getRecipients() {
return recipients;
}
/**
* @param recipients the recipients to set
*/
public void setRecipients(List<ApplicationUserRequest> recipients) {
this.recipients = recipients;
}
}
@@ -0,0 +1,19 @@
package net.locusworks.portal.json;
public class ScriptEnvironmentVariableRequest extends EnvironmentVariableRequest {
private Integer script;
/**
* @return the script
*/
public Integer getScript() {
return script;
}
/**
* @param script the script to set
*/
public void setScript(Integer script) {
this.script = script;
}
}
@@ -0,0 +1,45 @@
package net.locusworks.portal.json;
public class ScriptParameterRequest {
private Integer id;
private String parameter;
private Integer script;
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the parameter
*/
public String getParameter() {
return parameter;
}
/**
* @param parameter the parameter to set
*/
public void setParameter(String parameter) {
this.parameter = parameter;
}
/**
* @return the script
*/
public Integer getScript() {
return script;
}
/**
* @param script the script to set
*/
public void setScript(Integer script) {
this.script = script;
}
}
@@ -0,0 +1,39 @@
package net.locusworks.portal.json;
public class ScriptRemoteRequest {
private Integer scriptId;
private CredentialRequest scriptCredentials;
private String url;
private Integer port;
public Integer getScriptId() {
return scriptId;
}
public void setScriptId(Integer scriptId) {
this.scriptId = scriptId;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
public CredentialRequest getScriptCredentials() {
return scriptCredentials;
}
public void setScriptCredentials(CredentialRequest scriptCredentials) {
this.scriptCredentials = scriptCredentials;
}
}
@@ -0,0 +1,182 @@
package net.locusworks.portal.json;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown=true)
public class ScriptRequest {
private Integer id;
private String name;
private String command;
private String scriptType;
private String baseDirectory;
private String outputDirectory;
private List<ScriptParameterRequest> parameters;
private List<ScriptScheduleRequest> schedule;
private List<ScriptEnvironmentVariableRequest> scriptVariables;
private List<ScriptChainRequest> scriptChain;
private List<ScriptEmailRequest> scriptEmails;
private CredentialRequest scriptCredentials;
private ScriptRemoteRequest remote;
private ScriptScpRequest scp;
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the command
*/
public String getCommand() {
return command;
}
/**
* @param command the command to set
*/
public void setCommand(String command) {
this.command = command;
}
/**
* @return the baseDirectory
*/
public String getBaseDirectory() {
return baseDirectory;
}
/**
* @param baseDirectory the baseDirectory to set
*/
public void setBaseDirectory(String baseDirectory) {
this.baseDirectory = baseDirectory;
}
/**
* @return the outputDirectory
*/
public String getOutputDirectory() {
return outputDirectory;
}
/**
* @param outputDirectory the outputDirectory to set
*/
public void setOutputDirectory(String outputDirectory) {
this.outputDirectory = outputDirectory;
}
/**
* @return the parameters
*/
public List<ScriptParameterRequest> getParameters() {
return parameters;
}
/**
* @param parameters the parameters to set
*/
public void setParameters(List<ScriptParameterRequest> parameters) {
this.parameters = parameters;
}
/**
* @return the schedule
*/
public List<ScriptScheduleRequest> getSchedule() {
return schedule;
}
/**
* @param schedule the schedule to set
*/
public void setSchedule(List<ScriptScheduleRequest> schedule) {
this.schedule = schedule;
}
/**
* @return the scriptVariables
*/
public List<ScriptEnvironmentVariableRequest> getScriptVariables() {
return scriptVariables;
}
/**
* @param scriptVariables the scriptVariables to set
*/
public void setScriptVariables(List<ScriptEnvironmentVariableRequest> scriptVariables) {
this.scriptVariables = scriptVariables;
}
/**
* @return the scriptCredentials
*/
public CredentialRequest getScriptCredentials() {
return scriptCredentials;
}
/**
* @param scriptCredentials the scriptCredentials to set
*/
public void setScriptCredentials(CredentialRequest scriptCredentials) {
this.scriptCredentials = scriptCredentials;
}
/**
* @return the scriptType
*/
public String getScriptType() {
return scriptType;
}
/**
* @param scriptType the scriptType to set
*/
public void setScriptType(String scriptType) {
this.scriptType = scriptType;
}
public ScriptRemoteRequest getRemote() {
return remote;
}
public void setRemote(ScriptRemoteRequest remote) {
this.remote = remote;
}
/**
* @return the scp
*/
public ScriptScpRequest getScp() {
return scp;
}
/**
* @param scp the scp to set
*/
public void setScp(ScriptScpRequest scp) {
this.scp = scp;
}
public List<ScriptChainRequest> getScriptChain() {
return scriptChain;
}
public void setScriptChain(List<ScriptChainRequest> scriptChain) {
this.scriptChain = scriptChain;
}
/**
* @return the scriptEmails
*/
public List<ScriptEmailRequest> getScriptEmails() {
return scriptEmails;
}
/**
* @param scriptEmails the scriptEmails to set
*/
public void setScriptEmails(List<ScriptEmailRequest> scriptEmails) {
this.scriptEmails = scriptEmails;
}
}
@@ -0,0 +1,165 @@
package net.locusworks.portal.json;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import net.locusworks.common.utils.DateTimeStampDeserializer;
import net.locusworks.common.utils.DateTimeStampSerializer;
public class ScriptScheduleRequest {
private Integer id;
private String jobId;
@JsonDeserialize(using=DateTimeStampDeserializer.class)
@JsonSerialize(using=DateTimeStampSerializer.class)
private Date startDatetime;
@JsonDeserialize(using=DateTimeStampDeserializer.class)
@JsonSerialize(using=DateTimeStampSerializer.class)
private Date endDatetime;
private String frequency;
private Integer maxExecutions;
private Integer currentExecutionCount;
private Integer executionStatus;
@JsonDeserialize(using=DateTimeStampDeserializer.class)
@JsonSerialize(using=DateTimeStampSerializer.class)
private Date lastRun;
private Integer script;
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the jobId
*/
public String getJobId() {
return jobId;
}
/**
* @param jobId the jobId to set
*/
public void setJobId(String jobId) {
this.jobId = jobId;
}
/**
* @return the startDatetime
*/
public Date getStartDatetime() {
return startDatetime;
}
/**
* @param startDatetime the startDatetime to set
*/
public void setStartDatetime(Date startDatetime) {
this.startDatetime = startDatetime;
}
/**
* @return the endDatetime
*/
public Date getEndDatetime() {
return endDatetime;
}
/**
* @param endDatetime the endDatetime to set
*/
public void setEndDatetime(Date endDatetime) {
this.endDatetime = endDatetime;
}
/**
* @return the frequency
*/
public String getFrequency() {
return frequency;
}
/**
* @param frequency the frequency to set
*/
public void setFrequency(String frequency) {
this.frequency = frequency;
}
/**
* @return the lastRun
*/
public Date getLastRun() {
return lastRun;
}
/**
* @param lastRun the lastRun to set
*/
public void setLastRun(Date lastRun) {
this.lastRun = lastRun;
}
/**
* @return the script
*/
public Integer getScript() {
return script;
}
/**
* @param script the script to set
*/
public void setScript(Integer script) {
this.script = script;
}
/**
* @return the maxExecutions
*/
public Integer getMaxExecutions() {
return maxExecutions;
}
/**
* @param maxExecutions the maxExecutions to set
*/
public void setMaxExecutions(Integer maxExecutions) {
this.maxExecutions = maxExecutions;
}
/**
* @return the currentExecutionCount
*/
public Integer getCurrentExecutionCount() {
return currentExecutionCount;
}
/**
* @param currentExecutionCount the currentExecutionCount to set
*/
public void setCurrentExecutionCount(Integer currentExecutionCount) {
this.currentExecutionCount = currentExecutionCount;
}
/**
* @return the executionStatus
*/
public Integer getExecutionStatus() {
return executionStatus;
}
/**
* @param executionStatus the executionStatus to set
*/
public void setExecutionStatus(Integer executionStatus) {
this.executionStatus = executionStatus;
}
/**
* Checks to see if the schedule is eligible to be scheduled
* @return true if this schedule can be scheduled; false otherwise
*/
@JsonIgnore
public boolean isSchedulable() {
Date now = new Date();
boolean expired = this.endDatetime != null && this.endDatetime.before(now);
int maxExecutions = this.maxExecutions == null ? 0 : this.maxExecutions;
int currentExecutions = this.currentExecutionCount == null ? 0 : this.currentExecutionCount;
return !expired && (maxExecutions == 0 || currentExecutions < maxExecutions);
}
}
@@ -0,0 +1,95 @@
package net.locusworks.portal.json;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import net.locusworks.common.utils.DateTimeStampDeserializer;
import net.locusworks.common.utils.DateTimeStampSerializer;
import static net.locusworks.common.Charsets.UTF_8;
@JsonIgnoreProperties(ignoreUnknown=true)
public class ScriptScheduleResultsRequest {
private Integer id;
private Short exitStatus;
private String results;
@JsonDeserialize(using=DateTimeStampDeserializer.class)
@JsonSerialize(using=DateTimeStampSerializer.class)
private Date startTime;
@JsonDeserialize(using=DateTimeStampDeserializer.class)
@JsonSerialize(using=DateTimeStampSerializer.class)
private Date endTime;
private List<ResourceFileRequest> resourceFiles;
public ScriptScheduleResultsRequest() {
this((short)-1, "");
}
public ScriptScheduleResultsRequest(Short exitStatus, String results) {
this.exitStatus = exitStatus;
this.results = results;
this.startTime = new Date();
this.endTime = new Date();
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Short getExitStatus() {
return exitStatus;
}
public void setExitStatus(Short exitStatus) {
this.exitStatus = exitStatus;
}
public String getResults() {
return results;
}
public void setResults(byte[] results) {
setResults(new String(results, UTF_8));
}
public void setResults(String results) {
this.results = results;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public List<ResourceFileRequest> getResourceFiles() {
return resourceFiles;
}
public void setResourceFiles(List<ResourceFileRequest> resourceFiles) {
this.resourceFiles = resourceFiles;
}
@Override
@JsonIgnore
public String toString() {
SimpleDateFormat sdf = new SimpleDateFormat("MMM d, yyyy HH:mm:ss z");
return String.format("Execution started at %s and ended at %s with exit status of %d",
sdf.format(this.getStartTime()),
sdf.format(this.getEndTime()),
this.getExitStatus());
}
}
@@ -0,0 +1,127 @@
package net.locusworks.portal.json;
/**
*
* @author Isaac Parenteau
*/
public class ScriptScpRequest {
private Integer id;
private Integer scriptId;
private String fromHost;
private Integer fromPort;
private CredentialRequest fromCredentials;
private String toHost;
private Integer toPort;
private CredentialRequest toCredentials;
private String dataRegex;
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the scriptId
*/
public Integer getScriptId() {
return scriptId;
}
/**
* @param scriptId the scriptId to set
*/
public void setScriptId(Integer scriptId) {
this.scriptId = scriptId;
}
/**
* @return the fromHost
*/
public String getFromHost() {
return fromHost;
}
/**
* @param fromHost the fromHost to set
*/
public void setFromHost(String fromHost) {
this.fromHost = fromHost;
}
/**
* @return the fromPort
*/
public Integer getFromPort() {
return fromPort;
}
/**
* @param fromPort the fromPort to set
*/
public void setFromPort(Integer fromPort) {
this.fromPort = fromPort;
}
/**
* @return the fromCredentials
*/
public CredentialRequest getFromCredentials() {
return fromCredentials;
}
/**
* @param fromCredentials the fromCredentials to set
*/
public void setFromCredentials(CredentialRequest fromCredentials) {
this.fromCredentials = fromCredentials;
}
/**
* @return the toHost
*/
public String getToHost() {
return toHost;
}
/**
* @param toHost the toHost to set
*/
public void setToHost(String toHost) {
this.toHost = toHost;
}
/**
* @return the toPort
*/
public Integer getToPort() {
return toPort;
}
/**
* @param toPort the toPort to set
*/
public void setToPort(Integer toPort) {
this.toPort = toPort;
}
/**
* @return the toCredentials
*/
public CredentialRequest getToCredentials() {
return toCredentials;
}
/**
* @param toCredentials the toCredentials to set
*/
public void setToCredentials(CredentialRequest toCredentials) {
this.toCredentials = toCredentials;
}
/**
* @return the dataRegex
*/
public String getDataRegex() {
return dataRegex;
}
/**
* @param dataRegex the dataRegex to set
*/
public void setDataRegex(String dataRegex) {
this.dataRegex = dataRegex;
}
}
@@ -0,0 +1,63 @@
package net.locusworks.portal.json;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import static net.locusworks.common.Charsets.UTF_8;
@JsonIgnoreProperties(ignoreUnknown=true)
public class ValueRequest {
private Integer id;
private String name;
private String value;
public ValueRequest() { }
public ValueRequest(Integer id, String name, String value) {
this.id = id;
this.name = name;
this.value = value;
}
public ValueRequest(Integer id, String name, byte[] value) {
this(id, name, new String(value, UTF_8));
}
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the value
*/
public String getValue() {
return value;
}
/**
* @param value the value to set
*/
public void setValue(String value) {
this.value = value;
}
}
@@ -0,0 +1,10 @@
/**
* These classes are used to map JPO Entities to POJO
* which then can be converted to JSON and passed to the client.
* If a JPO Entity is sent to the client. Hibernate throws a
* Lazy Initialization failed exception.
* @since 1.0.0-RELEASE
* @author Isaac Parenteau
* @version 1.0
*/
package net.locusworks.portal.json;