feat(explode): first commit

master
guilherme 2025-06-17 15:19:52 -03:00
commit 5862aabf61
1134 changed files with 613522 additions and 0 deletions

19
nb-configuration.xml Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
<!--
This file contains additional configuration written by modules in the NetBeans IDE.
The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
<!--
Properties that influence various parts of the IDE, especially code formatting and the like.
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>Tomcat</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
<netbeans.hint.jdkPlatform>JDK_21</netbeans.hint.jdkPlatform>
</properties>
</project-shared-configuration>

498
pom.xml Normal file
View File

@ -0,0 +1,498 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.agapesistemas</groupId>
<artifactId>agtemplate</artifactId>
<version>1.0.0</version>
<packaging>${packaging.type}</packaging>
<name>AgTemplate</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<owb.version>2.0.21</owb.version>
<mojarra.version>4.0.7</mojarra.version>
<open-pdf.version>1.3.24</open-pdf.version>
<poi.version>5.0.0</poi.version>
<lombok.version>1.18.32</lombok.version>
<modelmapper.version>3.1.0</modelmapper.version>
<jackson.version>2.15.2</jackson.version>
<packaging.type>war</packaging.type>
<project.template>poseidon</project.template>
</properties>
<dependencies>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.1</version>
</dependency>
<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<optional>true</optional>
</dependency>
<!-- Model Mapper-->
<dependency>
<groupId>org.modelmapper</groupId>
<artifactId>modelmapper</artifactId>
<version>${modelmapper.version}</version>
</dependency>
<!-- API -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version> <!-- Verifique a versão mais recente no momento de uso -->
</dependency>
<!-- Java 8 Date/time -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson.version}</version>
</dependency>
<!-- Java 8 Datatypes -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.3.1</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>11.0.0</version>
<classifier>jakarta</classifier>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.faces</artifactId>
<version>${mojarra.version}</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>5.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>10.0.0</version>
</dependency>
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet-shaded</artifactId>
<version>5.0.1.Final</version>
</dependency>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<version>4.0.1</version>
</dependency>
<!--
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-jsf</artifactId>
<version>${owb.version}</version>
<classifier>jakarta</classifier>
<exclusions>
<exclusion>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-web</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-el22</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-impl</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-spi</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-web</artifactId>
<version>${owb.version}</version>
<classifier>jakarta</classifier>
<exclusions>
<exclusion>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-el22</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-impl</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-spi</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-el22</artifactId>
<version>${owb.version}</version>
<classifier>jakarta</classifier>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-impl</artifactId>
<version>${owb.version}</version>
<classifier>jakarta</classifier>
<exclusions>
<exclusion>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-spi</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-spi</artifactId>
<version>${owb.version}</version>
<classifier>jakarta</classifier>
</dependency>
-->
<!-- Export Demo Impl -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-all</artifactId>
</exclusion>
<exclusion>
<groupId>de.rototor.pdfbox</groupId>
<artifactId>graphics2d</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.santuario</groupId>
<artifactId>xmlsec</artifactId>
</exclusion>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
</exclusion>
<exclusion>
<groupId>com.github.virtuald</groupId>
<artifactId>curvesapi</artifactId>
</exclusion>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.librepdf</groupId>
<artifactId>openpdf</artifactId>
<version>${open-pdf.version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
</repository>
</repositories>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<includes>
<include>web.xml</include>
</includes>
<filtering>true</filtering>
<targetPath>${project.build.directory}</targetPath>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.36.v20210114</version>
<configuration>
<webAppConfig>
<contextPath>/poseidon</contextPath>
</webAppConfig>
<scanIntervalSeconds>5</scanIntervalSeconds>
<webXml>${project.build.directory}/web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>distribute</id>
<properties>
<packaging.type>jar</packaging.type>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>build-layout</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assemble/layout.xml</descriptor>
</descriptors>
<finalName>${project.template}-layout-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
<execution>
<id>build-theme</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assemble/theme.xml</descriptor>
</descriptors>
<finalName>${project.template}-theme-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<finalName>${project.template}-theme-${project.version}-jakarta</finalName>
<shadedArtifactAttached>false</shadedArtifactAttached>
<createDependencyReducedPom>false</createDependencyReducedPom>
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
<minimizeJar>true</minimizeJar>
<shadeSourcesContent>true</shadeSourcesContent>
<filters>
<filter>
<artifact>*:*</artifact>
<includes>
<include>org/primefaces/${project.template}/component/*</include>
<include>META-INF/MANIFEST.MF</include>
<include>META-INF/faces-config.xml</include>
<include>META-INF/primefaces-${project.template}.taglib.xml</include>
<include>META-INF/resources/primefaces-${project.template}-*/*</include>
</includes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<id>jakarta</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>jakarta</shadedClassifierName>
<createDependencyReducedPom>false</createDependencyReducedPom>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="io.yupiik.maven.shade.transformer.RelocationTransformer">
<delegates>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
<resource>META-INF/faces-config.xml</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
<resource>META-INF/primefaces-${project.template}.taglib.xml</resource>
</transformer>
</delegates>
</transformer>
</transformers>
<artifactSet>
<includes>
<include>${project.groupId}:${project.artifactId}</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>javax.faces</pattern>
<shadedPattern>jakarta.faces</shadedPattern>
</relocation>
<relocation>
<pattern>javax.el</pattern>
<shadedPattern>jakarta.el</shadedPattern>
</relocation>
<relocation>
<pattern>jakarta.annotation</pattern>
<shadedPattern>jakarta.annotation</shadedPattern>
</relocation>
<relocation>
<pattern>javax.servlet</pattern>
<shadedPattern>jakarta.servlet</shadedPattern>
</relocation>
<relocation>
<pattern>javax.persistence</pattern>
<shadedPattern>jakarta.persistence</shadedPattern>
</relocation>
<relocation>
<pattern>jakarta.enterprise</pattern>
<shadedPattern>jakarta.enterprise</shadedPattern>
</relocation>
<relocation>
<pattern>javax.xml.bind</pattern>
<shadedPattern>jakarta.xml.bind</shadedPattern>
</relocation>
<relocation>
<pattern>javax.validation</pattern>
<shadedPattern>jakarta.validation</shadedPattern>
</relocation>
<relocation>
<pattern>jakarta.inject</pattern>
<shadedPattern>jakarta.inject</shadedPattern>
</relocation>
<relocation>
<pattern>javax.activation</pattern>
<shadedPattern>jakarta.activation</shadedPattern>
</relocation>
<relocation>
<pattern>javax.ws.rs</pattern>
<shadedPattern>jakarta.ws.rs</shadedPattern>
</relocation>
<relocation>
<pattern>javax.jws</pattern>
<shadedPattern>jakarta.jws</shadedPattern>
</relocation>
<relocation>
<pattern>javax.cache</pattern>
<shadedPattern>jakarta.cache</shadedPattern>
</relocation>
<relocation>
<pattern>javax.xml.ws</pattern>
<shadedPattern>jakarta.xml.ws</shadedPattern>
</relocation>
<relocation>
<pattern>javax.xml.soap</pattern>
<shadedPattern>jakarta.xml.soap</shadedPattern>
</relocation>
<relocation>
<pattern>window.jsf</pattern>
<shadedPattern>window.faces</shadedPattern>
</relocation>
<relocation>
<pattern>jsf.ajax</pattern>
<shadedPattern>faces.ajax</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>io.yupiik.maven</groupId>
<artifactId>maven-shade-transformers</artifactId>
<version>0.0.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>deploy</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<webResources>
<resource>
<filtering>true</filtering>
<directory>src/main/webapp</directory>
<includes>
<include>**/web.xml</include>
</includes>
</resource>
</webResources>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<webXml>${project.build.directory}/web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

44
src/assemble/layout.xml Normal file
View File

@ -0,0 +1,44 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>layout</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/poseidon-layout</directory>
<outputDirectory>/resources/poseidon-layout</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp</directory>
<includes>
<include>notfound.xhtml</include>
<include>access.xhtml</include>
<include>login.xhtml</include>
<include>empty.xhtml</include>
<include>error.xhtml</include>
<include>landing.xhtml</include>
<include>invoice.xhtml</include>
<include>help.xhtml</include>
</includes>
<outputDirectory>/</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<includes>
<include>*.xhtml</include>
</includes>
<outputDirectory>/WEB-INF</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/sass</directory>
<outputDirectory>/sass</outputDirectory>
</fileSet>
</fileSets>
</assembly>

173
src/assemble/theme.xml Normal file
View File

@ -0,0 +1,173 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>theme</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-amber-dark</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-amber-dark</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-amber-dim</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-amber-dim</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-amber-light</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-amber-light</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-amethyst-dark</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-amethyst-dark</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-amethyst-dim</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-amethyst-dim</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-amethyst-light</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-amethyst-light</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-apple-dark</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-apple-dark</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-apple-dim</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-apple-dim</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-apple-light</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-apple-light</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-camelot-dark</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-camelot-dark</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-camelot-dim</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-camelot-dim</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-camelot-light</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-camelot-light</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-cape-palliser-dark</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-cape-palliser-dark</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-cape-palliser-dim</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-cape-palliser-dim</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-cape-palliser-light</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-cape-palliser-light</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-cyan-dark</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-cyan-dark</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-cyan-dim</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-cyan-dim</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-cyan-light</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-cyan-light</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-denim-dark</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-denim-dark</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-denim-dim</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-denim-dim</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-denim-light</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-denim-light</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-gigas-dark</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-gigas-dark</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-gigas-dim</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-gigas-dim</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-gigas-light</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-gigas-light</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-jungle-green-dark</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-jungle-green-dark</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-jungle-green-dim</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-jungle-green-dim</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-jungle-green-light</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-jungle-green-light</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-sea-green-dark</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-sea-green-dark</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-sea-green-dim</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-sea-green-dim</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-sea-green-light</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-sea-green-light</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-tapestry-dark</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-tapestry-dark</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-tapestry-dim</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-tapestry-dim</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-tapestry-light</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-tapestry-light</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-wedgewood-dark</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-wedgewood-dark</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-wedgewood-dim</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-wedgewood-dim</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/resources/primefaces-poseidon-wedgewood-light</directory>
<outputDirectory>/META-INF/resources/primefaces-poseidon-wedgewood-light</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<outputDirectory>/META-INF/</outputDirectory>
<includes>
<include>faces-config.xml</include>
<include>primefaces-poseidon.taglib.xml</include>
</includes>
</fileSet>
<fileSet>
<directory>${basedir}/target/classes</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>org/primefaces/poseidon/component/*</include>
</includes>
</fileSet>
</fileSets>
</assembly>

View File

@ -0,0 +1,39 @@
package br.com.agapesistemas.agtemplate.agtemplate.api.assembler;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
import org.modelmapper.ModelMapper;
import br.com.agapesistemas.agtemplate.agtemplate.api.model.input.Tb_templateInput;
import br.com.agapesistemas.agtemplate.agtemplate.api.model.input.Tb_templateIdInput;
import br.com.agapesistemas.agtemplate.agtemplate.model.to.Tb_template;
import br.com.agapesistemas.agtemplate.agtemplate.api.model.ModelMapperConfiguration;
public class Tb_templateInputAssembler implements Serializable {
private ModelMapper modelMapper;
public Tb_templateInputAssembler(){
modelMapper = ModelMapperConfiguration.getInstance();
}
public Tb_templateInput toInput(Tb_template tb_template) {
return modelMapper.map(tb_template, Tb_templateInput.class);
}
public List<Tb_templateInput> toCollectionInput(List<Tb_template> listTb_template) {
return listTb_template.stream()
.map(tb_template -> toInput(tb_template))
.collect(Collectors.toList());
}
public Tb_templateIdInput toIdInput(Tb_template tb_template) {
return modelMapper.map(tb_template, Tb_templateIdInput.class);
}
public List<Tb_templateIdInput> toCollectionIdInput(List<Tb_template> listTb_template) {
return listTb_template.stream()
.map(tb_template -> toIdInput(tb_template))
.collect(Collectors.toList());
}
}

View File

@ -0,0 +1,20 @@
package br.com.agapesistemas.agtemplate.agtemplate.api.assembler;
import java.io.Serializable;
import org.modelmapper.ModelMapper;
import br.com.agapesistemas.agtemplate.agtemplate.api.model.Tb_templateModel;
import br.com.agapesistemas.agtemplate.agtemplate.model.to.Tb_template;
import br.com.agapesistemas.agtemplate.agtemplate.api.model.ModelMapperConfiguration;
public class Tb_templateModelDisassembler implements Serializable {
private ModelMapper modelMapper = ModelMapperConfiguration.getInstance();
public Tb_template toDomainObject(Tb_templateModel tb_templateModel) {
return modelMapper.map(tb_templateModel, Tb_template.class);
}
public void copyToDomainObject(Tb_templateModel tb_templateModel, Tb_template tb_template) {
modelMapper.map(tb_templateModel, tb_template);
}
}

View File

@ -0,0 +1,38 @@
package br.com.agapesistemas.agtemplate.agtemplate.api.model;
import org.modelmapper.ModelMapper;
import org.modelmapper.PropertyMap;
import br.com.agapesistemas.agtemplate.agtemplate.model.to.Tb_template;
import br.com.agapesistemas.agtemplate.agtemplate.api.model.input.Tb_templateInput;
public class ModelMapperConfiguration {
private static ModelMapper modelMapper = null;
public synchronized static ModelMapper getInstance(){
if(modelMapper == null){
modelMapper = new ModelMapper();
//Mapear tb_template
modelMapper.addMappings(new PropertyMap<Tb_template, Tb_templateInput>() {
@Override
protected void configure() {
}
});
modelMapper.addMappings(new PropertyMap<Tb_template, Tb_templateModel>() {
@Override
protected void configure() {
}
});
modelMapper.addMappings(new PropertyMap<Tb_templateModel, Tb_template>() {
@Override
protected void configure() {
}
});
}
return modelMapper;
}
}

View File

@ -0,0 +1,16 @@
package br.com.agapesistemas.agtemplate.agtemplate.api.model;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
import com.fasterxml.jackson.annotation.JsonView;
import br.com.agapesistemas.agtemplate.agtemplate.api.model.view.Tb_templateView;
@Setter
@Getter
public class Tb_templateModel implements Serializable {
private Integer id;
private String nome;
}

View File

@ -0,0 +1,13 @@
package br.com.agapesistemas.agtemplate.agtemplate.api.model.input;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class Tb_templateIdInput implements Serializable {
private Integer id;
}

View File

@ -0,0 +1,16 @@
package br.com.agapesistemas.agtemplate.agtemplate.api.model.input;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class Tb_templateInput implements Serializable {
private Integer id;
private String nome;
}

View File

@ -0,0 +1,11 @@
package br.com.agapesistemas.agtemplate.agtemplate.api.model.view;
public interface Tb_templateView {
public interface Consulta {
}
public interface Id {
}
}

View File

@ -0,0 +1,111 @@
package br.com.agapesistemas.agtemplate.agtemplate.api.service;
import br.com.agapesistemas.agtemplate.agtemplate.api.assembler.Tb_templateModelDisassembler;
import br.com.agapesistemas.agtemplate.agtemplate.api.assembler.Tb_templateInputAssembler;
import br.com.agapesistemas.agtemplate.agtemplate.api.model.Tb_templateModel;
import br.com.agapesistemas.agtemplate.agtemplate.api.model.input.Tb_templateInput;
import br.com.agapesistemas.agtemplate.agtemplate.api.model.input.Tb_templateIdInput;
import br.com.agapesistemas.agtemplate.agtemplate.model.to.Tb_template;
import br.com.agapesistemas.agtemplate.agtemplate.api.service.base.AgtemplateApiBase;
import com.fasterxml.jackson.core.type.TypeReference;
import java.util.ArrayList;
import java.util.List;
import br.com.agapesistemas.agtemplate.agtemplate.filtro.Tb_templateFiltro;
import java.util.Map;
public class Tb_templateService extends AgtemplateApiBase {
private static final String BASE_URL = SCHEMA_URL+"/tb_templates";
private static String getBase(String token){
return token==null?BASE_URL:BASE_URL+"/"+getUuidCliente(token);
}
public static void insert(String token, Tb_template tb_template) throws Exception {
String uri = getBase(token);
Tb_templateInputAssembler assembler = new Tb_templateInputAssembler();
Tb_templateInput input = assembler.toInput(tb_template);
String jsonBody = convertObjectToJson(input);
Tb_templateModelDisassembler disassembler = new Tb_templateModelDisassembler();
Tb_templateModel model = (Tb_templateModel) post(token,uri,jsonBody, new TypeReference<Tb_templateModel>() {});
if (model != null) {
disassembler.copyToDomainObject(model, tb_template);
}
}
public static void update(String token, Tb_template tb_template) throws Exception {
String uri = getBase(token)+"/"+tb_template.getId();
Tb_templateInputAssembler assembler = new Tb_templateInputAssembler();
Tb_templateInput input = assembler.toInput(tb_template);
String jsonBody = convertObjectToJson(input);
Tb_templateModelDisassembler disassembler = new Tb_templateModelDisassembler();
Tb_templateModel model = (Tb_templateModel) put(token,uri,jsonBody, new TypeReference<Tb_templateModel>() {});
if (model != null) {
disassembler.copyToDomainObject(model, tb_template);
}
}
public static void delete(String token, Tb_template tb_template) throws Exception {
String uri = getBase(token)+"/"+tb_template.getId();
delete(token,uri);
}
public static void deleteAll(String token, List<Tb_template> listTb_template) throws Exception {
String uri = getBase(token) + "/excluirlista";
Tb_templateInputAssembler assembler = new Tb_templateInputAssembler();
List<Tb_templateIdInput> inputs = assembler.toCollectionIdInput(listTb_template);
String jsonBody = convertObjectToJson(inputs);
post(token,uri, jsonBody, new TypeReference<String>() {});
}
public static Tb_template getByPK(String token, Tb_template tb_template) throws Exception {
String uri = getBase(token) +"/"+ tb_template.getId();
Tb_templateModelDisassembler disassembler = new Tb_templateModelDisassembler();
Tb_templateModel model = (Tb_templateModel) get(token,uri, new TypeReference<Tb_templateModel>() {});
if (model != null) {
Tb_template objeto = new Tb_template();
disassembler.copyToDomainObject(model, objeto);
return objeto;
}
return null;
}
public static Tb_template getByPKToString(String token, Tb_template tb_template) throws Exception {
String uri = getBase(token) +"/"+ tb_template.getId()+"/tostring";
Tb_templateModelDisassembler disassembler = new Tb_templateModelDisassembler();
Tb_templateModel model = (Tb_templateModel) get(token,uri, new TypeReference<Tb_templateModel>() {});
if (model != null) {
Tb_template objeto = new Tb_template();
disassembler.copyToDomainObject(model, objeto);
return objeto;
}
return null;
}
public static List<Tb_template> getAllByFiltro(String token, Tb_templateFiltro tb_templateFiltro) throws Exception {
tb_templateFiltro.setCount(false);
String uri = getBase(token)+"/filtrar";
String jsonBody = convertObjectToJson(tb_templateFiltro);
Tb_templateModelDisassembler disassembler = new Tb_templateModelDisassembler();
List<Tb_templateModel> list = (List<Tb_templateModel>) post(token,uri,jsonBody, new TypeReference<List<Tb_templateModel>>() {});
List<Tb_template> listTb_template = new ArrayList<>();
if (list != null) {
for (Tb_templateModel model : list) {
Tb_template tb_template = new Tb_template();
disassembler.copyToDomainObject(model, tb_template);
listTb_template.add(tb_template);
}
}
return listTb_template;
}
public static Integer getCountByFiltro(String token, Tb_templateFiltro tb_templateFiltro) throws Exception {
tb_templateFiltro.setCount(true);
String uri = getBase(token)+"/filtrar/total";
String jsonBody = convertObjectToJson(tb_templateFiltro);
Map<String,Integer> resultMap = (Map) post(token,uri,jsonBody, new TypeReference<Map<String,Integer>>() {});
return resultMap.get("total");
}
}

View File

@ -0,0 +1,10 @@
package br.com.agapesistemas.agtemplate.agtemplate.api.service.base;
import br.com.agapesistemas.agtemplate.service.BaseService;
public class AgtemplateApiBase extends BaseService {
protected static final String SCHEMA_URL = DOMINIO_SERVICE+"/agtemplate";
}

View File

@ -0,0 +1,123 @@
package br.com.agapesistemas.agtemplate.agtemplate.controller;
import br.com.agapesistemas.agtemplate.agtemplate.model.to.Tb_template;
import br.com.agapesistemas.agtemplate.agtemplate.filtro.Tb_templateFiltro;
import br.com.agapesistemas.agtemplate.agtemplate.exception.Tb_templateException;
import java.io.Serializable;
import br.com.agapesistemas.agtemplate.jdbc.TransactionManager;
import br.com.agapesistemas.agtemplate.agtemplate.model.dao.Tb_templateDAO;
import java.util.List;
public class Tb_templateController implements Serializable {
public static void insert(Tb_template tb_template) throws Exception {
try (TransactionManager transactionManager = new TransactionManager()) {
Tb_templateDAO.insert(tb_template,transactionManager.getConnection());
transactionManager.commit();
} catch (Exception ex) {
throw ex;
}
}
public static void update(Tb_template tb_template) throws Exception {
try (TransactionManager transactionManager = new TransactionManager()) {
Tb_templateDAO.update(tb_template,transactionManager.getConnection());
transactionManager.commit();
} catch (Exception ex) {
throw ex;
}
}
public static void delete(Tb_template tb_template) throws Exception {
try (TransactionManager transactionManager = new TransactionManager()) {
Tb_templateDAO.delete(tb_template,transactionManager.getConnection());
transactionManager.commit();
} catch (Exception ex) {
throw ex;
}
}
public static void deleteAll(List<Tb_template> listTb_template) throws Exception {
try (TransactionManager transactionManager = new TransactionManager()) {
for(Tb_template tb_template: listTb_template){
Tb_templateDAO.delete(tb_template,transactionManager.getConnection());
}
transactionManager.commit();
} catch (Exception ex) {
throw ex;
}
}
public static Tb_template getByPK(Tb_template tb_template) throws Exception {
try (TransactionManager transactionManager = new TransactionManager()) {
return Tb_templateDAO.getByPK(tb_template,transactionManager.getConnection());
} catch (Exception e) {
throw e;
}
}
public static Tb_template buscarOuFalhar(Integer id) throws Exception {
try (TransactionManager transactionManager = new TransactionManager()) {
Tb_template tb_template = Tb_templateDAO.getByPK(id,transactionManager.getConnection());
if(tb_template == null){
throw new Tb_templateException(Tb_template.MODULO+" não encontrado.");
}
return tb_template;
} catch (Exception e) {
throw e;
}
}
public static Tb_template buscarOuFalharToString(Integer id) throws Exception {
try (TransactionManager transactionManager = new TransactionManager()) {
Tb_template tb_template = Tb_templateDAO.getByPKToString(id,transactionManager.getConnection());
if(tb_template == null){
throw new Tb_templateException(Tb_template.MODULO+" não encontrado.");
}
return tb_template;
} catch (Exception e) {
throw e;
}
}
public static List<Tb_template> getAll(String pesquisa) throws Exception {
try (TransactionManager transactionManager = new TransactionManager()) {
return Tb_templateDAO.getAll(pesquisa,transactionManager.getConnection());
} catch (Exception e) {
throw e;
}
}
public static List<Tb_template> getAllToString(String pesquisa) throws Exception {
try (TransactionManager transactionManager = new TransactionManager()) {
return Tb_templateDAO.getAllToString(pesquisa,transactionManager.getConnection());
} catch (Exception e) {
throw e;
}
}
public static List<Tb_template> getAllByFiltro(Tb_templateFiltro tb_templateFiltro) throws Exception {
try (TransactionManager transactionManager = new TransactionManager()) {
return Tb_templateDAO.getAllByFiltro(tb_templateFiltro,transactionManager.getConnection());
} catch (Exception e) {
throw e;
}
}
public static int getCountByFiltro(Tb_templateFiltro tb_templateFiltro) throws Exception {
try (TransactionManager transactionManager = new TransactionManager()) {
return Tb_templateDAO.getCountByFiltro(tb_templateFiltro,transactionManager.getConnection());
} catch (Exception e) {
throw e;
}
}
public static int getQtdCamposPreenchidos(Tb_template tb_template) throws Exception {
try (TransactionManager transactionManager = new TransactionManager()) {
return Tb_templateDAO.getQtdCamposPreenchidos(tb_template,transactionManager.getConnection());
} catch (Exception e) {
throw e;
}
}
}

View File

@ -0,0 +1,39 @@
package br.com.agapesistemas.agtemplate.agtemplate.converter;
import br.com.agapesistemas.agtemplate.agtemplate.model.to.Tb_template;
import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;
import jakarta.faces.component.UIComponent;
import jakarta.faces.context.FacesContext;
import jakarta.faces.convert.Converter;
import jakarta.faces.convert.FacesConverter;
import br.com.agapesistemas.agtemplate.agtemplate.controller.Tb_templateController;
@FacesConverter(value = "agtemplateTb_templateConverter")
public class Tb_templateConverter implements Converter,Serializable {
@Override
public Object getAsObject(FacesContext fc, UIComponent uic, String string) {
return string;
}
@Override
public String getAsString(FacesContext fc, UIComponent uic, Object o) {
if (o != null) {
Tb_template objeto = null;
try {
if(objeto != null){
return objeto.toString();
} else {
return null;
}
} catch (Exception ex) {
Logger.getLogger(Tb_templateConverter.class.getName()).log(Level.SEVERE, null, ex);
}
return o.toString();
}
return null;
}
}

View File

@ -0,0 +1,48 @@
package br.com.agapesistemas.agtemplate.agtemplate.exception;
import java.util.HashMap;
import java.sql.SQLException;
import br.com.agapesistemas.agtemplate.exception.base.BaseException;
import br.com.agapesistemas.agtemplate.agtemplate.model.to.Tb_template;
public class Tb_templateException extends BaseException {
private static HashMap<String,String> chaves;
private Tb_template tb_template;
public Tb_templateException(String msg) {
super(msg);
}
public Tb_templateException(String msg, Tb_template tb_template) {
super((tb_template != null?" ("+tb_template.toString()+")":"")+msg);
}
public Tb_template getTb_template() {
return tb_template;
}
public String getNomeObjeto() {
if (tb_template != null){
return "("+tb_template.toString()+")";
}
return "";
}
public static String getErro(SQLException ex) {
if(ex != null){
return getChaves().get(getKey("tb_template",ex));
}
return null;
}
private static synchronized HashMap<String, String> getChaves(){
if(chaves == null){
chaves = new HashMap<>();
chaves.put("tb_template.tb_template_pkey", Tb_template.MODULO+" já cadastrado.");
}
return chaves;
}
}

View File

@ -0,0 +1,37 @@
package br.com.agapesistemas.agtemplate.agtemplate.filter;
import java.io.IOException;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.FilterConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
public class AgtemplateFilter implements Filter {
@Override
public void destroy() {
// TODO Auto-generated method stub
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
//Usuario usuario = (Usuario) ((HttpServletRequest) request).getSession().getAttribute("usuarioSessao")
String usuario = "";
if(usuario == null){
String contextPath = ((HttpServletRequest) request).getContextPath();
((HttpServletResponse) response).sendRedirect(contextPath + "/");
} else {
chain.doFilter(request, response);
}
}
@Override
public void init(FilterConfig filterConfig) {
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,88 @@
package br.com.agapesistemas.agtemplate.agtemplate.filtro;
import java.io.Serializable;
import java.util.List;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class Filtro implements Serializable {
private int primeiroRegitro = 0;
private int quantidadeRegitros = 10;
private boolean generica;
private boolean limit = true;
private boolean count;
private String pesquisaGenerica;
private List<Object> listFiltro = new ArrayList<Object>();
private Map<String, Boolean> listColumnOrder = new HashMap<>();
private Map<String, String> listColumnFilter = new HashMap<>();
public Map<String, Boolean> getListColumnOrder() {
return listColumnOrder;
}
public void setListColumnOrder(Map<String, Boolean> listColumnOrder) {
this.listColumnOrder = listColumnOrder;
}
public Map<String, String> getListColumnFilter() {
return listColumnFilter;
}
public void setListColumnFilter(Map<String, String> listColumnFilter) {
this.listColumnFilter = listColumnFilter;
}
public int getPrimeiroRegitro() {
return primeiroRegitro;
}
public void setPrimeiroRegitro(int primeiroRegitro) {
this.primeiroRegitro = primeiroRegitro;
}
public int getQuantidadeRegitros() {
return quantidadeRegitros;
}
public void setQuantidadeRegitros(int quantidadeRegitros) {
this.quantidadeRegitros = quantidadeRegitros;
}
public List<Object> getListFiltro() {
return listFiltro;
}
public void setListFiltro(List<Object> listFiltro) {
this.listFiltro = listFiltro;
}
public boolean isGenerica() {
return generica;
}
public void setGenerica(boolean generica) {
this.generica = generica;
}
public boolean isCount() {
return count;
}
public void setCount(boolean count) {
this.count = count;
}
public boolean isLimit() {
return limit;
}
public void setLimit(boolean limit) {
this.limit = limit;
}
public String getPesquisaGenerica() {
return pesquisaGenerica;
}
public void setPesquisaGenerica(String pesquisaGenerica) {
this.pesquisaGenerica = pesquisaGenerica;
}
}

View File

@ -0,0 +1,75 @@
package br.com.agapesistemas.agtemplate.agtemplate.filtro;
import java.math.BigDecimal;
public class Tb_templateFiltro extends Filtro {
private Integer id;
private String nome;
public Integer getId(){
return id;
}
public void setId(Integer id){
this.id = id;
}
public String getNome(){
return nome;
}
public void setNome(String nome){
this.nome = nome;
}
public String getSQL(String orderBy){
StringBuilder sql = new StringBuilder(" where 1=1");
getListFiltro().clear();
if (isGenerica()) {
if (getPesquisaGenerica() != null && !getPesquisaGenerica().trim().equals("")) {
sql.append(" and (1=2");
try{
getListFiltro().add(Integer.parseInt(getPesquisaGenerica()));
sql.append(" or id = ?");
}catch(NumberFormatException e){}
getListFiltro().add("%"+getPesquisaGenerica()+"%");
sql.append(" or nome ilike ?");
sql.append(")");
}
}else{
if(id != null){
getListFiltro().add(id);
sql.append(" and id = ?");
}
if(nome != null && !nome.trim().equals("")){
getListFiltro().add("%"+nome+"%");
sql.append(" and nome ilike ?");
}
}
if (!isCount()){
if (!isCount() && !getListColumnOrder().isEmpty()) {
sql.append(" order by ");
int i = 0;
for (String key : getListColumnOrder().keySet()) {
if (i > 0) {
sql.append(",");
}
sql.append(key);
boolean asc = getListColumnOrder().get(key);
if (asc) {
sql.append(" asc");
} else {
sql.append(" desc");
}
i++; } }else if(orderBy != null){
sql.append(orderBy);
}
if(isLimit()){
sql.append(" limit ").append(getQuantidadeRegitros());
sql.append(" offset ").append(getPrimeiroRegitro());
}
}
return sql.toString();
}
}

View File

@ -0,0 +1,349 @@
package br.com.agapesistemas.agtemplate.agtemplate.model.dao;
import br.com.agapesistemas.agtemplate.agtemplate.model.to.Tb_template;
import br.com.agapesistemas.agtemplate.agtemplate.filtro.Tb_templateFiltro;
import br.com.agapesistemas.agtemplate.agtemplate.exception.Tb_templateException;
import java.io.Serializable;
import java.sql.*;
import java.util.List;
import java.util.ArrayList;
public class Tb_templateDAO extends br.com.agapesistemas.agtemplate.model.dao.BaseDAO implements Serializable {
private static final String SQL_QTD_CAMPOS_PREENCHIDOS = "select case when id is null then 0 else 1 end + case when nome is null then 0 else 1 end as total from agtemplate.tb_template where 1=1 and id = ?";
private static final String TABELA = "agtemplate.tb_template";
private static final String TABELA_CONSULTA = TABELA+ " t";
public static final String CAMPOS_PK = "id";
private static final String CAMPOS_SEM_PK_ANEXOS = "nome";
private static final String CAMPOS_ANEXOS = "";
private static final String CAMPOS_TO_STRING = "id";
private static final String CAMPOS_COMPLETO_SEM_PK = CAMPOS_SEM_PK_ANEXOS + (!CAMPOS_ANEXOS.isEmpty() ? "," + CAMPOS_ANEXOS : "");
private static final String CAMPOS_SEM_ANEXO = CAMPOS_PK + "," + CAMPOS_SEM_PK_ANEXOS;
private static final String CAMPOS_COMPLETO = CAMPOS_PK + "," + CAMPOS_SEM_PK_ANEXOS + (!CAMPOS_ANEXOS.isEmpty() ? "," + CAMPOS_ANEXOS : "");
private static final String ORDERBY = " order by id";
private static final String SQL_INSERT = "insert into "+TABELA+"(" + CAMPOS_COMPLETO + ") values ("+createPlaceHolderInsert(CAMPOS_COMPLETO)+")";
private static final String SQL_UPDATE = "update "+TABELA+" set "+createPlaceHolderUpdate(CAMPOS_COMPLETO_SEM_PK)+" where id=? ";
private static final String SQL_DELETE = "delete from "+TABELA+" where id=? ";
private static final String SQL_SELECT = "select "+CAMPOS_SEM_ANEXO+" from "+TABELA_CONSULTA;
private static final String SQL_TOSTRING = "select "+CAMPOS_TO_STRING+" from "+TABELA_CONSULTA;
private static final String SQL_PK = "select "+CAMPOS_COMPLETO+" from "+TABELA_CONSULTA+" where id=? ";
private static final String SQL_TOSTRING_PK = "select "+CAMPOS_TO_STRING+" from "+TABELA_CONSULTA+" where id=? ";
private static final String SQL_COUNT = "select count(1) as total from "+TABELA_CONSULTA;
private static final String SQL_SEQUENCE = "select nextval('agtemplate.sq_agtemplate_tb_template') as valor";
public static Integer getNextCodigo(Connection con) throws Exception {
PreparedStatement pStmt = null;
ResultSet rs = null;
try {
pStmt = con.prepareStatement(SQL_SEQUENCE);
rs = pStmt.executeQuery();
if(rs.next()){
return rs.getInt("valor");
}
return null;
} catch (SQLException e) {
throw e;
} finally {
close(rs, pStmt);
}
}
public static Integer getNextCodigo(String sequence, Connection con) throws Exception {
PreparedStatement pStmt = null;
ResultSet rs = null;
try {
String sql_sequence = "select nextval('agtemplate."+sequence+"') as valor ";
pStmt = con.prepareStatement(sql_sequence);
rs = pStmt.executeQuery();
if(rs.next()){
return rs.getInt("valor");
}
return null;
} catch (SQLException e) {
throw e;
} finally {
close(rs, pStmt);
}
}
public static void insert(Tb_template tb_template, Connection con) throws Exception {
PreparedStatement pStmt = null;
try {
pStmt = con.prepareStatement((new StringBuilder(SQL_INSERT)).toString());
int i = 1;
/*
pStmt.setObject(i++, tb_template.getId());
pStmt.setObject(i++, tb_template.getNome());
*/
i = createPreparedStatement(i,pStmt, CAMPOS_COMPLETO, tb_template);
pStmt.execute();
br.com.agapesistemas.agtemplate.model.dao.LogDAO.insertLog(tb_template, con);
} catch (SQLException ex) {
String msg = Tb_templateException.getErro(ex);
if(msg != null){
throw new Tb_templateException(msg, tb_template);
}
throw ex;
} finally {
close(null, pStmt);
}
}
public static void update(Tb_template tb_template, Connection con) throws Exception {
PreparedStatement pStmt = null;
try {
pStmt = con.prepareStatement((new StringBuilder(SQL_UPDATE)).toString());
int i = 1;
/*
pStmt.setObject(i++, tb_template.getNome());
pStmt.setObject(i++, tb_template.getId());
*/
i = createPreparedStatement(i,pStmt, CAMPOS_COMPLETO_SEM_PK, tb_template);
createPreparedStatement(i,pStmt, CAMPOS_PK, tb_template);
pStmt.execute();
br.com.agapesistemas.agtemplate.model.dao.LogDAO.updateLog(tb_template, con);
} catch (SQLException ex) {
String msg = Tb_templateException.getErro(ex);
if(msg != null){
throw new Tb_templateException(msg, tb_template);
}
throw ex;
} finally {
close(null, pStmt);
}
}
public static void delete(Tb_template tb_template, Connection con) throws Exception {
PreparedStatement pStmt = null;
try {
pStmt = con.prepareStatement((new StringBuilder(SQL_DELETE)).toString());
int i = 1;
/*
pStmt.setObject(i++, tb_template.getId());
*/
createPreparedStatement(i,pStmt, CAMPOS_PK, tb_template);
pStmt.execute();
br.com.agapesistemas.agtemplate.model.dao.LogDAO.deleteLog(tb_template, con);
} catch (SQLException ex) {
String msg = Tb_templateException.getErro(ex);
if(msg != null){
throw new Tb_templateException(msg, tb_template);
}
throw ex;
} finally {
close(null, pStmt);
}
}
private static List<Tb_template> resultSetToObjectTransfer(ResultSet rs, boolean completo, Connection con) throws Exception {
List<Tb_template> objs = new ArrayList<>();
while (rs.next()) {
Tb_template tb_template = new Tb_template();
resultSetPreencher(rs, tb_template);
if(completo){
setObjetos(tb_template,con);
}
objs.add(tb_template);
}
return objs;
}
private static Tb_template resultSetToObject(ResultSet rs, boolean completo, Connection con) throws Exception {
if (rs.next()) {
Tb_template tb_template = new Tb_template();
resultSetPreencher(rs, tb_template);
if(completo){
setObjetos(tb_template,con);
}
return tb_template;
}
return null;
}
private static List<Tb_template> resultSetToObjectTransferToString(ResultSet rs, boolean completo, Connection con) throws Exception {
List<Tb_template> objs = new ArrayList<>();
while (rs.next()) {
Tb_template tb_template = new Tb_template();
resultSetPreencher(rs, tb_template);
objs.add(tb_template);
}
return objs;
}
private static Tb_template resultSetToObjectToString(ResultSet rs, boolean completo, Connection con) throws Exception {
if (rs.next()) {
Tb_template tb_template = new Tb_template();
resultSetPreencher(rs, tb_template);
return tb_template;
}
return null;
}
private static void resultSetPreencher(ResultSet rs, Tb_template tb_template) throws Exception {
preencherObjeto(rs, tb_template);
/*
tb_template.setId((Integer)rs.getObject("id"));
tb_template.setNome(rs.getString("nome"));
*/
}
public static void setObjetos(Tb_template tb_template, Connection con) throws Exception {
}
public static Tb_template getByPK(Tb_template tb_template, Connection con) throws Exception {
PreparedStatement pStmt = null;
ResultSet rs = null;
try {
pStmt = con.prepareStatement((new StringBuilder(SQL_PK)).append(ORDERBY).toString());
int i = 1;
createPreparedStatement(i,pStmt, CAMPOS_PK, tb_template);
rs = pStmt.executeQuery();
return resultSetToObject(rs,false,con);
} catch (SQLException e) {
throw e;
} finally {
close(rs, pStmt);
}
}
public static Tb_template getByPK(Integer id, Connection con) throws Exception {
PreparedStatement pStmt = null;
ResultSet rs = null;
try {
pStmt = con.prepareStatement((new StringBuilder(SQL_PK)).append(ORDERBY).toString());
int i = 1;
pStmt.setObject(i++, id);
rs = pStmt.executeQuery();
return resultSetToObjectToString(rs,true,con);
} catch (SQLException e) {
throw e;
} finally {
close(rs, pStmt);
}
}
public static Tb_template getByPKToString(Integer id, Connection con) throws Exception {
PreparedStatement pStmt = null;
ResultSet rs = null;
try {
pStmt = con.prepareStatement((new StringBuilder(SQL_TOSTRING_PK)).append(ORDERBY).toString());
int i = 1;
pStmt.setObject(i++, id);
rs = pStmt.executeQuery();
return resultSetToObjectToString(rs,true,con);
} catch (SQLException e) {
throw e;
} finally {
close(rs, pStmt);
}
}
public static List<Tb_template> getAll(String pesquisa, Connection con) throws Exception {
PreparedStatement pStmt = null;
ResultSet rs = null;
try {
pStmt = con.prepareStatement((new StringBuilder(SQL_SELECT)).append(ORDERBY).toString());
int i = 1;
rs = pStmt.executeQuery();
return resultSetToObjectTransfer(rs,true,con);
} catch (SQLException e) {
throw e;
} finally {
close(rs, pStmt);
}
}
public static List<Tb_template> getAllToString(String pesquisa, Connection con) throws Exception {
PreparedStatement pStmt = null;
ResultSet rs = null;
try {
pStmt = con.prepareStatement((new StringBuilder(SQL_TOSTRING)).append(ORDERBY).toString());
int i = 1;
rs = pStmt.executeQuery();
return resultSetToObjectTransferToString(rs,true,con);
} catch (SQLException e) {
throw e;
} finally {
close(rs, pStmt);
}
}
public static List<Tb_template> getAllByFiltro(Tb_templateFiltro tb_templateFiltro, Connection con) throws Exception {
tb_templateFiltro.setCount(false);
PreparedStatement pStmt = null;
ResultSet rs = null;
try {
pStmt = con.prepareStatement((new StringBuilder(SQL_SELECT)).append(tb_templateFiltro.getSQL(ORDERBY)).toString());
int i = 1;
for(Object object : tb_templateFiltro.getListFiltro()){
pStmt.setObject(i++, object);
}
rs = pStmt.executeQuery();
return resultSetToObjectTransfer(rs,false,con);
} catch (SQLException e) {
throw e;
} finally {
close(rs, pStmt);
}
}
public static int getCountByFiltro(Tb_templateFiltro tb_templateFiltro, Connection con) throws Exception {
tb_templateFiltro.setCount(true);
PreparedStatement pStmt = null;
ResultSet rs = null;
try {
tb_templateFiltro.getListColumnOrder().clear();
tb_templateFiltro.getListColumnFilter().clear();
pStmt = con.prepareStatement((new StringBuilder(SQL_COUNT)).append(tb_templateFiltro.getSQL(null)).toString());
int i = 1;
for(Object object : tb_templateFiltro.getListFiltro()){
pStmt.setObject(i++, object);
}
rs = pStmt.executeQuery();
if(rs.next()){
return ((Number) rs.getObject("total")).intValue();
}
return 0;
} catch (SQLException e) {
throw e;
} finally {
close(rs, pStmt);
}
}
public static int getQtdCamposPreenchidos(Tb_template tb_template, Connection con) throws Exception {
PreparedStatement pStmt = null;
ResultSet rs = null;
try {
pStmt = con.prepareStatement(SQL_QTD_CAMPOS_PREENCHIDOS);
int i = 1;
pStmt.setObject(i++,tb_template.getId());
rs = pStmt.executeQuery();
if(rs.next()){
return rs.getInt("total");
}
return 0;
} catch (SQLException e) {
throw e;
} finally {
close(rs, pStmt);
}
}
}

View File

@ -0,0 +1,80 @@
package br.com.agapesistemas.agtemplate.agtemplate.model.to;
import java.io.Serializable;
import java.util.HashMap;
import br.com.agapesistemas.agtemplate.agtemplate.controller.Tb_templateController;
public class Tb_template extends br.com.agapesistemas.agtemplate.model.to.Log implements Cloneable, Serializable {
public static final int TOTAL_CAMPOS = 2;
public static final String SISTEMA = "Agtemplate";
public static final String MODULO = "Tb_template";
private Integer id;
private String nome;
public Tb_template(){
super.setSistemaLog(SISTEMA);
super.setModuloLog(MODULO);
}
public Integer getId(){
return id;
}
public void setId(Integer id){
this.id = id;
}
public String getNome(){
return nome;
}
public void setNome(String nome){
this.nome = nome;
}
@Override
public String getLog(){
return "id: "+ getId() + " / nome: "+ getNome();
}
@Override
public String toString(){
return super.toString();
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Tb_template other = (Tb_template) obj;
if ( this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 3;
return hash;
}
public Tb_template clonar() throws CloneNotSupportedException {
Tb_template tb_template = (Tb_template)super.clone();
tb_template.setId(null);
return tb_template;
}
public int getQtdCamposPreenchidos() throws Exception{
return Tb_templateController.getQtdCamposPreenchidos(this);
}
public double getPercCamposPreenchidos() throws Exception{
return (((double)getQtdCamposPreenchidos())*100)/TOTAL_CAMPOS;
}
}

View File

@ -0,0 +1,302 @@
package br.com.agapesistemas.agtemplate.agtemplate.view;
import java.io.Serializable;
import java.util.Map;
import org.primefaces.model.LazyDataModel;
import org.primefaces.model.FilterMeta;
import org.primefaces.model.SortMeta;
import org.primefaces.model.SortOrder;
import java.util.Collection;
import java.io.IOException;
import br.com.agapesistemas.agtemplate.agtemplate.view.base.BaseBean;
import br.com.agapesistemas.agtemplate.agtemplate.model.to.Tb_template;
import br.com.agapesistemas.agtemplate.agtemplate.filtro.Tb_templateFiltro;
import br.com.agapesistemas.agtemplate.agtemplate.controller.Tb_templateController;
import br.com.agapesistemas.agtemplate.agtemplate.api.service.Tb_templateService;
import br.com.agapesistemas.agtemplate.agtemplate.exception.Tb_templateException;
import java.util.List;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import jakarta.faces.event.ActionEvent;
import jakarta.inject.Named;
import jakarta.faces.view.ViewScoped;
import org.primefaces.event.ToggleEvent;
import org.primefaces.model.Visibility;
@ViewScoped
@Named("agtemplateTb_templateBean")
public class Tb_templateBean extends BaseBean implements Serializable {
private static final String PAGINA = "/agtemplate/Tb_template.xhtml";
private Tb_template tb_template = new Tb_template();
private Tb_templateFiltro tb_templateFiltro = new Tb_templateFiltro();
private List<Tb_template> listTb_template;
private List<Tb_template> selectedTb_template;
private LazyDataModel<Tb_template> model;
public Tb_templateBean(){
if(isPaginaTb_template()){
clickPesquisarByFiltro();
}
}
public boolean isPaginaTb_template() {
return getPaginaAcesso().contains(PAGINA);
}
public Tb_template getTb_template() {
return tb_template;
}
public void setTb_template(Tb_template tb_template) {
this.tb_template = tb_template;
}
public Tb_templateFiltro getTb_templateFiltro() {
return tb_templateFiltro;
}
public void setTb_templateFiltro(Tb_templateFiltro tb_templateFiltro) {
this.tb_templateFiltro = tb_templateFiltro;
}
public List<Tb_template> getListTb_template() {
return listTb_template;
}
public void setListTb_template(List<Tb_template> listTb_template) {
this.listTb_template = listTb_template;
}
public List<Tb_template> getSelectedTb_template() {
return selectedTb_template;
}
public void setSelectedTb_template(List<Tb_template> selectedTb_template) {
this.selectedTb_template = selectedTb_template;
}
public LazyDataModel<Tb_template> getModel() {
return model;
}
public void clickClonar(Tb_template tb_template){
setTb_template(tb_template);
try {
setTb_template(getTb_template().clonar());
setNovo(true);
} catch (CloneNotSupportedException ex) {
setAlerta(this, ex, AlertaEnum.ERRO);
}
}
public void clickNovo() {
if(!isNovo()){
resetInput();
setTb_template(new Tb_template());
setNovo(true);
}
}
public void clickSalvar() {
try {
if (isNovo()) {
clickInsert();
}else if (isAlterar()) {
clickUpdate();
}
} catch (Exception ex) {
setAlerta(this, ex, AlertaEnum.ERRO);
}
}
public void clickCancelar() {
setAlterar(true);
resetInput();
}
public void clickAlterar(Tb_template tb_template){
setTb_template(tb_template);
setAlterar(true);
resetInput();
}
public void clickDeletar(Tb_template tb_template){
setTb_template(tb_template);
setDeletar(true);
}
public void clickSelecionar(Tb_template tb_template){
setTb_template(tb_template);
setSelecionar(true);
}
public void clickConsultar() {
setConsultar(true);
}
public void clickAdicionar(ActionEvent e) {
setAdicionar(true);
}
public void clickInsert() {
try {
Tb_templateController.insert(tb_template);
setNovo(false);
setTotalPesquisa(getTotalPesquisa()+1);
if(getListTb_template() == null){
setListTb_template(new ArrayList<Tb_template>());
}
getListTb_template().add(0,tb_template);
clickNovo();
inicializaLazyDataModel();
setAlerta(Tb_template.MODULO+" inserido(a) com sucesso.",AlertaEnum.INFO.getAlerta());
} catch (Exception ex) {
setAlerta(this, ex, AlertaEnum.ERRO);
}
}
public void clickUpdate() {
try {
Tb_templateController.update(tb_template);
setAlerta(Tb_template.MODULO+" atualizado(a) com sucesso.",AlertaEnum.INFO.getAlerta());
} catch (Exception ex) {
setAlerta(this, ex, AlertaEnum.ERRO);
}
}
public void clickDelete() {
try {
Tb_templateController.delete(tb_template);
getListTb_template().remove(tb_template);
setAlerta(Tb_template.MODULO+" removido(a) com sucesso.",AlertaEnum.INFO.getAlerta());
} catch (Exception ex) {
setAlerta(this, ex, AlertaEnum.ERRO);
}
}
public void clickPesquisar() {
try {
tb_templateFiltro.setGenerica(true);
tb_templateFiltro.setPesquisaGenerica(getPesquisa());
carregaTotalPesquisa();
inicializaLazyDataModel();
} catch (Exception ex) {
setAlerta(this, ex, AlertaEnum.ERRO);
}
}
public void clickPesquisarByFiltro() {
try {
tb_templateFiltro.setGenerica(false);
carregaTotalPesquisa();
inicializaLazyDataModel();
} catch (Exception ex) {
setAlerta(this, ex, AlertaEnum.ERRO);
}
}
private void carregaTotalPesquisa() throws Exception{
setTotalPesquisa(Tb_templateController.getCountByFiltro(tb_templateFiltro));
mensagemConsulta();
}
private void inicializaLazyDataModel() {
getDataTable().setFirst(0);
if (model == null) {
model = new LazyDataModel<Tb_template>() {
@Override
public String getRowKey(Tb_template tb_template) {
return tb_template.getId().toString();
}
@Override
public Tb_template getRowData(String rowKey) {
Tb_template row = getListTb_template().stream()
.filter(tb_template -> rowKey.equals(tb_template.getId().toString()))
.findAny()
.orElse(null);
return row;
}
@Override
public List<Tb_template> load(int offset, int pageSize, Map<String, SortMeta> sortBy, Map<String, FilterMeta> filterBy) {
if (getTotalPesquisa() < 0) {
setRowCount(getRowCount() + 1);
}
try {
if (!isPossuiErro() && getTotalPesquisa() >= 0) {
tb_templateFiltro.setPrimeiroRegitro(offset);
tb_templateFiltro.setQuantidadeRegitros(pageSize);
Collection<SortMeta> filtrosSortOrder = sortBy.values();
tb_templateFiltro.getListColumnOrder().clear();
for(SortMeta f : filtrosSortOrder){
tb_templateFiltro.getListColumnOrder().put(f.getField(), SortOrder.ASCENDING.equals(f.getOrder()));
}
setRowCount(getTotalPesquisa());
setListTb_template(Tb_templateController.getAllByFiltro(tb_templateFiltro));
}
return getListTb_template();
} catch (Exception ex) {
setAlerta(this, ex, AlertaEnum.ERRO);
}
return null;
}
@Override
public int count(Map<String, FilterMeta> map) {
return getTotalPesquisa();
}
};
}
}
public void clickLimparPesquisa() {
setPesquisa(null);
setListTb_template(null);
}
public void clickLimparFiltro() {
tb_templateFiltro = new Tb_templateFiltro();
}
@Override
public String getTituloModal() {
return super.getTituloModal()+" "+Tb_template.MODULO;
}
public void onRowToggle(ToggleEvent event) {
if (event.getVisibility() == Visibility.VISIBLE) {
Tb_template tb_template = (Tb_template) event.getData();
if (tb_template != null) {
//CARREGA ALGO
}
}
}
public String getDeleteButtonMessage() {
if (hasSelectedTb_template()) {
int size = this.selectedTb_template.size();
return size > 1 ? size + " tb_templates selecionadas(os)" : "1 tb_template selecionada(o)";
}
return "Remover";
}
public boolean hasSelectedTb_template() {
return this.selectedTb_template != null && !this.selectedTb_template.isEmpty();
}
public void deleteSelectedTb_template() {
try {
Tb_templateController.deleteAll(this.selectedTb_template);
this.selectedTb_template.clear();
setAlerta(Tb_template.MODULO+"(s) removidas(os) com sucesso.",AlertaEnum.INFO.getAlerta());
} catch (Exception ex) {
setAlerta(this, ex, AlertaEnum.ERRO);
}
}
}

View File

@ -0,0 +1,191 @@
package br.com.agapesistemas.agtemplate.agtemplate.view.base;
import java.io.Serializable;
import br.com.agapesistemas.agtemplate.util.Utils;
import br.com.agapesistemas.agtemplate.exception.base.BaseException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.primefaces.component.datatable.DataTable;
public class BaseBean extends Utils implements Serializable {
private boolean alterar;
private boolean deletar;
private boolean novo;
private boolean selecionar;
private boolean consultar;
private boolean adicionar;
private boolean menuDataTableDynamic = true;
private String pesquisa;
private int alturaModal = 400;
private int larguraModal = 600;
private int zindexModal = 101;
private int totalPesquisa = 0;
private transient DataTable dataTable = new DataTable();
public boolean isMenuDataTableDynamic(){
return menuDataTableDynamic;
}
public DataTable getDataTable(){
return dataTable;
}
public void setDataTable(DataTable dataTable) {
this.dataTable = dataTable;
}
public int getTotalPesquisa() {
return totalPesquisa;
}
public void setTotalPesquisa(int totalPesquisa) {
this.totalPesquisa = totalPesquisa;
}
public boolean isAchouPesquisa(){
return getTotalPesquisa() != 0;
}
public boolean isNovoAlterar(){
if(isNovo() || isAlterar()){
return true;
}
return false;
}
public boolean isAlterar(){
return alterar;
}
public void setAlterar(boolean alterar) {
iniciarVariaveis();
this.alterar = alterar;
}
public boolean isDeletar(){
return deletar;
}
public void setDeletar(boolean deletar) {
iniciarVariaveis();
this.deletar = deletar;
}
public boolean isNovo(){
return novo;
}
public void setNovo(boolean novo) {
iniciarVariaveis();
this.novo = novo;
}
public boolean isSelecionar(){
return selecionar;
}
public void setSelecionar(boolean selecionar) {
iniciarVariaveis();
this.selecionar = selecionar;
}
public boolean isConsultar(){
return consultar;
}
public void setConsultar(boolean consultar) {
this.consultar = consultar;
}
public boolean isAdicionar(){
return adicionar;
}
public void setAdicionar(boolean adicionar) {
this.adicionar = adicionar;
}
private void iniciarVariaveis() {
this.alterar = false;
this.deletar = false;
this.novo = false;
this.selecionar = false;
//this.consultar = false;
this.adicionar = false;
}
public String getPesquisa(){
return pesquisa;
}
public void setPesquisa(String pesquisa){
this.pesquisa = pesquisa;
}
public int getAlturaModal(){
return alturaModal;
}
public void setAlturaModal(int alturaModal){
this.alturaModal = alturaModal;
}
public int getLarguraModal(){
return larguraModal;
}
public void setLarguraModal(int larguraModal){
this.larguraModal = larguraModal;
}
public int getZindexModal(){
return zindexModal;
}
public void setZindexModal(int zindexModal){
this.zindexModal = zindexModal;
}
public String getTituloModal(){
if(isAlterar()){
return "Alterar";
}else if(isNovo()){
return "Novo(a)";
}else if(isDeletar()){
return "Excluir";
}else if(isConsultar()){
return "Consultar";
}
return "";
}
protected void mensagemConsulta() {
if (!isAchouPesquisa()) {
setAlerta("Nenhum registro encontrado.", OBSERVACAO);
} else {
setAlerta("Encontrado(s) " + getTotalPesquisa() + " registro(s).", INFO);
}
}
public enum AlertaEnum {
ERRO('E'),INFO('I'),OBSERVACAO('O'),FATAL('F');
private char alerta;
AlertaEnum(char alerta) {
this.alerta = alerta;
}
public char getAlerta(){
return alerta;
}
}
protected void setAlerta(Object object, Exception ex, AlertaEnum alerta) {
setAlerta(ex.getMessage(),alerta == null ? AlertaEnum.ERRO.getAlerta() : alerta.getAlerta());
if(!(ex instanceof BaseException)){
Logger.getLogger(object.getClass().getName()).log(Level.SEVERE, null, ex);
}
}
}

View File

@ -0,0 +1,30 @@
package br.com.agapesistemas.agtemplate.converter;
import java.io.Serializable;
import jakarta.faces.component.UIComponent;
import jakarta.faces.context.FacesContext;
import jakarta.faces.convert.Converter;
import jakarta.faces.convert.FacesConverter;
@FacesConverter(value = "booleanConverter")
public class BooleanConverter implements Converter, Serializable {
@Override
public Object getAsObject(FacesContext fc, UIComponent uic, String string) {
return string;
}
@Override
public String getAsString(FacesContext fc, UIComponent uic, Object o) {
if (o != null) {
boolean objeto = (Boolean)o;
if (objeto) {
return "Sim";
}else{
return "Não";
}
}
return null;
}
}

View File

@ -0,0 +1,35 @@
package br.com.agapesistemas.agtemplate.exception.base;
import java.sql.SQLException;
public class BaseException extends Exception {
public BaseException(String msg) {
super(msg);
}
public static String getKey(String tabela, SQLException ex) {
String codigoErro = ex.getSQLState();
if(codigoErro.equals("23503") || codigoErro.equals("23505")){
String msg = ex.getMessage();
String key = null,erro = null, fk = null, origem=null;
if(codigoErro.equals("23503")){
erro = msg.substring(0, msg.indexOf("Detalhe:")).trim();
erro = erro.substring(0,erro.lastIndexOf("\""));
tabela = erro.substring(erro.lastIndexOf("\"")+1);
erro = erro.substring(0,erro.lastIndexOf("\""));
erro = erro.substring(0,erro.lastIndexOf("\""));
key = erro.substring(erro.lastIndexOf("\"")+1);
erro = erro.substring(0,erro.lastIndexOf("\""));
erro = erro.substring(0,erro.lastIndexOf("\""));
origem = erro.substring(erro.lastIndexOf("\"")+1);
}else if(codigoErro.equals("23505")){
key = msg.substring(msg.indexOf("\"")+1,msg.lastIndexOf("\""));
}
if(key != null && tabela != null){
return tabela+"."+key;
}
}
return null;
}
}

View File

@ -0,0 +1,42 @@
package br.com.agapesistemas.agtemplate.jdbc;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
public class ConnectionFactory {
private static boolean poll;
public static Connection getConnection() throws Exception{
if(poll){
return getConnectionPool();
}else{
return getConnectionDrive();
}
}
public static Connection getConnectionDrive() throws SQLException{
try{
Class.forName("org.postgresql.Driver");
return DriverManager.getConnection("jdbc:postgresql://localhost:5432/agtemplate","postgres","postgres");
}catch (ClassNotFoundException e){
throw new SQLException(e.getMessage());
}
}
public static Connection getConnectionPool() throws SQLException{
try{
InitialContext initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)envCtx.lookup("jdbc/agtemplate");
return ds.getConnection();
}catch (NamingException e){
throw new SQLException(e.getMessage());
}
}
}

View File

@ -0,0 +1,35 @@
package br.com.agapesistemas.agtemplate.jdbc;
import java.sql.Connection;
import java.sql.SQLException;
public class TransactionManager implements AutoCloseable {
private Connection con;
public TransactionManager() throws Exception {
this.con = ConnectionFactory.getConnection();
this.con.setAutoCommit(false);
}
public Connection getConnection() {
return con;
}
public void commit() throws SQLException {
con.commit();
}
public void rollback() throws SQLException {
if (con != null) {
con.rollback();
}
}
@Override
public void close() throws SQLException {
if (con != null) {
con.close();
}
}
}

View File

@ -0,0 +1,149 @@
package br.com.agapesistemas.agtemplate.model.dao;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
import java.sql.*;import java.util.ArrayList;
import java.util.List;
public class BaseDAO implements Serializable {
public static boolean isExisteColuna(ResultSet resultSet, String columnName) throws SQLException {
// Obtendo o metadata do ResultSet
ResultSetMetaData metaData = resultSet.getMetaData();
// Obtendo o número total de colunas
int columnCount = metaData.getColumnCount();
// Verificando se a coluna está presente no ResultSet
boolean columnExists = false;
for (int i = 1; i <= columnCount; i++) {
if (columnName.equalsIgnoreCase(metaData.getColumnName(i))) {
columnExists = true;
break;
}
}
return columnExists;
}
public static <T> T preencherObjeto(ResultSet resultSet, T objeto) throws SQLException {
Class<?> classeObjeto = objeto.getClass();
Field[] campos = classeObjeto.getDeclaredFields();
for (Field campo : campos) {
campo.setAccessible(true);
String nomeCampo = campo.getName();
if (isExisteColuna(resultSet, nomeCampo)) {
Object valorCampo = resultSet.getObject(nomeCampo);
try {
campo.set(objeto, valorCampo);
} catch (IllegalAccessException e) {
// Tratar exceção de acesso ilegal aqui
//e.printStackTrace();
}
}
}
return objeto;
}
public static <T> int createPreparedStatement(int pos, PreparedStatement ps, String campos, T objeto) throws SQLException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
// Dividir a string usando a vírgula como delimitador e remover os espaços em branco
String[] valueArray = campos.split(",");
for (int i = 0; i < valueArray.length; i++) {
valueArray[i] = valueArray[i].trim(); // Remove os espaços em branco
}
return createPreparedStatement(pos, ps, valueArray, objeto);
}
public static <T> int createPreparedStatement(int pos, PreparedStatement ps, String[] campos, T objeto) throws SQLException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
Class<?> classeObjeto = objeto.getClass();
for (String nomeCampo : campos) {
// Obter o campo da classe
Field field = classeObjeto.getDeclaredField(nomeCampo.trim());
// Tornar o campo acessível (pode ser privado)
field.setAccessible(true);
// Tentar obter o método getter usando a convenção padrão
String nomeMetodo = "get" + Character.toUpperCase(nomeCampo.charAt(0)) + nomeCampo.substring(1);
Method getter = null;
Object value = null;
try {
getter = classeObjeto.getMethod(nomeMetodo);
} catch (NoSuchMethodException e) {
// Se não encontrar, tentar usando a convenção com "_"
nomeMetodo = "get" + formatarNomeCampo(nomeCampo);
try {
getter = classeObjeto.getMethod(nomeMetodo);
} catch (NoSuchMethodException e2) {
// Obter o valor da variável no objeto
value = field.get(objeto);
}
}
// Obter o valor da variável no objeto usando o método getter
if(getter != null){
value = getter.invoke(objeto);
}
// Verificar o tipo do campo e converter se necessário
if (value instanceof java.sql.Timestamp) {
ps.setTimestamp(pos++, (value == null) ? null : (java.sql.Timestamp) value);
} else if (value instanceof java.util.Date) {
// Se for java.util.Date, converte para java.sql.Date
ps.setDate(pos++, (value == null) ? null : new Date(((java.util.Date) value).getTime()));
} else {
// Caso padrão, define o valor diretamente (tratando o valor nulo)
ps.setObject(pos++, value);
}
}
return pos;
}
private static String formatarNomeCampo(String nomeCampo) {
String[] partes = nomeCampo.split("_");
StringBuilder sb = new StringBuilder();
for (String parte : partes) {
if (!parte.isEmpty()) {
sb.append(Character.toUpperCase(parte.charAt(0)));
if (parte.length() > 1) {
sb.append(parte.substring(1));
}
}
}
return sb.toString();
}
public static String createPlaceHolderInsert(String campos){
String[] valueArray = campos.split(",");
return createPlaceHolderInsert(valueArray);
}
public static String createPlaceHolderInsert(String[] campos){
List<String> value = new ArrayList<>();
for (int i = 0; i < campos.length; i++) {
value.add("?");
}
return String.join(",", value);
}
public static String createPlaceHolderUpdate(String campos){
String[] valueArray = campos.split(",");
return createPlaceHolderUpdate(valueArray);
}
public static String createPlaceHolderUpdate(String[] campos){
List<String> value = new ArrayList<>();
for (int i = 0; i < campos.length; i++) {
value.add(campos[i].trim()+"=?");
}
return String.join(",", value);
}
public static void close(ResultSet rs, PreparedStatement pStmt) throws Exception{
try {
if (rs != null)
rs.close();
if (pStmt != null)
pStmt.close();
} catch (SQLException e) {
throw e;
}
}
}

View File

@ -0,0 +1,22 @@
package br.com.agapesistemas.agtemplate.model.dao;
import java.io.Serializable;
import br.com.agapesistemas.agtemplate.model.to.Log;
import java.sql.Connection;
public class LogDAO implements Serializable {
public static void insertLog(Log log, Connection con) throws Exception{
//TODO
}
public static void updateLog(Log log, Connection con) throws Exception{
//TODO
}
public static void deleteLog(Log log, Connection con) throws Exception{
//TODO
}
}

View File

@ -0,0 +1,68 @@
package br.com.agapesistemas.agtemplate.model.to;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
public class Log implements Serializable {
public static final String TIPO_INSERCAO = "INSERT";
public static final String TIPO_ALTERACAO = "UPDATE";
public static final String TIPO_REMOCAO = "DELETE";
private String sistemaLog;
private String moduloLog;
private String tipoLog;
public String getLog(){
return toString();
}
public Date getData(){
return new Date();
}
public String getSistemaLog(){
return sistemaLog;
}
public void setSistemaLog(String sistemaLog) {
this.sistemaLog = sistemaLog;
}
public String getModuloLog() {
return moduloLog;
}
public void setModuloLog(String moduloLog) {
this.moduloLog = moduloLog;
}
public String getTipoLog() {
return tipoLog;
}
public void setTipoLog(String tipoLog) {
this.tipoLog = tipoLog;
}
public boolean isTipoAlteracao(){
if(tipoLog != null && tipoLog.equals(TIPO_ALTERACAO)){
return true;
}
return false;
}
public boolean isTipoInsercao(){
if(tipoLog != null && tipoLog.equals(TIPO_INSERCAO)){
return true;
}
return false;
}
public boolean isTipoRemocao(){
if(tipoLog != null && tipoLog.equals(TIPO_REMOCAO)){
return true;
}
return false;
}
}

View File

@ -0,0 +1,118 @@
package br.com.agapesistemas.agtemplate.service;
import br.com.agapesistemas.agtemplate.exception.base.BaseException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import jakarta.enterprise.inject.Produces;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
import java.io.Serializable;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jws;
import io.jsonwebtoken.Jwts;
public class BaseService implements Serializable {
protected static final String DOMINIO_SERVICE = "http://localhost:8080";
@Produces
public static final ObjectMapper getDefaultObjectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JavaTimeModule());
return objectMapper;
}
protected static String convertObjectToJson(Object object) throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.writeValueAsString(object);
}
protected static Object handleResponse(HttpResponse response, Object responseClass) throws IOException, Exception {
// Verifica se a resposta foi bem-sucedida (código 2xx)
int statusCode = response.getStatusLine().getStatusCode();
HttpEntity entity = response.getEntity();
String responseBody = null;
if (entity != null) {
responseBody = EntityUtils.toString(entity);
if (statusCode >= 200 && statusCode < 300) {
if(responseBody.isEmpty()){
return null;
}
ObjectMapper objectMapper = getDefaultObjectMapper();
if(responseClass instanceof TypeReference){
return objectMapper.readValue(responseBody, (TypeReference)responseClass);
}
return objectMapper.readValue(responseBody, responseClass.getClass());
} else if (statusCode == 400) {
ObjectMapper objectMapper = getDefaultObjectMapper();
Problem problem = objectMapper.readValue(responseBody, Problem.class);
throw new BaseException(problem.getDetail());
} else {
throw new Exception("Falha na requisição. Código de status: " + statusCode);
}
}
return null;
}
public static <T> Object post(String token,String uri, String json, TypeReference<T> typeReference) throws IOException, Exception {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(uri);
httpPost.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
HttpResponse postResponse = httpClient.execute(httpPost);
return handleResponse(postResponse, typeReference);
}
public static <T> Object put(String token,String uri, String json, TypeReference<T> typeReference) throws IOException, Exception {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPut httpPut = new HttpPut(uri);
httpPut.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
HttpResponse postResponse = httpClient.execute(httpPut);
return handleResponse(postResponse, typeReference);
}
public static <T> void delete(String token,String uri) throws IOException, Exception {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpDelete httpDelete = new HttpDelete(uri);
HttpResponse postResponse = httpClient.execute(httpDelete);
handleResponse(postResponse, String.class);
}
public static <T> Object get(String token,String uri, TypeReference<T> typeReference) throws IOException, Exception {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(uri);
HttpResponse postResponse = httpClient.execute(httpGet);
return handleResponse(postResponse, typeReference);
}
public static String getUuidCliente(String token) {
Claims claims = getClaimsToken(token);
return claims.get("agc_codigo", String.class);
}
public static Claims getClaimsToken(String token) {
Claims claims = decodeJWTWithoutValidation(token);
return claims;
}
private static Claims decodeJWTWithoutValidation(String jwt) {
String[] parts = jwt.split("\\.");
if (parts.length != 3) {
throw new IllegalArgumentException("Invalid JWT token");
}
Claims jwsClaims = Jwts.parser().parseClaimsJwt(parts[0] + "." + parts[1] + ".").getBody();
return jwsClaims;
}
}

View File

@ -0,0 +1,29 @@
package br.com.agapesistemas.agtemplate.service;
import java.time.OffsetDateTime;
import java.util.List;
import java.io.Serializable;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class Problem implements Serializable {
private Integer status;
private OffsetDateTime timestamp;
private String type;
private String title;
private String detail;
private String userMessage;
private List<Object> objects;
@Getter
@Setter
public static class Object {
private String name;
private String userMessage;
}
}

View File

@ -0,0 +1,215 @@
package br.com.agapesistemas.agtemplate.util;
import java.io.Serializable;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.text.ParseException;
import java.util.Date;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.List;
import java.util.Collection;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.context.ExternalContext;
import jakarta.faces.context.FacesContext;
import jakarta.servlet.ServletOutputStream;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import jakarta.faces.component.UIViewRoot;
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UIInput;
import org.primefaces.PrimeFaces;
import jakarta.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
public class Utils implements Serializable {
public static final char INFO = 'I';
public static final char ERRO = 'E';
public static final char OBSERVACAO = 'O';
public static final char FATAL = 'F';
public static void clearSession(){
getExternalContext().getSessionMap().clear();
((HttpSession)getExternalContext().getSession(false)).invalidate();
}
public static void download(String nome, byte[] data) throws IOException {
FacesContext facesContext = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
response.setContentType("application/download");
response.setHeader("Content-disposition", "attachment;filename=" + nome);
ServletOutputStream ouputStream = response.getOutputStream();
ouputStream.write(data, 0, data.length);
response.getOutputStream().close();
facesContext.responseComplete();
}
public static void download(String nome, File arquivo) throws IOException, Exception {
byte[] data = fileToByte(arquivo);
download(nome,data);
}
public static byte[] fileToByte(File arquivo) throws Exception {
FileInputStream fis = new FileInputStream(arquivo);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[8192];
int bytesRead = 0;
while ((bytesRead = fis.read(buffer, 0, 8192)) != -1) {
baos.write(buffer, 0, bytesRead);
}
fis.close();
baos.close();
baos.flush();
return baos.toByteArray();
}
public static long getDiasEntreData(Date inicio, Date fim) throws ParseException {
return (fim.getTime() - inicio.getTime() + 3600000L) / 86400000L;
}
public static String getDiretorioReal(String diretorio){
HttpSession request = (HttpSession) getExternalContext().getSession(false);
return request.getServletContext().getRealPath(diretorio);
}
public static ExternalContext getExternalContext(){
return FacesContext.getCurrentInstance().getExternalContext();
}
/**
*
* @param caminho Empresa, forms/crud/EmpresaConsultLazy
* @param modal true, false
* @param options
options.put("width", 640);
options.put("height", 340);
options.put("contentWidth", "100%");
options.put("contentHeight", "100%");
options.put("headerElement", "customheader");
**/
public static void abrirDialogXhtml(String caminho, boolean modal, Map<String, Object> options) {
if(options == null){
options = new HashMap<>();
}
options.put("modal", modal);
/*
options.put("width", 640);
options.put("height", 340);
options.put("contentWidth", "100%");
options.put("contentHeight", "100%");
options.put("headerElement", "customheader");
*/
PrimeFaces.current().dialog().openDynamic(caminho, options, null);
}
public static void fecharDialogXhtml(String nome) {
PrimeFaces.current().dialog().closeDynamic(nome);
}
public static void abrirDialogJS(String vwDialog) {
PrimeFaces.current().executeScript("PF('"+vwDialog+"').show();");
}
public static void fecharDialogJS(String vwDialog) {
PrimeFaces.current().executeScript("PF('"+vwDialog+"').hide();");
}
public static void executeScriptJS(String script) {
PrimeFaces.current().executeScript(script);
}
public static String getPaginaAcesso() {
return ((HttpServletRequest)getExternalContext().getRequest()).getRequestURI();
}
public static String getParam(String parametro){
return FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(parametro);
}
public static Object getSessionObject(String nome){
return getExternalContext().getSessionMap().get(nome);
}
public static Object removeSessionObject(String nome){
return getExternalContext().getSessionMap().remove(nome);
}
public boolean isPossuiErro() {
for (FacesMessage fm : FacesContext.getCurrentInstance().getMessageList()) {
if (fm.getSeverity().equals(FacesMessage.SEVERITY_ERROR) || fm.getSeverity().equals(FacesMessage.SEVERITY_FATAL)) {
return true;
}
}
return false;
}
public static String gerarSenha(int nCaracteres) {
char[] letras = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();
char[] numeros = "0123456789".toCharArray();
char[] ordem = "01".toCharArray();
Random rand = new Random();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < nCaracteres; i++) {
int valor = rand.nextInt(ordem.length);
char character = ordem[valor];
if(character == '0'){
valor = rand.nextInt(letras.length);
character = letras[valor];
}else{
valor = rand.nextInt(numeros.length);
character = numeros[valor];
}
sb.append(character);
}
return sb.toString();
}
public static void setAlerta(String mensagem, char tipo){
FacesMessage msg = null;
switch (tipo){
case 'O' : msg = new FacesMessage(FacesMessage.SEVERITY_WARN, mensagem, "");break;
case 'I' : msg = new FacesMessage(FacesMessage.SEVERITY_INFO, mensagem, "");break;
case 'E' : msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, mensagem, "");break;
case 'F' : msg = new FacesMessage(FacesMessage.SEVERITY_FATAL, mensagem, "");break;
}
FacesContext.getCurrentInstance().addMessage(null, msg);
//Essa linha vai fazer com que suas mensagens sejam armazenadas no escopo de Flash.
//A duração desse escopo vai ser o suficiente para que você consiga exibir as mensagens adicionadas depois do redirecionamento.
getExternalContext().getFlash().setKeepMessages(true);
}
public static void setSessionObject(String nome, Object objeto){
getExternalContext().getSessionMap().put(nome, objeto);
}
public void resetInput(){
FacesContext context = FacesContext.getCurrentInstance();
UIViewRoot viewRoot = context.getViewRoot();
List<UIComponent> children = viewRoot.getChildren();
resetInputValues(children);
}
private void resetInputValues(List<UIComponent> children) {
for (UIComponent component : children) {
if (component.getChildCount() > 0) {
resetInputValues(component.getChildren());
} else {
if (component instanceof UIInput) {
UIInput input = (UIInput) component;
input.resetValue();
}
}
}
}
public static <T> T getBean(String beanName, Class<T> beanClass) { FacesContext facesContext = FacesContext.getCurrentInstance(); return facesContext.getApplication().evaluateExpressionGet(facesContext, "#{" + beanName + "}", beanClass); }
public static void updateRegion(String id){ PrimeFaces.current().ajax().update(id); }
public static void updateRegion(Collection<String> ids){ PrimeFaces.current().ajax().update(ids); }
}

View File

@ -0,0 +1,21 @@
package br.com.agapesistemas.agtemplate.view;
import java.io.Serializable;
import java.util.List;
import java.util.ArrayList;
import jakarta.faces.model.SelectItem;
import jakarta.inject.Named;
import jakarta.faces.view.ViewScoped;
@ViewScoped
@Named("comboUtilsBean")
public class ComboUtilsBean implements Serializable {
public List<SelectItem> getComboTodosSimNaoFiltro() {
List<SelectItem> combo = new ArrayList<>();
combo.add(new SelectItem("T","Todos"));
combo.add(new SelectItem("S","Sim"));
combo.add(new SelectItem("N","Não"));
return combo;
}
}

View File

@ -0,0 +1,48 @@
/*
Copyright 2009-2022 PrimeTek.
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.primefaces.poseidon.blockviewer;
import jakarta.faces.component.FacesComponent;
import jakarta.faces.component.UINamingContainer;
import java.io.Serializable;
@FacesComponent(value="BlockViewer")
public class BlockViewer extends UINamingContainer implements Serializable {
@Override
public String getFamily() { return "jakarta.faces.NamingContainer"; }
private enum PropertyKeys {
CODEMODE
}
public void change2PreviewMode() {
setCodeMode(false);
}
public void change2CodeMode() {
setCodeMode(true);
}
public void setCodeMode(boolean expanded) {
getStateHelper().put(PropertyKeys.CODEMODE, expanded);
}
public boolean isCodeMode() {
return (boolean) getStateHelper().eval(PropertyKeys.CODEMODE, false);
}
}

View File

@ -0,0 +1,138 @@
/*
Copyright 2009-2022 PrimeTek.
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.primefaces.poseidon.component;
import jakarta.faces.component.UIComponent;
import org.primefaces.component.menu.AbstractMenu;
import jakarta.faces.context.FacesContext;
import jakarta.faces.component.UINamingContainer;
import jakarta.faces.component.UIOutput;
import jakarta.faces.component.UIViewRoot;
import jakarta.faces.event.AbortProcessingException;
import jakarta.faces.event.ComponentSystemEvent;
import jakarta.faces.event.ComponentSystemEventListener;
import jakarta.faces.event.ListenerFor;
import jakarta.faces.event.PostAddToViewEvent;
import org.primefaces.component.api.Widget;
@ListenerFor(sourceClass = PoseidonMenu.class, systemEventClass = PostAddToViewEvent.class)
public class PoseidonMenu extends AbstractMenu implements Widget,ComponentSystemEventListener {
public static final String COMPONENT_TYPE = "org.primefaces.component.PoseidonMenu";
public static final String COMPONENT_FAMILY = "org.primefaces.component";
private static final String DEFAULT_RENDERER = "org.primefaces.component.PoseidonMenuRenderer";
private static final String[] LEGACY_RESOURCES = new String[]{"primefaces.css","jquery/jquery.js","jquery/jquery-plugins.js","primefaces.js"};
private static final String[] MODERN_RESOURCES = new String[]{"components.css","jquery/jquery.js","jquery/jquery-plugins.js","core.js"};
protected enum PropertyKeys {
widgetVar, model, style, styleClass;
String toString;
PropertyKeys(String toString) {
this.toString = toString;
}
PropertyKeys() {
}
public String toString() {
return ((this.toString != null) ? this.toString : super.toString());
}
}
public PoseidonMenu() {
setRendererType(DEFAULT_RENDERER);
}
public String getFamily() {
return COMPONENT_FAMILY;
}
public java.lang.String getWidgetVar() {
return (java.lang.String) getStateHelper().eval(PropertyKeys.widgetVar, null);
}
public void setWidgetVar(java.lang.String _widgetVar) {
getStateHelper().put(PropertyKeys.widgetVar, _widgetVar);
}
public org.primefaces.model.menu.MenuModel getModel() {
return (org.primefaces.model.menu.MenuModel) getStateHelper().eval(PropertyKeys.model, null);
}
public void setModel(org.primefaces.model.menu.MenuModel _model) {
getStateHelper().put(PropertyKeys.model, _model);
}
public java.lang.String getStyle() {
return (java.lang.String) getStateHelper().eval(PropertyKeys.style, null);
}
public void setStyle(java.lang.String _style) {
getStateHelper().put(PropertyKeys.style, _style);
}
public java.lang.String getStyleClass() {
return (java.lang.String) getStateHelper().eval(PropertyKeys.styleClass, null);
}
public void setStyleClass(java.lang.String _styleClass) {
getStateHelper().put(PropertyKeys.styleClass, _styleClass);
}
public String resolveWidgetVar() {
FacesContext context = getFacesContext();
String userWidgetVar = (String) getAttributes().get("widgetVar");
if (userWidgetVar != null) {
return userWidgetVar;
} else {
return "widget_" + getClientId(context).replaceAll("-|" + UINamingContainer.getSeparatorChar(context), "_");
}
}
@Override
public void processEvent(ComponentSystemEvent event) throws AbortProcessingException {
if(event instanceof PostAddToViewEvent) {
FacesContext context = getFacesContext();
UIViewRoot root = context.getViewRoot();
boolean isPrimeConfig;
try {
isPrimeConfig = Class.forName("org.primefaces.config.PrimeConfiguration") != null;
} catch (ClassNotFoundException e) {
isPrimeConfig = false;
}
String[] resources = (isPrimeConfig) ? MODERN_RESOURCES : LEGACY_RESOURCES;
for(String res : resources) {
UIComponent component = context.getApplication().createComponent(UIOutput.COMPONENT_TYPE);
if(res.endsWith("css"))
component.setRendererType("jakarta.faces.resource.Stylesheet");
else if(res.endsWith("js"))
component.setRendererType("jakarta.faces.resource.Script");
component.getAttributes().put("library", "primefaces");
component.getAttributes().put("name", res);
root.addComponentResource(context, component);
}
}
}
}

View File

@ -0,0 +1,453 @@
/*
Copyright 2009-2022 PrimeTek.
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.primefaces.poseidon.component;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import jakarta.faces.FacesException;
import jakarta.faces.component.UIComponent;
import jakarta.faces.context.FacesContext;
import jakarta.faces.context.ResponseWriter;
import jakarta.servlet.http.HttpServletRequest;
import org.primefaces.component.api.AjaxSource;
import org.primefaces.component.api.UIOutcomeTarget;
import org.primefaces.component.menu.AbstractMenu;
import org.primefaces.component.menu.BaseMenuRenderer;
import org.primefaces.component.menuitem.UIMenuItem;
import org.primefaces.component.submenu.UISubmenu;
import org.primefaces.expression.SearchExpressionFacade;
import org.primefaces.model.menu.MenuElement;
import org.primefaces.model.menu.MenuItem;
import org.primefaces.model.menu.Separator;
import org.primefaces.model.menu.Submenu;
import org.primefaces.util.AjaxRequestBuilder;
import org.primefaces.util.ComponentTraversalUtils;
import org.primefaces.util.WidgetBuilder;
public class PoseidonMenuRenderer extends BaseMenuRenderer {
@Override
protected void encodeMarkup(FacesContext context, AbstractMenu abstractMenu) throws IOException {
PoseidonMenu menu = (PoseidonMenu) abstractMenu;
ResponseWriter writer = context.getResponseWriter();
String style = menu.getStyle();
String styleClass = menu.getStyleClass();
String defaultStyleClass = "layout-menu";
styleClass = styleClass == null ? defaultStyleClass : defaultStyleClass + " " + styleClass;
writer.startElement("ul", menu);
writer.writeAttribute("id", menu.getClientId(context), "id");
writer.writeAttribute("class", styleClass, "styleClass");
if(style != null) {
writer.writeAttribute("style", style, "style");
}
if(menu.getElementsCount() > 0) {
encodeElements(context, menu, menu.getElements(),true);
}
writer.endElement("ul");
}
protected void encodeElements(FacesContext context, AbstractMenu menu, List<MenuElement> elements, boolean root) throws IOException {
int size = elements.size();
for (int i = 0; i < size; i++) {
encodeElement(context, menu, elements.get(i),root);
}
}
protected void encodeElement(FacesContext context, AbstractMenu menu, MenuElement element, boolean root) throws IOException {
ResponseWriter writer = context.getResponseWriter();
if(element.isRendered()) {
if(element instanceof MenuItem) {
MenuItem menuItem = (MenuItem) element;
String menuItemClientId = (menuItem instanceof UIComponent) ? menuItem.getClientId() : menu.getClientId(context) + "_" + menuItem.getClientId();
String containerStyle = menuItem.getContainerStyle();
String containerStyleClass = menuItem.getContainerStyleClass();
writer.startElement("li", null);
writer.writeAttribute("id", menuItemClientId, null);
writer.writeAttribute("role", "menuitem", null);
if(containerStyle != null) writer.writeAttribute("style", containerStyle, null);
if(containerStyleClass != null) writer.writeAttribute("class", containerStyleClass, null);
encodeMenuItem(context, menu, menuItem);
writer.endElement("li");
}
else if(element instanceof Submenu) {
Submenu submenu = (Submenu) element;
String submenuClientId = (submenu instanceof UIComponent) ? ((UIComponent) submenu).getClientId() : menu.getClientId(context) + "_" + submenu.getId();
String style = submenu.getStyle();
String styleClass = submenu.getStyleClass();
String className = root ? (styleClass != null) ? styleClass + " layout-root-menuitem" : "layout-root-menuitem" : styleClass;
writer.startElement("li", null);
writer.writeAttribute("id", submenuClientId, null);
writer.writeAttribute("role", "menuitem", null);
if(style != null) writer.writeAttribute("style", style, null);
if(className != null) writer.writeAttribute("class", className, null);
encodeSubmenu(context, menu, submenu, root);
writer.endElement("li");
}
else if(element instanceof Separator) {
encodeSeparator(context, (Separator) element);
}
}
}
protected void encodeSubmenu(FacesContext context, AbstractMenu menu, Submenu submenu, boolean root) throws IOException{
ResponseWriter writer = context.getResponseWriter();
String icon = submenu.getIcon();
String label = submenu.getLabel();
int childrenElementsCount = submenu.getElementsCount();
if (root) {
writer.startElement("div", null);
if(label != null) {
writer.startElement("span", null);
writer.writeAttribute("class", "layout-menuitem-text", null);
writer.writeText(label, null);
writer.endElement("span");
}
writer.endElement("div");
}
writer.startElement("a", null);
writer.writeAttribute("href", "#", null);
encodeItemIcon(context, icon);
if(label != null) {
writer.startElement("span", null);
writer.writeAttribute("class", "layout-menuitem-text", null);
writer.writeText(label, null);
writer.endElement("span");
encodeToggleIcon(context, submenu, childrenElementsCount);
if(submenu instanceof UISubmenu) {
encodeBadge(context, ((UISubmenu) submenu).getAttributes().get("badge"));
}
}
writer.endElement("a");
if(label != null) {
encodeTooltip(context, label);
}
//submenus and menuitems
if(childrenElementsCount > 0) {
writer.startElement("ul", null);
writer.writeAttribute("role", "menu", null);
encodeElements(context, menu, submenu.getElements(),root);
writer.endElement("ul");
}
}
protected void encodeItemIcon(FacesContext context, String icon) throws IOException {
if(icon != null) {
ResponseWriter writer = context.getResponseWriter();
writer.startElement("i", null);
if(icon.contains("fa "))
icon += " fa-fw";
writer.writeAttribute("class", icon + " layout-menuitem-icon", null);
writer.endElement("i");
}
}
protected void encodeToggleIcon(FacesContext context, Submenu submenu, int childrenElementsCount) throws IOException {
if(childrenElementsCount > 0) {
ResponseWriter writer = context.getResponseWriter();
writer.startElement("i", null);
writer.writeAttribute("class", "fa fa-fw layout-submenu-toggler fa-angle-down", null);
writer.endElement("i");
}
}
protected void encodeBadge(FacesContext context, Object value) throws IOException {
if(value != null) {
ResponseWriter writer = context.getResponseWriter();
writer.startElement("span", null);
writer.writeAttribute("class", "menuitem-badge", null);
writer.writeText(value.toString(), null);
writer.endElement("span");
}
}
@Override
protected void encodeSeparator(FacesContext context, Separator separator) throws IOException {
ResponseWriter writer = context.getResponseWriter();
String style = separator.getStyle();
String styleClass = separator.getStyleClass();
styleClass = styleClass == null ? "Separator" : "Separator " + styleClass;
//title
writer.startElement("li", null);
writer.writeAttribute("class", styleClass, null);
if(style != null) {
writer.writeAttribute("style", style, null);
}
writer.endElement("li");
}
@Override
protected void encodeMenuItem(FacesContext context, AbstractMenu menu, MenuItem menuitem) throws IOException {
ResponseWriter writer = context.getResponseWriter();
String title = menuitem.getTitle();
boolean disabled = menuitem.isDisabled();
Object value = menuitem.getValue();
String style = menuitem.getStyle();
String styleClass = menuitem.getStyleClass();
writer.startElement("a", null);
if(title != null) writer.writeAttribute("title", title, null);
if(style != null) writer.writeAttribute("style", style, null);
if(styleClass != null) writer.writeAttribute("class", styleClass, null);
if(disabled) {
writer.writeAttribute("href", "#", null);
writer.writeAttribute("onclick", "return false;", null);
}
else {
String onclick = menuitem.getOnclick();
//GET
if(menuitem.getUrl() != null || menuitem.getOutcome() != null) {
String targetURL = getTargetURL(context, (UIOutcomeTarget) menuitem);
writer.writeAttribute("href", targetURL, null);
if(menuitem.getTarget() != null) {
writer.writeAttribute("target", menuitem.getTarget(), null);
}
}
//POST
else {
writer.writeAttribute("href", "#", null);
UIComponent form = ComponentTraversalUtils.closestForm(context, menu);
if(form == null) {
throw new FacesException("MenuItem must be inside a form element");
}
String command;
if(menuitem.isDynamic()) {
String menuClientId = menu.getClientId(context);
Map<String,List<String>> params = menuitem.getParams();
if(params == null) {
params = new LinkedHashMap<String, List<String>>();
}
List<String> idParams = new ArrayList<String>();
idParams.add(menuitem.getId());
params.put(menuClientId + "_menuid", idParams);
command = menuitem.isAjax() ? createAjaxRequest(context, menu, (AjaxSource) menuitem, form, params) : buildNonAjaxRequest(context, menu, form, menuClientId, params, true);
}
else {
command = menuitem.isAjax() ? createAjaxRequest(context, (AjaxSource) menuitem, form) : buildNonAjaxRequest(context, ((UIComponent) menuitem), form, ((UIComponent) menuitem).getClientId(context), true);
}
onclick = (onclick == null) ? command : onclick + ";" + command;
}
if(onclick != null) {
writer.writeAttribute("onclick", onclick, null);
}
}
encodeMenuItemContent(context, menu, menuitem);
writer.endElement("a");
if(value != null) {
encodeTooltip(context, value);
}
}
@Override
protected void encodeMenuItemContent(FacesContext context, AbstractMenu menu, MenuItem menuitem) throws IOException {
ResponseWriter writer = context.getResponseWriter();
String icon = menuitem.getIcon();
Object value = menuitem.getValue();
if(menuitem instanceof UIMenuItem) {
encodeBadge(context, ((UIMenuItem) menuitem).getAttributes().get("badge"));
}
encodeItemIcon(context, icon);
if(value != null) {
writer.startElement("span", null);
writer.writeAttribute("class", "layout-menuitem-text", null);
writer.writeText(value, "value");
writer.endElement("span");
}
}
protected void encodeTooltip(FacesContext context, Object value) throws IOException {
ResponseWriter writer = context.getResponseWriter();
writer.startElement("div", null);
writer.writeAttribute("class", "layout-menu-tooltip", null);
writer.startElement("div", null);
writer.writeAttribute("class", "layout-menu-tooltip-arrow", null);
writer.endElement("div");
writer.startElement("div", null);
writer.writeAttribute("class", "layout-menu-tooltip-text", null);
writer.writeText(value, null);
writer.endElement("div");
writer.endElement("div");
}
@Override
protected void encodeScript(FacesContext context, AbstractMenu abstractMenu) throws IOException {
PoseidonMenu menu = (PoseidonMenu) abstractMenu;
String clientId = menu.getClientId(context);
HttpServletRequest req = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
String pathname = req.getContextPath() + req.getServletPath();
ResponseWriter rw = context.getResponseWriter();
rw.startElement("script", null);
rw.writeAttribute("id", clientId + "_s", null);
rw.writeAttribute("type", "text/javascript", null);
rw.write("PrimeFaces.cw(\"Poseidon\",\"");
rw.write(menu.resolveWidgetVar());
rw.write("\",{id:\"");
rw.write(clientId);
rw.write("\",");
// attrs
rw.write("pathname:\"");
rw.write(pathname);
rw.write("\"");
rw.write("});");
rw.endElement("script");
}
protected String createAjaxRequest(FacesContext context, AjaxSource source, UIComponent form) {
UIComponent component = (UIComponent) source;
String clientId = component.getClientId(context);
AjaxRequestBuilder builder = getAjaxRequestBuilder();
builder.init()
.source(clientId)
.form(SearchExpressionFacade.resolveClientId(context, component, source.getForm()))
.process(component, source.getProcess())
.update(component, source.getUpdate())
.async(source.isAsync())
.global(source.isGlobal())
.delay(source.getDelay())
.timeout(source.getTimeout())
.partialSubmit(source.isPartialSubmit(), source.isPartialSubmitSet(), source.getPartialSubmitFilter())
.resetValues(source.isResetValues(), source.isResetValuesSet())
.ignoreAutoUpdate(source.isIgnoreAutoUpdate())
.onstart(source.getOnstart())
.onerror(source.getOnerror())
.onsuccess(source.getOnsuccess())
.oncomplete(source.getOncomplete())
.params(component);
if (form != null) {
builder.form(form.getClientId(context));
}
builder.preventDefault();
return builder.build();
}
protected String createAjaxRequest(FacesContext context, AbstractMenu menu, AjaxSource source, UIComponent form,
Map<String, List<String>> params) {
String clientId = menu.getClientId(context);
AjaxRequestBuilder builder = getAjaxRequestBuilder();
builder.init()
.source(clientId)
.process(menu, source.getProcess())
.update(menu, source.getUpdate())
.async(source.isAsync())
.global(source.isGlobal())
.delay(source.getDelay())
.timeout(source.getTimeout())
.partialSubmit(source.isPartialSubmit(), source.isPartialSubmitSet(), source.getPartialSubmitFilter())
.resetValues(source.isResetValues(), source.isResetValuesSet())
.ignoreAutoUpdate(source.isIgnoreAutoUpdate())
.onstart(source.getOnstart())
.onerror(source.getOnerror())
.onsuccess(source.getOnsuccess())
.oncomplete(source.getOncomplete())
.params(params);
if (form != null) {
builder.form(form.getClientId(context));
}
builder.preventDefault();
return builder.build();
}
protected AjaxRequestBuilder getAjaxRequestBuilder() {
Class rootContext;
Object requestContextInstance;
AjaxRequestBuilder builder;
try {
rootContext = Class.forName("org.primefaces.context.PrimeRequestContext");
} catch (ClassNotFoundException ex) {
try {
rootContext = Class.forName("org.primefaces.context.RequestContext");
} catch (ClassNotFoundException ex1) {
throw new RuntimeException(ex1);
}
}
try {
Method method = rootContext.getMethod("getCurrentInstance");
requestContextInstance = method.invoke(null);
method = requestContextInstance.getClass().getMethod("getAjaxRequestBuilder");
builder = (AjaxRequestBuilder) method.invoke(requestContextInstance);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
return builder;
}
}

View File

@ -0,0 +1,48 @@
/*
Copyright 2009-2022 PrimeTek.
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.primefaces.poseidon.domain;
import java.io.Serializable;
public class Country implements Serializable {
private String name;
private String code;
public Country() {}
public Country(String name, String code) {
this.name = name;
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}

View File

@ -0,0 +1,98 @@
/*
Copyright 2009-2022 PrimeTek.
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.primefaces.poseidon.domain;
import java.io.Serializable;
import java.time.LocalDate;
public class Customer implements Serializable {
private int id;
private String name;
private Country country;
private LocalDate date;
private CustomerStatus status;
private int activity;
private Representative representative;
public Customer() {}
public Customer(int id, String name, Country country, LocalDate date, CustomerStatus status, int activity, Representative representative) {
this.id = id;
this.name = name;
this.country = country;
this.date = date;
this.status = status;
this.activity = activity;
this.representative = representative;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Country getCountry() {
return country;
}
public void setCountry(Country country) {
this.country = country;
}
public LocalDate getDate() {
return date;
}
public void setDate(LocalDate date) {
this.date = date;
}
public CustomerStatus getStatus() {
return status;
}
public void setStatus(CustomerStatus status) {
this.status = status;
}
public int getActivity() {
return activity;
}
public void setActivity(int activity) {
this.activity = activity;
}
public Representative getRepresentative() {
return representative;
}
public void setRepresentative(Representative representative) {
this.representative = representative;
}
}

View File

@ -0,0 +1,32 @@
/*
Copyright 2009-2022 PrimeTek.
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.primefaces.poseidon.domain;
import java.util.Random;
public enum CustomerStatus {
QUALIFIED,
UNQUALIFIED,
NEGOTIATION,
NEW,
RENEWAL,
PROPOSAL;
public static CustomerStatus random() {
Random random = new Random();
return values()[random.nextInt(values().length)];
}
}

View File

@ -0,0 +1,104 @@
/*
Copyright 2009-2022 PrimeTek.
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.primefaces.poseidon.domain;
import java.io.Serializable;
public class Document implements Serializable, Comparable<Document> {
private String name;
private String size;
private String type;
public Document(String name, String size, String type) {
this.name = name;
this.size = size;
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSize() {
return size;
}
public void setSize(String size) {
this.size = size;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
//Eclipse Generated hashCode and equals
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((size == null) ? 0 : size.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Document other = (Document) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (size == null) {
if (other.size != null)
return false;
} else if (!size.equals(other.size))
return false;
if (type == null) {
if (other.type != null)
return false;
} else if (!type.equals(other.type))
return false;
return true;
}
@Override
public String toString() {
return name;
}
public int compareTo(Document document) {
return this.getName().compareTo(document.getName());
}
}

View File

@ -0,0 +1,32 @@
/*
Copyright 2009-2022 PrimeTek.
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.primefaces.poseidon.domain;
public enum InventoryStatus {
INSTOCK("In Stock"),
OUTOFSTOCK("Out of Stock"),
LOWSTOCK("Low Stock");
private String text;
InventoryStatus(String text) {
this.text = text;
}
public String getText() {
return text;
}
}

View File

@ -0,0 +1,104 @@
/*
Copyright 2009-2022 PrimeTek.
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.primefaces.poseidon.domain;
import java.io.Serializable;
import java.time.LocalDate;
public class Order implements Serializable {
private int id;
private String productCode;
private LocalDate date;
private double amount;
private int quantity;
private String customer;
private OrderStatus status;
public Order() {}
public Order(int id, String productCode, LocalDate date, double amount, int quantity, String customer, OrderStatus status) {
this.id = id;
this.productCode = productCode;
this.date = date;
this.amount = amount;
this.quantity = quantity;
this.customer = customer;
this.status = status;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public LocalDate getDate() {
return date;
}
public void setDate(LocalDate date) {
this.date = date;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public String getCustomer() {
return customer;
}
public void setCustomer(String customer) {
this.customer = customer;
}
public OrderStatus getStatus() {
return status;
}
public void setStatus(OrderStatus status) {
this.status = status;
}
}

View File

@ -0,0 +1,30 @@
/*
Copyright 2009-2022 PrimeTek.
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.primefaces.poseidon.domain;
import java.util.Random;
public enum OrderStatus {
PENDING,
DELIVERED,
CANCELLED,
RETURNED;
public static OrderStatus random() {
Random random = new Random();
return values()[random.nextInt(values().length)];
}
}

View File

@ -0,0 +1,77 @@
/*
* The MIT License
*
* Copyright (c) 2009-2022 PrimeTek
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.primefaces.poseidon.domain;
import java.io.Serializable;
public class Photo implements Serializable {
private String itemImageSrc;
private String thumbnailImageSrc;
private String alt;
private String title;
public Photo() {
}
public Photo(String itemImageSrc, String thumbnailImageSrc, String alt, String title) {
this.itemImageSrc = itemImageSrc;
this.thumbnailImageSrc = thumbnailImageSrc;
this.alt = alt;
this.title = title;
}
public String getItemImageSrc() {
return itemImageSrc;
}
public void setItemImageSrc(String itemImageSrc) {
this.itemImageSrc = itemImageSrc;
}
public String getThumbnailImageSrc() {
return thumbnailImageSrc;
}
public void setThumbnailImageSrc(String thumbnailImageSrc) {
this.thumbnailImageSrc = thumbnailImageSrc;
}
public String getAlt() {
return alt;
}
public void setAlt(String alt) {
this.alt = alt;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}

View File

@ -0,0 +1,178 @@
/*
Copyright 2009-2022 PrimeTek.
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.primefaces.poseidon.domain;
import java.io.Serializable;
import java.util.List;
public class Product implements Serializable {
private int id;
private String code;
private String name;
private String description;
private String image;
private double price;
private String category;
private int quantity;
private InventoryStatus inventoryStatus;
private int rating;
private List<Order> orders;
public Product() {}
public Product(int id, String code, String name, String description, String image, double price, String category, int quantity, InventoryStatus inventoryStatus, int rating) {
this.id = id;
this.code = code;
this.name = name;
this.description = description;
this.image = image;
this.price = price;
this.category = category;
this.quantity = quantity;
this.inventoryStatus = inventoryStatus;
this.rating = rating;
}
public Product clone() {
return new Product(getId(), getCode(), getName(), getDescription(), getImage(), getPrice(), getCategory(), getQuantity(), getInventoryStatus(), getRating());
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public InventoryStatus getInventoryStatus() {
return inventoryStatus;
}
public void setInventoryStatus(InventoryStatus inventoryStatus) {
this.inventoryStatus = inventoryStatus;
}
public int getRating() {
return rating;
}
public void setRating(int rating) {
this.rating = rating;
}
public List<Order> getOrders() {
return this.orders;
}
public void setOrders(List<Order> orders) {
this.orders = orders;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((code == null) ? 0 : code.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Product other = (Product) obj;
if (code == null) {
if (other.code != null)
return false;
} else if (!code.equals(other.code))
return false;
return true;
}
}

View File

@ -0,0 +1,48 @@
/*
Copyright 2009-2022 PrimeTek.
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.primefaces.poseidon.domain;
import java.io.Serializable;
public class Representative implements Serializable {
private String name;
private String image;
public Representative() {}
public Representative(String name, String image) {
this.name = name;
this.image = image;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
}

View File

@ -0,0 +1,44 @@
/*
Copyright 2009-2022 PrimeTek.
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.primefaces.poseidon.filter;
import java.io.IOException;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.FilterConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
public class CharacterEncodingFilter implements Filter {
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
req.setCharacterEncoding("UTF-8");
resp.setCharacterEncoding("UTF-8");
chain.doFilter(req, resp);
}
public void init(FilterConfig filterConfig) throws ServletException {
}
public void destroy() {
}
}

View File

@ -0,0 +1,101 @@
/*
Copyright 2009-2022 PrimeTek.
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.primefaces.poseidon.service;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Named;
import org.primefaces.poseidon.domain.Country;
import org.primefaces.poseidon.domain.Customer;
import org.primefaces.poseidon.domain.CustomerStatus;
import org.primefaces.poseidon.domain.Representative;
@Named
@ApplicationScoped
public class CustomerService {
private final static Country[] countries;
private final static Representative[] representatives;
private final static String[] names;
List<Customer> customers = new ArrayList<>();
static {
countries = new Country[]{
new Country("Argentina", "ar"),new Country("Australia", "au"),new Country("Brazil", "br"),
new Country("Canada", "ca"),new Country("Germany", "de"),new Country("France", "fr"),
new Country("India", "in"), new Country("Italy", "it"),new Country("Japan", "jp"),
new Country("Russia", "ru"),
new Country("Spain", "es"),new Country("United Kingdom", "gb")};
representatives = new Representative[]{new Representative("Amy Elsner", "amyelsner.png"),new Representative("Anna Fali", "annafali.png"),
new Representative("Asiya Javayant", "asiyajavayant.png"),new Representative("Bernardo Dominic", "bernardodominic.png"),
new Representative("Elwin Sharvill", "elwinsharvill.png"),new Representative("Ioni Bowcher", "ionibowcher.png"),
new Representative("Ivan Magalhaes", "ivanmagalhaes.png"),new Representative("Onyama Limba", "onyamalimba.png"),
new Representative("Stephen Shaw", "stephenshaw.png"),new Representative("Xuxue Feng", "xuxuefeng.png")};
names = new String[]{"James","David","Jeanfrancois","Ivar","Tony","Adams","Claire","Costa","Juan","Maria","Jennifer","Stacey","Leja","Morrow",
"Arvin","Darci","Izzy","Lionel","Clifford","Emily","Kadeem","Mujtaba","Aika","Mayumi","Misaki","Silvio","Nicolas","Antonio",
"Deepesh","Aditya","Aruna","Jones","Julie","Smith","Johnson","Francesco","Salvatore","Kaitlin","Faith","Maisha","Jefferson",
"Leon","Rodrigues","Alejandro","Munro","Cody","Chavez","Sinclair","Isabel","Octavia","Murillo","Greenwood","Wickens","Ashley"};
}
public List<Customer> getCustomers(int number) {
List<Customer> customers = new ArrayList<>();
for (int i = 0; i < number; i++) {
customers.add(new Customer(i + 1000, getCustomerName(), getCountry(), getDate(), CustomerStatus.random(), getActivity(), getRepresentative()));
}
return customers;
}
private String getCustomerName() {
String firstName = this.getName();
String lastName;
while((lastName = this.getName()).equals(firstName)) {}
return firstName + " " + lastName;
}
private String getName() {
return names[(int) (Math.random() * names.length)];
}
private Country getCountry() {
return countries[(int) (Math.random() * countries.length)];
}
private LocalDate getDate() {
LocalDate now = LocalDate.now();
long randomDay = ThreadLocalRandom.current().nextLong(now.minusDays(30).toEpochDay(), now.toEpochDay());
return LocalDate.ofEpochDay(randomDay);
}
private int getActivity() {
return (int) (Math.random() * 100);
}
private Representative getRepresentative() {
return representatives[(int) (Math.random() * representatives.length)];
}
}

View File

@ -0,0 +1,95 @@
/*
Copyright 2009-2022 PrimeTek.
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.primefaces.poseidon.service;
import org.primefaces.model.CheckboxTreeNode;
import org.primefaces.model.DefaultTreeNode;
import org.primefaces.model.TreeNode;
import org.primefaces.poseidon.domain.Document;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Named;
@Named
@ApplicationScoped
public class DocumentService {
public TreeNode createDocuments() {
TreeNode root = new DefaultTreeNode(new Document("Files", "-", "Folder"), null);
TreeNode documents = new DefaultTreeNode(new Document("Documents", "-", "Folder"), root);
TreeNode pictures = new DefaultTreeNode(new Document("Pictures", "-", "Folder"), root);
TreeNode movies = new DefaultTreeNode(new Document("Movies", "-", "Folder"), root);
TreeNode work = new DefaultTreeNode(new Document("Work", "-", "Folder"), documents);
TreeNode primefaces = new DefaultTreeNode(new Document("PrimeFaces", "-", "Folder"), documents);
//Documents
TreeNode expenses = new DefaultTreeNode("document", new Document("Expenses.doc", "30 KB", "Word Document"), work);
TreeNode resume = new DefaultTreeNode("document", new Document("Resume.doc", "10 KB", "Word Document"), work);
TreeNode refdoc = new DefaultTreeNode("document", new Document("RefDoc.pages", "40 KB", "Pages Document"), primefaces);
//Pictures
TreeNode barca = new DefaultTreeNode("picture", new Document("barcelona.jpg", "30 KB", "JPEG Image"), pictures);
TreeNode primelogo = new DefaultTreeNode("picture", new Document("logo.jpg", "45 KB", "JPEG Image"), pictures);
TreeNode optimus = new DefaultTreeNode("picture", new Document("optimusprime.png", "96 KB", "PNG Image"), pictures);
//Movies
TreeNode pacino = new DefaultTreeNode(new Document("Al Pacino", "-", "Folder"), movies);
TreeNode deniro = new DefaultTreeNode(new Document("Robert De Niro", "-", "Folder"), movies);
TreeNode scarface = new DefaultTreeNode("mp3", new Document("Scarface", "15 GB", "Movie File"), pacino);
TreeNode carlitosWay = new DefaultTreeNode("mp3", new Document("Carlitos' Way", "24 GB", "Movie File"), pacino);
TreeNode goodfellas = new DefaultTreeNode("mp3", new Document("Goodfellas", "23 GB", "Movie File"), deniro);
TreeNode untouchables = new DefaultTreeNode("mp3", new Document("Untouchables", "17 GB", "Movie File"), deniro);
return root;
}
public TreeNode createCheckboxDocuments() {
TreeNode root = new CheckboxTreeNode(new Document("Files", "-", "Folder"), null);
TreeNode documents = new CheckboxTreeNode(new Document("Documents", "-", "Folder"), root);
TreeNode pictures = new CheckboxTreeNode(new Document("Pictures", "-", "Folder"), root);
TreeNode movies = new CheckboxTreeNode(new Document("Movies", "-", "Folder"), root);
TreeNode work = new CheckboxTreeNode(new Document("Work", "-", "Folder"), documents);
TreeNode primefaces = new CheckboxTreeNode(new Document("PrimeFaces", "-", "Folder"), documents);
//Documents
TreeNode expenses = new CheckboxTreeNode("document", new Document("Expenses.doc", "30 KB", "Word Document"), work);
TreeNode resume = new CheckboxTreeNode("document", new Document("Resume.doc", "10 KB", "Word Document"), work);
TreeNode refdoc = new CheckboxTreeNode("document", new Document("RefDoc.pages", "40 KB", "Pages Document"), primefaces);
//Pictures
TreeNode barca = new CheckboxTreeNode("picture", new Document("barcelona.jpg", "30 KB", "JPEG Image"), pictures);
TreeNode primelogo = new CheckboxTreeNode("picture", new Document("logo.jpg", "45 KB", "JPEG Image"), pictures);
TreeNode optimus = new CheckboxTreeNode("picture", new Document("optimusprime.png", "96 KB", "PNG Image"), pictures);
//Movies
TreeNode pacino = new CheckboxTreeNode(new Document("Al Pacino", "-", "Folder"), movies);
TreeNode deniro = new CheckboxTreeNode(new Document("Robert De Niro", "-", "Folder"), movies);
TreeNode scarface = new CheckboxTreeNode("mp3", new Document("Scarface", "15 GB", "Movie File"), pacino);
TreeNode carlitosWay = new CheckboxTreeNode("mp3", new Document("Carlitos' Way", "24 GB", "Movie File"), pacino);
TreeNode goodfellas = new CheckboxTreeNode("mp3", new Document("Goodfellas", "23 GB", "Movie File"), deniro);
TreeNode untouchables = new CheckboxTreeNode("mp3", new Document("Untouchables", "17 GB", "Movie File"), deniro);
return root;
}
}

View File

@ -0,0 +1,81 @@
/*
Copyright 2009-2022 PrimeTek.
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.primefaces.poseidon.service;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Named;
import org.primefaces.poseidon.domain.Order;
import org.primefaces.poseidon.domain.OrderStatus;
@Named
@ApplicationScoped
public class OrderService {
private final static String[] names;
static {
names = new String[]{"James","David","Jeanfrancois","Ivar","Tony","Adams","Claire","Costa","Juan","Maria","Jennifer","Stacey","Leja","Morrow",
"Arvin","Darci","Izzy","Lionel","Clifford","Emily","Kadeem","Mujtaba","Aika","Mayumi","Misaki","Silvio","Nicolas","Antonio",
"Deepesh","Aditya","Aruna","Jones","Julie","Smith","Johnson","Francesco","Salvatore","Kaitlin","Faith","Maisha","Jefferson",
"Leon","Rodrigues","Alejandro","Munro","Cody","Chavez","Sinclair","Isabel","Octavia","Murillo","Greenwood","Wickens","Ashley"};
}
public List<Order> getOrders(int number) {
List<Order> orders = new ArrayList<>();
for (int i = 0; i < number; i++) {
orders.add(new Order(i + 1000, getProductCode(), getDate(), getAmount(), getQuantity(), getCustomerName(), OrderStatus.random()));
}
return orders;
}
private String getCustomerName() {
String firstName = this.getName();
String lastName;
while((lastName = this.getName()).equals(firstName)) {}
return firstName + " " + lastName;
}
private String getName() {
return names[(int) (Math.random() * names.length)];
}
private String getProductCode() {
return UUID.randomUUID().toString().substring(6, 16);
}
private LocalDate getDate() {
LocalDate now = LocalDate.now();
long randomDay = ThreadLocalRandom.current().nextLong(now.minusDays(30).toEpochDay(), now.toEpochDay());
return LocalDate.ofEpochDay(randomDay);
}
private double getAmount() {
return ThreadLocalRandom.current().nextDouble(1, 200);
}
private int getQuantity() {
return ThreadLocalRandom.current().nextInt(1, 10);
}
}

View File

@ -0,0 +1,78 @@
/*
* The MIT License
*
* Copyright (c) 2009-2022 PrimeTek
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.primefaces.poseidon.service;
import java.util.ArrayList;
import java.util.List;
import jakarta.annotation.PostConstruct;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Named;
import org.primefaces.poseidon.domain.Photo;
@Named
@ApplicationScoped
public class PhotoService {
private List<Photo> photos;
@PostConstruct
public void init() {
photos = new ArrayList<>();
photos.add(new Photo("demo/images/galleria/galleria1.jpg", "demo/images/galleria/galleria1s.jpg",
"Description for Image 1", "Title 1"));
photos.add(new Photo("demo/images/galleria/galleria2.jpg", "demo/images/galleria/galleria2s.jpg",
"Description for Image 2", "Title 2"));
photos.add(new Photo("demo/images/galleria/galleria3.jpg", "demo/images/galleria/galleria3s.jpg",
"Description for Image 3", "Title 3"));
photos.add(new Photo("demo/images/galleria/galleria4.jpg", "demo/images/galleria/galleria4s.jpg",
"Description for Image 4", "Title 4"));
photos.add(new Photo("demo/images/galleria/galleria5.jpg", "demo/images/galleria/galleria5s.jpg",
"Description for Image 5", "Title 5"));
photos.add(new Photo("demo/images/galleria/galleria6.jpg", "demo/images/galleria/galleria6s.jpg",
"Description for Image 6", "Title 6"));
photos.add(new Photo("demo/images/galleria/galleria7.jpg", "demo/images/galleria/galleria7s.jpg",
"Description for Image 7", "Title 7"));
photos.add(new Photo("demo/images/galleria/galleria8.jpg", "demo/images/galleria/galleria8s.jpg",
"Description for Image 8", "Title 8"));
photos.add(new Photo("demo/images/galleria/galleria9.jpg", "demo/images/galleria/galleria9s.jpg",
"Description for Image 9", "Title 9"));
photos.add(new Photo("demo/images/galleria/galleria10.jpg", "demo/images/galleria/galleria10s.jpg",
"Description for Image 10", "Title 10"));
photos.add(new Photo("demo/images/galleria/galleria11.jpg", "demo/images/galleria/galleria11s.jpg",
"Description for Image 11", "Title 11"));
photos.add(new Photo("demo/images/galleria/galleria12.jpg", "demo/images/galleria/galleria12s.jpg",
"Description for Image 12", "Title 12"));
photos.add(new Photo("demo/images/galleria/galleria13.jpg", "demo/images/galleria/galleria13s.jpg",
"Description for Image 13", "Title 13"));
photos.add(new Photo("demo/images/galleria/galleria14.jpg", "demo/images/galleria/galleria14s.jpg",
"Description for Image 14", "Title 14"));
photos.add(new Photo("demo/images/galleria/galleria15.jpg", "demo/images/galleria/galleria15s.jpg",
"Description for Image 15", "Title 15"));
}
public List<Photo> getPhotos() {
return photos;
}
}

View File

@ -0,0 +1,103 @@
/*
Copyright 2009-2022 PrimeTek.
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.primefaces.poseidon.service;
import org.primefaces.poseidon.domain.InventoryStatus;
import org.primefaces.poseidon.domain.Product;
import jakarta.annotation.PostConstruct;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Named;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@Named
@ApplicationScoped
public class ProductService {
List<Product> products;
@PostConstruct
public void init() {
products = new ArrayList<>();
products.add(new Product(1000, "f230fh0g3", "Bamboo Watch", "Product Description", "bamboo-watch.jpg", 65, "Accessories", 24, InventoryStatus.INSTOCK, 5));
products.add(new Product(1001, "nvklal433", "Black Watch", "Product Description", "black-watch.jpg", 72, "Accessories", 61, InventoryStatus.OUTOFSTOCK, 4));
products.add(new Product(1002, "zz21cz3c1", "Blue Band", "Product Description", "blue-band.jpg", 79, "Fitness", 2, InventoryStatus.LOWSTOCK, 3));
products.add(new Product(1003, "244wgerg2", "Blue T-Shirt", "Product Description", "blue-t-shirt.jpg", 29, "Clothing", 25, InventoryStatus.INSTOCK, 5));
products.add(new Product(1004, "h456wer53", "Bracelet", "Product Description", "bracelet.jpg", 15, "Accessories", 73, InventoryStatus.INSTOCK, 4));
products.add(new Product(1005, "av2231fwg", "Brown Purse", "Product Description", "brown-purse.jpg", 120, "Accessories", 0, InventoryStatus.OUTOFSTOCK, 4));
products.add(new Product(1006, "bib36pfvm", "Chakra Bracelet", "Product Description", "chakra-bracelet.jpg", 32, "Accessories", 5, InventoryStatus.LOWSTOCK, 3));
products.add(new Product(1007, "mbvjkgip5", "Galaxy Earrings", "Product Description", "galaxy-earrings.jpg", 34, "Accessories", 23, InventoryStatus.INSTOCK, 5));
products.add(new Product(1008, "vbb124btr", "Game Controller", "Product Description", "game-controller.jpg", 99, "Electronics", 2, InventoryStatus.LOWSTOCK, 4));
products.add(new Product(1009, "cm230f032", "Gaming Set", "Product Description", "gaming-set.jpg", 299, "Electronics", 63, InventoryStatus.INSTOCK, 3));
products.add(new Product(1010, "plb34234v", "Gold Phone Case", "Product Description", "gold-phone-case.jpg", 24, "Accessories", 0, InventoryStatus.OUTOFSTOCK, 4));
products.add(new Product(1011, "4920nnc2d", "Green Earbuds", "Product Description", "green-earbuds.jpg", 89, "Electronics", 23, InventoryStatus.INSTOCK, 4));
products.add(new Product(1012, "250vm23cc", "Green T-Shirt", "Product Description", "green-t-shirt.jpg", 49, "Clothing", 74, InventoryStatus.INSTOCK, 5));
products.add(new Product(1013, "fldsmn31b", "Grey T-Shirt", "Product Description", "grey-t-shirt.jpg", 48, "Clothing", 0, InventoryStatus.OUTOFSTOCK, 3));
products.add(new Product(1014, "waas1x2as", "Headphones", "Product Description", "headphones.jpg", 175, "Electronics", 8, InventoryStatus.LOWSTOCK, 5));
products.add(new Product(1015, "vb34btbg5", "Light Green T-Shirt", "Product Description", "light-green-t-shirt.jpg", 49, "Clothing", 34, InventoryStatus.INSTOCK, 4));
products.add(new Product(1016, "k8l6j58jl", "Lime Band", "Product Description", "lime-band.jpg", 79, "Fitness", 12, InventoryStatus.INSTOCK, 3));
products.add(new Product(1017, "v435nn85n", "Mini Speakers", "Product Description", "mini-speakers.jpg", 85, "Clothing", 42, InventoryStatus.INSTOCK, 4));
products.add(new Product(1018, "09zx9c0zc", "Painted Phone Case", "Product Description", "painted-phone-case.jpg", 56, "Accessories", 41, InventoryStatus.INSTOCK, 5));
products.add(new Product(1019, "mnb5mb2m5", "Pink Band", "Product Description", "pink-band.jpg", 79, "Fitness", 63, InventoryStatus.INSTOCK, 4));
products.add(new Product(1020, "r23fwf2w3", "Pink Purse", "Product Description", "pink-purse.jpg", 110, "Accessories", 0, InventoryStatus.OUTOFSTOCK, 4));
products.add(new Product(1021, "pxpzczo23", "Purple Band", "Product Description", "purple-band.jpg", 79, "Fitness", 6, InventoryStatus.LOWSTOCK, 3));
products.add(new Product(1022, "2c42cb5cb", "Purple Gemstone Necklace", "Product Description", "purple-gemstone-necklace.jpg", 45, "Accessories", 62, InventoryStatus.INSTOCK, 4));
products.add(new Product(1023, "5k43kkk23", "Purple T-Shirt", "Product Description", "purple-t-shirt.jpg", 49, "Clothing", 2, InventoryStatus.LOWSTOCK, 5));
products.add(new Product(1024, "lm2tny2k4", "Shoes", "Product Description", "shoes.jpg", 64, "Clothing", 0, InventoryStatus.INSTOCK, 4));
products.add(new Product(1025, "nbm5mv45n", "Sneakers", "Product Description", "sneakers.jpg", 78, "Clothing", 52, InventoryStatus.INSTOCK, 4));
products.add(new Product(1026, "zx23zc42c", "Teal T-Shirt", "Product Description", "teal-t-shirt.jpg", 49, "Clothing", 3, InventoryStatus.LOWSTOCK, 3));
products.add(new Product(1027, "acvx872gc", "Yellow Earbuds", "Product Description", "yellow-earbuds.jpg", 89, "Electronics", 35, InventoryStatus.INSTOCK, 3));
products.add(new Product(1028, "tx125ck42", "Yoga Mat", "Product Description", "yoga-mat.jpg", 20, "Fitness", 15, InventoryStatus.INSTOCK, 5));
products.add(new Product(1029, "gwuby345v", "Yoga Set", "Product Description", "yoga-set.jpg", 20, "Fitness", 25, InventoryStatus.INSTOCK, 8));
}
public List<Product> getProducts() {
return new ArrayList<>(products);
}
public List<Product> getProducts(int size) {
if (size > products.size()) {
Random rand = new Random();
List<Product> randomList = new ArrayList<>();
for (int i = 0; i < size; i++) {
int randomIndex = rand.nextInt(products.size());
randomList.add(products.get(randomIndex));
}
return randomList;
}
else {
return new ArrayList<>(products.subList(0, size));
}
}
public List<Product> getClonedProducts(int size) {
List<Product> results = new ArrayList<>();
List<Product> originals = getProducts(size);
for (Product original : originals) {
results.add(original.clone());
}
return results;
}
}

View File

@ -0,0 +1,131 @@
/*
Copyright 2009-2022 PrimeTek.
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under PrimeFaces Commercial License, Version 1.0 (the "License");
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.primefaces.poseidon.view;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import org.primefaces.PrimeFaces;
import org.primefaces.poseidon.domain.Product;
import org.primefaces.poseidon.service.OrderService;
import org.primefaces.poseidon.service.ProductService;
import org.primefaces.event.ToggleEvent;
import org.primefaces.model.Visibility;
import java.io.Serializable;
import java.util.List;
import java.util.UUID;
import jakarta.annotation.PostConstruct;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.context.FacesContext;
import jakarta.faces.view.ViewScoped;
@Named
@ViewScoped
public class CrudDemoView implements Serializable {
private List<Product> products;
private Product selectedProduct;
private List<Product> selectedProducts;
@Inject
private ProductService productService;
@Inject
private OrderService orderService;
@PostConstruct
public void init() {
this.products = this.productService.getClonedProducts(30);
}
public List<Product> getProducts() {
return products;
}
public Product getSelectedProduct() {
return selectedProduct;
}
public void setSelectedProduct(Product selectedProduct) {
this.selectedProduct = selectedProduct;
}
public List<Product> getSelectedProducts() {
return selectedProducts;
}
public void setSelectedProducts(List<Product> selectedProducts) {
this.selectedProducts = selectedProducts;
}
public void openNew() {
this.selectedProduct = new Product();
}
public void saveProduct() {
if (this.selectedProduct.getCode() == null) {
this.selectedProduct.setCode(UUID.randomUUID().toString().replaceAll("-", "").substring(0, 9));
this.products.add(this.selectedProduct);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Product Added"));
}
else {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Product Updated"));
}
PrimeFaces.current().executeScript("PF('manageProductDialog').hide()");
PrimeFaces.current().ajax().update("form:messages", "form:dt-products");
}
public void deleteProduct() {
this.products.remove(this.selectedProduct);
this.selectedProduct = null;
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Product Removed"));
PrimeFaces.current().ajax().update("form:messages", "form:dt-products");
}
public String getDeleteButtonMessage() {
if (hasSelectedProducts()) {
int size = this.selectedProducts.size();
return size > 1 ? size + " products selected" : "1 product selected";
}
return "Delete";
}
public boolean hasSelectedProducts() {
return this.selectedProducts != null && !this.selectedProducts.isEmpty();
}
public void deleteSelectedProducts() {
this.products.removeAll(this.selectedProducts);
this.selectedProducts = null;
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Products Removed"));
PrimeFaces.current().ajax().update("form:messages", "form:dt-products");
}
public void onRowToggle(ToggleEvent event) {
if (event.getVisibility() == Visibility.VISIBLE) {
Product product = (Product) event.getData();
if (product.getOrders() == null) {
product.setOrders(orderService.getOrders((int) (Math.random() * 10)));
}
}
}
}

View File

@ -0,0 +1,143 @@
package org.primefaces.poseidon.view;
import jakarta.enterprise.context.SessionScoped;
import jakarta.annotation.PostConstruct;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import jakarta.inject.Named;
@Named
@SessionScoped
public class GuestPreferences implements Serializable {
private String menuMode = "layout-static layout-static-active";
private String componentTheme = "denim";
private String topbarTheme = "light";
private String menuTheme = "dim";
private boolean orientationRTL;
private String darkMode = "light";
private String inputStyle = "outlined";
private List<ComponentTheme> componentThemes = new ArrayList<ComponentTheme>();
@PostConstruct
public void init() {
componentThemes.add(new ComponentTheme("Denim", "denim", "#2f8ee5"));
componentThemes.add(new ComponentTheme("Sea Green", "sea-green", "#30A059"));
componentThemes.add(new ComponentTheme("Amethyst", "amethyst", "#834CA8"));
componentThemes.add(new ComponentTheme("Wedgewood", "wedgewood", "#557DAA"));
componentThemes.add(new ComponentTheme("Tapestry", "tapestry", "#A74896"));
componentThemes.add(new ComponentTheme("Cape Palliser", "cape-palliser", "#A46B3E"));
componentThemes.add(new ComponentTheme("Apple", "apple", "#52A235"));
componentThemes.add(new ComponentTheme("Gigas", "gigas", "#5751A9"));
componentThemes.add(new ComponentTheme("Jungle Green", "jungle-green", "#2B9F9C"));
componentThemes.add(new ComponentTheme("Camelot", "camelot", "#A54357"));
componentThemes.add(new ComponentTheme("Amber", "amber", "#D49341"));
componentThemes.add(new ComponentTheme("Cyan", "cyan", "#399DB2"));
}
public String getDarkMode() {
return darkMode;
}
public void setDarkMode(String darkMode) {
this.darkMode = darkMode;
this.menuTheme = darkMode;
this.topbarTheme = darkMode;
}
public String getTheme() {
return this.componentTheme + '-' + this.darkMode ;
}
public String getComponentTheme() {
return componentTheme;
}
public void setComponentTheme(String componentTheme) {
this.componentTheme = componentTheme;
}
public String getMenuTheme() {
return menuTheme;
}
public void setMenuTheme(String menuTheme) {
this.menuTheme = menuTheme;
}
public String getTopbarTheme() {
return topbarTheme;
}
public void setTopbarTheme(String topbarTheme) {
this.topbarTheme = topbarTheme;
}
public String getMenuMode() {
return this.menuMode;
}
public void setMenuMode(String menuMode) {
this.menuMode = menuMode;
}
public boolean isOrientationRTL() {
return orientationRTL;
}
public void setOrientationRTL(boolean orientationRTL) {
this.orientationRTL = orientationRTL;
}
public String getInputStyle() {
return inputStyle;
}
public String getInputStyleClass() {
return this.inputStyle.equals("filled") ? "ui-input-filled" : "";
}
public void setInputStyle(String inputStyle) {
this.inputStyle = inputStyle;
}
public List<ComponentTheme> getComponentThemes() {
return componentThemes;
}
public class ComponentTheme {
String name;
String file;
String color;
public ComponentTheme(String name, String file, String color) {
this.name = name;
this.file = file;
this.color = color;
}
public String getName() {
return this.name;
}
public String getFile() {
return this.file;
}
public String getColor() {
return this.color;
}
}
}

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/teste">
<Resource auth="Container" factory="org.jboss.weld.resources.ManagerObjectFactory" name="BeanManager" type="jakarta.enterprise.inject.spi.BeanManager"/>
</Context>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans version="3.0" bean-discovery-mode="all"
xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd">
</beans>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<faces-config
xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_3_0.xsd"
version="3.0"
>
<name>primefaces_poseidon</name>
<component>
<component-type>org.primefaces.component.PoseidonMenu</component-type>
<component-class>org.primefaces.poseidon.component.PoseidonMenu</component-class>
</component>
<render-kit>
<renderer>
<component-family>org.primefaces.component</component-family>
<renderer-type>org.primefaces.component.PoseidonMenuRenderer</renderer-type>
<renderer-class>org.primefaces.poseidon.component.PoseidonMenuRenderer</renderer-class>
</renderer>
</render-kit>
</faces-config>

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
version="2.0">
<namespace>http://primefaces.org/poseidon</namespace>
<tag>
<description><![CDATA[Menu is a navigation component for Poseidon Layout.]]></description>
<tag-name>menu</tag-name>
<component>
<component-type>org.primefaces.component.PoseidonMenu</component-type>
<renderer-type>org.primefaces.component.PoseidonMenuRenderer</renderer-type>
</component>
<attribute>
<description><![CDATA[Unique identifier of the component in a namingContainer.]]></description>
<name>id</name>
<required>false</required>
<type>java.lang.String</type>
</attribute>
<attribute>
<description><![CDATA[Boolean value to specify the rendering of the component, when set to false component will not be rendered.]]></description>
<name>rendered</name>
<required>false</required>
<type>java.lang.Boolean</type>
</attribute>
<attribute>
<description><![CDATA[An el expression referring to a server side UIComponent instance in a backing bean.]]></description>
<name>binding</name>
<required>false</required>
<type>jakarta.faces.component.UIComponent</type>
</attribute>
<attribute>
<description><![CDATA[Name of the client side widget.]]></description>
<name>widgetVar</name>
<required>false</required>
<type>java.lang.String</type>
</attribute>
<attribute>
<description><![CDATA[A menu model instance to create menu programmatically.]]></description>
<name>model</name>
<required>false</required>
<type>org.primefaces.model.menu.MenuModel</type>
</attribute>
<attribute>
<description><![CDATA[Inline style of the main container element.]]></description>
<name>style</name>
<required>false</required>
<type>java.lang.String</type>
</attribute>
<attribute>
<description><![CDATA[Style class of the main container element.]]></description>
<name>styleClass</name>
<required>false</required>
<type>java.lang.String</type>
</attribute>
</tag>
</facelet-taglib>

View File

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns = "https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
version = "5.0"
metadata-complete = "false"
>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
<context-param>
<param-name>primefaces.SUBMIT</param-name>
<param-value>partial</param-value>
</context-param>
<context-param>
<param-name>jakarta.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>poseidon-#{guestPreferences.theme}</param-value>
</context-param>
<context-param>
<param-name>primefaces.FONT_AWESOME</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>jakarta.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/primefaces-poseidon.taglib.xml</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<filter>
<filter-name>Character Encoding Filter</filter-name>
<filter-class>org.primefaces.poseidon.filter.CharacterEncodingFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Character Encoding Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
<mime-mapping>
<extension>ttf</extension>
<mime-type>application/font-sfnt</mime-type>
</mime-mapping>
<mime-mapping>
<extension>woff</extension>
<mime-type>application/font-woff</mime-type>
</mime-mapping>
<mime-mapping>
<extension>woff2</extension>
<mime-type>application/font-woff2</mime-type>
</mime-mapping>
<mime-mapping>
<extension>eot</extension>
<mime-type>application/vnd.ms-fontobject</mime-type>
</mime-mapping>
<mime-mapping>
<extension>eot?#iefix</extension>
<mime-type>application/vnd.ms-fontobject</mime-type>
</mime-mapping>
<mime-mapping>
<extension>svg</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>svg#exosemibold</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>svg#exobolditalic</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>svg#exomedium</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>svg#exoregular</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>svg#fontawesomeregular</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
</web-app>

View File

@ -0,0 +1,44 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:jsf="http://xmlns.jcp.org/jsf"
template="../template/template.xhtml" >
<ui:define name="HEAD_TITULO_PAGINA">tb_template</ui:define>
<ui:define name="TITULO_PAGINA"><p:menuitem value="tb_template" url="#" /></ui:define>
<ui:define name="SISTEMA_PAGINA">Agtemplate</ui:define>
<ui:define name="CAMINHO_PAGINA">tb_template</ui:define>
<ui:define name="MENU_BOTOES">
<p:commandButton value="Novo" icon="pi pi-plus" update="@([id$=modalAgtemplateTb_templateCU])" action="#{agtemplateTb_templateBean.clickNovo()}" oncomplete="PF('wvModalAgtemplateTb_templateCU').show();"
styleClass="ui-button-success" style="margin-right: .5rem" process="@this" >
<p:resetInput target="modalAgtemplateTb_templateCU"/>
</p:commandButton>
<p:commandButton process="@this" id="deleteAgtemplateTb_templateButton" value="#{agtemplateTb_templateBean.deleteButtonMessage}" icon="pi pi-trash" actionListener="#{agtemplateTb_templateBean.deleteSelectedTb_template}"
styleClass="ui-button-danger" disabled="#{!agtemplateTb_templateBean.hasSelectedTb_template()}" update="@this,panel_formulario,panelAlerta">
<p:confirm header="Confirmação" message="Remover o(s) tb_template(s) selecionado(s)?" icon="pi pi-exclamation-triangle" />
</p:commandButton>
</ui:define>
<ui:define name="MENU_FILTRO"> <h:panelGroup id="optionsPesquisa" layout="block" >
<span class="filter-container ui-input-icon-left">
<i class="pi pi-search"></i>
<p:inputText onkeypress="if (event.keyCode == 13) {jQuery('#btPesquisa').trigger('click'); return false;}" style="margin-right:10px" id="pesquisa" title="Informar parametros de pesquisa" styleClass="pesquisa" value="#{agtemplateTb_templateBean.pesquisa}" >
<p:hotkey bind="return" handler="btPesquisa.click();"/>
</p:inputText>
</span>
<p:commandButton title="Pesquisar" icon="pi pi-search" id="btPesquisa" update="form_formulario,messages" styleClass="bt_pesquisa m-2" action="#{agtemplateTb_templateBean.clickPesquisar()}" process="optionsPesquisa"/>
<p:commandButton title="Filtrar" icon="pi pi-filter" styleClass="bt_pesquisa_filtro" process="@this" oncomplete="PF('wvModalAgtemplateTb_templateFiltro').show();" />
</h:panelGroup>
</ui:define>
<ui:define name="FORMULARIO">
<ui:include src="./forms/crud/Tb_template/Tb_templateConsultLazy.xhtml" />
</ui:define>
<ui:define name="LIVRE">
<ui:include src="./forms/modal/Tb_template/Tb_templateR.xhtml" />
<ui:include src="./forms/modal/Tb_template/Tb_templateD.xhtml" />
<ui:include src="./forms/modal/Tb_template/Tb_templateCU.xhtml" />
<ui:include src="./forms/modal/Tb_template/Tb_templateFiltro.xhtml" />
</ui:define>
</ui:composition>

View File

@ -0,0 +1,22 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:fw="http://xmlns.jcp.org/jsf/composite/framework"
xmlns:jsf="http://xmlns.jcp.org/jsf" >
<p:panelGrid layout="grid" contentStyleClass="ui-fluid" columns="1" styleClass="panelGridStyleClass" >
<fw:panelGroup id="pg_agtemplate_tb_template_id" required="true" idInput="agtemplate_tb_template_id" label="id" >
<p:inputNumber emptyValue="always" id="agtemplate_tb_template_id" value="#{agtemplateTb_templateBean.tb_template.id}" required="true" requiredMessage="id requerido(a)." styleClass="inputTextInteiro" />
</fw:panelGroup>
<fw:panelGroup id="pg_agtemplate_tb_template_nome" required="true" idInput="agtemplate_tb_template_nome" label="nome" >
<p:inputText id="agtemplate_tb_template_nome" value="#{agtemplateTb_templateBean.tb_template.nome}" required="true" requiredMessage="nome requerido(a)." maxlength="255" styleClass="inputText" />
</fw:panelGroup>
</p:panelGrid>
</ui:composition>

View File

@ -0,0 +1,51 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:jsf="http://xmlns.jcp.org/jsf" >
<p:dataTable reflow="true" var="item" paginator="true" value="#{agtemplateTb_templateBean.listTb_template}" rendered="#{not empty agtemplateTb_templateBean.listTb_template}" rows="10" rowStyleClass="dataTableRowClass1,dataTableRowClass2" styleClass="dataTableStyleClass" currentPageReportTemplate="[ Exibindo de {startRecord} a {endRecord} no total de {totalRecords} - Página: {currentPage}/{totalPages} ]" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="5,10,15" paginatorPosition="bottom" id="dataTableAgtemplateTb_template" >
<p:column sortBy="#{item.id}" styleClass="columnInteiro" >
<f:facet name="header"><h:outputText value="id"/></f:facet>
<h:outputText value="#{item.id}" />
</p:column>
<p:column sortBy="#{item.nome}" styleClass="column" >
<f:facet name="header"><h:outputText value="nome"/></f:facet>
<h:outputText value="#{item.nome}" />
</p:column>
<p:column rendered="false" styleClass="column_perc" >
<f:facet name="header"><h:outputText value="%"/></f:facet>
<h:outputText value="#{item.percCamposPreenchidos}" />
</p:column>
<p:column rendered="#{!agtemplateTb_templateBean.consultar}" styleClass="column_clonar" style="text-align: center">
<f:facet name="header"><h:outputText value="Clonar"/></f:facet>
<p:commandButton title="Clonar" process="@this" action="#{agtemplateTb_templateBean.clickClonar()}" update="@([id$=modalAgtemplateTb_templateCU])" oncomplete="PF('wvModalAgtemplateTb_templateCU').show();" styleClass="consulta_bt_clonar" icon="ui-icon-copy" >
<f:setPropertyActionListener target="#{agtemplateTb_templateBean.tb_template}" value="#{item}" />
</p:commandButton>
</p:column>
<p:column rendered="#{!agtemplateTb_templateBean.consultar}" styleClass="column_selecionar" style="text-align: center">
<f:facet name="header"><h:outputText value="Selecionar"/></f:facet>
<p:commandButton title="Selecionar" process="@this" action="#{agtemplateTb_templateBean.clickSelecionar()}" update="@([id$=modalAgtemplateTb_templateR])" oncomplete="PF('wvModalAgtemplateTb_templateR').show();" styleClass="consulta_bt_selecionar" icon="ui-icon-zoomin" >
<f:setPropertyActionListener target="#{agtemplateTb_templateBean.tb_template}" value="#{item}" />
</p:commandButton>
</p:column>
<p:column rendered="#{!agtemplateTb_templateBean.consultar}" styleClass="column_alterar" style="text-align: center">
<f:facet name="header"><h:outputText value="Alterar"/></f:facet>
<p:commandButton title="Alterar" process="@this" action="#{agtemplateTb_templateBean.clickAlterar()}" update="@([id$=modalAgtemplateTb_templateCU])" oncomplete="PF('wvModalAgtemplateTb_templateCU').show();" styleClass="consulta_bt_alterar" icon="ui-icon-pencil" >
<f:setPropertyActionListener target="#{agtemplateTb_templateBean.tb_template}" value="#{item}" />
</p:commandButton>
</p:column>
<p:column rendered="#{!agtemplateTb_templateBean.consultar}" styleClass="column_excluir" style="text-align: center">
<f:facet name="header"><h:outputText value="Excluir"/></f:facet>
<p:commandButton title="Excluir" process="@this" action="#{agtemplateTb_templateBean.clickDeletar()}" update="@([id$=modalAgtemplateTb_templateD])" oncomplete="PF('wvModalAgtemplateTb_templateD').show();" styleClass="consula_bt_excluir" icon="ui-icon-trash" >
<f:setPropertyActionListener target="#{agtemplateTb_templateBean.tb_template}" value="#{item}" />
</p:commandButton>
</p:column>
<p:column rendered="#{agtemplateTb_templateBean.consultar}" styleClass="column_consultar" style="text-align: center">
<f:facet name="header"><h:outputText value="ADD"/></f:facet>
</p:column>
</p:dataTable>
</ui:composition>

View File

@ -0,0 +1,79 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:jsf="http://xmlns.jcp.org/jsf" >
<p:dataTable sortMode="multiple" binding="#{agtemplateTb_templateBean.dataTable}" reflow="true" rendered="#{agtemplateTb_templateBean.achouPesquisa}" var="item" paginator="true" value="#{agtemplateTb_templateBean.model}" lazy="true" rows="#{agtemplateTb_templateBean.tb_templateFiltro.quantidadeRegitros}" rowStyleClass="dataTableRowClass1,dataTableRowClass2" styleClass="dataTableStyleClass"
currentPageReportTemplate="[ Exibindo de {startRecord} a {endRecord} no total de {totalRecords} - Página: {currentPage}/{totalPages} ]"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="5,10,15" paginatorPosition="bottom" id="dataTableAgtemplateTb_templateLazy" selection="#{agtemplateTb_templateBean.selectedTb_template}" rowSelectMode="add" >
<p:ajax ignoreComponentNotFound="true" event="rowToggle" listener="#{agtemplateTb_templateBean.onRowToggle}" rendered="false" />
<p:ajax ignoreComponentNotFound="true" event="rowSelect" update="@([id$=deleteAgtemplateTb_templateButton])" />
<p:ajax ignoreComponentNotFound="true" event="rowUnselect" update="@([id$=deleteAgtemplateTb_templateButton])" />
<p:ajax ignoreComponentNotFound="true" event="rowSelectCheckbox" update="@([id$=deleteAgtemplateTb_templateButton])" />
<p:ajax ignoreComponentNotFound="true" event="rowUnselectCheckbox" update="@([id$=deleteAgtemplateTb_templateButton])" />
<p:ajax ignoreComponentNotFound="true" event="toggleSelect" update="@([id$=deleteAgtemplateTb_templateButton])" />
<f:facet name="header">
<div class="flex justify-content-between align-items-center">
<div>
<p:commandButton id="toggler" type="button" value="Colunas" icon="pi pi-align-justify"/>
<p:columnToggler datasource="dataTableAgtemplateTb_templateLazy" trigger="toggler">
<p:ajax />
</p:columnToggler>
</div>
</div>
</f:facet>
<p:column toggleable="false" exportable="false" rendered="#{agtemplateTb_templateBean.paginaTb_template}" selectionMode="multiple" ></p:column>
<p:column sortBy="#{item.id}" styleClass="columnInteiro" >
<f:facet name="header"><h:outputText value="id"/></f:facet>
<h:outputText value="#{item.id}" />
</p:column>
<p:column sortBy="#{item.nome}" styleClass="column" >
<f:facet name="header"><h:outputText value="nome"/></f:facet>
<h:outputText value="#{item.nome}" />
</p:column>
<p:column toggleable="false" exportable="false" rendered="#{!agtemplateTb_templateBean.consultar}" styleClass="column_clonar" style="text-align: center">
<f:facet name="header"><h:outputText value="Menu"/></f:facet>
<h:panelGroup layout="block" rendered="#{!agtemplateTb_templateBean.menuDataTableDynamic}" >
<p:commandButton rendered="#{!agtemplateTb_templateBean.consultar}" title="Clonar" process="@this" action="#{agtemplateTb_templateBean.clickClonar(item)}" update="@([id$=modalAgtemplateTb_templateCU])" oncomplete="PF('wvModalAgtemplateTb_templateCU').show();" styleClass="consulta_bt_clonar rounded-button ui-button-secondary mr-2" icon="pi pi-copy" >
<p:resetInput target="modalAgtemplateTb_templateCU"/>
</p:commandButton>
<p:commandButton rendered="#{!agtemplateTb_templateBean.consultar}" title="Selecionar" process="@this" action="#{agtemplateTb_templateBean.clickSelecionar(item)}" update="@([id$=modalAgtemplateTb_templateR])" oncomplete="PF('wvModalAgtemplateTb_templateR').show();" styleClass="consulta_bt_selecionar rounded-button ui-button-success mr-2" icon="pi pi-search-plus" >
<p:resetInput target="modalAgtemplateTb_templateR"/>
</p:commandButton>
<p:commandButton rendered="#{!agtemplateTb_templateBean.consultar}" title="Alterar" process="@this" action="#{agtemplateTb_templateBean.clickAlterar(item)}" update="@([id$=modalAgtemplateTb_templateCU])" oncomplete="PF('wvModalAgtemplateTb_templateCU').show();" styleClass="consulta_bt_alterar rounded-button ui-button-warning mr-2" icon="pi pi-pencil" >
<p:resetInput target="modalAgtemplateTb_templateCU"/>
</p:commandButton>
<p:commandButton rendered="#{!agtemplateTb_templateBean.consultar}" title="Excluir" process="@this" action="#{agtemplateTb_templateBean.clickDeletar(item)}" update="@([id$=modalAgtemplateTb_templateD])" oncomplete="PF('wvModalAgtemplateTb_templateD').show();" styleClass="consula_bt_excluir rounded-button ui-button-danger mr-2" icon="pi pi-trash" >
<p:resetInput target="modalAgtemplateTb_templateD"/>
</p:commandButton>
</h:panelGroup>
<h:panelGroup layout="block" rendered="#{agtemplateTb_templateBean.menuDataTableDynamic}" >
<p:commandButton id="dynaButton" type="button" icon="pi pi-bars"/>
<p:menu overlay="true" trigger="dynaButton" my="left top" at="left bottom">
<p:menuitem value="Clonar" title="Clonar" process="@this" action="#{agtemplateTb_templateBean.clickClonar(item)}" update="@([id$=modalAgtemplateTb_templateCU])" oncomplete="PF('wvModalAgtemplateTb_templateCU').show();" styleClass="consulta_bt_clonar" icon="pi pi-copy" >
<p:resetInput target="modalAgtemplateTb_templateCU"/>
</p:menuitem>
<p:menuitem value="Selecionar" title="Selecionar" process="@this" action="#{agtemplateTb_templateBean.clickSelecionar(item)}" update="@([id$=modalAgtemplateTb_templateR])" oncomplete="PF('wvModalAgtemplateTb_templateR').show();" styleClass="consulta_bt_selecionar" icon="pi pi-search-plus" >
<p:resetInput target="modalAgtemplateTb_templateR"/>
</p:menuitem>
<p:menuitem value="Alterar" title="Alterar" process="@this" action="#{agtemplateTb_templateBean.clickAlterar(item)}" update="@([id$=modalAgtemplateTb_templateCU])" oncomplete="PF('wvModalAgtemplateTb_templateCU').show();" styleClass="consulta_bt_alterar" icon="pi pi-pencil" >
<p:resetInput target="modalAgtemplateTb_templateCU"/>
</p:menuitem>
<p:menuitem value="Excluir" title="Excluir" process="@this" action="#{agtemplateTb_templateBean.clickDeletar(item)}" update="@([id$=modalAgtemplateTb_templateD])" oncomplete="PF('wvModalAgtemplateTb_templateD').show();" styleClass="consula_bt_excluir" icon="pi pi-trash" >
<p:resetInput target="modalAgtemplateTb_templateD"/>
</p:menuitem>
</p:menu>
</h:panelGroup>
</p:column>
<p:column exportable="false" rendered="#{agtemplateTb_templateBean.consultar}" styleClass="column_consultar" style="text-align: center">
</p:column>
</p:dataTable>
</ui:composition>

View File

@ -0,0 +1,21 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:jsf="http://xmlns.jcp.org/jsf" >
<h:outputText value="Deseja remover o(a):" styleClass="titulo_mensagem_delete" />
<p:panelGrid layout="grid" contentStyleClass="ui-fluid" columns="1" styleClass="regiao_mensagem_delete" >
<h:panelGroup>
<h:outputText styleClass="label" value="id:" /><br/>
<h:outputText styleClass="valor" value="#{agtemplateTb_templateBean.tb_template.id}" />
</h:panelGroup>
<h:panelGroup>
<h:outputText styleClass="label" value="nome:" /><br/>
<h:outputText styleClass="valor" value="#{agtemplateTb_templateBean.tb_template.nome}" />
</h:panelGroup>
</p:panelGrid>
</ui:composition>

View File

@ -0,0 +1,22 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:fw="http://xmlns.jcp.org/jsf/composite/framework"
xmlns:jsf="http://xmlns.jcp.org/jsf" >
<p:panelGrid layout="grid" contentStyleClass="ui-fluid" columns="1" styleClass="panelGridStyleClass" >
<fw:panelGroup required="false" idInput="agtemplate_tb_template_idFiltro" label="id" >
<p:inputNumber emptyValue="always" id="agtemplate_tb_template_idFiltro" value="#{agtemplateTb_templateBean.tb_templateFiltro.id}" required="false" requiredMessage="id requerido(a)." styleClass="inputText" />
</fw:panelGroup>
<fw:panelGroup required="false" idInput="agtemplate_tb_template_nomeFiltro" label="nome" >
<p:inputText id="agtemplate_tb_template_nomeFiltro" value="#{agtemplateTb_templateBean.tb_templateFiltro.nome}" required="false" requiredMessage="nome requerido(a)." maxlength="255" styleClass="inputText" />
</fw:panelGroup>
</p:panelGrid>
</ui:composition>

View File

@ -0,0 +1,20 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:jsf="http://xmlns.jcp.org/jsf" >
<p:panelGrid layout="grid" contentStyleClass="ui-fluid" columns="1" styleClass="panelGridStyleClass" >
<h:panelGroup>
<h:outputText styleClass="label" value="id:" /><br/>
<h:outputText styleClass="valor" value="#{agtemplateTb_templateBean.tb_template.id}" />
</h:panelGroup>
<h:panelGroup>
<h:outputText styleClass="label" value="nome:" /><br/>
<h:outputText styleClass="valor" value="#{agtemplateTb_templateBean.tb_template.nome}" />
</h:panelGroup>
</p:panelGrid>
</ui:composition>

View File

@ -0,0 +1,19 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:jsf="http://xmlns.jcp.org/jsf">
<p:dialog width="80%" onShow="window.scrollTo(0,0)" dynamic="true" fitViewport="true" blockScroll="true" positionType="absolute" closeOnEscape="true" responsive="true" modal="true" widgetVar="wvModalAgtemplateTb_templateCU" showEffect="fade" hideEffect="fade" header="#{agtemplateTb_templateBean.tituloModal}" closable="true" maximizable="true" styleClass="modalPanelStyleClass"
minHeight="#{agtemplateTb_templateBean.alturaModal}" minWidth="#{agtemplateTb_templateBean.larguraModal}" id="modalAgtemplateTb_templateCU" >
<h:panelGroup layout="block" styleClass="rolagem" id="panelModalModalAgtemplateTb_templateCU" >
<ui:include src="../../crud/Tb_template/Tb_templateCU.xhtml" />
</h:panelGroup>
<f:facet name="footer">
<p:commandButton update="panel_formulario,panelAlerta,panelModalModalAgtemplateTb_templateCU" action="#{agtemplateTb_templateBean.clickSalvar()}" icon="pi pi-check" value="Salvar" styleClass="menu_ul_li_bt_inserir" process="modalAgtemplateTb_templateCU" />
<p:commandButton action="#{agtemplateTb_templateBean.clickCancelar()}" icon="pi pi-times" onclick="PF('wvModalAgtemplateTb_templateCU').hide();" value="Cancelar" styleClass="menu_ul_li_bt_cancelar" process="@this" class="ui-button-secondary" />
</f:facet>
</p:dialog>
</ui:composition>

View File

@ -0,0 +1,16 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:jsf="http://xmlns.jcp.org/jsf">
<p:dialog width="80%" onShow="window.scrollTo(0,0)" dynamic="true" fitViewport="true" blockScroll="true" positionType="absolute" closeOnEscape="true" responsive="true" modal="true" widgetVar="wvModalAgtemplateTb_templateD" showEffect="fade" hideEffect="fade" header="#{agtemplateTb_templateBean.tituloModal}" closable="true" maximizable="true" styleClass="modalPanelStyleClass"
minHeight="#{agtemplateTb_templateBean.alturaModal}" minWidth="#{agtemplateTb_templateBean.larguraModal}" id="modalAgtemplateTb_templateD" >
<ui:include rendered="#{agtemplateTb_templateBean.deletar}" src="../../crud/Tb_template/Tb_templateD.xhtml" />
<f:facet name="footer">
<p:commandButton process="@this" update="form_formulario, panelAlerta" action="#{agtemplateTb_templateBean.clickDelete()}" oncomplete="PF('wvModalAgtemplateTb_templateD').hide();" value="Sim" styleClass="menu_ul_li_bt_sim" icon="pi pi-check" />
<p:commandButton process="@this" onclick="PF('wvModalAgtemplateTb_templateD').hide();" value="Não" styleClass="menu_ul_li_bt_nao" icon="pi pi-times" class="ui-button-secondary" />
</f:facet></p:dialog>
</ui:composition>

View File

@ -0,0 +1,22 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:jsf="http://xmlns.jcp.org/jsf">
<p:dialog width="80%" onShow="window.scrollTo(0,0)" dynamic="true" fitViewport="true" blockScroll="true" positionType="absolute" closeOnEscape="true" responsive="true" modal="true" widgetVar="wvModalAgtemplateTb_templateFiltro" showEffect="fade" hideEffect="fade" header="Filtrar #{agtemplateTb_templateBean.tituloModal}" closable="true" maximizable="true" styleClass="modalPanelStyleClass"
minHeight="#{agtemplateTb_templateBean.alturaModal}" minWidth="#{agtemplateTb_templateBean.larguraModal}" id="modalAgtemplateTb_templateFiltro" >
<h:panelGroup layout="block" styleClass="rolagem" id="panelModalAgtemplateTb_templateFiltro" >
<ui:include src="../../crud/Tb_template/Tb_templateFiltro.xhtml" />
</h:panelGroup>
<f:facet name="footer">
<p:commandButton update="form_formulario,messages" action="#{agtemplateTb_templateBean.clickPesquisarByFiltro()}" oncomplete="PF('wvModalAgtemplateTb_templateFiltro').hide();" icon="pi pi-search" value="Filtrar" styleClass="menu_ul_li_bt_filtrar" process="modalAgtemplateTb_templateFiltro" />
<p:commandButton action="#{agtemplateTb_templateBean.clickLimparFiltro()}" rendered="false" icon="pi pi-refresh" value="Limpar" styleClass="menu_ul_li_bt_limpar" process="@this" class="ui-button-warning" >
<p:ajax update="panelModalAgtemplateTb_templateFiltro" resetValues="true" />
</p:commandButton>
<p:commandButton icon="pi pi-times" onclick="PF('wvModalAgtemplateTb_templateFiltro').hide();" value="Fechar" styleClass="menu_ul_li_bt_fechar" process="@this" class="ui-button-secondary" />
</f:facet>
</p:dialog>
</ui:composition>

View File

@ -0,0 +1,26 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:jsf="http://xmlns.jcp.org/jsf">
<p:dialog width="80%" onShow="window.scrollTo(0,0)" dynamic="true" fitViewport="true" blockScroll="true" positionType="absolute" closeOnEscape="true" responsive="true" modal="true" id="modalPesquisaAgtemplateTb_template" widgetVar="wvModalPesquisaAgtemplateTb_template" showEffect="fade" hideEffect="fade" header="#{agtemplateTb_templateBean.tituloModal}" closable="true" maximizable="true" styleClass="modalPanelStyleClass" >
<p:menubar>
<p:menuitem rendered="false" process="@this" update="@([id$=modalAgtemplateTb_templateCU])" action="#{agtemplateTb_templateBean.clickNovo()}" oncomplete="PF('wvModalAgtemplateTb_templateCU').show();" value="Novo" icon="pi pi-plus" />
<f:facet name="options">
<h:panelGroup id="pesquisaModalAgtemplateTb_templateOptions">
<p:inputText onkeypress="if (event.keyCode == 13) {jQuery('#btPesquisaPanelPesquisaAgtemplateTb_template').trigger('click'); return false;}" style="margin-right:10px" id="pesquisaPanelPesquisaAgtemplateTb_template" title="Informar parametros de pesquisa" styleClass="pesquisa" value="#{agtemplateTb_templateBean.pesquisa}" >
<p:hotkey bind="return" handler="btPesquisaPanelPesquisaAgtemplateTb_template.click();"/>
</p:inputText>
<p:commandButton id="btPesquisaPanelPesquisaAgtemplateTb_template" update="panelPesquisaAgtemplateTb_template" styleClass="bt_pesquisa" action="#{agtemplateTb_templateBean.clickPesquisar()}" icon="pi pi-search" process="pesquisaModalAgtemplateTb_templateOptions"/>
</h:panelGroup>
</f:facet>
</p:menubar>
<h:panelGroup id="panelPesquisaAgtemplateTb_template" >
<p:messages />
<ui:include src="../../crud/Tb_template/Tb_templateConsultLazy.xhtml" />
</h:panelGroup>
</p:dialog>
</ui:composition>

View File

@ -0,0 +1,17 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:jsf="http://xmlns.jcp.org/jsf">
<p:dialog width="80%" onShow="window.scrollTo(0,0)" dynamic="true" fitViewport="true" blockScroll="true" positionType="absolute" closeOnEscape="true" responsive="true" modal="true" widgetVar="wvModalAgtemplateTb_templateR" showEffect="fade" hideEffect="fade" header="#{agtemplateTb_templateBean.tituloModal}" closable="true" maximizable="true" styleClass="modalPanelStyleClass"
minHeight="#{agtemplateTb_templateBean.alturaModal}" minWidth="#{agtemplateTb_templateBean.larguraModal}" id="modalAgtemplateTb_templateR" >
<h:panelGroup layout="block" styleClass="rolagem" >
<ui:include src="../../crud/Tb_template/Tb_templateR.xhtml" />
</h:panelGroup>
<f:facet name="footer">
<p:commandButton icon="pi pi-times" onclick="PF('wvModalAgtemplateTb_templateR').hide();" value="Fechar" styleClass="menu_ul_li_bt_fechar" process="@this" />
</f:facet></p:dialog>
</ui:composition>

View File

@ -0,0 +1,18 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:jsf="http://xmlns.jcp.org/jsf"
template="../template/template.xhtml" >
<ui:define name="HEAD_TITULO_PAGINA">HOME</ui:define>
<ui:define name="TITULO_PAGINA"><p:menuitem value="agtemplate" url="#" /></ui:define>
<ui:define name="CAMINHO_PAGINA">agtemplate</ui:define>
<ui:define name="MENU_PAGINA">
</ui:define>
<ui:define name="FORMULARIO"></ui:define>
<ui:define name="LIVRE">
</ui:define>
</ui:composition>

View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8" ?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Tb_template" language="groovy" pageWidth="555" pageHeight="802" whenNoDataType="NoDataSection" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="da6f7cff-86dc-4624-b468-4a1cd82ee44f">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="EXE_EXERCICIO" class="java.lang.Integer"/>
<parameter name="MUN_CODIGO" class="java.lang.Integer"/>
<queryString>
<![CDATA[select id,nome from agtemplate.tb_template where 1 = 1]]>
</queryString>
<field name="id" class="java.lang.Integer"/>
<field name="nome" class="java.lang.String"/>
<columnHeader>
<band height="31">
<staticText>
<reportElement positionType="Float" mode="Opaque" x="0" y="0" width="555" height="30" backcolor="#E9E9E9" uuid="c2b3210b-4a3f-44c0-8c99-55f096af817e" />
<box leftPadding="10">
<bottomPen lineWidth="1.0"/>
</box>
<textElement verticalAlignment="Middle" lineSpacing="Single">
<font fontName="Arial" size="14" isBold="true" pdfFontName="Helvetica-Bold"/>
<paragraph lineSpacing="Single"/>
</textElement>
<text><![CDATA[tb_template]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="60" splitType="Stretch">
<staticText>
<reportElement positionType="Float" x="0" y="0" width="555" height="20" uuid="7982a95f-71fe-48ee-acfc-4194dacb7427"/>
<box leftPadding="10">
<topPen lineWidth="1.0" lineStyle="Double"/>
<bottomPen lineWidth="1.0" lineStyle="Double"/>
</box>
<textElement verticalAlignment="Middle">
<font fontName="Arial" size="12" isBold="true" isUnderline="false" pdfFontName="Helvetica-Bold"/>
<paragraph lineSpacing="Single"/>
</textElement>
<text><![CDATA[id]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="0" y="20" width="555" height="10" uuid="cd7676af-3d49-41c9-bf77-919a812f8597"/>
<box topPadding="10" bottomPadding="10"/>
<textElement textAlignment="Justified" verticalAlignment="Top">
<font fontName="Arial"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$F{id}]]></textFieldExpression>
</textField>
<staticText>
<reportElement positionType="Float" x="0" y="30" width="555" height="20" uuid="bf977995-9fe7-43d4-bb77-13a8ca3f6720"/>
<box leftPadding="10">
<topPen lineWidth="1.0" lineStyle="Double"/>
<bottomPen lineWidth="1.0" lineStyle="Double"/>
</box>
<textElement verticalAlignment="Middle">
<font fontName="Arial" size="12" isBold="true" isUnderline="false" pdfFontName="Helvetica-Bold"/>
<paragraph lineSpacing="Single"/>
</textElement>
<text><![CDATA[nome]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="0" y="50" width="555" height="10" uuid="15ba1b89-0821-48fa-8e39-b48ba7f6852a"/>
<box topPadding="10" bottomPadding="10"/>
<textElement textAlignment="Justified" verticalAlignment="Top">
<font fontName="Arial"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$F{nome}]]></textFieldExpression>
</textField>
</band>
</detail>
<noData>
<band height="68">
<staticText>
<reportElement positionType="Float" mode="Opaque" x="0" y="30" width="555" height="38"/>
<textElement textAlignment="Center" verticalAlignment="Middle" lineSpacing="Single">
<font fontName="Arial" size="12" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<text><![CDATA[NENHUM REGISTO ENCONTRADO]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" mode="Opaque" x="0" y="0" width="555" height="30" backcolor="#E9E9E9" uuid="89c4ff5b-4350-49d1-a220-b67c9decc1b6" />
<box leftPadding="10">
<bottomPen lineWidth="1.0"/>
</box>
<textElement verticalAlignment="Middle" lineSpacing="Single">
<font fontName="Arial" size="14" isBold="true" pdfFontName="Helvetica-Bold"/>
<paragraph lineSpacing="Single"/>
</textElement>
<text><![CDATA[tb_template]]></text>
</staticText>
</band>
</noData>
</jasperReport>

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8" ?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="agtemplate" language="groovy" pageWidth="595" pageHeight="842" whenNoDataType="NoDataSection" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="5ae21a78-b224-4868-864e-72b5abec8255">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="EXE_EXERCICIO" class="java.lang.Integer"/>
<parameter name="MUN_CODIGO" class="java.lang.Integer"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["/"]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[select 1 as linha]]>
</queryString>
<field name="linha" class="java.lang.Integer"/>
<pageHeader>
<band height="128">
<subreport>
<reportElement x="0" y="0" width="555" height="90" uuid="5a529817-d567-4551-b747-6061a45483da"/>
<subreportParameter name="MUN_CODIGO">
<subreportParameterExpression><![CDATA[$P{MUN_CODIGO}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "CABECALHO.jasper"]]></subreportExpression>
</subreport>
<staticText>
<reportElement positionType="Float" mode="Opaque" x="0" y="90" width="555" height="38" uuid="69991a78-af4b-411f-9a2b-30ba447f6b28"/>
<textElement verticalAlignment="Middle">
<font fontName="Arial" size="15" isBold="true" pdfFontName="Helvetica-Bold"/>
<paragraph lineSpacing="Single"/>
</textElement>
<text><![CDATA[AGTEMPLATE]]></text>
</staticText>
<textField>
<reportElement x="375" y="90" width="180" height="38" uuid="42155e48-a9ea-4abb-bfcd-2a58c3f5ae61"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="Arial" size="15" isBold="true" pdfFontName="Helvetica-Bold"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$P{EXE_EXERCICIO}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<detail>
<band height="10" >
<subreport>
<reportElement positionType="Float" isPrintRepeatedValues="false" x="0" y="0" width="555" height="10" uuid="7f1abc89-855e-4791-bc06-9377eb1ef639"/>
<subreportParameter name="EXE_EXERCICIO">
<subreportParameterExpression><![CDATA[$P{EXE_EXERCICIO}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="MUN_CODIGO">
<subreportParameterExpression><![CDATA[$P{MUN_CODIGO}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "Tb_template.jasper"]]></subreportExpression>
</subreport>
</band>
</detail>
<pageFooter>
<band height="20">
<textField>
<reportElement x="439" y="0" width="80" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle" lineSpacing="Single">
<font fontName="Arial"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["Página "+$V{PAGE_NUMBER}+" de"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="519" y="0" width="40" height="20"/>
<textElement verticalAlignment="Middle" lineSpacing="Single">
<font fontName="Arial"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<noData>
<band height="38">
<staticText>
<reportElement positionType="Float" mode="Opaque" x="0" y="0" width="555" height="38"/>
<textElement textAlignment="Center" verticalAlignment="Middle" lineSpacing="Single">
<font fontName="Arial" size="15" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<text><![CDATA[NENHUM REGISTO ENCONTRADO]]></text>
</staticText>
</band>
</noData>
</jasperReport>

View File

@ -0,0 +1,11 @@
<?xml version='1.0' encoding='UTF-8' ?>
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<p:submenu icon="pi pi-chevron-down" label="agtemplate">
<p:menuitem value="tb_template" onclick="location.href='${request.contextPath}/agtemplate/Tb_template.xhtml'" immediate="true" styleClass="menuItem_styleClass" />
</p:submenu>
</ui:composition>

View File

@ -0,0 +1,38 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:jsf="http://xmlns.jcp.org/jsf">
<f:view>
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>AGTEMPLATE / <ui:insert name="HEAD_TITULO_PAGINA"></ui:insert></title>
<ui:insert name="HEAD_PAGINA"></ui:insert>
</h:head>
<h:body id="body_agtemplate">
<h:form id="form_geral">
<p:menubar>
<ui:include src="./menu.xhtml" />
</p:menubar>
<ui:insert name="TITULO_PAGINA"></ui:insert>
<ui:insert name="SISTEMA_PAGINA"></ui:insert>
<ui:insert name="CAMINHO_PAGINA"></ui:insert>
<ui:insert name="MENU_PAGINA"></ui:insert>
<p:messages id="messages" showSummary="true" closable="true" />
<h:panelGroup id="form_formulario" layout="block" >
<ui:insert name="FORMULARIO"></ui:insert>
</h:panelGroup>
<ui:insert name="LIVRE">
</ui:insert>
<p:confirmDialog message="Deseja Excluir?">
<p:commandButton value="SIM" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check"/>
<p:commandButton value="NÃO" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close"/>
</p:confirmDialog>
<p:growl id="panelAlerta" life="5000" showSummary="true" />
</h:form>
</h:body>
</f:view>
</html>

View File

@ -0,0 +1,14 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:jsf="http://xmlns.jcp.org/jsf"
template="./template/template.xhtml" >
<ui:define name="HEAD_TITULO_PAGINA">AgTemplate</ui:define>
<ui:define name="TITULO_PAGINA"></ui:define>
<ui:define name="CAMINHO_PAGINA">AgTemplate</ui:define>
<ui:define name="FORMULARIO"></ui:define>
</ui:composition>

View File

@ -0,0 +1,16 @@
@import '../../sass/mixins/_mixins';
@import './pages/_common';
@import './pages/_crud';
@import './pages/_documentation';
@import './pages/_icons';
@import './pages/_list';
@import './pages/_messages';
@import './pages/_misc';
@import './pages/_table';
@import './pages/_dashboard';
@import './pages/_chronoline';
@import './pages/_floatlabel';
@import './pages/_syntax';
@import './pages/_blocks';
@import './_rightpanel';
@import './_topbar';

View File

@ -0,0 +1,74 @@
.layout-rightpanel {
.rightpanel-wrapper {
.section-tasks {
h5 {
margin:30px 20px 10px;
color: $textColor;
opacity: .8;
}
> ul {
padding: 30px 0;
margin: 0;
list-style-type: none;
> li {
@include flex();
padding: 8px 24px;
margin: 0 0 4px;
.ui-selectbooleancheckbox {
width: 32px;
height: 32px;
.ui-chkbox-box {
width: 32px;
height: 32px;
@include border-radius(50%);
&.ui-state-active {
color: $textColor;
background-color: transparent;
border-color: transparent;
&.ui-state-hover {
border-color: #D9DEE6;
}
}
}
}
.task {
margin-left: 12px;
h6 {
margin: 0;
color: $textColor;
}
span {
display: block;
font-size: 12px;
color: $textColor;
opacity: 0.5;
}
&.done {
h6 {
text-decoration: line-through;
}
}
}
}
}
}
hr {
border: none;
background-image: linear-gradient(to right, $dividerColor, $contentBgColor 100%);
height: 1px;
margin: 0;
margin-left: 20px;
}
}
}

View File

@ -0,0 +1,48 @@
.layout-topbar{
.layout-topbar-wrapper {
.layout-topbar-right {
.layout-topbar-actions {
> li {
&.notifications, &.settings {
> ul {
> li {
&:nth-child(2){
> a{
> i {
background-color: rgba(#2f8ee5,0.2) ;
color: #2f8ee5;
}
}
}
&:nth-child(3){
> a{
> i {
background-color: rgba(#02acac,0.2) ;
color: #02acac;
}
}
}
&:nth-child(4){
> a{
> i {
background-color: rgba(#f16383,0.2) ;
color: #f16383;
}
}
}
&:nth-child(5){
> a{
> i {
background-color: rgba(#2f8ee5,0.2) ;
color: #2f8ee5;
}
}
}
}
}
}
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,2 @@
@import '../../sass/variables/layout/_layout_dark';
@import './_demo_common';

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,2 @@
@import '../../sass/variables/layout/_layout_dim';
@import './_demo_common';

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,2 @@
@import '../../sass/variables/layout/_layout_light';
@import './_demo_common';

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -0,0 +1,133 @@
.block-section {
margin-bottom: 4rem;
}
.block-header {
padding: 1rem 2rem;
background-color: var(--surface-section);
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border:1px solid var(--surface-d);
display: flex;
align-items: center;
justify-content: space-between;
.block-title {
font-size: 1.25rem;
font-weight: 600;
display: inline-flex;
align-items: center;
.badge-free {
border-radius: 4px;
padding: .25rem .5rem;
background-color: var(--orange-500);
color: white;
margin-left: 1rem;
font-weight: 600;
font-size: .875rem;
}
.badge-new {
border-radius: 4px;
padding: .25rem .5rem;
background-color: var(--green-500);
color: white;
margin-left: 1rem;
font-weight: 600;
font-size: .875rem;
}
}
.block-actions {
display: flex;
align-items: center;
justify-content: space-between;
user-select: none;
a {
display: flex;
align-items: center;
margin-right: .75rem;
padding: .5rem 1rem;
border-radius: 4px;
border: 1px solid transparent;
transition: background-color .2s;
cursor: pointer;
color: var(--text-color);
&:last-child {
margin-right: 0;
}
&:not(.block-action-disabled):hover {
background-color: var(--surface-c);
}
&.block-action-active {
border-color: var(--primary-color);
color: var(--primary-color);
}
&.block-action-copy {
i {
color: var(--primary-color);
font-size: 1.25rem;
}
}
&.block-action-disabled {
opacity: .6;
pointer-events: none;
cursor: auto !important;
}
.pi-lock {
margin-right: .5rem;
}
}
}
}
.block-content {
padding: 0;
border:1px solid var(--surface-d);
border-top: 0 none;
> div {
display: none;
&.block-content-active {
display: block;
}
}
}
.block-section pre[class*="language-"] {
margin: 0 !important;
&:before, &:after {
display: none !important;
}
code {
border-left: 0 none !important;
box-shadow: none !important;
background: var(--surface-e) !important;
margin: 0;
color: var(--text-color);
font-size: 14px;
padding: 1.5rem 2rem !important;
}
}
@media screen and (max-width: 575px) {
.block-header {
flex-direction: column;
align-items: start;
.block-actions {
margin-top: 1rem;
}
}
}

View File

@ -0,0 +1,33 @@
.custom-marker {
display: flex;
width: 2rem;
height: 2rem;
align-items: center;
justify-content: center;
color: #ffffff;
border-radius: 50%;
z-index: 1;
}
.ui-chronoline-event-content,
.ui-chronoline-event-opposite {
line-height: 1;
}
@media screen and (max-width: 960px) {
.customized-chronoline .ui-chronoline-event:nth-child(even) {
flex-direction: row !important;
}
.customized-chronoline .ui-chronoline-event:nth-child(even) .ui-chronoline-event-content {
text-align: left !important;
}
.customized-chronoline .ui-chronoline-event-opposite {
flex: 0;
}
.customized-chronoline .ui-card {
margin-top: 1rem;
}
}

View File

@ -0,0 +1,121 @@
.order-badge {
border-radius: 2px;
padding: .25em .5rem;
text-transform: uppercase;
font-weight: 700;
font-size: 12px;
letter-spacing: .3px;
&.order-delivered {
background: #C8E6C9;
color: #256029;
}
&.order-cancelled {
background: #FFCDD2;
color: #C63737;
}
&.order-pending {
background: #FEEDAF;
color: #8A5340;
}
&.order-returned {
background: #ECCFFF;
color: #694382;
}
}
.product-badge {
border-radius: 2px;
padding: .25em .5rem;
text-transform: uppercase;
font-weight: 700;
font-size: 12px;
letter-spacing: .3px;
&.status-instock {
background: #C8E6C9;
color: #256029;
}
&.status-outofstock {
background: #FFCDD2;
color: #C63737;
}
&.status-lowstock {
background: #FEEDAF;
color: #8A5340;
}
}
.customer-badge {
border-radius: 2px;
padding: .25em .5rem;
text-transform: uppercase;
font-weight: 700;
font-size: 12px;
letter-spacing: .3px;
&.status-qualified {
background: #C8E6C9;
color: #256029;
}
&.status-unqualified {
background: #FFCDD2;
color: #C63737;
}
&.status-negotiation {
background: #FEEDAF;
color: #8A5340;
}
&.status-new {
background: #B3E5FC;
color: #23547B;
}
&.status-renewal {
background: #ECCFFF;
color: #694382;
}
&.status-proposal {
background: #FFD8B2;
color: #805B36;
}
}
.filter-container {
.ui-inputtext {
width: 400px;
}
}
.ui-selection-column {
width: 2rem;
}
@media (max-width: 640px) {
.filter-container {
width: 100%;
margin-top: .5rem;
}
.filter-container .ui-inputtext {
width: 100%;
}
.ui-selection-column {
width: auto;
text-align: center;
.ui-column-title {
display: none !important;
}
}
}

View File

@ -0,0 +1,68 @@
.crud-demo {
.ui-datatable {
margin-top: 1rem;
}
.product-image {
width: 100px;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
}
.ui-dialog .product-image {
width: 250px;
margin: 0 auto 2rem auto;
display: block;
}
.ui-dialog-footer .ui-button {
min-width: 6rem;
}
.ui-datatable .ui-column-filter {
display: none;
}
.products-table-header {
@include flex();
@include flex-align-center();
@include flex-justify-between();
@include flex-wrap(wrap);
}
.edit-button.ui-button {
margin-right: .5rem;
}
.orders-subtable {
padding: 1rem;
}
.products-table {
> .ui-datatable-tablewrapper > table > thead > tr > th:nth-child(2) {
width: 2rem;
}
.ui-rating {
display: inline-block;
}
}
}
@media (max-width: 640px) {
.products-table > .ui-datatable-tablewrapper > table > thead > tr > th:nth-child(2),
.products-table > .ui-datatable-tablewrapper > table > tbody > tr > td:nth-child(2) {
.ui-column-title {
display: none !important;
}
}
.products-buttonbar {
@include flex-direction-column();
> div {
&:last-child {
margin-top: .5rem;
}
}
}
}

View File

@ -0,0 +1,247 @@
.layout-dashboard {
.traffic {
overflow-x: hidden;
> span {
display: block;
margin-top: 2px;
margin-bottom: 12px;
font-size: 13px;
font-weight: 600;
color: $textColor;
}
.traffic-tabs {
margin-top: 28px;
@include flex();
@include flex-align-center();
@include flex-justify-between();
.traffic-tab {
border-radius: 4px;
background-color: $contentAltBgColor;
text-align: center;
padding: 6px 1px 8px;
width: 100%;
margin-right: 5px;
cursor: pointer;
@include transition(background-color $transitionDuration);
&:last-child{
margin: 0;
}
> h6 {
font-weight: bold;
margin: 0;
color: $textColor;
margin-bottom: 10px;
}
> i {
font-size: 24px;
}
> span {
display: block;
font-size: 12px;
color: $textColor;
margin-top: 6px;
}
&:hover {
background-color: rgba($contentAltBgColor, .4);
}
&.traffic-tab-active {
background-color: #1c75c6;
background-color: var(--primary-dark-color,#1c75c6);
> h6,
> span,
i {
color: #ffffff;
}
&:hover {
background-color: #2c84d8;
background-color: var(--primary-color,#2c84d8)
}
}
}
}
.traffic-chart {
@include flex();
@include flex-justify-center();
}
}
.goals {
overflow-x: hidden;
background-image: linear-gradient(134deg, #2873D3, #2873D3 99%);
background-image: linear-gradient(134deg, var(--primary-color,#2873D3), var(--primary-dark-color,#2873D3) 99%);
.card-header {
padding: 0;
> h6 {
color: #ffffff;
color: var(--primary-color-text,#ffffff);
}
> span {
color: #ffffff;
color: var(--primary-color-text,#ffffff);
font-size: 11px;
display: block;
> span {
font-size: 14px;
font-weight: 600;
}
}
}
> span {
color: #ffffff;
color: var(--primary-color-text,#ffffff);
opacity: 0.8;
font-size: 12px;
font-weight: 600;
display: block;
}
.goal-graph {
@include flex();
@include flex-justify-center();
padding: 24px 0;
> img {
width: 100%;
max-width: 240px;
height: auto;
}
}
}
.leaderboard {
height: 100%;
> ul {
margin: 0;
padding: 0;
list-style-type: none;
> li {
@include flex();
@include flex-align-center();
@include flex-justify-between();
margin-top: 6px;
padding: 5px 0;
padding: 6px;
@include border-radius(4px);
cursor: pointer;
&:hover {
background-color: rgba($contentAltBgColor,.7);
}
.person {
@include flex();
@include flex-align-center();
> img {
width: 32px;
height: 32px;
margin-right: 12px;
}
> p {
margin: 0;
color: $textColor;
}
}
.person-numbers {
@include flex();
@include flex-align-center();
> h6 {
margin: 0;
color: $textColor;
font-weight: 600;
margin-right: 12px;
}
> i {
color: #00acac;
}
}
}
}
}
.sales {
.card-header {
margin-bottom: 8px;
}
}
}
.layout-rtl {
.layout-dashboard {
.sale-graph {
.order-tabs {
.order-tab {
&:first-child {
margin-right: 0;
margin-left: 26px;
}
}
}
}
.traffic {
.traffic-tabs {
.traffic-tab {
margin-right: 0px;
margin-left: 5px;
}
}
}
.leaderboard {
> ul {
li {
background-color: $contentBgColor;
cursor: pointer;
.person {
> img {
margin-right: 0px;
margin-left: 12px;
}
}
.person-numbers {
> h6 {
margin-right: 0px;
margin-left: 12px;
}
}
&:hover {
background-color: $contentAltBgColor;
}
}
}
}
.product-list {
> ul {
li {
.product {
> img {
margin-right: 0px;
margin-left: 12px;
}
}
&:hover {
background-color: $contentAltBgColor;
}
}
}
}
}
}

View File

@ -0,0 +1,3 @@
.docs li {
line-height: 1.5;
}

View File

@ -0,0 +1,5 @@
.floatlabel-demo {
.field {
margin-top: 2rem;
}
}

View File

@ -0,0 +1,11 @@
.icons-demo {
.icons-list {
text-align: center;
color: $textSecondaryColor;
}
.icons-list i {
font-size: 1.5rem;
margin-bottom: .5rem;
}
}

View File

@ -0,0 +1,119 @@
.list-demo {
.product-name {
font-size: 1.5rem;
font-weight: 700;
}
.product-description {
margin: 0 0 1rem 0;
}
.product-category-icon {
vertical-align: middle;
margin-right: .5rem;
}
.product-category {
font-weight: 600;
vertical-align: middle;
}
.product-list-item {
@include flex();
@include flex-align-center();
padding: 1rem;
img {
width: 150px;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
margin-right: 2rem;
}
.product-list-detail {
flex: 1 1 0;
-ms-flex: 1 1 0px;
}
.ui-rating {
margin: 0 0 .5rem 0;
}
.product-price {
font-size: 1.5rem;
font-weight: 600;
margin-bottom: .5rem;
align-self: flex-end;
}
.product-list-action {
@include flex();
@include flex-direction-column();
}
.ui-button {
margin-bottom: .5rem;
}
}
.product-grid-item {
border: 1px solid $dividerColor;
.product-grid-item-top,
.product-grid-item-bottom {
@include flex();
@include flex-align-center();
@include flex-justify-between();
}
img {
width: 75%;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
margin: 2rem 0;
}
.product-grid-item-content {
text-align: center;
}
.product-price {
font-size: 1.5rem;
font-weight: 600;
}
}
}
@media screen and (max-width: $phoneBreakpoint) {
.list-demo {
.product-list-item {
@include flex-direction-column();
@include flex-align-center();
img {
width: 75%;
margin: 2rem 0;
}
.product-list-detail {
text-align: center;
}
.product-price {
align-self: center;
}
.product-list-action {
@include flex();
@include flex-direction-column();
}
.product-list-action {
margin-top: 2rem;
@include flex-direction-row();
@include flex-justify-between();
@include flex-align-center();
width: 100%;
}
}
}
}

View File

@ -0,0 +1,9 @@
.messages-demo {
.ui-button.ui-widget {
min-width: 6rem;
}
.field > label {
width: 125px;
}
}

View File

@ -0,0 +1,39 @@
.misc-demo {
.ui-button.ui-widget {
min-width: 6rem;
}
.badges .ui-badge,
.badges .ui-tag {
margin-right: .5rem;
}
.ui-chip.custom-chip {
background: var(--primary-color);
color: var(--primary-color-text);
}
.custom-scrolltop {
width: 2rem;
height: 2rem;
border-radius: 4px;
background-color: var(--primary-color);
}
.custom-scrolltop:hover {
background-color: var(--primary-color);
}
.custom-scrolltop .ui-scrolltop-icon {
font-size: 1rem;
color: var(--primary-color-text);
}
.custom-skeleton {
border: 1px solid var(--surface-d);
border-radius: 4px;
}
.custom-skeleton ul {
list-style: none;
}
}

Some files were not shown because too many files have changed in this diff Show More