This file contains hidden or 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
final Collection<String> parts = buildUpdateParts( dbObj ); | |
if ( parts.isEmpty() ) { return; } | |
final String query = "UPDATE " + dbObj.getTableName() + " SET " + join( parts, ", " ) + " WHERE id = :id"; | |
simpleJdbcTemplate.update( query, new BeanPropertySqlParameterSource( dbObj ) ); | |
private static final Collection<String> buildUpdateParts( final LocaDbObj dbObj ) { | |
return transform( filter( dbObj.getFieldNames(), not( IS_ID ) ), new BuildPart( dbObj ) ); | |
} | |
private static final class BuildPart implements Function<String, String> { | |
private final LocaDbObj dbObj; | |
public BuildPart( final LocaDbObj dbObj ) { |
This file contains hidden or 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
simpleJdbcTemplate.update( "DELETE FROM " + dbObj.getTableName() + " WHERE id = :id", new BeanPropertySqlParameterSource( dbObj ) ); |
This file contains hidden or 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
// Get Datasource from Spring Context | |
SimpleJdbcInsert jdbcInsert = new SimpleJdbcInsert( dataSource ).withTableName( dbObj.getTableName() ).usingGeneratedKeyColumns( "id" ); | |
final int id = jdbcInsert.executeAndReturnKey( new BeanPropertySqlParameterSource( dbObj ) ).intValue(); | |
dbObj.setId( id ); |
This file contains hidden or 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 static com.google.common.collect.Collections2.filter; | |
import static com.google.common.collect.Collections2.transform; | |
import static org.apache.commons.lang.StringUtils.join; | |
import static org.apache.commons.lang.StringUtils.lowerCase; | |
import static org.apache.commons.lang.StringUtils.splitByCharacterTypeCamelCase; | |
import static org.jvnet.inflector.Noun.pluralOf; | |
import java.util.Collection; | |
import java.util.Map; | |
import java.util.concurrent.ConcurrentHashMap; | |
import java.util.concurrent.ConcurrentMap; |
This file contains hidden or 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 org.apache.commons.lang.builder.EqualsBuilder; | |
import org.apache.commons.lang.builder.HashCodeBuilder; | |
import org.apache.commons.lang.builder.ReflectionToStringBuilder; | |
import org.apache.commons.lang.builder.ToStringStyle; | |
public abstract class AbstractBaseObj { | |
@Override | |
public boolean equals( final Object obj ) { | |
return EqualsBuilder.reflectionEquals( this, obj ); |
This file contains hidden or 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
function addGlobalStyle(css) { | |
var head, style; | |
head = document.getElementsByTagName(‘head’)[0]; | |
if (!head) { return; } | |
style = document.createElement(‘style’); | |
style.type = ‘text/css’; | |
style.innerHTML = css; | |
head.appendChild(style); | |
} |
This file contains hidden or 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
@Component | |
public class Requestor { | |
private static final class ProducerConsumer implements SessionCallback<Message> { | |
private static final int TIMEOUT = 5000; | |
private final String msg; | |
private final DestinationResolver destinationResolver; | |
private final String queue; | |
public ProducerConsumer( final String msg, String queue, final DestinationResolver destinationResolver ) { | |
this.msg = msg; | |
this.queue = queue; |
This file contains hidden or 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
@Component | |
public class Requestor { | |
private static final class CorrelationIdPostProcessor implements MessagePostProcessor { | |
private final String correlationId; | |
public CorrelationIdPostProcessor( final String correlationId ) { | |
this.correlationId = correlationId; | |
} |
This file contains hidden or 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
package com.company; | |
import javax.jms.ExceptionListener; | |
import javax.jms.JMSException; | |
import org.springframework.stereotype.Component; | |
@Component | |
public class JmsExceptionListener implements ExceptionListener | |
{ | |
public void onException( final JMSException e ) | |
{ | |
e.printStackTrace(); |
This file contains hidden or 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
package com.company; | |
import javax.jms.JMSException; | |
import javax.jms.Message; | |
import javax.jms.MessageListener; | |
import javax.jms.TextMessage; | |
import org.springframework.stereotype.Component; | |
@Component | |
public class QueueListener implements MessageListener | |
{ | |
public void onMessage( final Message message ) |