diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9fd246c --- /dev/null +++ b/.gitignore @@ -0,0 +1,153 @@ +###################### +# Project Specific +###################### +/build/www/** +/src/test/javascript/coverage/ +/src/test/javascript/PhantomJS*/ + +###################### +# Node +###################### +/node/ +node_tmp/ +node_modules/ +npm-debug.log.* + +###################### +# SASS +###################### +.sass-cache/ + +###################### +# Eclipse +###################### +*.pydevproject +.project +.metadata +tmp/ +tmp/**/* +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath +.factorypath +/src/main/resources/rebel.xml + +# External tool builders +.externalToolBuilders/** + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + +###################### +# Intellij +###################### +.idea/ +*.iml +*.iws +*.ipr +*.ids +*.orig + +###################### +# Visual Studio Code +###################### +.vscode/ + +###################### +# Maven +###################### +/log/ +/target/ + +###################### +# Gradle +###################### +.gradle/ +/build/ + +###################### +# Package Files +###################### +*.jar +*.war +*.ear +*.db + +###################### +# Windows +###################### +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + +###################### +# Mac OSX +###################### +.DS_Store +.svn + +# Thumbnails +._* + +# Files that might appear on external disk +.Spotlight-V100 +.Trashes + +###################### +# Directories +###################### +/bin/ +/deploy/ + +###################### +# Logs +###################### +*.log + +###################### +# Others +###################### +*.class +*.*~ +*~ +.merge_file* + +###################### +# Gradle Wrapper +###################### +!gradle/wrapper/gradle-wrapper.jar + +###################### +# Maven Wrapper +###################### +!.mvn/wrapper/maven-wrapper.jar + +###################### +# ESLint +###################### +.eslintcache +© 2019 GitHub, Inc. +Terms +Privacy +Security +Status +Help +Contact GitHub +Pricing +API +Training +Blog +About diff --git a/configurationapp/GREGS-README.md b/configurationapp/GREGS-README.md new file mode 100644 index 0000000..3ddc3c7 --- /dev/null +++ b/configurationapp/GREGS-README.md @@ -0,0 +1,8 @@ +# Notes + +* commit with this value : + gregcanter <5223851+gregcanter@users.noreply.github.com> + + + + \ No newline at end of file diff --git a/configurationapp/configurationapp.iml b/configurationapp/configurationapp.iml new file mode 100644 index 0000000..80a3010 --- /dev/null +++ b/configurationapp/configurationapp.iml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/configurationapp/pom.xml b/configurationapp/pom.xml index 78931d3..2f616b0 100644 --- a/configurationapp/pom.xml +++ b/configurationapp/pom.xml @@ -28,7 +28,19 @@ org.springframework.boot spring-boot-starter-web - + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-devtools + runtime + org.springframework.boot spring-boot-devtools @@ -39,14 +51,43 @@ spring-boot-starter-test test + + com.h2database + h2 + runtime + + + org.projectlombok + lombok + 1.16.4 + + + com.github.darrachequesne + spring-data-jpa-datatables + 5.0.0 + + + io.rest-assured + rest-assured + ${rest-assured.version} + test + - org.springframework.boot spring-boot-maven-plugin + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + configurationapp diff --git a/configurationapp/src/main/java/com/att/ConfigurationApp.java b/configurationapp/src/main/java/com/att/ConfigurationApp.java index 1ea7d60..7ab8ff1 100644 --- a/configurationapp/src/main/java/com/att/ConfigurationApp.java +++ b/configurationapp/src/main/java/com/att/ConfigurationApp.java @@ -2,8 +2,11 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.data.jpa.datatables.repository.DataTablesRepositoryFactoryBean; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; @SpringBootApplication +@EnableJpaRepositories(repositoryFactoryBeanClass = DataTablesRepositoryFactoryBean.class) public class ConfigurationApp { public static void main(String[] args) { diff --git a/configurationapp/src/main/java/com/att/Init/ConfigvaluesInitializer.java b/configurationapp/src/main/java/com/att/Init/ConfigvaluesInitializer.java new file mode 100755 index 0000000..54dc887 --- /dev/null +++ b/configurationapp/src/main/java/com/att/Init/ConfigvaluesInitializer.java @@ -0,0 +1,53 @@ +package com.att.Init; + +import com.att.model.Configvalues; +import com.att.repositories.ConfigvaluesRepository; +//import com.github.javafaker.Faker; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.PostConstruct; +import java.util.ArrayList; +import java.util.Random; + +@Service +@Slf4j +class ConfigvaluesInitializer { + private static final int NUMBER_TO_GENERATE = 4; + + private ConfigvaluesRepository configvaluesRepository; + + public ConfigvaluesInitializer(ConfigvaluesRepository configvaluesRepository) { + this.configvaluesRepository = configvaluesRepository; + } + + @PostConstruct + public void init() { + log.info("generating {} random employees", NUMBER_TO_GENERATE); + + ArrayList arrayList = new ArrayList(); + arrayList.add("A"); + arrayList.add("B"); + arrayList.add("C"); + arrayList.add("D"); + arrayList.add("E"); + + + ArrayList arrayList1 = new ArrayList(); + arrayList1.add("012019"); + arrayList1.add("022019"); + arrayList1.add("042019"); + arrayList1.add("062019"); + arrayList1.add("072019"); + + for (int i = 0; i <= NUMBER_TO_GENERATE; i++) { + Configvalues configvalues = Configvalues.builder() + .configID(i) + .configName(arrayList.get(i)) + .configDate(arrayList1.get(i)) + .build(); + configvaluesRepository.save(configvalues); + } + } + +} \ No newline at end of file diff --git a/configurationapp/src/main/java/com/att/controllers/ConfigvaluesController.java b/configurationapp/src/main/java/com/att/controllers/ConfigvaluesController.java new file mode 100644 index 0000000..98ca938 --- /dev/null +++ b/configurationapp/src/main/java/com/att/controllers/ConfigvaluesController.java @@ -0,0 +1,71 @@ +package com.att.controllers; + +import com.att.repositories.ConfigvaluesRepository; +import org.springframework.data.jpa.datatables.mapping.DataTablesInput; +import org.springframework.data.jpa.datatables.mapping.DataTablesOutput; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +import com.att.model.Configvalues; +import org.springframework.web.servlet.view.RedirectView; + +@RestController +public class ConfigvaluesController { + + private ConfigvaluesRepository configvaluesRepository; + + public ConfigvaluesController(ConfigvaluesRepository configvaluesRepository) { + this.configvaluesRepository = configvaluesRepository; + } + + // SHOW ALL VALUES + @RequestMapping(value = "/api/configvalues", method = RequestMethod.GET) + public DataTablesOutput list(@Valid DataTablesInput input) { +// configvaluesRepository.deleteAllByConfigDate("102019"); +// System.out.println(" DELETION IN AFFECT "); + return configvaluesRepository.findAll(input); + } + + // DELETION OF CONFIGS BY CONFIG DATE VALUE + @Transactional // REQUIRED by Spring or will get Entity errors + @RequestMapping(value = "/delete/{ConfigDate}", method = RequestMethod.POST) + public RedirectView deleteConfig(@RequestParam String ConfigDate) { + configvaluesRepository.deleteAllByConfigDate(ConfigDate); + System.out.println(" ########## DELETION IN AFFECT FOR " + ConfigDate.toString() + " ############## "); + RedirectView redirectView = new RedirectView(); + redirectView.setUrl(("http://localhost:9000/index.html")); + return redirectView; + } + + // ADDITION OF A CONFIG + @Transactional // REQUIRED by Spring or will get Entity errors + @RequestMapping(value = "/add/{ConfigDate1}/{ConfigName1}", method = RequestMethod.POST) + public RedirectView addConfig(@RequestParam String ConfigDate1, String ConfigName1) { + int newID = (((int) configvaluesRepository.count()) + 1); + Configvalues configvalues = Configvalues.builder() + .configID(newID) + .configName(ConfigName1) + .configDate(ConfigDate1) + .build(); + configvaluesRepository.save(configvalues); + + System.out.println(" ########## ADDED FOR " + configvalues.toString() + " ############## "); + RedirectView redirectView = new RedirectView(); + redirectView.setUrl(("http://localhost:9000/index.html")); + return redirectView; + + } + + // DELETION OF A SINGLE CONFIG BY CONFIG ID VALUE + @Transactional // REQUIRED by Spring or will get Entity errors + @RequestMapping(value = "/deleteSingle/{ConfigID}", method = RequestMethod.POST) + public RedirectView deleteSingleConfig(@RequestParam Integer ConfigID) { + configvaluesRepository.deleteById(ConfigID); + System.out.println(" ########## *SINGLE* DELETION IN AFFECT FOR " + ConfigID.toString() + " ############## "); + RedirectView redirectView = new RedirectView(); + redirectView.setUrl(("http://localhost:9000/index.html")); + return redirectView; + } +} diff --git a/configurationapp/src/main/java/com/att/dao/configurations/ConfigurationDao.java b/configurationapp/src/main/java/com/att/dao/configurations/ConfigurationDao.java deleted file mode 100644 index f889558..0000000 --- a/configurationapp/src/main/java/com/att/dao/configurations/ConfigurationDao.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.att.dao.configurations; - -import com.att.data.configurations.ConfigValue; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Service -public class ConfigurationDao { - private class IdProvider { - private int currentId; - - public IdProvider() { - currentId = 0; - } - - public int getNextId() { - return this.currentId++; - } - } - - /** - * No DB, so store the configs in a map. - */ - private Map> currentConfigurations; - private IdProvider idProvider; - - public ConfigurationDao() { - idProvider = new IdProvider(); - currentConfigurations = new HashMap<>(); - } - - public List getConfigurationsForYearMonth(String yearMonth) { - return new ArrayList<>(); - } - - public void addConfiguration(String yearMonth, ConfigValue value) { - int newId = idProvider.getNextId(); - - } - - public void removeAllConfigurationsForYearMonth(String yearMonth) { - - } -} diff --git a/configurationapp/src/main/java/com/att/data/configurations/ConfigValue.java b/configurationapp/src/main/java/com/att/data/configurations/ConfigValue.java deleted file mode 100644 index 55339a3..0000000 --- a/configurationapp/src/main/java/com/att/data/configurations/ConfigValue.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.att.data.configurations; - -/** - * Data Model - */ -public class ConfigValue { - private String configName; - private int configId; - - public ConfigValue(String name, int id) { - this.configId = id; - this.configName = name; - } - - public ConfigValue() { - - } - - public void setConfigName(String name) { - this.configName = name; - } - - public String getConfigName() { - return this.configName; - } - - public void setConfigId(int id) { - this.configId = id; - } - - public int getConfigId() { - return this.configId; - } -} diff --git a/configurationapp/src/main/java/com/att/exceptions/ConfigNotFoundException.java b/configurationapp/src/main/java/com/att/exceptions/ConfigNotFoundException.java new file mode 100644 index 0000000..74cc437 --- /dev/null +++ b/configurationapp/src/main/java/com/att/exceptions/ConfigNotFoundException.java @@ -0,0 +1,28 @@ +package com.att.exceptions; + +/** + *

com.att.web.exceptions.ConfigNotFoundException

+ * Description : + * + * @author gcanter + * on 2019-06-24 + */ + + +public class ConfigNotFoundException extends RuntimeException { + public ConfigNotFoundException(){ + super(); + } + + public ConfigNotFoundException(final String message, final Throwable cause) { + super(message, cause); + } + + public ConfigNotFoundException(final String message) { + super(message); + } + + public ConfigNotFoundException(final Throwable cause) { + super(cause); + } +} diff --git a/configurationapp/src/main/java/com/att/model/Configvalues.java b/configurationapp/src/main/java/com/att/model/Configvalues.java new file mode 100644 index 0000000..e0c7a38 --- /dev/null +++ b/configurationapp/src/main/java/com/att/model/Configvalues.java @@ -0,0 +1,30 @@ +package com.att.model; + +import javax.persistence.*; +import javax.persistence.Entity; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * Data Model + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name = "CONFIGVALUES") +@Entity +public class Configvalues { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int configID; + + @Column(nullable = false) + private String configName; // 'A, B, C, D' etc + + @Column(nullable = false) + private String configDate; // 022019 for Feb 2019 +} \ No newline at end of file diff --git a/configurationapp/src/main/java/com/att/repositories/ConfigvaluesRepository.java b/configurationapp/src/main/java/com/att/repositories/ConfigvaluesRepository.java new file mode 100644 index 0000000..e9d6f25 --- /dev/null +++ b/configurationapp/src/main/java/com/att/repositories/ConfigvaluesRepository.java @@ -0,0 +1,21 @@ +package com.att.repositories; + +import com.att.model.Configvalues; +import org.springframework.data.jpa.datatables.repository.DataTablesRepository; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

com.att.repositories.ConfigvaluesRepository

+ * Description : + * + * @author gcanter + * on 2019-06-23 + */ + +@Repository +public interface ConfigvaluesRepository extends DataTablesRepository { + + void deleteAllByConfigDate(String configDate); +} diff --git a/configurationapp/src/main/java/com/att/web/configuarations/ConfigurationController.java b/configurationapp/src/main/java/com/att/web/configuarations/ConfigurationController.java deleted file mode 100644 index 995402a..0000000 --- a/configurationapp/src/main/java/com/att/web/configuarations/ConfigurationController.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.att.web.configuarations; - -import com.att.dao.configurations.ConfigurationDao; -import com.att.data.configurations.ConfigValue; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.ArrayList; -import java.util.List; - -@RestController -@RequestMapping(value="/configuration") -public class ConfigurationController { - - private ConfigurationDao dao; - - @Autowired - public ConfigurationController(ConfigurationDao dao) { - this.dao = dao; - } - - @RequestMapping(value="/{yearMonthNumber}", method=RequestMethod.GET) - @ResponseBody - public List getConfigurationsForYearMonth( - @PathVariable("yearMonthNumber") String yearMonth) { - - return new ArrayList<>(); - } - - @RequestMapping(value="/{yearMonthNumber}", method=RequestMethod.DELETE) - public void deleteConfigurationsForYearMonth(@PathVariable("yearMonthNumber") String yearMonth) { - try { - - } catch (Exception ex) { - - } - } - - @RequestMapping(value="/{yearMonthNumber}", method={ RequestMethod.POST, RequestMethod.PUT }) - public void addConfigurationForYearMonth( - @PathVariable("yearMonthNumber") String yearMonth, - @RequestBody ConfigValue value) { - - } -} diff --git a/configurationapp/src/main/resources/application.properties b/configurationapp/src/main/resources/application.properties index 6c77a8e..e17ca3f 100644 --- a/configurationapp/src/main/resources/application.properties +++ b/configurationapp/src/main/resources/application.properties @@ -3,4 +3,15 @@ spring.mvc.favicon.enabled=false logging.level.root=WARN logging.level.org.springframework.web=DEBUG -logging.level.org.hibernate=ERROR \ No newline at end of file +logging.level.org.hibernate=ERROR + +spring.h2.console.enabled=true + +spring.datasource.url=jdbc:h2:mem:testdb + +#spring.datasource.url=jdbc:h2:file:/data/demo + +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password= +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect \ No newline at end of file diff --git a/configurationapp/src/main/resources/data.sql b/configurationapp/src/main/resources/data.sql new file mode 100644 index 0000000..9ce4cf4 --- /dev/null +++ b/configurationapp/src/main/resources/data.sql @@ -0,0 +1,4 @@ +INSERT INTO CONFIGVALUES (config_Name, config_Date) VALUES ('A', '022019'); +INSERT INTO CONFIGVALUES (config_Name, config_Date) VALUES ('B', '022019'); +INSERT INTO CONFIGVALUES (config_Name, config_Date) VALUES ('C', '032019'); +INSERT INTO CONFIGVALUES (config_Name, config_Date) VALUES ('D', '042019'); \ No newline at end of file diff --git a/configurationapp/src/main/resources/static/css/main.css b/configurationapp/src/main/resources/static/css/main.css deleted file mode 100644 index d03098f..0000000 --- a/configurationapp/src/main/resources/static/css/main.css +++ /dev/null @@ -1,11 +0,0 @@ -.controls { - -} - -.config-table-wrapper { - -} - -.content { - -} \ No newline at end of file diff --git a/configurationapp/src/main/resources/static/index.html b/configurationapp/src/main/resources/static/index.html old mode 100644 new mode 100755 index 7cd14ba..fc8e983 --- a/configurationapp/src/main/resources/static/index.html +++ b/configurationapp/src/main/resources/static/index.html @@ -1,47 +1,136 @@ - Configuration App - - - - + + + + DataTables -

Welcome To The Configuration App

-
-
- -
-
- - - - - - - - - - -
Configuration IdConfiguration Name
-
-
- -
+ + + + + + + + + + + + + + + + + + + + + + + + +

Welcome To The Configuration App

+ +

Current Configurations (All)

+ +
+ + + + + + + + +
Config IDConfig NameConfig Date
+ +

To Add a Configuration

+ +
+ + + + + + + + + + + + + + +
+ +

To Delete ALL Configurations for a Selected Month

+
+ + + + + + +
+ +

To Delete a SINGLE Configuration

+
+ + + + + + + + +
+ + + + + + + + + + + \ No newline at end of file diff --git a/configurationapp/src/main/resources/static/js/app.js b/configurationapp/src/main/resources/static/js/app.js index 2d4b945..9ba6a11 100644 --- a/configurationapp/src/main/resources/static/js/app.js +++ b/configurationapp/src/main/resources/static/js/app.js @@ -14,12 +14,14 @@ App.prototype.init = function() { $('#configTable').DataTable({ scrollY: 300, - paging: false, - sorting: false, + paging: true, + sorting: true, + ordering: true, + select: true, searching: false, info: false }); }; window.app = new App; -})($); \ No newline at end of file +})($); diff --git a/configurationapp/src/main/resources/static/js/jquery.spring-friendly.js b/configurationapp/src/main/resources/static/js/jquery.spring-friendly.js new file mode 100755 index 0000000..c786bdd --- /dev/null +++ b/configurationapp/src/main/resources/static/js/jquery.spring-friendly.js @@ -0,0 +1,73 @@ +// From https://github.com/jquery/jquery/blob/master/src/serialize.js +// Overrides data serialization to allow Spring MVC to correctly map input parameters : column[0][data] now becomes column[0].data +(function($) { + var r20 = /%20/g, rbracket = /\[\]$/, rCRLF = /\r?\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i; + + function customBuildParams(prefix, obj, traditional, add) { + var name; + + if (jQuery.isArray(obj)) { + // Serialize array item. + jQuery.each(obj, function(i, v) { + if (traditional || rbracket.test(prefix)) { + // Treat each array item as a scalar. + add(prefix, v); + + } else { + // Item is non-scalar (array or object), encode its numeric + // index. + customBuildParams(prefix + "[" + + (typeof v === "object" ? i : "") + "]", v, + traditional, add); + } + }); + + } else if (!traditional && jQuery.type(obj) === "object") { + // Serialize object item. + for (name in obj) { + // This is where the magic happens + customBuildParams(prefix + "." + name, obj[name], traditional, + add); + } + + } else { + // Serialize scalar item. + add(prefix, obj); + } + } + + $.param = function(a, traditional) { + var prefix, s = [], add = function(key, value) { + // If value is a function, invoke it and return its value + value = jQuery.isFunction(value) ? value() : (value == null ? "" + : value); + s[s.length] = encodeURIComponent(key) + "=" + + encodeURIComponent(value); + }; + + // Set traditional to true for jQuery <= 1.3.2 behavior. + if (traditional === undefined) { + traditional = jQuery.ajaxSettings + && jQuery.ajaxSettings.traditional; + } + + // If an array was passed in, assume that it is an array of form + // elements. + if (jQuery.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) { + // Serialize the form elements + jQuery.each(a, function() { + add(this.name, this.value); + }); + + } else { + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for (prefix in a) { + customBuildParams(prefix, a[prefix], traditional, add); + } + } + + // Return the resulting serialization + return s.join("&").replace(r20, "+"); + }; +})(jQuery); \ No newline at end of file diff --git a/configurationapp/src/test/com/att/BootstrapTest.java b/configurationapp/src/test/com/att/BootstrapTest.java new file mode 100644 index 0000000..77e2305 --- /dev/null +++ b/configurationapp/src/test/com/att/BootstrapTest.java @@ -0,0 +1,48 @@ +package com.att; + +/** + *

java.com.att.BootstrapTest

+ * Description : + * + * @author gcanter + * on 2019-06-24 + */ + + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; +import static org.apache.commons.lang3.RandomStringUtils.randomNumeric; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.junit.Test; + + +import org.springframework.http.HttpStatus; + +import io.restassured.RestAssured; +import io.restassured.response.Response; + +public class BootstrapTest { + + private static final String API_ROOT = "http://localhost:9000"; + + + // test to see if connection to http://localhost:9000 is working and returns all data + @Test + public void whenGetAllConfigs_thenOK() { + final Response response = RestAssured.get(API_ROOT); + assertEquals(HttpStatus.OK.value(), response.getStatusCode()); + } + + // Test to see if app returns just 1 single record + + + + + + + + + + + +} diff --git a/configurationapp/src/test/com/att/SpringContextIntegrationTest.java b/configurationapp/src/test/com/att/SpringContextIntegrationTest.java new file mode 100644 index 0000000..2495f44 --- /dev/null +++ b/configurationapp/src/test/com/att/SpringContextIntegrationTest.java @@ -0,0 +1,24 @@ +package com.att; + +/** + *

java.com.att.SpringContextIntegrationTest

+ * Description : Tests the Spring Context Integration to see if it loads. I always include it in + * all of my Spring Boot projects as the first test * + * @author gcanter + * on 2019-06-24 + */ + + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class SpringContextIntegrationTest { + + @Test + public void contextLoads() { + } +} diff --git a/configurationapp/target/classes/application.properties b/configurationapp/target/classes/application.properties new file mode 100644 index 0000000..e17ca3f --- /dev/null +++ b/configurationapp/target/classes/application.properties @@ -0,0 +1,17 @@ +server.port=9000 +spring.mvc.favicon.enabled=false + +logging.level.root=WARN +logging.level.org.springframework.web=DEBUG +logging.level.org.hibernate=ERROR + +spring.h2.console.enabled=true + +spring.datasource.url=jdbc:h2:mem:testdb + +#spring.datasource.url=jdbc:h2:file:/data/demo + +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password= +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect \ No newline at end of file diff --git a/configurationapp/target/classes/data.sql b/configurationapp/target/classes/data.sql new file mode 100644 index 0000000..9ce4cf4 --- /dev/null +++ b/configurationapp/target/classes/data.sql @@ -0,0 +1,4 @@ +INSERT INTO CONFIGVALUES (config_Name, config_Date) VALUES ('A', '022019'); +INSERT INTO CONFIGVALUES (config_Name, config_Date) VALUES ('B', '022019'); +INSERT INTO CONFIGVALUES (config_Name, config_Date) VALUES ('C', '032019'); +INSERT INTO CONFIGVALUES (config_Name, config_Date) VALUES ('D', '042019'); \ No newline at end of file diff --git a/configurationapp/target/classes/static/index.html b/configurationapp/target/classes/static/index.html new file mode 100755 index 0000000..fc8e983 --- /dev/null +++ b/configurationapp/target/classes/static/index.html @@ -0,0 +1,136 @@ + + + + + + + DataTables + + + + + + + + + + + + + + + + + + + + + + + + + + +

Welcome To The Configuration App

+ +

Current Configurations (All)

+ +
+ + + + + + + + +
Config IDConfig NameConfig Date
+
+ +

To Add a Configuration

+ +
+ + + + + + + + + + + + + + +
+ +

To Delete ALL Configurations for a Selected Month

+
+ + + + + + +
+ +

To Delete a SINGLE Configuration

+
+ + + + + + + + +
+ + + + + + + + + + + + + + \ No newline at end of file diff --git a/configurationapp/target/classes/static/js/app.js b/configurationapp/target/classes/static/js/app.js new file mode 100644 index 0000000..9ba6a11 --- /dev/null +++ b/configurationapp/target/classes/static/js/app.js @@ -0,0 +1,27 @@ +(function() { + function App() { + + } + + App.prototype.getData = function() { + $.ajax('',{ + + }).then(function(data) { + + }) + }; + + App.prototype.init = function() { + $('#configTable').DataTable({ + scrollY: 300, + paging: true, + sorting: true, + ordering: true, + select: true, + searching: false, + info: false + }); + }; + + window.app = new App; +})($); diff --git a/configurationapp/target/classes/static/js/jquery.spring-friendly.js b/configurationapp/target/classes/static/js/jquery.spring-friendly.js new file mode 100755 index 0000000..c786bdd --- /dev/null +++ b/configurationapp/target/classes/static/js/jquery.spring-friendly.js @@ -0,0 +1,73 @@ +// From https://github.com/jquery/jquery/blob/master/src/serialize.js +// Overrides data serialization to allow Spring MVC to correctly map input parameters : column[0][data] now becomes column[0].data +(function($) { + var r20 = /%20/g, rbracket = /\[\]$/, rCRLF = /\r?\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i; + + function customBuildParams(prefix, obj, traditional, add) { + var name; + + if (jQuery.isArray(obj)) { + // Serialize array item. + jQuery.each(obj, function(i, v) { + if (traditional || rbracket.test(prefix)) { + // Treat each array item as a scalar. + add(prefix, v); + + } else { + // Item is non-scalar (array or object), encode its numeric + // index. + customBuildParams(prefix + "[" + + (typeof v === "object" ? i : "") + "]", v, + traditional, add); + } + }); + + } else if (!traditional && jQuery.type(obj) === "object") { + // Serialize object item. + for (name in obj) { + // This is where the magic happens + customBuildParams(prefix + "." + name, obj[name], traditional, + add); + } + + } else { + // Serialize scalar item. + add(prefix, obj); + } + } + + $.param = function(a, traditional) { + var prefix, s = [], add = function(key, value) { + // If value is a function, invoke it and return its value + value = jQuery.isFunction(value) ? value() : (value == null ? "" + : value); + s[s.length] = encodeURIComponent(key) + "=" + + encodeURIComponent(value); + }; + + // Set traditional to true for jQuery <= 1.3.2 behavior. + if (traditional === undefined) { + traditional = jQuery.ajaxSettings + && jQuery.ajaxSettings.traditional; + } + + // If an array was passed in, assume that it is an array of form + // elements. + if (jQuery.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) { + // Serialize the form elements + jQuery.each(a, function() { + add(this.name, this.value); + }); + + } else { + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for (prefix in a) { + customBuildParams(prefix, a[prefix], traditional, add); + } + } + + // Return the resulting serialization + return s.join("&").replace(r20, "+"); + }; +})(jQuery); \ No newline at end of file diff --git a/configurationapp/target/configurationapp.jar.original b/configurationapp/target/configurationapp.jar.original new file mode 100644 index 0000000..a2dfe08 Binary files /dev/null and b/configurationapp/target/configurationapp.jar.original differ diff --git a/configurationapp/target/maven-archiver/pom.properties b/configurationapp/target/maven-archiver/pom.properties new file mode 100644 index 0000000..02b9c6b --- /dev/null +++ b/configurationapp/target/maven-archiver/pom.properties @@ -0,0 +1,4 @@ +#Created by Apache Maven 3.6.0 +groupId=com.att +artifactId=configurationapp +version=0.0.1-SNAPSHOT diff --git a/configurationapp/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/configurationapp/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..4e0519f --- /dev/null +++ b/configurationapp/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,5 @@ +com/att/dao/configurations/ConfigurationDao.class +com/att/ConfigurationApp.class +com/att/web/configuarations/ConfigurationController.class +com/att/dao/configurations/ConfigurationDao$IdProvider.class +com/att/data/configurations/ConfigValue.class diff --git a/configurationapp/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/configurationapp/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..6aa7b0a --- /dev/null +++ b/configurationapp/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,4 @@ +/Users/gcanter/dev/springboot/configurationapp/src/main/java/com/att/dao/configurations/ConfigurationDao.java +/Users/gcanter/dev/springboot/configurationapp/src/main/java/com/att/ConfigurationApp.java +/Users/gcanter/dev/springboot/configurationapp/src/main/java/com/att/data/configurations/ConfigValue.java +/Users/gcanter/dev/springboot/configurationapp/src/main/java/com/att/web/configuarations/ConfigurationController.java