Commit c445a628a00dec61edb25e8e8a229d584eb74e62
Exists in
master
Merge branch 'master' of https://github.com/demoiselle/framework.git
Showing
7 changed files
with
49 additions
and
22 deletions
Show diff stats
documentation/reference/pt-BR/paginacao.xml
| @@ -93,10 +93,10 @@ public class PaginationContext { | @@ -93,10 +93,10 @@ public class PaginationContext { | ||
| 93 | @Configuration | 93 | @Configuration |
| 94 | public class PaginationConfig { | 94 | public class PaginationConfig { |
| 95 | 95 | ||
| 96 | - @Key("default_page_size") | 96 | + @Name("default_page_size") |
| 97 | private int defaultPageSize = 10; | 97 | private int defaultPageSize = 10; |
| 98 | 98 | ||
| 99 | - @Key("max_page_links") | 99 | + @Name("max_page_links") |
| 100 | private int maxPageLinks = 5; | 100 | private int maxPageLinks = 5; |
| 101 | }]]></programlisting> | 101 | }]]></programlisting> |
| 102 | 102 |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/interceptor/TransactionalInterceptor.java
| @@ -82,6 +82,7 @@ public class TransactionalInterceptor implements Serializable { | @@ -82,6 +82,7 @@ public class TransactionalInterceptor implements Serializable { | ||
| 82 | 82 | ||
| 83 | try { | 83 | try { |
| 84 | instance = Beans.getReference(TransactionInfo.class); | 84 | instance = Beans.getReference(TransactionInfo.class); |
| 85 | + instance.getCounter(); | ||
| 85 | 86 | ||
| 86 | } catch (ContextNotActiveException cause) { | 87 | } catch (ContextNotActiveException cause) { |
| 87 | instance = new TransactionInfo() { | 88 | instance = new TransactionInfo() { |
impl/core/src/main/java/br/gov/frameworkdemoiselle/security/SecurityException.java
| @@ -57,4 +57,14 @@ public class SecurityException extends DemoiselleException { | @@ -57,4 +57,14 @@ public class SecurityException extends DemoiselleException { | ||
| 57 | public SecurityException(String message) { | 57 | public SecurityException(String message) { |
| 58 | super(message); | 58 | super(message); |
| 59 | } | 59 | } |
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * Constructor with the cause. | ||
| 63 | + * | ||
| 64 | + * @param cause | ||
| 65 | + * exception cause | ||
| 66 | + */ | ||
| 67 | + public SecurityException(Throwable cause) { | ||
| 68 | + super(cause); | ||
| 69 | + } | ||
| 60 | } | 70 | } |
impl/core/src/main/java/br/gov/frameworkdemoiselle/util/Beans.java
| @@ -74,12 +74,11 @@ public final class Beans { | @@ -74,12 +74,11 @@ public final class Beans { | ||
| 74 | return manager; | 74 | return manager; |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | - @SuppressWarnings("unchecked") | ||
| 78 | public static <T> T getReference(final Class<T> beanClass, Annotation... qualifiers) { | 77 | public static <T> T getReference(final Class<T> beanClass, Annotation... qualifiers) { |
| 79 | T instance; | 78 | T instance; |
| 80 | 79 | ||
| 81 | try { | 80 | try { |
| 82 | - instance = (T) getReference(manager.getBeans(beanClass, qualifiers)); | 81 | + instance = (T) getReference(manager.getBeans(beanClass, qualifiers), beanClass); |
| 83 | 82 | ||
| 84 | } catch (NoSuchElementException cause) { | 83 | } catch (NoSuchElementException cause) { |
| 85 | StringBuffer buffer = new StringBuffer(); | 84 | StringBuffer buffer = new StringBuffer(); |
| @@ -97,12 +96,11 @@ public final class Beans { | @@ -97,12 +96,11 @@ public final class Beans { | ||
| 97 | return instance; | 96 | return instance; |
| 98 | } | 97 | } |
| 99 | 98 | ||
| 100 | - @SuppressWarnings("unchecked") | ||
| 101 | public static <T> T getReference(final Class<T> beanClass) { | 99 | public static <T> T getReference(final Class<T> beanClass) { |
| 102 | T instance; | 100 | T instance; |
| 103 | 101 | ||
| 104 | try { | 102 | try { |
| 105 | - instance = (T) getReference(manager.getBeans(beanClass)); | 103 | + instance = (T) getReference(manager.getBeans(beanClass), beanClass); |
| 106 | 104 | ||
| 107 | } catch (NoSuchElementException cause) { | 105 | } catch (NoSuchElementException cause) { |
| 108 | String message = getBundle().getString("bean-not-found", beanClass.getCanonicalName()); | 106 | String message = getBundle().getString("bean-not-found", beanClass.getCanonicalName()); |
| @@ -128,12 +126,17 @@ public final class Beans { | @@ -128,12 +126,17 @@ public final class Beans { | ||
| 128 | } | 126 | } |
| 129 | 127 | ||
| 130 | @SuppressWarnings("unchecked") | 128 | @SuppressWarnings("unchecked") |
| 131 | - private static <T> T getReference(Set<Bean<?>> beans) { | 129 | + private static <T> T getReference(Set<Bean<?>> beans, Class<T> beanClass) { |
| 132 | Bean<?> bean = beans.iterator().next(); | 130 | Bean<?> bean = beans.iterator().next(); |
| 133 | - return (T) manager.getReference(bean, bean.getBeanClass(), manager.createCreationalContext(bean)); | 131 | + return (T) manager.getReference(bean, beanClass == null ? bean.getBeanClass() : beanClass, |
| 132 | + manager.createCreationalContext(bean)); | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + private static <T> T getReference(Set<Bean<?>> beans) { | ||
| 136 | + return getReference(beans, null); | ||
| 134 | } | 137 | } |
| 135 | 138 | ||
| 136 | private static ResourceBundle getBundle() { | 139 | private static ResourceBundle getBundle() { |
| 137 | return ResourceBundleProducer.create("demoiselle-core-bundle", Locale.getDefault()); | 140 | return ResourceBundleProducer.create("demoiselle-core-bundle", Locale.getDefault()); |
| 138 | } | 141 | } |
| 139 | -} | 142 | -} |
| 143 | +} | ||
| 140 | \ No newline at end of file | 144 | \ No newline at end of file |
impl/core/src/test/java/br/gov/frameworkdemoiselle/util/BeansTest.java
| @@ -50,6 +50,7 @@ import javax.enterprise.inject.spi.Bean; | @@ -50,6 +50,7 @@ import javax.enterprise.inject.spi.Bean; | ||
| 50 | import javax.enterprise.inject.spi.BeanManager; | 50 | import javax.enterprise.inject.spi.BeanManager; |
| 51 | 51 | ||
| 52 | import org.easymock.EasyMock; | 52 | import org.easymock.EasyMock; |
| 53 | +import org.junit.Ignore; | ||
| 53 | import org.junit.Test; | 54 | import org.junit.Test; |
| 54 | import org.junit.runner.RunWith; | 55 | import org.junit.runner.RunWith; |
| 55 | import org.powermock.api.easymock.PowerMock; | 56 | import org.powermock.api.easymock.PowerMock; |
| @@ -73,10 +74,9 @@ public class BeansTest { | @@ -73,10 +74,9 @@ public class BeansTest { | ||
| 73 | 74 | ||
| 74 | expect(beanManager.createCreationalContext(EasyMock.anyObject(Contextual.class))).andReturn(null); | 75 | expect(beanManager.createCreationalContext(EasyMock.anyObject(Contextual.class))).andReturn(null); |
| 75 | expect(beanManager.getBeans(EasyMock.anyObject(Class.class))).andReturn(collection); | 76 | expect(beanManager.getBeans(EasyMock.anyObject(Class.class))).andReturn(collection); |
| 76 | - expect(beanManager.getReference(EasyMock.anyObject(Bean.class), EasyMock.anyObject(Class.class), | 77 | + expect( |
| 78 | + beanManager.getReference(EasyMock.anyObject(Bean.class), EasyMock.anyObject(Class.class), | ||
| 77 | EasyMock.anyObject(CreationalContext.class))).andReturn(object); | 79 | EasyMock.anyObject(CreationalContext.class))).andReturn(object); |
| 78 | - | ||
| 79 | - expect(bean.getBeanClass()).andReturn(null); | ||
| 80 | 80 | ||
| 81 | replayAll(beanManager, bean); | 81 | replayAll(beanManager, bean); |
| 82 | 82 | ||
| @@ -103,7 +103,8 @@ public class BeansTest { | @@ -103,7 +103,8 @@ public class BeansTest { | ||
| 103 | expect(bean.getBeanClass()).andReturn(null); | 103 | expect(bean.getBeanClass()).andReturn(null); |
| 104 | expect(beanManager.createCreationalContext(EasyMock.anyObject(Contextual.class))).andReturn(null); | 104 | expect(beanManager.createCreationalContext(EasyMock.anyObject(Contextual.class))).andReturn(null); |
| 105 | expect(beanManager.getBeans("something")).andReturn(collection); | 105 | expect(beanManager.getBeans("something")).andReturn(collection); |
| 106 | - expect(beanManager.getReference(EasyMock.anyObject(Bean.class), EasyMock.anyObject(Class.class), | 106 | + expect( |
| 107 | + beanManager.getReference(EasyMock.anyObject(Bean.class), EasyMock.anyObject(Class.class), | ||
| 107 | EasyMock.anyObject(CreationalContext.class))).andReturn(object); | 108 | EasyMock.anyObject(CreationalContext.class))).andReturn(object); |
| 108 | 109 | ||
| 109 | replayAll(beanManager, bean); | 110 | replayAll(beanManager, bean); |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/SecurityObserver.java
| @@ -61,8 +61,7 @@ public class SecurityObserver implements Serializable { | @@ -61,8 +61,7 @@ public class SecurityObserver implements Serializable { | ||
| 61 | 61 | ||
| 62 | private static final long serialVersionUID = 1L; | 62 | private static final long serialVersionUID = 1L; |
| 63 | 63 | ||
| 64 | - @Inject | ||
| 65 | - private JsfSecurityConfig config; | 64 | + private transient JsfSecurityConfig config; |
| 66 | 65 | ||
| 67 | private transient Map<String, Object> savedParams; | 66 | private transient Map<String, Object> savedParams; |
| 68 | 67 | ||
| @@ -83,11 +82,19 @@ public class SecurityObserver implements Serializable { | @@ -83,11 +82,19 @@ public class SecurityObserver implements Serializable { | ||
| 83 | return this.savedParams; | 82 | return this.savedParams; |
| 84 | } | 83 | } |
| 85 | 84 | ||
| 85 | + public JsfSecurityConfig getConfig() { | ||
| 86 | + if (this.config == null) { | ||
| 87 | + this.config = Beans.getReference(JsfSecurityConfig.class); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + return this.config; | ||
| 91 | + } | ||
| 92 | + | ||
| 86 | private void saveCurrentState() { | 93 | private void saveCurrentState() { |
| 87 | clear(); | 94 | clear(); |
| 88 | FacesContext facesContext = Beans.getReference(FacesContext.class); | 95 | FacesContext facesContext = Beans.getReference(FacesContext.class); |
| 89 | 96 | ||
| 90 | - if (!config.getLoginPage().equals(facesContext.getViewRoot().getViewId())) { | 97 | + if (!getConfig().getLoginPage().equals(facesContext.getViewRoot().getViewId())) { |
| 91 | getSavedParams().putAll(facesContext.getExternalContext().getRequestParameterMap()); | 98 | getSavedParams().putAll(facesContext.getExternalContext().getRequestParameterMap()); |
| 92 | savedViewId = facesContext.getViewRoot().getViewId(); | 99 | savedViewId = facesContext.getViewRoot().getViewId(); |
| 93 | } | 100 | } |
| @@ -97,7 +104,7 @@ public class SecurityObserver implements Serializable { | @@ -97,7 +104,7 @@ public class SecurityObserver implements Serializable { | ||
| 97 | saveCurrentState(); | 104 | saveCurrentState(); |
| 98 | 105 | ||
| 99 | try { | 106 | try { |
| 100 | - Redirector.redirect(config.getLoginPage()); | 107 | + Redirector.redirect(getConfig().getLoginPage()); |
| 101 | 108 | ||
| 102 | } catch (PageNotFoundException cause) { | 109 | } catch (PageNotFoundException cause) { |
| 103 | // TODO Colocar a mensagem no bundle | 110 | // TODO Colocar a mensagem no bundle |
| @@ -116,9 +123,9 @@ public class SecurityObserver implements Serializable { | @@ -116,9 +123,9 @@ public class SecurityObserver implements Serializable { | ||
| 116 | if (savedViewId != null) { | 123 | if (savedViewId != null) { |
| 117 | Redirector.redirect(savedViewId, getSavedParams()); | 124 | Redirector.redirect(savedViewId, getSavedParams()); |
| 118 | 125 | ||
| 119 | - } else if (config.isRedirectEnabled()) { | 126 | + } else if (getConfig().isRedirectEnabled()) { |
| 120 | redirectedFromConfig = true; | 127 | redirectedFromConfig = true; |
| 121 | - Redirector.redirect(config.getRedirectAfterLogin(), getSavedParams()); | 128 | + Redirector.redirect(getConfig().getRedirectAfterLogin(), getSavedParams()); |
| 122 | } | 129 | } |
| 123 | 130 | ||
| 124 | } catch (PageNotFoundException cause) { | 131 | } catch (PageNotFoundException cause) { |
| @@ -140,8 +147,8 @@ public class SecurityObserver implements Serializable { | @@ -140,8 +147,8 @@ public class SecurityObserver implements Serializable { | ||
| 140 | 147 | ||
| 141 | public void onLogoutSuccessful(@Observes final AfterLogoutSuccessful event) { | 148 | public void onLogoutSuccessful(@Observes final AfterLogoutSuccessful event) { |
| 142 | try { | 149 | try { |
| 143 | - if (config.isRedirectEnabled()) { | ||
| 144 | - Redirector.redirect(config.getRedirectAfterLogout()); | 150 | + if (getConfig().isRedirectEnabled()) { |
| 151 | + Redirector.redirect(getConfig().getRedirectAfterLogout()); | ||
| 145 | } | 152 | } |
| 146 | 153 | ||
| 147 | } catch (PageNotFoundException cause) { | 154 | } catch (PageNotFoundException cause) { |
| @@ -165,4 +172,5 @@ public class SecurityObserver implements Serializable { | @@ -165,4 +172,5 @@ public class SecurityObserver implements Serializable { | ||
| 165 | savedViewId = null; | 172 | savedViewId = null; |
| 166 | getSavedParams().clear(); | 173 | getSavedParams().clear(); |
| 167 | } | 174 | } |
| 175 | + | ||
| 168 | } | 176 | } |
site/apt/release-notes.apt
| @@ -38,10 +38,14 @@ | @@ -38,10 +38,14 @@ | ||
| 38 | 38 | ||
| 39 | Notas de Versão | 39 | Notas de Versão |
| 40 | 40 | ||
| 41 | -* v2.3.0 | 41 | +* v2.3.1 |
| 42 | 42 | ||
| 43 | * {{{http://demoiselle.atlassian.net/secure/ReleaseNote.jspa?projectId=10007&version=10101}Notas de Versão no JIRA}} | 43 | * {{{http://demoiselle.atlassian.net/secure/ReleaseNote.jspa?projectId=10007&version=10101}Notas de Versão no JIRA}} |
| 44 | 44 | ||
| 45 | +* {{{../2.3.0/}v2.3.0}} | ||
| 46 | + | ||
| 47 | + * {{{http://demoiselle.atlassian.net/secure/ReleaseNote.jspa?projectId=10007&version=10218}Notas de Versão no JIRA}} | ||
| 48 | + | ||
| 45 | * {{{../2.2.2/}v2.2.2}} | 49 | * {{{../2.2.2/}v2.2.2}} |
| 46 | 50 | ||
| 47 | * {{{http://sourceforge.net/apps/mantisbt/demoiselle/view.php?id=752}0000752}} [Bug] Correção da exceção retornada pelo interceptador de ExceptionHandler. | 51 | * {{{http://sourceforge.net/apps/mantisbt/demoiselle/view.php?id=752}0000752}} [Bug] Correção da exceção retornada pelo interceptador de ExceptionHandler. |