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

@@ -0,0 +1,117 @@
package net.locusworks.portal.database.config;
import java.util.HashSet;
import java.util.Properties;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.Primary;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.Database;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/***
* Spring bean configuration for the database.
* Shows which package is where the spring repositories are and the entities to scan
* @author Isaac Parenteau
* @since 1.0.0-RELEASE
* @version 1.0
*
*/
@Configuration(value="net.locusworks.portal.database.config.PortalBeanConfiguration")
@EnableTransactionManagement
@EnableJpaRepositories(
basePackages = {"net.locusworks.portal.database.repos"},
entityManagerFactoryRef = "portalEntityManagerFactory",
transactionManagerRef = "portalTransactionManager"
)
public class PortalBeanConfiguration {
public static final String PERSISTENCE_UNIT = "portal_pu";
public static final HashSet<String> cacheNames = new HashSet<>();
private static final String[] PACKAGES_TO_SCAN = {"net.locusworks.portal.database.entities"};
private static final Properties hibernateProperties;
static {
hibernateProperties = new Properties();
hibernateProperties.setProperty("hibernate.connection.zeroDateTimeBehavior", "convertToNull");
hibernateProperties.setProperty("hibernate.dbcp.maxActive", "50");
hibernateProperties.setProperty("hibernate.dbcp.maxIdle", "10");
hibernateProperties.setProperty("hibernate.dbcp.maxWait", "5000");
hibernateProperties.setProperty("hibernate.jdbc.batch_size property", "50");
hibernateProperties.setProperty("hibernate.connection.charSet", "UTF-8");
hibernateProperties.setProperty("hibernate.connection.characterEncoding", "UTF-8");
hibernateProperties.setProperty("hibernate.connection.useUnicode", "true");
}
@Autowired
private DataSource dataSource;
/**
* Create the entity manager factory bean used in the database connection
* @return entityManagerFactoryBean
*/
@Primary
@Bean
@DependsOn("migration")
public LocalContainerEntityManagerFactoryBean portalEntityManagerFactory() {
LocalContainerEntityManagerFactoryBean lef = new LocalContainerEntityManagerFactoryBean();
lef.setDataSource(dataSource);
lef.setJpaVendorAdapter(portalJpaVendorAdapter());
lef.setPackagesToScan(PACKAGES_TO_SCAN);
lef.setJpaProperties(hibernateProperties);
lef.setPersistenceUnitName(PERSISTENCE_UNIT);
return lef;
}
/**
* Create the session factory bean
* @return sessionFactoryBean
*/
@Bean
public LocalSessionFactoryBean portalSessionFactory() {
LocalSessionFactoryBean sessionBean = new LocalSessionFactoryBean();
sessionBean.setDataSource(dataSource);
sessionBean.setPackagesToScan(PACKAGES_TO_SCAN);
sessionBean.setHibernateProperties(hibernateProperties);
return sessionBean;
}
/**
* Create the JPA Vendor adaptor bean that is used in the entity manager factory
* @return jpaVendorAdaptor
*/
@Primary
@Bean
public JpaVendorAdapter portalJpaVendorAdapter() {
HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
hibernateJpaVendorAdapter.setShowSql(false);
hibernateJpaVendorAdapter.setGenerateDdl(false);
hibernateJpaVendorAdapter.setDatabase(Database.MYSQL);
return hibernateJpaVendorAdapter;
}
/**
* Create the transaction manager bean
* @return transactionManager
*/
@Primary
@Bean
public PlatformTransactionManager portalTransactionManager() {
JpaTransactionManager manager = new JpaTransactionManager();
manager.setEntityManagerFactory(portalEntityManagerFactory().getObject());
return new JpaTransactionManager();
}
}
@@ -0,0 +1,156 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "application_log", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "ApplicationLog.findAll", query = "SELECT a FROM ApplicationLog a")})
public class ApplicationLog implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "logged_by")
private String loggedBy;
@Basic(optional = false)
@Column(name = "event_type")
private String eventType;
@Basic(optional = false)
@Column(name = "event")
private String event;
@Basic(optional = false)
@Column(name = "severity")
private String severity;
@Basic(optional = false)
@Column(name = "ip_address")
private String ipAddress;
@Basic(optional = false)
@Column(name = "timestamp")
@Temporal(TemporalType.TIMESTAMP)
private Date timestamp;
public ApplicationLog() {
}
public ApplicationLog(Integer id) {
this.id = id;
}
public ApplicationLog(Integer id, String loggedBy, String eventType, String event, String severity, String ipAddress, Date timestamp) {
this.id = id;
this.loggedBy = loggedBy;
this.eventType = eventType;
this.event = event;
this.severity = severity;
this.ipAddress = ipAddress;
this.timestamp = timestamp;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getLoggedBy() {
return loggedBy;
}
public void setLoggedBy(String loggedBy) {
this.loggedBy = loggedBy;
}
public String getEventType() {
return eventType;
}
public void setEventType(String eventType) {
this.eventType = eventType;
}
public String getEvent() {
return event;
}
public void setEvent(String event) {
this.event = event;
}
public String getSeverity() {
return severity;
}
public void setSeverity(String severity) {
this.severity = severity;
}
public String getIpAddress() {
return ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public Date getTimestamp() {
return timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ApplicationLog)) {
return false;
}
ApplicationLog other = (ApplicationLog) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.ApplicationLog[ id=" + id + " ]";
}
}
@@ -0,0 +1,245 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "application_user", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "ApplicationUser.findAll", query = "SELECT a FROM ApplicationUser a")})
public class ApplicationUser implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "email_address_txt")
private String emailAddressTxt;
@Basic(optional = false)
@Column(name = "effective_date")
@Temporal(TemporalType.DATE)
private Date effectiveDate;
@Basic(optional = false)
@Column(name = "expiration_date")
@Temporal(TemporalType.DATE)
private Date expirationDate;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "createdBy")
private List<ScriptEnvironmentVariable> scriptEnvironmentVariableList;
@OneToOne(cascade = CascadeType.ALL, mappedBy = "applicationUser")
private UserAttribute userAttribute;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "createdBy")
private List<Password> passwordList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "createdBy")
private List<GitRepo> gitRepoList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "createdBy")
private List<EnvironmentVariable> environmentVariableList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "createdBy")
private List<Keyword> keywordList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "createdBy")
private List<KeyValue> keyValueList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "applicationUser")
private List<UserPasswordTracking> userPasswordTrackingList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "createdBy")
private List<Script> scriptList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "recipient")
private List<ScriptEmailRecipient> scriptEmailRecipientList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "createdBy")
private List<SshKey> sshKeyList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "createdBy")
private List<EmailTemplate> emailTemplateList;
public ApplicationUser() {
}
public ApplicationUser(Integer id) {
this.id = id;
}
public ApplicationUser(Integer id, String emailAddressTxt, Date effectiveDate, Date expirationDate) {
this.id = id;
this.emailAddressTxt = emailAddressTxt;
this.effectiveDate = effectiveDate;
this.expirationDate = expirationDate;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getEmailAddressTxt() {
return emailAddressTxt;
}
public void setEmailAddressTxt(String emailAddressTxt) {
this.emailAddressTxt = emailAddressTxt;
}
public Date getEffectiveDate() {
return effectiveDate;
}
public void setEffectiveDate(Date effectiveDate) {
this.effectiveDate = effectiveDate;
}
public Date getExpirationDate() {
return expirationDate;
}
public void setExpirationDate(Date expirationDate) {
this.expirationDate = expirationDate;
}
public List<ScriptEnvironmentVariable> getScriptEnvironmentVariableList() {
return scriptEnvironmentVariableList;
}
public void setScriptEnvironmentVariableList(List<ScriptEnvironmentVariable> scriptEnvironmentVariableList) {
this.scriptEnvironmentVariableList = scriptEnvironmentVariableList;
}
public UserAttribute getUserAttribute() {
return userAttribute;
}
public void setUserAttribute(UserAttribute userAttribute) {
this.userAttribute = userAttribute;
}
public List<Password> getPasswordList() {
return passwordList;
}
public void setPasswordList(List<Password> passwordList) {
this.passwordList = passwordList;
}
public List<GitRepo> getGitRepoList() {
return gitRepoList;
}
public void setGitRepoList(List<GitRepo> gitRepoList) {
this.gitRepoList = gitRepoList;
}
public List<EnvironmentVariable> getEnvironmentVariableList() {
return environmentVariableList;
}
public void setEnvironmentVariableList(List<EnvironmentVariable> environmentVariableList) {
this.environmentVariableList = environmentVariableList;
}
public List<Keyword> getKeywordList() {
return keywordList;
}
public void setKeywordList(List<Keyword> keywordList) {
this.keywordList = keywordList;
}
public List<KeyValue> getKeyValueList() {
return keyValueList;
}
public void setKeyValueList(List<KeyValue> keyValueList) {
this.keyValueList = keyValueList;
}
public List<UserPasswordTracking> getUserPasswordTrackingList() {
return userPasswordTrackingList;
}
public void setUserPasswordTrackingList(List<UserPasswordTracking> userPasswordTrackingList) {
this.userPasswordTrackingList = userPasswordTrackingList;
}
public List<Script> getScriptList() {
return scriptList;
}
public void setScriptList(List<Script> scriptList) {
this.scriptList = scriptList;
}
public List<ScriptEmailRecipient> getScriptEmailRecipientList() {
return scriptEmailRecipientList;
}
public void setScriptEmailRecipientList(List<ScriptEmailRecipient> scriptEmailRecipientList) {
this.scriptEmailRecipientList = scriptEmailRecipientList;
}
public List<SshKey> getSshKeyList() {
return sshKeyList;
}
public void setSshKeyList(List<SshKey> sshKeyList) {
this.sshKeyList = sshKeyList;
}
public List<EmailTemplate> getEmailTemplateList() {
return emailTemplateList;
}
public void setEmailTemplateList(List<EmailTemplate> emailTemplateList) {
this.emailTemplateList = emailTemplateList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ApplicationUser)) {
return false;
}
ApplicationUser other = (ApplicationUser) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.ApplicationUser[ id=" + id + " ]";
}
}
@@ -0,0 +1,117 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "credential_type", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "CredentialType.findAll", query = "SELECT c FROM CredentialType c")})
public class CredentialType implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "name")
private String name;
@Basic(optional = false)
@Column(name = "display_name")
private String displayName;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "credentialType")
private List<Credentials> credentialsList;
public CredentialType() {
}
public CredentialType(Integer id) {
this.id = id;
}
public CredentialType(Integer id, String name, String displayName) {
this.id = id;
this.name = name;
this.displayName = displayName;
}
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 getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public List<Credentials> getCredentialsList() {
return credentialsList;
}
public void setCredentialsList(List<Credentials> credentialsList) {
this.credentialsList = credentialsList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof CredentialType)) {
return false;
}
CredentialType other = (CredentialType) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.CredentialType[ id=" + id + " ]";
}
}
@@ -0,0 +1,176 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "credentials", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "Credentials.findAll", query = "SELECT c FROM Credentials c")})
public class Credentials implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "uuid")
private String uuid;
@Basic(optional = false)
@Column(name = "reference_id")
private int referenceId;
@Basic(optional = false)
@Column(name = "date_added")
@Temporal(TemporalType.TIMESTAMP)
private Date dateAdded;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "credentials")
private List<ScriptRemote> scriptRemoteList;
@JoinColumn(name = "credential_type", referencedColumnName = "id")
@ManyToOne(optional = false)
private CredentialType credentialType;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "credentials")
private List<GitRepo> gitRepoList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "fromCredentials")
private List<ScriptScp> scriptScpList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "toCredentials")
private List<ScriptScp> scriptScpList1;
public Credentials() {
}
public Credentials(Integer id) {
this.id = id;
}
public Credentials(Integer id, String uuid, int referenceId, Date dateAdded) {
this.id = id;
this.uuid = uuid;
this.referenceId = referenceId;
this.dateAdded = dateAdded;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public int getReferenceId() {
return referenceId;
}
public void setReferenceId(int referenceId) {
this.referenceId = referenceId;
}
public Date getDateAdded() {
return dateAdded;
}
public void setDateAdded(Date dateAdded) {
this.dateAdded = dateAdded;
}
public List<ScriptRemote> getScriptRemoteList() {
return scriptRemoteList;
}
public void setScriptRemoteList(List<ScriptRemote> scriptRemoteList) {
this.scriptRemoteList = scriptRemoteList;
}
public CredentialType getCredentialType() {
return credentialType;
}
public void setCredentialType(CredentialType credentialType) {
this.credentialType = credentialType;
}
public List<GitRepo> getGitRepoList() {
return gitRepoList;
}
public void setGitRepoList(List<GitRepo> gitRepoList) {
this.gitRepoList = gitRepoList;
}
public List<ScriptScp> getScriptScpList() {
return scriptScpList;
}
public void setScriptScpList(List<ScriptScp> scriptScpList) {
this.scriptScpList = scriptScpList;
}
public List<ScriptScp> getScriptScpList1() {
return scriptScpList1;
}
public void setScriptScpList1(List<ScriptScp> scriptScpList1) {
this.scriptScpList1 = scriptScpList1;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Credentials)) {
return false;
}
Credentials other = (Credentials) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.Credentials[ id=" + id + " ]";
}
}
@@ -0,0 +1,160 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "email_template", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "EmailTemplate.findAll", query = "SELECT e FROM EmailTemplate e")})
public class EmailTemplate implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "email_name")
private String emailName;
@Basic(optional = false)
@Column(name = "email_subject")
private String emailSubject;
@Basic(optional = false)
@Lob
@Column(name = "email_message")
private byte[] emailMessage;
@Basic(optional = false)
@Column(name = "date_created")
@Temporal(TemporalType.DATE)
private Date dateCreated;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "emailTemplate")
private List<ScriptEmail> scriptEmailList;
@JoinColumn(name = "created_by", referencedColumnName = "id")
@ManyToOne(optional = false)
private ApplicationUser createdBy;
public EmailTemplate() {
}
public EmailTemplate(Integer id) {
this.id = id;
}
public EmailTemplate(Integer id, String emailName, String emailSubject, byte[] emailMessage, Date dateCreated) {
this.id = id;
this.emailName = emailName;
this.emailSubject = emailSubject;
this.emailMessage = emailMessage;
this.dateCreated = dateCreated;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getEmailName() {
return emailName;
}
public void setEmailName(String emailName) {
this.emailName = emailName;
}
public String getEmailSubject() {
return emailSubject;
}
public void setEmailSubject(String emailSubject) {
this.emailSubject = emailSubject;
}
public byte[] getEmailMessage() {
return emailMessage;
}
public void setEmailMessage(byte[] emailMessage) {
this.emailMessage = emailMessage;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public List<ScriptEmail> getScriptEmailList() {
return scriptEmailList;
}
public void setScriptEmailList(List<ScriptEmail> scriptEmailList) {
this.scriptEmailList = scriptEmailList;
}
public ApplicationUser getCreatedBy() {
return createdBy;
}
public void setCreatedBy(ApplicationUser createdBy) {
this.createdBy = createdBy;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof EmailTemplate)) {
return false;
}
EmailTemplate other = (EmailTemplate) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.EmailTemplate[ id=" + id + " ]";
}
}
@@ -0,0 +1,146 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "environment_variable", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "EnvironmentVariable.findAll", query = "SELECT e FROM EnvironmentVariable e")})
public class EnvironmentVariable implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "name")
private String name;
@Basic(optional = false)
@Column(name = "value")
private String value;
@Basic(optional = false)
@Column(name = "last_updated")
@Temporal(TemporalType.TIMESTAMP)
private Date lastUpdated;
@Basic(optional = false)
@Column(name = "date_created")
@Temporal(TemporalType.TIMESTAMP)
private Date dateCreated;
@JoinColumn(name = "created_by", referencedColumnName = "id")
@ManyToOne(optional = false)
private ApplicationUser createdBy;
public EnvironmentVariable() {
}
public EnvironmentVariable(Integer id) {
this.id = id;
}
public EnvironmentVariable(Integer id, String name, String value, Date lastUpdated, Date dateCreated) {
this.id = id;
this.name = name;
this.value = value;
this.lastUpdated = lastUpdated;
this.dateCreated = dateCreated;
}
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 getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public Date getLastUpdated() {
return lastUpdated;
}
public void setLastUpdated(Date lastUpdated) {
this.lastUpdated = lastUpdated;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public ApplicationUser getCreatedBy() {
return createdBy;
}
public void setCreatedBy(ApplicationUser createdBy) {
this.createdBy = createdBy;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof EnvironmentVariable)) {
return false;
}
EnvironmentVariable other = (EnvironmentVariable) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.EnvironmentVariable[ id=" + id + " ]";
}
}
@@ -0,0 +1,181 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "git_repo", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "GitRepo.findAll", query = "SELECT g FROM GitRepo g")})
public class GitRepo implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "name")
private String name;
@Basic(optional = false)
@Column(name = "scm")
private String scm;
@Basic(optional = false)
@Column(name = "directory")
private String directory;
@Basic(optional = false)
@Column(name = "branch")
private String branch;
@Basic(optional = false)
@Column(name = "last_updated")
@Temporal(TemporalType.TIMESTAMP)
private Date lastUpdated;
@Basic(optional = false)
@Column(name = "dated_created")
@Temporal(TemporalType.DATE)
private Date datedCreated;
@JoinColumn(name = "credentials", referencedColumnName = "id")
@ManyToOne(optional = false)
private Credentials credentials;
@JoinColumn(name = "created_by", referencedColumnName = "id")
@ManyToOne(optional = false)
private ApplicationUser createdBy;
public GitRepo() {
}
public GitRepo(Integer id) {
this.id = id;
}
public GitRepo(Integer id, String name, String scm, String directory, String branch, Date lastUpdated, Date datedCreated) {
this.id = id;
this.name = name;
this.scm = scm;
this.directory = directory;
this.branch = branch;
this.lastUpdated = lastUpdated;
this.datedCreated = datedCreated;
}
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 getDirectory() {
return directory;
}
public void setDirectory(String directory) {
this.directory = directory;
}
public String getBranch() {
return branch;
}
public void setBranch(String branch) {
this.branch = branch;
}
public Date getLastUpdated() {
return lastUpdated;
}
public void setLastUpdated(Date lastUpdated) {
this.lastUpdated = lastUpdated;
}
public Date getDatedCreated() {
return datedCreated;
}
public void setDatedCreated(Date datedCreated) {
this.datedCreated = datedCreated;
}
public Credentials getCredentials() {
return credentials;
}
public void setCredentials(Credentials credentials) {
this.credentials = credentials;
}
public ApplicationUser getCreatedBy() {
return createdBy;
}
public void setCreatedBy(ApplicationUser createdBy) {
this.createdBy = createdBy;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof GitRepo)) {
return false;
}
GitRepo other = (GitRepo) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.GitRepo[ id=" + id + " ]";
}
}
@@ -0,0 +1,145 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "hash_type", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "HashType.findAll", query = "SELECT h FROM HashType h")})
public class HashType implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "name")
private String name;
@Basic(optional = false)
@Column(name = "display_name")
private String displayName;
@Basic(optional = false)
@Column(name = "valid")
private short valid;
@Basic(optional = false)
@Column(name = "last_modified")
@Temporal(TemporalType.DATE)
private Date lastModified;
@Basic(optional = false)
@Column(name = "date_created")
@Temporal(TemporalType.DATE)
private Date dateCreated;
public HashType() {
}
public HashType(Integer id) {
this.id = id;
}
public HashType(Integer id, String name, String displayName, short valid, Date lastModified, Date dateCreated) {
this.id = id;
this.name = name;
this.displayName = displayName;
this.valid = valid;
this.lastModified = lastModified;
this.dateCreated = dateCreated;
}
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 getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public short getValid() {
return valid;
}
public void setValid(short valid) {
this.valid = valid;
}
public Date getLastModified() {
return lastModified;
}
public void setLastModified(Date lastModified) {
this.lastModified = lastModified;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof HashType)) {
return false;
}
HashType other = (HashType) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.HashType[ id=" + id + " ]";
}
}
@@ -0,0 +1,135 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "key_value", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "KeyValue.findAll", query = "SELECT k FROM KeyValue k")})
public class KeyValue implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "reference_key")
private String referenceKey;
@Basic(optional = false)
@Lob
@Column(name = "reference_value")
private byte[] referenceValue;
@Basic(optional = false)
@Column(name = "date_created")
@Temporal(TemporalType.TIMESTAMP)
private Date dateCreated;
@JoinColumn(name = "created_by", referencedColumnName = "id")
@ManyToOne(optional = false)
private ApplicationUser createdBy;
public KeyValue() {
}
public KeyValue(Integer id) {
this.id = id;
}
public KeyValue(Integer id, String referenceKey, byte[] referenceValue, Date dateCreated) {
this.id = id;
this.referenceKey = referenceKey;
this.referenceValue = referenceValue;
this.dateCreated = dateCreated;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getReferenceKey() {
return referenceKey;
}
public void setReferenceKey(String referenceKey) {
this.referenceKey = referenceKey;
}
public byte[] getReferenceValue() {
return referenceValue;
}
public void setReferenceValue(byte[] referenceValue) {
this.referenceValue = referenceValue;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public ApplicationUser getCreatedBy() {
return createdBy;
}
public void setCreatedBy(ApplicationUser createdBy) {
this.createdBy = createdBy;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof KeyValue)) {
return false;
}
KeyValue other = (KeyValue) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.KeyValue[ id=" + id + " ]";
}
}
@@ -0,0 +1,121 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "keyword", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "Keyword.findAll", query = "SELECT k FROM Keyword k")})
public class Keyword implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "keyword")
private String keyword;
@Basic(optional = false)
@Column(name = "date_created")
@Temporal(TemporalType.DATE)
private Date dateCreated;
@JoinColumn(name = "created_by", referencedColumnName = "id")
@ManyToOne(optional = false)
private ApplicationUser createdBy;
public Keyword() {
}
public Keyword(Integer id) {
this.id = id;
}
public Keyword(Integer id, String keyword, Date dateCreated) {
this.id = id;
this.keyword = keyword;
this.dateCreated = dateCreated;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public ApplicationUser getCreatedBy() {
return createdBy;
}
public void setCreatedBy(ApplicationUser createdBy) {
this.createdBy = createdBy;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Keyword)) {
return false;
}
Keyword other = (Keyword) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.Keyword[ id=" + id + " ]";
}
}
@@ -0,0 +1,157 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "password", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "Password.findAll", query = "SELECT p FROM Password p")})
public class Password implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "uuid")
private String uuid;
@Basic(optional = false)
@Column(name = "name")
private String name;
@Basic(optional = false)
@Column(name = "user_name")
private String userName;
@Basic(optional = false)
@Column(name = "password")
private String password;
@Basic(optional = false)
@Column(name = "date_created")
@Temporal(TemporalType.DATE)
private Date dateCreated;
@JoinColumn(name = "created_by", referencedColumnName = "id")
@ManyToOne(optional = false)
private ApplicationUser createdBy;
public Password() {
}
public Password(Integer id) {
this.id = id;
}
public Password(Integer id, String uuid, String name, String userName, String password, Date dateCreated) {
this.id = id;
this.uuid = uuid;
this.name = name;
this.userName = userName;
this.password = password;
this.dateCreated = dateCreated;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
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;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public ApplicationUser getCreatedBy() {
return createdBy;
}
public void setCreatedBy(ApplicationUser createdBy) {
this.createdBy = createdBy;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Password)) {
return false;
}
Password other = (Password) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.Password[ id=" + id + " ]";
}
}
@@ -0,0 +1,159 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "permission", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "Permission.findAll", query = "SELECT p FROM Permission p")})
public class Permission implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "name")
private String name;
@Basic(optional = false)
@Column(name = "display_name")
private String displayName;
@Basic(optional = false)
@Column(name = "date_created")
@Temporal(TemporalType.DATE)
private Date dateCreated;
@Basic(optional = false)
@Column(name = "last_updated")
@Temporal(TemporalType.DATE)
private Date lastUpdated;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "permission")
private List<PermissionGroupPermission> permissionGroupPermissionList;
@JoinColumn(name = "permission_category", referencedColumnName = "id")
@ManyToOne(optional = false)
private PermissionCategory permissionCategory;
public Permission() {
}
public Permission(Integer id) {
this.id = id;
}
public Permission(Integer id, String name, String displayName, Date dateCreated, Date lastUpdated) {
this.id = id;
this.name = name;
this.displayName = displayName;
this.dateCreated = dateCreated;
this.lastUpdated = lastUpdated;
}
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 getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public Date getLastUpdated() {
return lastUpdated;
}
public void setLastUpdated(Date lastUpdated) {
this.lastUpdated = lastUpdated;
}
public List<PermissionGroupPermission> getPermissionGroupPermissionList() {
return permissionGroupPermissionList;
}
public void setPermissionGroupPermissionList(List<PermissionGroupPermission> permissionGroupPermissionList) {
this.permissionGroupPermissionList = permissionGroupPermissionList;
}
public PermissionCategory getPermissionCategory() {
return permissionCategory;
}
public void setPermissionCategory(PermissionCategory permissionCategory) {
this.permissionCategory = permissionCategory;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Permission)) {
return false;
}
Permission other = (Permission) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.Permission[ id=" + id + " ]";
}
}
@@ -0,0 +1,145 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "permission_category", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "PermissionCategory.findAll", query = "SELECT p FROM PermissionCategory p")})
public class PermissionCategory implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "name")
private String name;
@Basic(optional = false)
@Column(name = "display_name")
private String displayName;
@Basic(optional = false)
@Column(name = "date_created")
@Temporal(TemporalType.DATE)
private Date dateCreated;
@Basic(optional = false)
@Column(name = "last_updated")
private String lastUpdated;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "permissionCategory")
private List<Permission> permissionList;
public PermissionCategory() {
}
public PermissionCategory(Integer id) {
this.id = id;
}
public PermissionCategory(Integer id, String name, String displayName, Date dateCreated, String lastUpdated) {
this.id = id;
this.name = name;
this.displayName = displayName;
this.dateCreated = dateCreated;
this.lastUpdated = lastUpdated;
}
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 getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public String getLastUpdated() {
return lastUpdated;
}
public void setLastUpdated(String lastUpdated) {
this.lastUpdated = lastUpdated;
}
public List<Permission> getPermissionList() {
return permissionList;
}
public void setPermissionList(List<Permission> permissionList) {
this.permissionList = permissionList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof PermissionCategory)) {
return false;
}
PermissionCategory other = (PermissionCategory) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.PermissionCategory[ id=" + id + " ]";
}
}
@@ -0,0 +1,168 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "permission_group", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "PermissionGroup.findAll", query = "SELECT p FROM PermissionGroup p")})
public class PermissionGroup implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "name")
private String name;
@Basic(optional = false)
@Column(name = "display_name")
private String displayName;
@Basic(optional = false)
@Column(name = "enabled")
private short enabled;
@Basic(optional = false)
@Column(name = "date_created")
@Temporal(TemporalType.DATE)
private Date dateCreated;
@Basic(optional = false)
@Column(name = "last_modified")
@Temporal(TemporalType.DATE)
private Date lastModified;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "permissionGroup")
private List<UserAttribute> userAttributeList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "permissionGroup")
private List<PermissionGroupPermission> permissionGroupPermissionList;
public PermissionGroup() {
}
public PermissionGroup(Integer id) {
this.id = id;
}
public PermissionGroup(Integer id, String name, String displayName, short enabled, Date dateCreated, Date lastModified) {
this.id = id;
this.name = name;
this.displayName = displayName;
this.enabled = enabled;
this.dateCreated = dateCreated;
this.lastModified = lastModified;
}
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 getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public short getEnabled() {
return enabled;
}
public void setEnabled(short enabled) {
this.enabled = enabled;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public Date getLastModified() {
return lastModified;
}
public void setLastModified(Date lastModified) {
this.lastModified = lastModified;
}
public List<UserAttribute> getUserAttributeList() {
return userAttributeList;
}
public void setUserAttributeList(List<UserAttribute> userAttributeList) {
this.userAttributeList = userAttributeList;
}
public List<PermissionGroupPermission> getPermissionGroupPermissionList() {
return permissionGroupPermissionList;
}
public void setPermissionGroupPermissionList(List<PermissionGroupPermission> permissionGroupPermissionList) {
this.permissionGroupPermissionList = permissionGroupPermissionList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof PermissionGroup)) {
return false;
}
PermissionGroup other = (PermissionGroup) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.PermissionGroup[ id=" + id + " ]";
}
}
@@ -0,0 +1,145 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "permission_group_permission", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "PermissionGroupPermission.findAll", query = "SELECT p FROM PermissionGroupPermission p")})
public class PermissionGroupPermission implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "allowed")
private short allowed;
@Basic(optional = false)
@Column(name = "date_created")
@Temporal(TemporalType.DATE)
private Date dateCreated;
@Basic(optional = false)
@Column(name = "last_modified")
@Temporal(TemporalType.DATE)
private Date lastModified;
@JoinColumn(name = "permission", referencedColumnName = "id")
@ManyToOne(optional = false)
private Permission permission;
@JoinColumn(name = "permission_group", referencedColumnName = "id")
@ManyToOne(optional = false)
private PermissionGroup permissionGroup;
public PermissionGroupPermission() {
}
public PermissionGroupPermission(Integer id) {
this.id = id;
}
public PermissionGroupPermission(Integer id, short allowed, Date dateCreated, Date lastModified) {
this.id = id;
this.allowed = allowed;
this.dateCreated = dateCreated;
this.lastModified = lastModified;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public short getAllowed() {
return allowed;
}
public void setAllowed(short allowed) {
this.allowed = allowed;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public Date getLastModified() {
return lastModified;
}
public void setLastModified(Date lastModified) {
this.lastModified = lastModified;
}
public Permission getPermission() {
return permission;
}
public void setPermission(Permission permission) {
this.permission = permission;
}
public PermissionGroup getPermissionGroup() {
return permissionGroup;
}
public void setPermissionGroup(PermissionGroup permissionGroup) {
this.permissionGroup = permissionGroup;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof PermissionGroupPermission)) {
return false;
}
PermissionGroupPermission other = (PermissionGroupPermission) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.PermissionGroupPermission[ id=" + id + " ]";
}
}
@@ -0,0 +1,157 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "resource_file", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "ResourceFile.findAll", query = "SELECT r FROM ResourceFile r")})
public class ResourceFile implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "file_name")
private String fileName;
@Basic(optional = false)
@Column(name = "file_location")
private String fileLocation;
@Basic(optional = false)
@Column(name = "file_type")
private String fileType;
@Basic(optional = false)
@Column(name = "valid")
private short valid;
@Basic(optional = false)
@Column(name = "date_created")
@Temporal(TemporalType.DATE)
private Date dateCreated;
@JoinColumn(name = "script_result", referencedColumnName = "id")
@ManyToOne
private ScriptScheduleResults scriptResult;
public ResourceFile() {
}
public ResourceFile(Integer id) {
this.id = id;
}
public ResourceFile(Integer id, String fileName, String fileLocation, String fileType, short valid, Date dateCreated) {
this.id = id;
this.fileName = fileName;
this.fileLocation = fileLocation;
this.fileType = fileType;
this.valid = valid;
this.dateCreated = dateCreated;
}
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 short getValid() {
return valid;
}
public void setValid(short valid) {
this.valid = valid;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public ScriptScheduleResults getScriptResult() {
return scriptResult;
}
public void setScriptResult(ScriptScheduleResults scriptResult) {
this.scriptResult = scriptResult;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ResourceFile)) {
return false;
}
ResourceFile other = (ResourceFile) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.ResourceFile[ id=" + id + " ]";
}
}
@@ -0,0 +1,117 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "schedule_frequency", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "ScheduleFrequency.findAll", query = "SELECT s FROM ScheduleFrequency s")})
public class ScheduleFrequency implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "name")
private String name;
@Basic(optional = false)
@Column(name = "display_name")
private String displayName;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "frequency")
private List<ScriptSchedule> scriptScheduleList;
public ScheduleFrequency() {
}
public ScheduleFrequency(Integer id) {
this.id = id;
}
public ScheduleFrequency(Integer id, String name, String displayName) {
this.id = id;
this.name = name;
this.displayName = displayName;
}
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 getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public List<ScriptSchedule> getScriptScheduleList() {
return scriptScheduleList;
}
public void setScriptScheduleList(List<ScriptSchedule> scriptScheduleList) {
this.scriptScheduleList = scriptScheduleList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ScheduleFrequency)) {
return false;
}
ScheduleFrequency other = (ScheduleFrequency) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.ScheduleFrequency[ id=" + id + " ]";
}
}
@@ -0,0 +1,247 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "script", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "Script.findAll", query = "SELECT s FROM Script s")})
public class Script implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "script_name")
private String scriptName;
@Basic(optional = false)
@Column(name = "script_command")
private String scriptCommand;
@Column(name = "base_directory")
private String baseDirectory;
@Column(name = "output_directory")
private String outputDirectory;
@Basic(optional = false)
@Column(name = "date_created")
@Temporal(TemporalType.DATE)
private Date dateCreated;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "script")
private List<ScriptEnvironmentVariable> scriptEnvironmentVariableList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "script")
private List<ScriptRemote> scriptRemoteList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "script")
private List<ScriptParameter> scriptParameterList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "script")
private List<ScriptEmail> scriptEmailList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "childScript")
private List<ScriptChain> scriptChainList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "parentScript")
private List<ScriptChain> scriptChainList1;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "script")
private List<ScriptSchedule> scriptScheduleList;
@JoinColumn(name = "created_by", referencedColumnName = "id")
@ManyToOne(optional = false)
private ApplicationUser createdBy;
@JoinColumn(name = "script_type", referencedColumnName = "id")
@ManyToOne(optional = false)
private ScriptType scriptType;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "script")
private List<ScriptScp> scriptScpList;
public Script() {
}
public Script(Integer id) {
this.id = id;
}
public Script(Integer id, String scriptName, String scriptCommand, Date dateCreated) {
this.id = id;
this.scriptName = scriptName;
this.scriptCommand = scriptCommand;
this.dateCreated = dateCreated;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getScriptName() {
return scriptName;
}
public void setScriptName(String scriptName) {
this.scriptName = scriptName;
}
public String getScriptCommand() {
return scriptCommand;
}
public void setScriptCommand(String scriptCommand) {
this.scriptCommand = scriptCommand;
}
public String getBaseDirectory() {
return baseDirectory;
}
public void setBaseDirectory(String baseDirectory) {
this.baseDirectory = baseDirectory;
}
public String getOutputDirectory() {
return outputDirectory;
}
public void setOutputDirectory(String outputDirectory) {
this.outputDirectory = outputDirectory;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public List<ScriptEnvironmentVariable> getScriptEnvironmentVariableList() {
return scriptEnvironmentVariableList;
}
public void setScriptEnvironmentVariableList(List<ScriptEnvironmentVariable> scriptEnvironmentVariableList) {
this.scriptEnvironmentVariableList = scriptEnvironmentVariableList;
}
public List<ScriptRemote> getScriptRemoteList() {
return scriptRemoteList;
}
public void setScriptRemoteList(List<ScriptRemote> scriptRemoteList) {
this.scriptRemoteList = scriptRemoteList;
}
public List<ScriptParameter> getScriptParameterList() {
return scriptParameterList;
}
public void setScriptParameterList(List<ScriptParameter> scriptParameterList) {
this.scriptParameterList = scriptParameterList;
}
public List<ScriptEmail> getScriptEmailList() {
return scriptEmailList;
}
public void setScriptEmailList(List<ScriptEmail> scriptEmailList) {
this.scriptEmailList = scriptEmailList;
}
public List<ScriptChain> getScriptChainList() {
return scriptChainList;
}
public void setScriptChainList(List<ScriptChain> scriptChainList) {
this.scriptChainList = scriptChainList;
}
public List<ScriptChain> getScriptChainList1() {
return scriptChainList1;
}
public void setScriptChainList1(List<ScriptChain> scriptChainList1) {
this.scriptChainList1 = scriptChainList1;
}
public List<ScriptSchedule> getScriptScheduleList() {
return scriptScheduleList;
}
public void setScriptScheduleList(List<ScriptSchedule> scriptScheduleList) {
this.scriptScheduleList = scriptScheduleList;
}
public ApplicationUser getCreatedBy() {
return createdBy;
}
public void setCreatedBy(ApplicationUser createdBy) {
this.createdBy = createdBy;
}
public ScriptType getScriptType() {
return scriptType;
}
public void setScriptType(ScriptType scriptType) {
this.scriptType = scriptType;
}
public List<ScriptScp> getScriptScpList() {
return scriptScpList;
}
public void setScriptScpList(List<ScriptScp> scriptScpList) {
this.scriptScpList = scriptScpList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Script)) {
return false;
}
Script other = (Script) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.Script[ id=" + id + " ]";
}
}
@@ -0,0 +1,126 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "script_chain", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "ScriptChain.findAll", query = "SELECT s FROM ScriptChain s")})
public class ScriptChain implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "exit_status")
private int exitStatus;
@Column(name = "execute_after_min")
private Integer executeAfterMin;
@JoinColumn(name = "child_script", referencedColumnName = "id")
@ManyToOne(optional = false)
private Script childScript;
@JoinColumn(name = "parent_script", referencedColumnName = "id")
@ManyToOne(optional = false)
private Script parentScript;
public ScriptChain() {
}
public ScriptChain(Integer id) {
this.id = id;
}
public ScriptChain(Integer id, int exitStatus) {
this.id = id;
this.exitStatus = exitStatus;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public int getExitStatus() {
return exitStatus;
}
public void setExitStatus(int exitStatus) {
this.exitStatus = exitStatus;
}
public Integer getExecuteAfterMin() {
return executeAfterMin;
}
public void setExecuteAfterMin(Integer executeAfterMin) {
this.executeAfterMin = executeAfterMin;
}
public Script getChildScript() {
return childScript;
}
public void setChildScript(Script childScript) {
this.childScript = childScript;
}
public Script getParentScript() {
return parentScript;
}
public void setParentScript(Script parentScript) {
this.parentScript = parentScript;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ScriptChain)) {
return false;
}
ScriptChain other = (ScriptChain) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.ScriptChain[ id=" + id + " ]";
}
}
@@ -0,0 +1,133 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "script_email", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "ScriptEmail.findAll", query = "SELECT s FROM ScriptEmail s")})
public class ScriptEmail implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "date_created")
@Temporal(TemporalType.DATE)
private Date dateCreated;
@JoinColumn(name = "email_template", referencedColumnName = "id")
@ManyToOne(optional = false)
private EmailTemplate emailTemplate;
@JoinColumn(name = "script", referencedColumnName = "id")
@ManyToOne(optional = false)
private Script script;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "scriptEmail")
private List<ScriptEmailRecipient> scriptEmailRecipientList;
public ScriptEmail() {
}
public ScriptEmail(Integer id) {
this.id = id;
}
public ScriptEmail(Integer id, Date dateCreated) {
this.id = id;
this.dateCreated = dateCreated;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public EmailTemplate getEmailTemplate() {
return emailTemplate;
}
public void setEmailTemplate(EmailTemplate emailTemplate) {
this.emailTemplate = emailTemplate;
}
public Script getScript() {
return script;
}
public void setScript(Script script) {
this.script = script;
}
public List<ScriptEmailRecipient> getScriptEmailRecipientList() {
return scriptEmailRecipientList;
}
public void setScriptEmailRecipientList(List<ScriptEmailRecipient> scriptEmailRecipientList) {
this.scriptEmailRecipientList = scriptEmailRecipientList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ScriptEmail)) {
return false;
}
ScriptEmail other = (ScriptEmail) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.ScriptEmail[ id=" + id + " ]";
}
}
@@ -0,0 +1,120 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "script_email_recipient", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "ScriptEmailRecipient.findAll", query = "SELECT s FROM ScriptEmailRecipient s")})
public class ScriptEmailRecipient implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "date_created")
@Temporal(TemporalType.DATE)
private Date dateCreated;
@JoinColumn(name = "recipient", referencedColumnName = "id")
@ManyToOne(optional = false)
private ApplicationUser recipient;
@JoinColumn(name = "script_email", referencedColumnName = "id")
@ManyToOne(optional = false)
private ScriptEmail scriptEmail;
public ScriptEmailRecipient() {
}
public ScriptEmailRecipient(Integer id) {
this.id = id;
}
public ScriptEmailRecipient(Integer id, Date dateCreated) {
this.id = id;
this.dateCreated = dateCreated;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public ApplicationUser getRecipient() {
return recipient;
}
public void setRecipient(ApplicationUser recipient) {
this.recipient = recipient;
}
public ScriptEmail getScriptEmail() {
return scriptEmail;
}
public void setScriptEmail(ScriptEmail scriptEmail) {
this.scriptEmail = scriptEmail;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ScriptEmailRecipient)) {
return false;
}
ScriptEmailRecipient other = (ScriptEmailRecipient) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.ScriptEmailRecipient[ id=" + id + " ]";
}
}
@@ -0,0 +1,157 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "script_environment_variable", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "ScriptEnvironmentVariable.findAll", query = "SELECT s FROM ScriptEnvironmentVariable s")})
public class ScriptEnvironmentVariable implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "name")
private String name;
@Basic(optional = false)
@Column(name = "value")
private String value;
@Basic(optional = false)
@Column(name = "last_updated")
@Temporal(TemporalType.TIMESTAMP)
private Date lastUpdated;
@Basic(optional = false)
@Column(name = "date_created")
@Temporal(TemporalType.TIMESTAMP)
private Date dateCreated;
@JoinColumn(name = "created_by", referencedColumnName = "id")
@ManyToOne(optional = false)
private ApplicationUser createdBy;
@JoinColumn(name = "script", referencedColumnName = "id")
@ManyToOne(optional = false)
private Script script;
public ScriptEnvironmentVariable() {
}
public ScriptEnvironmentVariable(Integer id) {
this.id = id;
}
public ScriptEnvironmentVariable(Integer id, String name, String value, Date lastUpdated, Date dateCreated) {
this.id = id;
this.name = name;
this.value = value;
this.lastUpdated = lastUpdated;
this.dateCreated = dateCreated;
}
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 getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public Date getLastUpdated() {
return lastUpdated;
}
public void setLastUpdated(Date lastUpdated) {
this.lastUpdated = lastUpdated;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public ApplicationUser getCreatedBy() {
return createdBy;
}
public void setCreatedBy(ApplicationUser createdBy) {
this.createdBy = createdBy;
}
public Script getScript() {
return script;
}
public void setScript(Script script) {
this.script = script;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ScriptEnvironmentVariable)) {
return false;
}
ScriptEnvironmentVariable other = (ScriptEnvironmentVariable) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.ScriptEnvironmentVariable[ id=" + id + " ]";
}
}
@@ -0,0 +1,105 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "script_parameter", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "ScriptParameter.findAll", query = "SELECT s FROM ScriptParameter s")})
public class ScriptParameter implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "parameter")
private String parameter;
@JoinColumn(name = "script", referencedColumnName = "id")
@ManyToOne(optional = false)
private Script script;
public ScriptParameter() {
}
public ScriptParameter(Integer id) {
this.id = id;
}
public ScriptParameter(Integer id, String parameter) {
this.id = id;
this.parameter = parameter;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getParameter() {
return parameter;
}
public void setParameter(String parameter) {
this.parameter = parameter;
}
public Script getScript() {
return script;
}
public void setScript(Script script) {
this.script = script;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ScriptParameter)) {
return false;
}
ScriptParameter other = (ScriptParameter) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.ScriptParameter[ id=" + id + " ]";
}
}
@@ -0,0 +1,128 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "script_remote", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "ScriptRemote.findAll", query = "SELECT s FROM ScriptRemote s")})
public class ScriptRemote implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "url")
private String url;
@Basic(optional = false)
@Column(name = "port")
private int port;
@JoinColumn(name = "script", referencedColumnName = "id")
@ManyToOne(optional = false)
private Script script;
@JoinColumn(name = "credentials", referencedColumnName = "id")
@ManyToOne(optional = false)
private Credentials credentials;
public ScriptRemote() {
}
public ScriptRemote(Integer id) {
this.id = id;
}
public ScriptRemote(Integer id, String url, int port) {
this.id = id;
this.url = url;
this.port = port;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public Script getScript() {
return script;
}
public void setScript(Script script) {
this.script = script;
}
public Credentials getCredentials() {
return credentials;
}
public void setCredentials(Credentials credentials) {
this.credentials = credentials;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ScriptRemote)) {
return false;
}
ScriptRemote other = (ScriptRemote) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.ScriptRemote[ id=" + id + " ]";
}
}
@@ -0,0 +1,209 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "script_schedule", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "ScriptSchedule.findAll", query = "SELECT s FROM ScriptSchedule s")})
public class ScriptSchedule implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "job_id")
private String jobId;
@Basic(optional = false)
@Column(name = "start_datetime")
@Temporal(TemporalType.TIMESTAMP)
private Date startDatetime;
@Column(name = "end_datetime")
@Temporal(TemporalType.TIMESTAMP)
private Date endDatetime;
@Column(name = "max_executions")
private Integer maxExecutions;
@Column(name = "current_execution_count")
private Integer currentExecutionCount;
@Column(name = "last_run")
@Temporal(TemporalType.TIMESTAMP)
private Date lastRun;
@Column(name = "execution_status")
private Integer executionStatus;
@Basic(optional = false)
@Column(name = "finished")
private short finished;
@JoinColumn(name = "frequency", referencedColumnName = "id")
@ManyToOne(optional = false)
private ScheduleFrequency frequency;
@JoinColumn(name = "script", referencedColumnName = "id")
@ManyToOne(optional = false)
private Script script;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "scheduleJobId")
private List<ScriptScheduleResults> scriptScheduleResultsList;
public ScriptSchedule() {
}
public ScriptSchedule(Integer id) {
this.id = id;
}
public ScriptSchedule(Integer id, String jobId, Date startDatetime, short finished) {
this.id = id;
this.jobId = jobId;
this.startDatetime = startDatetime;
this.finished = finished;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getJobId() {
return jobId;
}
public void setJobId(String jobId) {
this.jobId = jobId;
}
public Date getStartDatetime() {
return startDatetime;
}
public void setStartDatetime(Date startDatetime) {
this.startDatetime = startDatetime;
}
public Date getEndDatetime() {
return endDatetime;
}
public void setEndDatetime(Date endDatetime) {
this.endDatetime = endDatetime;
}
public Integer getMaxExecutions() {
return maxExecutions;
}
public void setMaxExecutions(Integer maxExecutions) {
this.maxExecutions = maxExecutions;
}
public Integer getCurrentExecutionCount() {
return currentExecutionCount;
}
public void setCurrentExecutionCount(Integer currentExecutionCount) {
this.currentExecutionCount = currentExecutionCount;
}
public Date getLastRun() {
return lastRun;
}
public void setLastRun(Date lastRun) {
this.lastRun = lastRun;
}
public Integer getExecutionStatus() {
return executionStatus;
}
public void setExecutionStatus(Integer executionStatus) {
this.executionStatus = executionStatus;
}
public short getFinished() {
return finished;
}
public void setFinished(short finished) {
this.finished = finished;
}
public ScheduleFrequency getFrequency() {
return frequency;
}
public void setFrequency(ScheduleFrequency frequency) {
this.frequency = frequency;
}
public Script getScript() {
return script;
}
public void setScript(Script script) {
this.script = script;
}
public List<ScriptScheduleResults> getScriptScheduleResultsList() {
return scriptScheduleResultsList;
}
public void setScriptScheduleResultsList(List<ScriptScheduleResults> scriptScheduleResultsList) {
this.scriptScheduleResultsList = scriptScheduleResultsList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ScriptSchedule)) {
return false;
}
ScriptSchedule other = (ScriptSchedule) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.ScriptSchedule[ id=" + id + " ]";
}
}
@@ -0,0 +1,160 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "script_schedule_results", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "ScriptScheduleResults.findAll", query = "SELECT s FROM ScriptScheduleResults s")})
public class ScriptScheduleResults implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "exit_status")
private short exitStatus;
@Basic(optional = false)
@Lob
@Column(name = "results")
private byte[] results;
@Basic(optional = false)
@Column(name = "start_time")
@Temporal(TemporalType.TIMESTAMP)
private Date startTime;
@Basic(optional = false)
@Column(name = "end_time")
@Temporal(TemporalType.TIMESTAMP)
private Date endTime;
@OneToMany(mappedBy = "scriptResult")
private List<ResourceFile> resourceFileList;
@JoinColumn(name = "schedule_job_id", referencedColumnName = "job_id")
@ManyToOne(optional = false)
private ScriptSchedule scheduleJobId;
public ScriptScheduleResults() {
}
public ScriptScheduleResults(Integer id) {
this.id = id;
}
public ScriptScheduleResults(Integer id, short exitStatus, byte[] results, Date startTime, Date endTime) {
this.id = id;
this.exitStatus = exitStatus;
this.results = results;
this.startTime = startTime;
this.endTime = endTime;
}
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 byte[] getResults() {
return results;
}
public void setResults(byte[] 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<ResourceFile> getResourceFileList() {
return resourceFileList;
}
public void setResourceFileList(List<ResourceFile> resourceFileList) {
this.resourceFileList = resourceFileList;
}
public ScriptSchedule getScheduleJobId() {
return scheduleJobId;
}
public void setScheduleJobId(ScriptSchedule scheduleJobId) {
this.scheduleJobId = scheduleJobId;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ScriptScheduleResults)) {
return false;
}
ScriptScheduleResults other = (ScriptScheduleResults) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.ScriptScheduleResults[ id=" + id + " ]";
}
}
@@ -0,0 +1,202 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "script_scp", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "ScriptScp.findAll", query = "SELECT s FROM ScriptScp s")})
public class ScriptScp implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "from_host")
private String fromHost;
@Basic(optional = false)
@Column(name = "from_port")
private int fromPort;
@Basic(optional = false)
@Column(name = "to_host")
private String toHost;
@Basic(optional = false)
@Column(name = "to_port")
private int toPort;
@Column(name = "data_regex")
private String dataRegex;
@Basic(optional = false)
@Column(name = "last_updated")
@Temporal(TemporalType.TIMESTAMP)
private Date lastUpdated;
@Basic(optional = false)
@Column(name = "date_created")
@Temporal(TemporalType.TIMESTAMP)
private Date dateCreated;
@JoinColumn(name = "script", referencedColumnName = "id")
@ManyToOne(optional = false)
private Script script;
@JoinColumn(name = "from_credentials", referencedColumnName = "id")
@ManyToOne(optional = false)
private Credentials fromCredentials;
@JoinColumn(name = "to_credentials", referencedColumnName = "id")
@ManyToOne(optional = false)
private Credentials toCredentials;
public ScriptScp() {
}
public ScriptScp(Integer id) {
this.id = id;
}
public ScriptScp(Integer id, String fromHost, int fromPort, String toHost, int toPort, Date lastUpdated, Date dateCreated) {
this.id = id;
this.fromHost = fromHost;
this.fromPort = fromPort;
this.toHost = toHost;
this.toPort = toPort;
this.lastUpdated = lastUpdated;
this.dateCreated = dateCreated;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getFromHost() {
return fromHost;
}
public void setFromHost(String fromHost) {
this.fromHost = fromHost;
}
public int getFromPort() {
return fromPort;
}
public void setFromPort(int fromPort) {
this.fromPort = fromPort;
}
public String getToHost() {
return toHost;
}
public void setToHost(String toHost) {
this.toHost = toHost;
}
public int getToPort() {
return toPort;
}
public void setToPort(int toPort) {
this.toPort = toPort;
}
public String getDataRegex() {
return dataRegex;
}
public void setDataRegex(String dataRegex) {
this.dataRegex = dataRegex;
}
public Date getLastUpdated() {
return lastUpdated;
}
public void setLastUpdated(Date lastUpdated) {
this.lastUpdated = lastUpdated;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public Script getScript() {
return script;
}
public void setScript(Script script) {
this.script = script;
}
public Credentials getFromCredentials() {
return fromCredentials;
}
public void setFromCredentials(Credentials fromCredentials) {
this.fromCredentials = fromCredentials;
}
public Credentials getToCredentials() {
return toCredentials;
}
public void setToCredentials(Credentials toCredentials) {
this.toCredentials = toCredentials;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ScriptScp)) {
return false;
}
ScriptScp other = (ScriptScp) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.ScriptScp[ id=" + id + " ]";
}
}
@@ -0,0 +1,117 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "script_type", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "ScriptType.findAll", query = "SELECT s FROM ScriptType s")})
public class ScriptType implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "name")
private String name;
@Basic(optional = false)
@Column(name = "display_name")
private String displayName;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "scriptType")
private List<Script> scriptList;
public ScriptType() {
}
public ScriptType(Integer id) {
this.id = id;
}
public ScriptType(Integer id, String name, String displayName) {
this.id = id;
this.name = name;
this.displayName = displayName;
}
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 getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public List<Script> getScriptList() {
return scriptList;
}
public void setScriptList(List<Script> scriptList) {
this.scriptList = scriptList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ScriptType)) {
return false;
}
ScriptType other = (ScriptType) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.ScriptType[ id=" + id + " ]";
}
}
@@ -0,0 +1,169 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "ssh_key", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "SshKey.findAll", query = "SELECT s FROM SshKey s")})
public class SshKey implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "uuid")
private String uuid;
@Basic(optional = false)
@Column(name = "name")
private String name;
@Basic(optional = false)
@Column(name = "identity")
private String identity;
@Basic(optional = false)
@Lob
@Column(name = "ssh_key")
private byte[] sshKey;
@Column(name = "passphrase")
private String passphrase;
@Basic(optional = false)
@Column(name = "date_created")
@Temporal(TemporalType.DATE)
private Date dateCreated;
@JoinColumn(name = "created_by", referencedColumnName = "id")
@ManyToOne(optional = false)
private ApplicationUser createdBy;
public SshKey() {
}
public SshKey(Integer id) {
this.id = id;
}
public SshKey(Integer id, String uuid, String name, String identity, byte[] sshKey, Date dateCreated) {
this.id = id;
this.uuid = uuid;
this.name = name;
this.identity = identity;
this.sshKey = sshKey;
this.dateCreated = dateCreated;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getIdentity() {
return identity;
}
public void setIdentity(String identity) {
this.identity = identity;
}
public byte[] getSshKey() {
return sshKey;
}
public void setSshKey(byte[] sshKey) {
this.sshKey = sshKey;
}
public String getPassphrase() {
return passphrase;
}
public void setPassphrase(String passphrase) {
this.passphrase = passphrase;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public ApplicationUser getCreatedBy() {
return createdBy;
}
public void setCreatedBy(ApplicationUser createdBy) {
this.createdBy = createdBy;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof SshKey)) {
return false;
}
SshKey other = (SshKey) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.SshKey[ id=" + id + " ]";
}
}
@@ -0,0 +1,129 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "user_attribute", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "UserAttribute.findAll", query = "SELECT u FROM UserAttribute u")})
public class UserAttribute implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "first_name")
private String firstName;
@Basic(optional = false)
@Column(name = "last_name")
private String lastName;
@JoinColumn(name = "application_user", referencedColumnName = "id")
@OneToOne(optional = false)
private ApplicationUser applicationUser;
@JoinColumn(name = "permission_group", referencedColumnName = "id")
@ManyToOne(optional = false)
private PermissionGroup permissionGroup;
public UserAttribute() {
}
public UserAttribute(Integer id) {
this.id = id;
}
public UserAttribute(Integer id, String firstName, String lastName) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public ApplicationUser getApplicationUser() {
return applicationUser;
}
public void setApplicationUser(ApplicationUser applicationUser) {
this.applicationUser = applicationUser;
}
public PermissionGroup getPermissionGroup() {
return permissionGroup;
}
public void setPermissionGroup(PermissionGroup permissionGroup) {
this.permissionGroup = permissionGroup;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof UserAttribute)) {
return false;
}
UserAttribute other = (UserAttribute) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.UserAttribute[ id=" + id + " ]";
}
}
@@ -0,0 +1,134 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.locusworks.portal.database.entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author NGAS
*/
@Entity
@Table(name = "user_password_tracking", catalog = "portal", schema = "")
@NamedQueries({
@NamedQuery(name = "UserPasswordTracking.findAll", query = "SELECT u FROM UserPasswordTracking u")})
public class UserPasswordTracking implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "password_txt")
private String passwordTxt;
@Basic(optional = false)
@Column(name = "effective_date")
@Temporal(TemporalType.DATE)
private Date effectiveDate;
@Basic(optional = false)
@Column(name = "expiration_date")
@Temporal(TemporalType.DATE)
private Date expirationDate;
@JoinColumn(name = "application_user", referencedColumnName = "id")
@ManyToOne(optional = false)
private ApplicationUser applicationUser;
public UserPasswordTracking() {
}
public UserPasswordTracking(Integer id) {
this.id = id;
}
public UserPasswordTracking(Integer id, String passwordTxt, Date effectiveDate, Date expirationDate) {
this.id = id;
this.passwordTxt = passwordTxt;
this.effectiveDate = effectiveDate;
this.expirationDate = expirationDate;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPasswordTxt() {
return passwordTxt;
}
public void setPasswordTxt(String passwordTxt) {
this.passwordTxt = passwordTxt;
}
public Date getEffectiveDate() {
return effectiveDate;
}
public void setEffectiveDate(Date effectiveDate) {
this.effectiveDate = effectiveDate;
}
public Date getExpirationDate() {
return expirationDate;
}
public void setExpirationDate(Date expirationDate) {
this.expirationDate = expirationDate;
}
public ApplicationUser getApplicationUser() {
return applicationUser;
}
public void setApplicationUser(ApplicationUser applicationUser) {
this.applicationUser = applicationUser;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof UserPasswordTracking)) {
return false;
}
UserPasswordTracking other = (UserPasswordTracking) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.locusworks.portal.database.entities.UserPasswordTracking[ id=" + id + " ]";
}
}
@@ -0,0 +1,7 @@
/**
* Package contains all the JPO Entities that map to the database
* @author NGAS
* @since 1.0.0-RELEASE
* @version 1.0
*/
package net.locusworks.portal.database.entities;
@@ -0,0 +1,30 @@
package net.locusworks.portal.database.migration;
import javax.sql.DataSource;
import org.flywaydb.core.Flyway;
/***
* Flyway migration for the database
* @author Isaac Parenteau
* @since 1.0.0-RELEASE
* @version 1.0
*/
public class PortalMigration {
/**
* Setup the flyway migration class to perform
* @param dataSource the Datasource to use for the migration
* @return Flyway migration item
*/
public static Flyway getFlyway(DataSource dataSource) {
Flyway flyway = new Flyway();
flyway.setTable("_flyway_migration");
flyway.setSchemas("portal");
flyway.setLocations("database/migration");
flyway.setOutOfOrder(false);
flyway.setDataSource(dataSource);
return flyway;
}
}
@@ -0,0 +1,32 @@
package net.locusworks.portal.database.repos;
import java.util.Date;
import java.util.List;
import java.util.Set;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
import net.locusworks.portal.database.entities.ApplicationLog;
public interface ApplicationLogRepository extends CrudRepository<ApplicationLog, Integer> {
List<ApplicationLog> findAllByOrderByTimestampDesc();
List<ApplicationLog> findByTimestampBetween(Date start, Date end);
@Query("SELECT al FROM ApplicationLog al WHERE al.timestamp <= ?1")
List<ApplicationLog> findAllBeforeGivenTimestamp(Date timestamp);
@Modifying
@Transactional
@Query("DELETE FROM ApplicationLog al WHERE al.id in ?1")
void delete(Set<Integer> ids);
@Modifying
@Transactional
@Query("DELETE FROM ApplicationLog al WHERE al.id = ?1")
void delete(Integer id);
}
@@ -0,0 +1,29 @@
package net.locusworks.portal.database.repos;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
import net.locusworks.portal.database.entities.ApplicationUser;
public interface ApplicationUserRepository extends CrudRepository<ApplicationUser, Integer> {
@Query("SELECT user FROM ApplicationUser user WHERE user.id = ?1")
ApplicationUser findOne(Integer id);
@Query("SELECT user FROM ApplicationUser user JOIN user.userPasswordTrackingList userPwTrkg WHERE user.emailAddressTxt = ?1 AND userPwTrkg.passwordTxt = ?2")
ApplicationUser lookUpUser(String username, String password);
ApplicationUser findByEmailAddressTxt(String emailAddressTxt);
@Query("SELECT count(au) FROM ApplicationUser au "
+ "JOIN au.userAttribute ua "
+ "JOIN ua.permissionGroup pg WHERE pg.name = ?1")
Integer findPermissionGroupCount(String role);
@Modifying
@Transactional
@Query("DELETE FROM ApplicationUser au WHERE au.id = ?1")
void delete(Integer id);
}
@@ -0,0 +1,17 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import net.locusworks.portal.database.entities.CredentialType;
public interface CredentialTypeRepository extends CrudRepository<CredentialType, Integer> {
CredentialType findByName(String name);
@Query("SELECT st FROM CredentialType st")
List<CredentialType> findAll();
}
@@ -0,0 +1,48 @@
package net.locusworks.portal.database.repos;
import java.math.BigInteger;
import java.util.List;
import java.util.Set;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.query.Procedure;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
import net.locusworks.portal.database.entities.Credentials;
public interface CredentialsRepository extends CrudRepository<Credentials, Integer> {
public static final String CRED_IN_USE_PROC = "credentials_in_use";
public static final String CRED_COUNT_PROC = "credential_count";
public static final String CRED_UUID_IN_PARAM = "cred_uuid";
public static final String CRED_USE_OUT_PARA = "cred_use";
public static final String CRED_COUNT_OUT_PARAM = "cred_count";
@Query("SELECT sc FROM Credentials sc WHERE sc.id = ?1")
Credentials findOne(Integer id);
Credentials findByUuid(String uuid);
@Query("SELECT sc FROM Credentials sc")
List<Credentials> findAll();
@Procedure(procedureName=CRED_IN_USE_PROC, outputParameterName=CRED_USE_OUT_PARA)
boolean inUse(@Param(CRED_UUID_IN_PARAM) String uuid);
@Procedure(procedureName=CRED_COUNT_PROC, outputParameterName=CRED_COUNT_OUT_PARAM)
BigInteger credentialCount(@Param(CRED_UUID_IN_PARAM) String uuid);
@Modifying
@Transactional
@Query("DELETE FROM Credentials param WHERE param.id in ?1")
void delete(Set<Integer> keySet);
@Modifying
@Transactional
@Query("DELETE FROM Credentials param WHERE param.id = ?1")
void delete(Integer id);
}
@@ -0,0 +1,39 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import java.util.Set;
import javax.transaction.Transactional;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import net.locusworks.portal.database.entities.EmailTemplate;
public interface EmailTemplateRepository extends CrudRepository<EmailTemplate, Integer> {
@Query("SELECT et FROM EmailTemplate et WHERE et.id = ?1")
EmailTemplate findOne(Integer id);
EmailTemplate findByEmailName(String emailName);
@Query("SELECT et FROM EmailTemplate et")
List<EmailTemplate> findAll();
@Modifying
@Transactional
@Query("DELETE FROM EmailTemplate et WHERE et.emailName = ?1")
void delete(String key);
@Modifying
@Transactional
@Query("DELETE FROM EmailTemplate et WHERE et.id = ?1")
void delete(Integer id);
@Modifying
@Transactional
@Query("DELETE FROM EmailTemplate et WHERE et.id IN ?1")
void delete(Set<Integer> id);
}
@@ -0,0 +1,34 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import java.util.Set;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
import net.locusworks.portal.database.entities.EnvironmentVariable;
public interface EnvironmentVariableRepository extends CrudRepository<EnvironmentVariable, Integer> {
@Query("SELECT ev FROM EnvironmentVariable ev")
List<EnvironmentVariable> findAll();
@Query("SELECT ev FROM EnvironmentVariable ev WHERE id in ?1")
List<EnvironmentVariable> findAllById(Set<Integer> ids);
@Query("SELECT ev FROM EnvironmentVariable ev WHERE ev.id = ?1")
EnvironmentVariable findOne(Integer id);
@Modifying
@Transactional
@Query("DELETE FROM EnvironmentVariable ev WHERE ev.id in ?1")
void delete(Set<Integer> ids);
@Modifying
@Transactional
@Query("DELETE FROM EnvironmentVariable ev WHERE ev.id = ?1")
void delete(Integer id);
}
@@ -0,0 +1,35 @@
package net.locusworks.portal.database.repos;
import java.util.Set;
import java.util.List;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
import net.locusworks.portal.database.entities.GitRepo;
public interface GitRepository extends CrudRepository<GitRepo, Integer> {
GitRepo findByName(String name);
boolean existsByName(String name);
@Query("SELECT gr FROM GitRepo gr")
List<GitRepo> findAll();
@Query("SELECT c FROM GitRepo c WHERE c.id = ?1")
GitRepo findOne(Integer id);
@Modifying
@Transactional
@Query("DELETE FROM GitRepo gr WHERE gr.id = ?1")
void delete(Integer id);
@Modifying
@Transactional
@Query("DELETE FROM GitRepo gr WHERE gr.id in ?1")
void delete(Set<Integer> ids);
}
@@ -0,0 +1,48 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import java.util.Set;
import javax.transaction.Transactional;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import net.locusworks.portal.database.entities.KeyValue;
/**
* The key value repository to handle CRUD operations on the key_value table
* This table stores key value pairs that can be used throughout the application and any
* value can be stored with a unique key
* @author Isaac Parenteau
* @since 1.0.0-RELEASE
*/
public interface KeyValueRepository extends CrudRepository<KeyValue, Integer> {
@Query("SELECT kv FROM KeyValue kv WHERE kv.id = ?1")
KeyValue findOne(Integer id);
KeyValue findByReferenceKey(String key);
List<KeyValue> findByReferenceKeyIn(Set<String> key);
@Query("SELECT CASE WHEN COUNT(kv) > 0 THEN true ELSE false END "
+ "FROM KeyValue kv "
+ "WHERE kv.referenceKey = ?1")
boolean existsByReferenceKey(String key);
@Modifying
@Transactional
@Query("DELETE FROM KeyValue kv WHERE kv.referenceKey = ?1")
void delete(String key);
@Modifying
@Transactional
@Query("DELETE FROM KeyValue kv WHERE kv.id = ?1")
void delete(Integer id);
@Modifying
@Transactional
@Query("DELETE FROM KeyValue kv WHERE kv.id IN ?1")
void delete(Set<Integer> id);
}
@@ -0,0 +1,45 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import java.util.Set;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
import net.locusworks.portal.database.entities.Password;
public interface PasswordRepository extends CrudRepository<Password, Integer> {
Password findByName(String name);
Password findByUuid(String uid);
@Query("SELECT p FROM Password p")
List<Password> findAll();
@Query("SELECT c FROM Password c WHERE c.id = ?1")
Password findOne(Integer id);
@Query("SELECT count(c) FROM Password p, Credentials c "
+ "WHERE p.uuid = c.uuid "
+ "AND c.uuid = ?1")
Integer countPasswordUse(String uuid);
@Modifying
@Transactional
@Query("DELETE FROM Password key WHERE key.id = ?1")
void delete(Integer id);
@Modifying
@Transactional
@Query("DELETE FROM Password key WHERE key.id in ?1")
void delete(Set<Integer> id);
@Modifying
@Transactional
@Query("DELETE FROM Password key WHERE key.uuid = ?1")
void delete(String uid);
}
@@ -0,0 +1,18 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import net.locusworks.portal.database.entities.PermissionCategory;
public interface PermissionCategoryRepository extends CrudRepository<PermissionCategory, Integer> {
@Query("SELECT pg FROM PermissionCategory pg")
List<PermissionCategory> findAll();
@Query
PermissionCategory findByName(String name);
}
@@ -0,0 +1,38 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import net.locusworks.portal.database.entities.ApplicationUser;
import net.locusworks.portal.database.entities.Permission;
import net.locusworks.portal.database.entities.PermissionGroup;
import net.locusworks.portal.database.entities.PermissionGroupPermission;
public interface PermissionGroupPermissionRepository extends CrudRepository<PermissionGroupPermission, Integer> {
List<PermissionGroupPermission> findByPermissionGroup(PermissionGroup group);
PermissionGroupPermission findByPermissionGroupAndPermission(PermissionGroup permissionGroup, Permission permission);
@Query("SELECT pgp FROM PermissionGroupPermission pgp "
+ "JOIN pgp.permissionGroup pg "
+ "JOIN pgp.permission p "
+ "WHERE pg.id = ?1 AND p.id = ?2")
PermissionGroupPermission findByPermissionGroupAndPermission(Integer permissionGroupId, Integer permissionId);
@Query("SELECT pgp FROM PermissionGroupPermission pgp "
+ "JOIN pgp.permissionGroup pg "
+ "JOIN pg.userAttributeList ua "
+ "WHERE ua.applicationUser = ?1")
List<PermissionGroupPermission> findByApplicationUser(ApplicationUser user);
@Query("SELECT pgp FROM PermissionGroupPermission pgp "
+ "JOIN pgp.permissionGroup pg "
+ "JOIN pg.userAttributeList ua "
+ "JOIN ua.applicationUser au "
+ "WHERE au.id = ?1")
List<PermissionGroupPermission> findByApplicationUser(Integer auId);
}
@@ -0,0 +1,42 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import java.util.Set;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
import net.locusworks.portal.database.entities.PermissionGroup;
public interface PermissionGroupRepository extends CrudRepository<PermissionGroup, Integer> {
@Query("SELECT pg FROM PermissionGroup pg")
List<PermissionGroup> findAll();
PermissionGroup findByName(String name);
@Query("SELECT au.id FROM PermissionGroup pg "
+ "JOIN pg.userAttributeList ua "
+ "JOIN ua.applicationUser au "
+ "WHERE pg.name = ?1")
Set<Integer> findApplcationUserIdsFromPermissionGroup(String permissionGroup);
@Query("SELECT count(au.id) FROM PermissionGroup pg "
+ "JOIN pg.userAttributeList ua "
+ "JOIN ua.applicationUser au "
+ "WHERE pg.name = ?1")
Integer countApplicationUsersInPermissionGroup(String permissionGroup);
@Modifying
@Query("DELETE FROM PermissionGroup pf WHERE pf.id = ?1")
@Transactional
void delete(Integer id);
@Modifying
@Query("DELETE FROM PermissionGroup pf WHERE pf.id in ?1")
@Transactional
void delete(Set<Integer> id);
}
@@ -0,0 +1,24 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import net.locusworks.portal.database.entities.Permission;
import net.locusworks.portal.database.entities.PermissionCategory;
public interface PermissionRepository extends CrudRepository<Permission, Integer> {
@Query("SELECT p FROM Permission p")
List<Permission> findAll();
@Query("SELECT p FROM Permission p WHERE p.id = ?1")
Permission findOne(Integer id);
@Query
Permission findByName(String name);
List<Permission> findByPermissionCategory(PermissionCategory category);
}
@@ -0,0 +1,59 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import java.util.Set;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
import net.locusworks.portal.database.entities.ResourceFile;
import net.locusworks.portal.database.entities.ScriptScheduleResults;
public interface ResourceFileRepository extends CrudRepository<ResourceFile, Integer> {
@Query("SELECT count(rf) FROM ResourceFile rf "
+ "JOIN rf.scriptResult sr "
+ "JOIN sr.scheduleJobId ss "
+ "JOIN ss.script s "
+ "WHERE s.id = ?1")
Integer resourceFileCountByScriptId(Integer scriptId);
@Query("SELECT count(rf) FROM ResourceFile rf "
+ "JOIN rf.scriptResult sr "
+ "JOIN sr.scheduleJobId s "
+ "WHERE s.id = ?1")
Integer resourceFileCountByScriptScheduleId(Integer id);
List<ResourceFile> findByScriptResult(ScriptScheduleResults results);
@Query("SELECT rf FROM ResourceFile rf "
+ "JOIN rf.scriptResult sr "
+ "WHERE sr.id = ?1")
List<ResourceFile> findByScriptResultId(Integer id);
@Query("SELECT rf FROM ResourceFile rf "
+ "JOIN rf.scriptResult sr "
+ "WHERE sr.id in ?1")
List<ResourceFile> findByScriptResultIds(Set<Integer> ids);
@Query("SELECT rf FROM ResourceFile rf "
+ "JOIN rf.scriptResult sr "
+ "JOIN sr.scheduleJobId s "
+ "WHERE s.id = ?1")
List<ResourceFile> findByScriptScheduleId(Integer id);
ResourceFile findByScriptResultAndFileName(ScriptScheduleResults results, String fileName);
@Modifying
@Transactional
@Query("DELETE FROM ResourceFile s WHERE s.id = ?1")
void delete(Integer id);
@Modifying
@Transactional
@Query("DELETE FROM ResourceFile s WHERE s.id in ?1")
void delete(Set<Integer> id);
}
@@ -0,0 +1,17 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import net.locusworks.portal.database.entities.ScheduleFrequency;
public interface ScheduleFrequencyRepository extends CrudRepository<ScheduleFrequency, Integer> {
ScheduleFrequency findByName(String name);
@Query("SELECT sf FROM ScheduleFrequency sf")
List<ScheduleFrequency> findAll();
}
@@ -0,0 +1,33 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import java.util.Set;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
import net.locusworks.portal.database.entities.Script;
import net.locusworks.portal.database.entities.ScriptChain;
public interface ScriptChainRepository extends CrudRepository<ScriptChain, Integer> {
@Query("SELECT sc FROM ScriptChain sc")
List<ScriptChain> findAll();
List<ScriptChain> findByParentScript(Script parent);
List<ScriptChain> findByParentScriptAndExitStatus(Script parent, Integer exitStatus);
@Modifying
@Transactional
@Query("DELETE FROM Script s WHERE s.id = ?1")
void delete(Integer id);
@Modifying
@Transactional
@Query("DELETE FROM Script s WHERE s.id in ?1")
void delete(Set<Integer> id);
}
@@ -0,0 +1,28 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import java.util.Set;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
import net.locusworks.portal.database.entities.ScriptEmail;
import net.locusworks.portal.database.entities.ScriptEmailRecipient;
public interface ScriptEmailRecipientRepository extends CrudRepository<ScriptEmailRecipient, Integer> {
List<ScriptEmailRecipient> findByScriptEmail(ScriptEmail scriptEmail);
@Modifying
@Transactional
@Query("DELETE FROM ScriptEmailRecipient s WHERE s.id = ?1")
void delete(Integer id);
@Modifying
@Transactional
@Query("DELETE FROM ScriptEmailRecipient s WHERE s.id in ?1")
void delete(Set<Integer> id);
}
@@ -0,0 +1,29 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import java.util.Set;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
import net.locusworks.portal.database.entities.Script;
import net.locusworks.portal.database.entities.ScriptEmail;
public interface ScriptEmailRepository extends CrudRepository<ScriptEmail, Integer> {
@Query("SELECT se FROM ScriptEmail se WHERE se.script = ?1")
List<ScriptEmail> findByScript(Script script);
@Modifying
@Transactional
@Query("DELETE FROM ScriptEmail s WHERE s.id = ?1")
void delete(Integer id);
@Modifying
@Transactional
@Query("DELETE FROM ScriptEmail s WHERE s.id in ?1")
void delete(Set<Integer> id);
}
@@ -0,0 +1,32 @@
package net.locusworks.portal.database.repos;
import java.util.Set;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
import net.locusworks.portal.database.entities.Script;
import net.locusworks.portal.database.entities.ScriptEnvironmentVariable;
public interface ScriptEnvironmentVariableRepository extends CrudRepository<ScriptEnvironmentVariable, Integer> {
@Query("SELECT sev FROM ScriptEnvironmentVariable sev WHERE sev.id = ?1")
ScriptEnvironmentVariable findOne(Integer id);
Set<ScriptEnvironmentVariable> findByScript(Script script);
Set<ScriptEnvironmentVariable> findByIdIn(Set<Integer> ids);
@Modifying
@Transactional
@Query("DELETE FROM ScriptEnvironmentVariable param WHERE param.id in ?1")
void delete(Set<Integer> keySet);
@Modifying
@Transactional
@Query("DELETE FROM ScriptEnvironmentVariable param WHERE param.id = ?1")
void delete(Integer id);
}
@@ -0,0 +1,28 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import java.util.Set;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
import net.locusworks.portal.database.entities.Script;
import net.locusworks.portal.database.entities.ScriptParameter;
public interface ScriptParameterRepository extends CrudRepository<ScriptParameter, Integer> {
List<ScriptParameter> findByScript(Script script);
@Modifying
@Transactional
@Query("DELETE FROM ScriptParameter param WHERE param.id in ?1")
void delete(Set<Integer> keySet);
@Modifying
@Transactional
@Query("DELETE FROM ScriptParameter param WHERE param.id = ?1")
void delete(Integer id);
}
@@ -0,0 +1,28 @@
package net.locusworks.portal.database.repos;
import java.util.Set;
import javax.transaction.Transactional;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import net.locusworks.portal.database.entities.Script;
import net.locusworks.portal.database.entities.ScriptRemote;
public interface ScriptRemoteRepository extends CrudRepository<ScriptRemote, Integer> {
ScriptRemote findByScript(Script script);
@Query("DELETE FROM ScriptRemote sr WHERE sr.id = ?1")
@Modifying
@Transactional
void delete(Integer id);
@Query("DELETE FROM ScriptRemote sr WHERE sr.id in ?1")
@Modifying
@Transactional
void delete(Set<Integer> id);
}
@@ -0,0 +1,37 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.lang.Nullable;
import org.springframework.transaction.annotation.Transactional;
import net.locusworks.portal.database.entities.Script;
public interface ScriptRepository extends CrudRepository<Script, Integer> {
Optional<Script> findByScriptName(String name);
Optional<Script> findByIdOrScriptName(@Nullable Integer id, @Nullable String name);
@Query("SELECT s FROM Script s")
List<Script> findAll();
@Query("SELECT s FROM Script s WHERE s.id = ?1")
Script findOne(Integer id);
@Modifying
@Transactional
@Query("DELETE FROM Script s WHERE s.id = ?1")
void delete(Integer id);
@Modifying
@Transactional
@Query("DELETE FROM Script s WHERE s.id in ?1")
void delete(Set<Integer> id);
}
@@ -0,0 +1,37 @@
package net.locusworks.portal.database.repos;
import java.util.Set;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
import net.locusworks.portal.database.entities.ScheduleFrequency;
import net.locusworks.portal.database.entities.Script;
import net.locusworks.portal.database.entities.ScriptSchedule;
public interface ScriptScheduleRepository extends CrudRepository<ScriptSchedule, Integer> {
Set<ScriptSchedule> findByScript(Script script);
ScriptSchedule findByScriptAndFrequency(Script script, ScheduleFrequency frequency);
ScriptSchedule findByJobId(String jobId);
@Modifying
@Transactional
@Query("DELETE FROM ScriptSchedule param WHERE param.id in ?1")
void delete(Set<Integer> keySet);
@Modifying
@Transactional
@Query("DELETE FROM ScriptSchedule param WHERE param.id = ?1")
void delete(Integer id);
@Modifying
@Transactional
@Query("DELETE FROM ScriptSchedule param WHERE param.jobId = ?1")
void delete(String jobId);
}
@@ -0,0 +1,17 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import net.locusworks.portal.database.entities.ScriptScheduleResults;
public interface ScriptScheduleResultsRepository extends CrudRepository<ScriptScheduleResults, Integer> {
@Query("SELECT ssr FROM ScriptScheduleResults ssr "
+ "JOIN ssr.scheduleJobId ss "
+ "WHERE ss.jobId = ?1")
List<ScriptScheduleResults> findByScheduleJobId(String jobId);
}
@@ -0,0 +1,28 @@
package net.locusworks.portal.database.repos;
import java.util.Set;
import javax.transaction.Transactional;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import net.locusworks.portal.database.entities.Script;
import net.locusworks.portal.database.entities.ScriptScp;
public interface ScriptScpRepository extends CrudRepository<ScriptScp, Integer> {
ScriptScp findByScript(Script script);
@Query("DELETE FROM ScriptScp sr WHERE sr.id = ?1")
@Modifying
@Transactional
void delete(Integer id);
@Query("DELETE FROM ScriptScp sr WHERE sr.id in ?1")
@Modifying
@Transactional
void delete(Set<Integer> id);
}
@@ -0,0 +1,17 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import net.locusworks.portal.database.entities.ScriptType;
public interface ScriptTypeRepository extends CrudRepository<ScriptType, Integer> {
ScriptType findByName(String name);
@Query("SELECT st FROM ScriptType st")
List<ScriptType> findAll();
}
@@ -0,0 +1,44 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import java.util.Set;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
import net.locusworks.portal.database.entities.SshKey;
public interface SshKeyRepository extends CrudRepository<SshKey, Integer> {
SshKey findByName(String keyName);
SshKey findByUuid(String uid);
@Query("SELECT p FROM SshKey p")
List<SshKey> findAll();
@Query("SELECT c FROM SshKey c WHERE c.id = ?1")
SshKey findOne(Integer id);
@Query("SELECT count(c) FROM SshKey p, Credentials c "
+ "WHERE p.uuid = c.uuid "
+ "AND c.uuid = ?1")
Integer countSshKeyUse(String uuid);
@Modifying
@Transactional
@Query("DELETE FROM SshKey key WHERE key.id = ?1")
void delete(Integer id);
@Modifying
@Transactional
@Query("DELETE FROM SshKey key WHERE key.id in ?1")
void delete(Set<Integer> id);
@Modifying
@Transactional
@Query("DELETE FROM SshKey key WHERE key.uuid = ?1")
void delete(String uid);
}
@@ -0,0 +1,25 @@
package net.locusworks.portal.database.repos;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
import net.locusworks.portal.database.entities.ApplicationUser;
import net.locusworks.portal.database.entities.UserAttribute;
public interface UserAttributeRepository extends CrudRepository<UserAttribute, Integer> {
@Query("SELECT ua FROM UserAttribute ua "
+ "JOIN FETCH ua.permissionGroup "
+ "JOIN ua.applicationUser au "
+ "WHERE au.id = ?1")
UserAttribute findByApplicationUserId(Integer auId);
UserAttribute findByApplicationUser(ApplicationUser au);
@Modifying
@Transactional
@Query("DELETE FROM UserAttribute au WHERE au.id = ?1")
void delete(Integer id);
}
@@ -0,0 +1,14 @@
package net.locusworks.portal.database.repos;
import java.util.List;
import org.springframework.data.repository.CrudRepository;
import net.locusworks.portal.database.entities.ApplicationUser;
import net.locusworks.portal.database.entities.UserPasswordTracking;
public interface UserPasswordTrackingRepository extends CrudRepository<UserPasswordTracking, Integer> {
public List<UserPasswordTracking> findByApplicationUserOrderByEffectiveDateDesc(ApplicationUser au);
}
@@ -0,0 +1,8 @@
/**
* Repository library is used to handle the CRUD (crate, read, update, delete) operations on all the JPO Entities
* This is handled through Spring JPA and Hibernate.
* @author Isaac Parenteau
* @since 1.0.0-RELEASE
* @version 1.0
*/
package net.locusworks.portal.database.repos;
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="portal_pu" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>net.locusworks.portal.database.entities.ApplicationLog</class>
<class>net.locusworks.portal.database.entities.ApplicationUser</class>
<class>net.locusworks.portal.database.entities.Credentials</class>
<class>net.locusworks.portal.database.entities.EnvironmentVariable</class>
<class>net.locusworks.portal.database.entities.GitRepo</class>
<class>net.locusworks.portal.database.entities.HashType</class>
<class>net.locusworks.portal.database.entities.Keyword</class>
<class>net.locusworks.portal.database.entities.Password</class>
<class>net.locusworks.portal.database.entities.Permission</class>
<class>net.locusworks.portal.database.entities.PermissionCategory</class>
<class>net.locusworks.portal.database.entities.PermissionGroup</class>
<class>net.locusworks.portal.database.entities.PermissionGroupPermission</class>
<class>net.locusworks.portal.database.entities.ResourceFile</class>
<class>net.locusworks.portal.database.entities.ScheduleFrequency</class>
<class>net.locusworks.portal.database.entities.Script</class>
<class>net.locusworks.portal.database.entities.ScriptChain</class>
<class>net.locusworks.portal.database.entities.ScriptEnvironmentVariable</class>
<class>net.locusworks.portal.database.entities.ScriptParameter</class>
<class>net.locusworks.portal.database.entities.ScriptRemote</class>
<class>net.locusworks.portal.database.entities.ScriptSchedule</class>
<class>net.locusworks.portal.database.entities.ScriptScheduleResults</class>
<class>net.locusworks.portal.database.entities.ScriptScp</class>
<class>net.locusworks.portal.database.entities.ScriptType</class>
<class>net.locusworks.portal.database.entities.SshKey</class>
<class>net.locusworks.portal.database.entities.UserAttribute</class>
<class>net.locusworks.portal.database.entities.UserPasswordTracking</class>
<class>net.locusworks.portal.database.entities.CredentialType</class>
<class>net.locusworks.portal.database.entities.KeyValue</class>
<class>net.locusworks.portal.database.entities.EmailTemplate</class>
<class>net.locusworks.portal.database.entities.ScriptEmail</class>
<class>net.locusworks.portal.database.entities.ScriptEmailRecipient</class>
<properties>
<property name="javax.persistence.jdbc.url" value=""/>
<property name="javax.persistence.jdbc.user" value=""/>
<property name="javax.persistence.jdbc.driver" value=""/>
<property name="javax.persistence.jdbc.password" value=""/>
</properties>
</persistence-unit>
</persistence>
@@ -0,0 +1,114 @@
INSERT IGNORE INTO portal.script_type (id, name, display_name)
VALUES
(null, 'LOCAL', 'Local Execution'),
(null, 'REMOTE', 'Remote Execution'),
(null, 'SCP', 'Secure Copy');
COMMIT;
INSERT IGNORE INTO portal.schedule_frequency (id, name, display_name)
VALUES
(null, 'HOURLY', 'Hourly'),
(null, 'DAILY', 'Daily'),
(null, 'WEEKLY', 'Weekly'),
(null, 'MONTHLY', 'Monthly'),
(null, 'YEARLY', 'Yearly'),
(null, 'NOW', 'Now'),
(null, 'SPECIFIC', 'Specific'),
(null, 'TRIGGERED', 'Triggered');
COMMIT;
INSERT IGNORE INTO portal.credential_type (id, name, display_name)
VALUES
(null, 'SSH', 'SSH Key'),
(null, 'PASSWD', 'Username/Password');
COMMIT;
insert into portal.hash_type (name, display_name, valid, last_modified, date_created)
values
('MD2', 'MD2', 0, curdate(), curdate()),
('MD5', 'MD5', 1, curdate(), curdate()),
('SHA-1', 'SHA 1', 1, curdate(), curdate()),
('SHA-256', 'SHA 256', 0, curdate(), curdate()),
('SHA-384', 'SHA 384', 0, curdate(), curdate()),
('SHA-512', 'SHA 512', 1, curdate(), curdate());
COMMIT;
insert into portal.permission_group
values
(null, 'ADMIN', 'Administrator', 1, curdate(), curdate()),
(null, 'USER', 'User', 1, curdate(), curdate());
COMMIT;
insert into portal.permission_category
values
(null, 'TABS', 'Tabs', curdate(), curdate()),
(null, 'SCRIPT_TAB', 'Scripts Tab', curdate(), curdate()),
(null, 'GIT_TAB', 'Git Tab', curdate(), curdate()),
(null, 'CREDS_TAB', 'Credentials Tab', curdate(), curdate()),
(null, 'EMAIL_TAB', 'Email Tab', curdate(), curdate()),
(null, 'USER_TAB', 'User Tab', curdate(), curdate()),
(null, 'PERMISSION_TAB', 'Permissions Tab', curdate(), curdate()),
(null, 'ENV_VAR_TAB', 'Environment Variables Tab', curdate(), curdate()),
(null, 'LOG_TAB', 'Log Tab', curdate(), curdate()),
(null, 'CONFIGURATION', 'Configuration', curdate(), curdate());
COMMIT;
insert into portal.permission
values
(null, 'VIEW_SCRIPT_TAB', 'View Scripts Tab', (select id from portal.permission_category where name='TABS'), curdate(), curdate()),
(null, 'VIEW_GIT_TAB', 'View Git Tab', (select id from portal.permission_category where name='TABS'), curdate(), curdate()),
(null, 'VIEW_USER_TAB', 'View User Tab', (select id from portal.permission_category where name='TABS'), curdate(), curdate()),
(null, 'VIEW_CREDS_TAB', 'View Credentials Tab', (select id from portal.permission_category where name='TABS'), curdate(), curdate()),
(null, 'VIEW_EMAIL_TAB', 'View Email Tab', (select id from portal.permission_category where name='TABS'), curdate(), curdate()),
(null, 'VIEW_LOG_TAB', 'View System Log Tab', (select id from portal.permission_category where name='TABS'), curdate(), curdate()),
(null, 'VIEW_PERMISSION_TAB', 'View Permission Tab', (select id from portal.permission_category where name='TABS'), curdate(), curdate()),
(null, 'VIEW_ENV_VARS_TAB', 'View Environment Variables Tab', (select id from portal.permission_category where name='TABS'), curdate(), curdate()),
(null, 'VIEW_CONFIG', 'View Configuration Settings', (select id from portal.permission_category where name='CONFIGURATION'), curdate(), curdate()),
(null, 'CHANGE_CONFIG', 'Change Configuration Settings', (select id from portal.permission_category where name='CONFIGURATION'), curdate(), curdate()),
(null, 'VIEW_LOG_LEVELS', 'View Log Levels', (select id from portal.permission_category where name='CONFIGURATION'), curdate(), curdate()),
(null, 'CHANGE_LOG_LEVELS', 'Change Log Levels', (select id from portal.permission_category where name='CONFIGURATION'), curdate(), curdate()),
(null, 'VIEW_SMTP_CONFIG', 'View SMTP Configuration', (select id from portal.permission_category where name='CONFIGURATION'), curdate(), curdate()),
(null, 'EDIT_SMTP_CONFIG', 'Edit SMTP Cconfiguration', (select id from portal.permission_category where name='CONFIGURATION'), curdate(), curdate()),
(null, 'UPDATE_SEED_VALUE', 'Update AES Seed Value', (select id from portal.permission_category where name='CONFIGURATION'), curdate(), curdate()),
(null, 'ADD_USERS', 'Add/Edit Users', (select id from portal.permission_category where name='USER_TAB'), curdate(), curdate()),
(null, 'DELETE_USERS', 'Delete Users', (select id from portal.permission_category where name='USER_TAB'), curdate(), curdate()),
(null, 'PURGE_LOGS', 'Purge System Logs', (select id from portal.permission_category where name='LOG_TAB'), curdate(), curdate()),
(null, 'ADD_PERMS', 'Add/Edit Permissions', (select id from portal.permission_category where name='PERMISSION_TAB'), curdate(), curdate()),
(null, 'DELETE_PERMS', 'Delete Permissions', (select id from portal.permission_category where name='PERMISSION_TAB'), curdate(), curdate()),
(null, 'ADD_CREDENTIALS', 'Add Credentials', (select id from portal.permission_category where name='CREDS_TAB'), curdate(), curdate()),
(null, 'DELETE_CREDENTIALS', 'Delete Credentials', (select id from portal.permission_category where name='CREDS_TAB'), curdate(), curdate()),
(null, 'ADD_GIT_REPO', 'Add Git Repository', (select id from portal.permission_category where name='GIT_TAB'), curdate(), curdate()),
(null, 'PULL_GIT_REPO', 'Pull Git Repository', (select id from portal.permission_category where name='GIT_TAB'), curdate(), curdate()),
(null, 'DELETE_GIT_REPO', 'Delete Git Repository', (select id from portal.permission_category where name='GIT_TAB'), curdate(), curdate()),
(null, 'ADD_EMAIL', 'Add Email Template', (select id from portal.permission_category where name='EMAIL_TAB'), curdate(), curdate()),
(null, 'DELETE_EMAIL', 'Delete Email Template', (select id from portal.permission_category where name='EMAIL_TAB'), curdate(), curdate()),
(null, 'RUN_SCRIPT', 'Run Script', (select id from portal.permission_category where name='SCRIPT_TAB'), curdate(), curdate()),
(null, 'ADD_SCRIPT', 'Add Script', (select id from portal.permission_category where name='SCRIPT_TAB'), curdate(), curdate()),
(null, 'DELETE_SCRIPT', 'Delete Script', (select id from portal.permission_category where name='SCRIPT_TAB'), curdate(), curdate()),
(null, 'VIEW_SCRIPT_SCHED_STATUS', 'View Script Schedule Status', (select id from portal.permission_category where name='SCRIPT_TAB'), curdate(), curdate()),
(null, 'DELETE_SCRIPT_SCHED_STATUS', 'Delete Script Schedule', (select id from portal.permission_category where name='SCRIPT_TAB'), curdate(), curdate()),
(null, 'DELETE_FILE', 'Delete File', (select id from portal.permission_category where name='SCRIPT_TAB'), curdate(), curdate()),
(null, 'ADD_ENV_VARS', 'Add Enviornment Variable', (select id from portal.permission_category where name='ENV_VAR_TAB'), curdate(), curdate()),
(null, 'DELETE_ENV_VARS', 'Delete Enviornment Variable', (select id from portal.permission_category where name='ENV_VAR_TAB'), curdate(), curdate()),
(null, 'VIEW_ENV_VARS', 'View Enviornment Variable', (select id from portal.permission_category where name='ENV_VAR_TAB'), curdate(), curdate());
COMMIT;
insert into portal.permission_group_permission
(select null as id,
(select id from portal.permission_group where name='ADMIN') as permission_group,
id as permission,
true as allowed,
curdate() as date_created,
curdate() as last_modified from portal.permission
);
COMMIT;
insert into portal.permission_group_permission
(select null as id,
(select id from portal.permission_group where name='USER') as permission_group,
id as permission,
case when name in ('VIEW_SCRIPT_TAB', 'VIEW_HASH_TYPES', 'VIEW_GIT_TAB') then true else false end as allowed,
curdate() as date_created,
curdate() as last_modified from portal.permission
);
COMMIT;
@@ -0,0 +1,22 @@
INSERT ignore INTO portal.application_user (id, email_address_txt, effective_date, expiration_date)
values
(null, 'portalAdmin@locusworks.net', CURDATE(), '9999/12/31');
commit;
INSERT ignore INTO portal.user_attribute (id, application_user, permission_group, first_name, last_name)
values
(null,
(select id from portal.application_user where email_address_txt = 'portalAdmin@locusworks.net'),
(select id from portal.permission_group where name = 'ADMIN'),
'Portal', 'Admin');
commit;
INSERT ignore INTO portal.user_password_tracking (id, application_user, password_txt, effective_date, expiration_date)
values
(null,
(select id from portal.application_user where email_address_txt = 'portalAdmin@locusworks.net'),
'1000:9284df482920e9660aacca58f3a2ca7713d1e369e81e5d13:bf409cc87063667241984e044a1f8f798f18511b4242013d', curdate(), '9999/12/31');
commit;
@@ -0,0 +1,34 @@
USE portal;
DELIMITER $$
CREATE PROCEDURE credential_count(IN cred_uuid VARCHAR(50), OUT cred_count BIGINT)
BEGIN
DECLARE CRED_ID INT(11) DEFAULT 0;
DECLARE REPO_COUNT BIGINT DEFAULT 0;
DECLARE SCRIPT_REMOTE_COUNT BIGINT DEFAULT 0;
DECLARE SCRIPT_SCP_COUNT BIGINT DEFAULT 0;
SELECT ID INTO CRED_ID FROM portal.credentials WHERE uuid = cred_uuid;
SELECT count(*) INTO REPO_COUNT FROM portal.git_repo WHERE git_repo.credentials = CRED_ID;
SELECT count(*) INTO SCRIPT_REMOTE_COUNT FROM portal.script_remote WHERE script_remote.credentials = CRED_ID;
SELECT count(*) INTO SCRIPT_SCP_COUNT FROM portal.script_scp WHERE script_scp.from_credentials = CRED_ID or script_scp.to_credentials = CRED_ID;
SET cred_count = REPO_COUNT + SCRIPT_REMOTE_COUNT + SCRIPT_SCP_COUNT;
END ;$$
CREATE PROCEDURE credentials_in_use(IN cred_uuid VARCHAR(50), OUT cred_use TINYINT(1))
BEGIN
DECLARE CRED_COUNT TINYINT(1) DEFAULT 0;
CALL portal.credential_count(cred_uuid, @total);
select @total > 0 into CRED_COUNT from dual;
SET cred_use = CRED_COUNT;
END ;$$
DELIMITER ;
@@ -0,0 +1,400 @@
CREATE TABLE portal.application_log (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
logged_by varchar(250) NOT NULL COMMENT 'Device logging',
event_type varchar(200) NOT NULL COMMENT 'Event type',
event varchar(2000) NOT NULL COMMENT 'Event that happened',
severity varchar(45) NOT NULL COMMENT 'Severity of the event (info, error)',
ip_address varchar(45) NOT NULL COMMENT 'IP address of where the event came from',
timestamp datetime NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY id_UNIQUE (id)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='Application logs';
CREATE TABLE portal.permission_category (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
name varchar(45) NOT NULL COMMENT 'Name of the permission category',
display_name varchar(45) NOT NULL COMMENT 'Display Name of the permission category',
date_created date NOT NULL COMMENT 'Date the permission category was created',
last_updated varchar(45) NOT NULL COMMENT 'Last update time of the category',
PRIMARY KEY (id),
UNIQUE KEY name (name)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='Category the permission belongs to';
CREATE TABLE portal.permission (
id int(11) NOT NULL AUTO_INCREMENT,
name varchar(45) NOT NULL,
display_name varchar(45) NOT NULL,
permission_category int(11) NOT NULL,
date_created date NOT NULL,
last_updated date NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY name (name),
KEY p_pc_fk_idx (permission_category),
CONSTRAINT p_pc_fk FOREIGN KEY (permission_category) REFERENCES permission_category (id) ON DELETE NO ACTION ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='available permissions';
CREATE TABLE portal.permission_group (
id int(11) NOT NULL AUTO_INCREMENT,
name varchar(45) NOT NULL,
display_name varchar(45) NOT NULL,
enabled tinyint(4) NOT NULL,
date_created date NOT NULL,
last_modified date NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY name_UNIQUE (name)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='permission group definitions';
CREATE TABLE portal.permission_group_permission (
id int(11) NOT NULL AUTO_INCREMENT,
permission_group int(11) NOT NULL,
permission int(11) NOT NULL,
allowed tinyint(4) NOT NULL,
date_created date NOT NULL,
last_modified date NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY pg_p (permission_group,permission),
KEY pg_pgp_fk_idx (permission_group),
KEY pg_p_fk_idx (permission),
CONSTRAINT pg_p_fk FOREIGN KEY (permission) REFERENCES permission (id) ON UPDATE CASCADE,
CONSTRAINT pg_pgp_fk FOREIGN KEY (permission_group) REFERENCES permission_group (id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='permissions assigned to a group';
CREATE TABLE portal.application_user (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
email_address_txt varchar(255) NOT NULL COMMENT 'The e-mail address of the user that becomes their login to the application.',
effective_date date NOT NULL DEFAULT '2017-01-01' COMMENT 'Lower value of a date range states start of availability of corresponding data row.',
expiration_date date NOT NULL DEFAULT '9999-12-31' COMMENT 'Maximum value of a date range states end of availability of corresponding data row.',
PRIMARY KEY (id),
UNIQUE KEY usr_email_address_ak (email_address_txt)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='The persons allowed to access the program.';
CREATE TABLE portal.user_attribute (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
application_user int(11) NOT NULL COMMENT 'Refers to the user for which the corresponding characteristics apply.',
permission_group int(11) NOT NULL COMMENT 'Refers the permission group the user belongs to',
first_name varchar(60) NOT NULL COMMENT 'The first name of corresponding user.',
last_name varchar(60) NOT NULL COMMENT 'The last name of the corresponding user.',
PRIMARY KEY (id),
UNIQUE KEY usa_application_user_ak (application_user),
KEY user_atr_perm_fk_idx (permission_group),
CONSTRAINT user_atr_app_id_fk FOREIGN KEY (application_user) REFERENCES application_user (id) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT user_atr_pg_fk FOREIGN KEY (permission_group) REFERENCES permission_group (id) ON UPDATE CASCADE ON DELETE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='Those descriptors for corresponding user.';
CREATE TABLE portal.user_password_tracking (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
application_user int(11) NOT NULL COMMENT 'Refers to the user for which the characteristic values are specific.',
password_txt varchar(255) NOT NULL COMMENT 'Encrypted value used to authenticate the corresponding user''s access to the application.',
effective_date date NOT NULL DEFAULT '2017-01-01' COMMENT 'Lower value of a date range states start of availability of corresponding data row.',
expiration_date date NOT NULL DEFAULT '9999-12-31' COMMENT 'Maximum value of a date range states end of availability of corresponding data row.',
PRIMARY KEY (id),
UNIQUE KEY upt_application_user_ak (application_user,effective_date),
UNIQUE KEY upt_password_text_ak (application_user,password_txt),
CONSTRAINT user_pwd_trk_app_id_fk FOREIGN KEY (application_user) REFERENCES application_user (id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='For a given date range, those descriptors for corresponding user allows access to Patch Repo.';
CREATE TABLE portal.credential_type (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
name varchar(45) NOT NULL COMMENT 'Name of the credential type',
display_name varchar(45) NOT NULL COMMENT 'Display name',
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='Credential type (ssh, password)';
CREATE TABLE portal.credentials (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
uuid varchar(50) NOT NULL COMMENT 'uuid associated to the credentials or ssh_key',
credential_type int(11) NOT NULL COMMENT 'Credential type',
reference_id int(11) not NULL COMMENT 'id of the reference table from sshkey or password table',
date_added datetime NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY credential_uuid_UNIQUE (uuid),
CONSTRAINT c_ct_fk FOREIGN KEY (credential_type) REFERENCES credential_type (id) ON UPDATE CASCADE ON DELETE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='Assocation between script and credentials for the script';
CREATE TABLE portal.password (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
uuid varchar(50) NOT NULL COMMENT 'Unique universal id assigned to the credential to differentiate it from the rest',
name varchar(45) NOT NULL COMMENT 'Name of the credential',
user_name varchar(45) NOT NULL COMMENT 'User name to use',
password varchar(45) NOT NULL COMMENT 'Encrypted password for the user name',
created_by int(11) NOT NULL COMMENT 'Application user who added the credentials',
date_created date NOT NULL COMMENT 'Date the credentials were added',
PRIMARY KEY (id),
UNIQUE KEY credential_name_UNIQUE (name),
UNIQUE KEY uuid_UNIQUE (uuid),
KEY pgc_au_fk_idx (created_by),
CONSTRAINT pgc_au_fk FOREIGN KEY (created_by) REFERENCES application_user (id) ON UPDATE CASCADE ON DELETE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='username and password for git repo';
CREATE TABLE portal.ssh_key (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
uuid varchar(50) NOT NULL COMMENT 'Unique universal id assigned to the credential to differentiate it from the rest',
name varchar(45) NOT NULL COMMENT 'Name of the ssh key',
identity varchar(50) NOT NULL COMMENT 'User identity for the ssh key',
ssh_key blob NOT NULL COMMENT 'encrypted private ssh key',
passphrase varchar(45) DEFAULT NULL COMMENT'Encrypted passphrase to use with the ssh_key',
created_by int(11) NOT NULL COMMENT 'Application user who added the credentials',
date_created date NOT NULL COMMENT 'Date the credentials were added',
PRIMARY KEY (id),
UNIQUE KEY ssh_key_name_UNIQUE (name),
UNIQUE KEY uuid_UNIQUE (uuid),
KEY pgsk_au_fk_idx (created_by),
CONSTRAINT pgsk_au_fk FOREIGN KEY (created_by) REFERENCES application_user (id) ON UPDATE CASCADE ON DELETE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='ssh key and passphrase for the git repo';
CREATE TABLE portal.git_repo (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
name varchar(50) NOT NULL COMMENT 'name of repository',
scm varchar(500) NOT NULL COMMENT 'git remote repository url',
directory varchar(45) NOT NULL COMMENT 'directory to checkout to',
branch varchar(45) NOT NULL COMMENT 'branch to checkout ',
credentials int(11) NOT NULL,
created_by int(11) NOT NULL COMMENT 'user creating the scm',
last_updated datetime NOT NULL COMMENT 'last time directory was updated',
dated_created date NOT NULL COMMENT 'date the git repo was created',
PRIMARY KEY (id),
UNIQUE KEY name_UNIQUE (name),
KEY pg_au_fk_idx (created_by),
KEY gr_c_fk_idx (credentials),
CONSTRAINT gr_c_fk FOREIGN KEY (credentials) REFERENCES credentials (id) ON UPDATE CASCADE ON DELETE RESTRICT,
CONSTRAINT pg_au_fk FOREIGN KEY (created_by) REFERENCES application_user (id) ON UPDATE CASCADE ON DELETE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='Git repository information';
CREATE TABLE portal.keyword (
id INT NOT NULL AUTO_INCREMENT COMMENT 'Sequential ID ',
keyword VARCHAR(45) NOT NULL COMMENT 'keyword',
date_created DATE NOT NULL,
created_by INT NOT NULL,
PRIMARY KEY (id),
UNIQUE INDEX keyword_UNIQUE (keyword ASC),
INDEX k_au_fk_idx (created_by ASC),
CONSTRAINT k_au_fk FOREIGN KEY (created_by) REFERENCES portal.application_user (id) ON DELETE RESTRICT ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT = 'Keyword metadata ';
CREATE TABLE portal.hash_type (
id INT NOT NULL AUTO_INCREMENT COMMENT 'Sequential Identifier',
name VARCHAR(45) NOT NULL COMMENT 'Name of the hash',
display_name VARCHAR(45) NOT NULL COMMENT 'Display name of the hash value',
valid TINYINT NOT NULL COMMENT 'Hash Type valid',
last_modified DATE NOT NULL COMMENT 'Date hash type was last modified',
date_created DATE NOT NULL COMMENT 'date the hash type was ',
PRIMARY KEY (id),
UNIQUE INDEX name_UNIQUE (name asc)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT = 'valid types of hashes to use';
CREATE TABLE portal.schedule_frequency (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
name varchar(45) NOT NULL COMMENT 'Name of the schedule frequency',
display_name varchar(45) NOT NULL COMMENT 'Display name',
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='Schedule frequency (hourly, daily, weekly, monthly, yearly, specific)';
CREATE TABLE portal.script_type (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
name varchar(45) NOT NULL COMMENT 'Name of the schedule type',
display_name varchar(45) NOT NULL COMMENT 'Display name',
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='Schedule frequency (hourly, daily, weekly, monthly, yearly, specific)';
CREATE TABLE portal.script (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
script_name varchar(45) NOT NULL COMMENT 'Name of the script',
script_command varchar(200) NOT NULL COMMENT 'Script command to execute',
script_type int(11) NOT NULL COMMENT 'Type of script whether it be executable or ssh',
base_directory varchar(200) DEFAULT NULL COMMENT 'Base directory to start in',
output_directory varchar(45) DEFAULT NULL COMMENT 'Output directory',
created_by int(11) NOT NULL COMMENT 'Application user whom created the script',
date_created date NOT NULL COMMENT 'Date the script was created',
PRIMARY KEY (id),
UNIQUE KEY script_name_UNIQUE (script_name),
KEY s_au_fk_idx (created_by),
KEY s_st_fk_idx (script_type),
CONSTRAINT s_au_fk FOREIGN KEY (created_by) REFERENCES application_user (id) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT s_st_fk FOREIGN KEY (script_type) REFERENCES script_type (id) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='Scripts to execute';
CREATE TABLE portal.script_parameter (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
parameter varchar(100) NOT NULL COMMENT 'Parameter to add',
script int(11) NOT NULL COMMENT 'Script associated to the parameter',
PRIMARY KEY (id),
KEY s_sp_fk_idx (script),
CONSTRAINT s_sp_fk FOREIGN KEY (script) REFERENCES script (id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='Parameters associated with the respective scripts';
CREATE TABLE portal.script_schedule (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
job_id varchar(45) NOT NULL COMMENT 'Unique Identifier for the schedule',
script int(11) NOT NULL COMMENT 'Script reference to execute',
start_datetime datetime NOT NULL COMMENT 'Date in which to start the task',
end_datetime datetime DEFAULT NULL COMMENT 'Date in which to stop the task',
frequency int(11) NOT NULL COMMENT 'How often to execute the task in days',
max_executions int(11) DEFAULT NULL COMMENT 'How many times to execute before stopping',
current_execution_count int(11) DEFAULT NULL COMMENT 'how many times executoed thus far',
last_run datetime DEFAULT NULL COMMENT 'Last time script was executed for this schedule',
execution_status int(11) DEFAULT NULL COMMENT 'status of the last execution',
finished tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Indiciated if the script has finished its execution run',
PRIMARY KEY (id),
UNIQUE KEY uuid_UNIQUE (job_id),
KEY s_ss_fk_idx (script),
KEY s_sf_fk_idx (frequency),
CONSTRAINT s_sf_fk FOREIGN KEY (frequency) REFERENCES schedule_frequency (id) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT s_ss_fk FOREIGN KEY (script) REFERENCES script (id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='schedule to run script at';
CREATE TABLE portal.script_schedule_results (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Auto incremented identifier',
schedule_job_id varchar(45) NOT NULL COMMENT 'Unique Identifier of the script schedule that was ran\n',
exit_status smallint(2) NOT NULL COMMENT 'Exit status of the script',
results LONGBLOB NOT NULL COMMENT 'Output results of the script',
start_time datetime NOT NULL,
end_time datetime NOT NULL,
PRIMARY KEY (id),
KEY ssr_ss_fk_idx (schedule_job_id),
CONSTRAINT ssr_ss_fk FOREIGN KEY (schedule_job_id) REFERENCES script_schedule (job_id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='Storage for the output results of a script that was ran';
CREATE TABLE portal.script_scp (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
script int(11) NOT NULL COMMENT 'script id that the credentials are associated to',
from_host varchar(100) NOT NULL COMMENT 'location to the data is coming from',
from_port int(5) NOT NULL COMMENT 'port to connect to',
from_credentials int(11) NOT NULL COMMENT 'credentials to use for the from connection',
to_host varchar(100) NOT NULL COMMENT 'location to where the data',
to_port int(5) NOT NULL COMMENT 'port to send the data to',
to_credentials int(11) NOT NULL COMMENT 'credentials to use for where to send the data',
data_regex varchar(100) DEFAULT NULL COMMENT 'regular expression to look for when finding the file',
last_updated datetime NOT NULL COMMENT 'last time this record was updated',
date_created datetime NOT NULL COMMENT 'date this record was created',
PRIMARY KEY (id),
UNIQUE KEY unique_s_scp (script,from_host,to_host),
KEY s_sscp_fk_idx (script),
KEY sc_from_scp_fk_idx (from_credentials),
KEY sc_to_scp_fk_idx (to_credentials),
CONSTRAINT s_sscp_fk FOREIGN KEY (script) REFERENCES script (id) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT sc_from_scp_fk FOREIGN KEY (from_credentials) REFERENCES credentials (id) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT sc_to_scp_fk FOREIGN KEY (to_credentials) REFERENCES credentials (id) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='table defining the scp information to retrieve or push a file to/from remote system';
CREATE TABLE portal.script_remote (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
script int(11) NOT NULL COMMENT 'Script id this record references',
credentials int(11) NOT NULL COMMENT 'Credentials to use',
url varchar(200) NOT NULL,
port int(5) NOT NULL,
PRIMARY KEY (id),
KEY sr_s_fk_idx (script),
KEY sr_sc_fk_idx (credentials),
CONSTRAINT sr_s_fk FOREIGN KEY (script) REFERENCES script (id) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT sr_sc_fk FOREIGN KEY (credentials) REFERENCES credentials (id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='connection details for remote execution of scripts';
CREATE TABLE portal.script_chain (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row',
parent_script int(11) NOT NULL COMMENT 'identifier of the script that will trigger the chain',
child_script int(11) NOT NULL COMMENT 'identifier of the script to be executed once the parent script runs',
exit_status int(11) NOT NULL COMMENT 'exit status of the parent script that will trigger the child script',
execute_after_min int(11) DEFAULT NULL COMMENT 'number of minutes after parent finishes the child should execute',
PRIMARY KEY (id),
UNIQUE KEY unique_sp_sc_es (parent_script,child_script,exit_status),
KEY s_sp_fk_idx (parent_script),
KEY sc_s_fk_idx (child_script),
CONSTRAINT sc_s_fk FOREIGN KEY (child_script) REFERENCES script (id) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT sp_s_fk FOREIGN KEY (parent_script) REFERENCES script (id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='Script chaining table to tell which script to execute next';
CREATE TABLE portal.script_environment_variable (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
name varchar(100) NOT NULL COMMENT 'Environment variable name',
value varchar(100) NOT NULL COMMENT 'value of the environment variable',
script int(11) NOT NULL COMMENT 'The script the environment variable belongs to',
created_by int(11) NOT NULL COMMENT 'user who added the variable',
last_updated datetime NOT NULL COMMENT 'last time environment variable was updated',
date_created datetime NOT NULL COMMENT 'date the environment variable was created',
PRIMARY KEY (id),
UNIQUE KEY id_UNIQUE (id),
UNIQUE KEY name_script_UNIQUE (name,script),
KEY sev_au_fk_idx (created_by),
KEY sev_s_fk_idx (script),
CONSTRAINT sev_au_fk FOREIGN KEY (created_by) REFERENCES application_user (id) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT sev_s_fk FOREIGN KEY (script) REFERENCES script (id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='Script System Environment variables for scripts to use outside what is already establed by the server.';
CREATE TABLE portal.resource_file (
id int(11) NOT NULL AUTO_INCREMENT,
file_name varchar(200) NOT NULL,
file_location varchar(200) NOT NULL,
file_type varchar(45) NOT NULL,
valid tinyint(4) NOT NULL DEFAULT '1',
script_result int(11) DEFAULT NULL COMMENT 'the script that retrived and stored the file',
date_created date NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY id_UNIQUE (id),
KEY s_sr_ak_idx (script_result),
CONSTRAINT s_sr_ak FOREIGN KEY (script_result) REFERENCES script_schedule_results (id) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE portal.environment_variable (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
name varchar(100) NOT NULL COMMENT 'Environment variable name',
value varchar(100) NOT NULL COMMENT 'value of the environment variable',
created_by int(11) NOT NULL COMMENT 'user who added the variable',
last_updated datetime NOT NULL COMMENT 'last time environment variable was updated',
date_created datetime NOT NULL COMMENT 'date the environment variable was created',
PRIMARY KEY (id),
UNIQUE KEY id_UNIQUE (id),
UNIQUE KEY name_UNIQUE (name),
KEY ev_au_fk_idx (created_by),
CONSTRAINT ev_au_fk FOREIGN KEY (created_by) REFERENCES application_user (id) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='Global System Environment variables for scripts to use outside what is already establed by the server.';
CREATE TABLE portal.key_value (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
reference_key varchar(100) NOT NULL COMMENT 'Key entry',
reference_value blob NOT NULL COMMENT 'Entry value',
created_by int(11) NOT NULL COMMENT 'Reference to user who created the entry',
date_created datetime NOT NULL COMMENT 'Date the entry was created',
PRIMARY KEY (id),
UNIQUE KEY key_UNIQUE (reference_key),
KEY kv_au_fk_idx (created_by),
CONSTRAINT kv_au_fk FOREIGN KEY (created_by) REFERENCES application_user (id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='Table holding key value pairs';
CREATE TABLE portal.email_template (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
email_name varchar(45) NOT NULL COMMENT 'Unique name to identify the email',
email_subject varchar(100) NOT NULL COMMENT 'Email subject',
email_message blob NOT NULL COMMENT 'email message',
created_by int(11) NOT NULL COMMENT 'ApplicationUser who Created email',
date_created date NOT NULL COMMENT 'Date email was created',
PRIMARY KEY (id),
UNIQUE KEY email_name_UNIQUE (email_name),
KEY au_se_fk_idx (created_by),
CONSTRAINT au_se_fk FOREIGN KEY (created_by) REFERENCES application_user (id) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='Email templates';
CREATE TABLE portal.script_email (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
script int(11) NOT NULL COMMENT 'script the email belongs to',
email_template int(11) NOT NULL COMMENT 'email template to use',
date_created date NOT NULL COMMENT 'date added',
PRIMARY KEY (id),
KEY se_et_fk_idx (email_template),
KEY se_s_fk_idx (script),
CONSTRAINT se_et_fk FOREIGN KEY (email_template) REFERENCES email_template (id) ON UPDATE CASCADE,
CONSTRAINT se_s_fk FOREIGN KEY (script) REFERENCES script (id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='Table to link email templates to scripts';
CREATE TABLE portal.script_email_recipient (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Sequential number assigned to define uniqueness of row.',
script_email int(11) NOT NULL COMMENT 'script email id',
recipient int(11) NOT NULL COMMENT 'application users to send the email to',
date_created date NOT NULL,
PRIMARY KEY (id),
KEY ser_se_fk (script_email),
KEY ser_au_fk_idx (recipient),
CONSTRAINT ser_au_fk FOREIGN KEY (recipient) REFERENCES application_user (id) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT ser_se_fk FOREIGN KEY (script_email) REFERENCES script_email (id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4 COMMENT='table listing recipients to the script emails';
@@ -0,0 +1,36 @@
USE portal;
DELIMITER $$
CREATE PROCEDURE set_optimizer_switch_on()
BEGIN
IF SUBSTRING(@@version,1,3) = '5.7' THEN
SET optimizer_switch = 'derived_merge=on';
END IF;
END;$$
CREATE PROCEDURE create_user()
BEGIN
DECLARE foo BIGINT DEFAULT 0;
SELECT COUNT(*) INTO foo FROM mysql.user WHERE User = 'portalAdmin' and Host = 'localhost';
IF foo = 0 THEN
CREATE USER 'portalAdmin'@'localhost' IDENTIFIED BY 'portalAdmin2017!';
END IF;
SELECT COUNT(*) INTO foo FROM mysql.user WHERE User = 'portalAdmin' and Host = '%';
IF foo = 0 THEN
CREATE USER 'portalAdmin'@'%' IDENTIFIED BY 'portalAdmin2017!';
END IF;
END ;$$
DELIMITER ;
CALL set_optimizer_switch_on();
DROP PROCEDURE set_optimizer_switch_on;
CALL create_user();
DROP PROCEDURE create_user;
GRANT SELECT,INSERT,UPDATE,DELETE ON * TO 'portalAdmin'@'localhost';
GRANT SELECT,INSERT,UPDATE,DELETE ON * TO 'portalAdmin'@'%';
GRANT EXECUTE ON PROCEDURE portal.credentials_in_use to 'portalAdmin'@'localhost';
GRANT EXECUTE ON PROCEDURE portal.credential_count to 'portalAdmin'@'localhost';
FLUSH PRIVILEGES;