This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from os.path import * | |
import fnmatch | |
import sys | |
import commands | |
def is_success(result): | |
return result[0] == 0 | |
def get_message(result): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class A implements Serializable { | |
private static final long serialVersionUID = 1L; | |
private Long id; | |
private B b; | |
@Id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@OneToOne(optional = true, fetch = FetchType.LAZY) | |
public B getB() { | |
return b; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PrimeFaces.locales['pt'] = { | |
closeText: 'Fechar', | |
prevText: 'Anterior', | |
nextText: 'Próximo', | |
currentText: 'Começo', | |
monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'], | |
monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun', 'Jul','Ago','Set','Out','Nov','Dez'], | |
dayNames: ['Domingo','Segunda','Terça','Quarta','Quinta','Sexta','Sábado'], | |
dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'], | |
dayNamesMin: ['D','S','T','Q','Q','S','S'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<entity-mappings | |
xmlns="http://xmlns.jcp.org/xml/ns/persistence/orm" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/orm_2_2.xsd" | |
version="2.2"> | |
</entity-mappings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Baseado em: https://brightinventions.pl/blog/clear-database-in-spring-boot-tests/ | |
import java.sql.Connection; | |
import java.sql.DatabaseMetaData; | |
import java.sql.ResultSet; | |
import java.sql.SQLException; | |
import java.sql.Statement; | |
import java.util.ArrayList; | |
import java.util.List; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.io.InputStream; | |
import java.nio.charset.Charset; | |
import org.springframework.util.StreamUtils; | |
public class ResourceUtils { | |
public static String getContentFromResource(String resourceName) { | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Referências: | |
// - https://stackoverflow.com/a/53613678 | |
// - https://tomcat.apache.org/tomcat-8.5-doc/config/http.html | |
// - https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto-configure-webserver | |
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; | |
import org.springframework.boot.web.server.WebServerFactoryCustomizer; | |
import org.springframework.stereotype.Component; | |
@Component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import javax.annotation.PostConstruct; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.hateoas.MediaTypes; | |
import org.springframework.http.MediaType; | |
import org.springframework.http.converter.HttpMessageConverter; | |
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; | |
import org.springframework.stereotype.Component; |
OlderNewer