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 | 93 | @Configuration |
| 94 | 94 | public class PaginationConfig { |
| 95 | 95 | |
| 96 | - @Key("default_page_size") | |
| 96 | + @Name("default_page_size") | |
| 97 | 97 | private int defaultPageSize = 10; |
| 98 | 98 | |
| 99 | - @Key("max_page_links") | |
| 99 | + @Name("max_page_links") | |
| 100 | 100 | private int maxPageLinks = 5; |
| 101 | 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 | 82 | |
| 83 | 83 | try { |
| 84 | 84 | instance = Beans.getReference(TransactionInfo.class); |
| 85 | + instance.getCounter(); | |
| 85 | 86 | |
| 86 | 87 | } catch (ContextNotActiveException cause) { |
| 87 | 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 | 57 | public SecurityException(String message) { |
| 58 | 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 | 74 | return manager; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - @SuppressWarnings("unchecked") | |
| 78 | 77 | public static <T> T getReference(final Class<T> beanClass, Annotation... qualifiers) { |
| 79 | 78 | T instance; |
| 80 | 79 | |
| 81 | 80 | try { |
| 82 | - instance = (T) getReference(manager.getBeans(beanClass, qualifiers)); | |
| 81 | + instance = (T) getReference(manager.getBeans(beanClass, qualifiers), beanClass); | |
| 83 | 82 | |
| 84 | 83 | } catch (NoSuchElementException cause) { |
| 85 | 84 | StringBuffer buffer = new StringBuffer(); |
| ... | ... | @@ -97,12 +96,11 @@ public final class Beans { |
| 97 | 96 | return instance; |
| 98 | 97 | } |
| 99 | 98 | |
| 100 | - @SuppressWarnings("unchecked") | |
| 101 | 99 | public static <T> T getReference(final Class<T> beanClass) { |
| 102 | 100 | T instance; |
| 103 | 101 | |
| 104 | 102 | try { |
| 105 | - instance = (T) getReference(manager.getBeans(beanClass)); | |
| 103 | + instance = (T) getReference(manager.getBeans(beanClass), beanClass); | |
| 106 | 104 | |
| 107 | 105 | } catch (NoSuchElementException cause) { |
| 108 | 106 | String message = getBundle().getString("bean-not-found", beanClass.getCanonicalName()); |
| ... | ... | @@ -128,12 +126,17 @@ public final class Beans { |
| 128 | 126 | } |
| 129 | 127 | |
| 130 | 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 | 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 | 139 | private static ResourceBundle getBundle() { |
| 137 | 140 | return ResourceBundleProducer.create("demoiselle-core-bundle", Locale.getDefault()); |
| 138 | 141 | } |
| 139 | 142 | -} |
| 143 | +} | |
| 140 | 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 | 50 | import javax.enterprise.inject.spi.BeanManager; |
| 51 | 51 | |
| 52 | 52 | import org.easymock.EasyMock; |
| 53 | +import org.junit.Ignore; | |
| 53 | 54 | import org.junit.Test; |
| 54 | 55 | import org.junit.runner.RunWith; |
| 55 | 56 | import org.powermock.api.easymock.PowerMock; |
| ... | ... | @@ -73,10 +74,9 @@ public class BeansTest { |
| 73 | 74 | |
| 74 | 75 | expect(beanManager.createCreationalContext(EasyMock.anyObject(Contextual.class))).andReturn(null); |
| 75 | 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 | 79 | EasyMock.anyObject(CreationalContext.class))).andReturn(object); |
| 78 | - | |
| 79 | - expect(bean.getBeanClass()).andReturn(null); | |
| 80 | 80 | |
| 81 | 81 | replayAll(beanManager, bean); |
| 82 | 82 | |
| ... | ... | @@ -103,7 +103,8 @@ public class BeansTest { |
| 103 | 103 | expect(bean.getBeanClass()).andReturn(null); |
| 104 | 104 | expect(beanManager.createCreationalContext(EasyMock.anyObject(Contextual.class))).andReturn(null); |
| 105 | 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 | 108 | EasyMock.anyObject(CreationalContext.class))).andReturn(object); |
| 108 | 109 | |
| 109 | 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 | 61 | |
| 62 | 62 | private static final long serialVersionUID = 1L; |
| 63 | 63 | |
| 64 | - @Inject | |
| 65 | - private JsfSecurityConfig config; | |
| 64 | + private transient JsfSecurityConfig config; | |
| 66 | 65 | |
| 67 | 66 | private transient Map<String, Object> savedParams; |
| 68 | 67 | |
| ... | ... | @@ -83,11 +82,19 @@ public class SecurityObserver implements Serializable { |
| 83 | 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 | 93 | private void saveCurrentState() { |
| 87 | 94 | clear(); |
| 88 | 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 | 98 | getSavedParams().putAll(facesContext.getExternalContext().getRequestParameterMap()); |
| 92 | 99 | savedViewId = facesContext.getViewRoot().getViewId(); |
| 93 | 100 | } |
| ... | ... | @@ -97,7 +104,7 @@ public class SecurityObserver implements Serializable { |
| 97 | 104 | saveCurrentState(); |
| 98 | 105 | |
| 99 | 106 | try { |
| 100 | - Redirector.redirect(config.getLoginPage()); | |
| 107 | + Redirector.redirect(getConfig().getLoginPage()); | |
| 101 | 108 | |
| 102 | 109 | } catch (PageNotFoundException cause) { |
| 103 | 110 | // TODO Colocar a mensagem no bundle |
| ... | ... | @@ -116,9 +123,9 @@ public class SecurityObserver implements Serializable { |
| 116 | 123 | if (savedViewId != null) { |
| 117 | 124 | Redirector.redirect(savedViewId, getSavedParams()); |
| 118 | 125 | |
| 119 | - } else if (config.isRedirectEnabled()) { | |
| 126 | + } else if (getConfig().isRedirectEnabled()) { | |
| 120 | 127 | redirectedFromConfig = true; |
| 121 | - Redirector.redirect(config.getRedirectAfterLogin(), getSavedParams()); | |
| 128 | + Redirector.redirect(getConfig().getRedirectAfterLogin(), getSavedParams()); | |
| 122 | 129 | } |
| 123 | 130 | |
| 124 | 131 | } catch (PageNotFoundException cause) { |
| ... | ... | @@ -140,8 +147,8 @@ public class SecurityObserver implements Serializable { |
| 140 | 147 | |
| 141 | 148 | public void onLogoutSuccessful(@Observes final AfterLogoutSuccessful event) { |
| 142 | 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 | 154 | } catch (PageNotFoundException cause) { |
| ... | ... | @@ -165,4 +172,5 @@ public class SecurityObserver implements Serializable { |
| 165 | 172 | savedViewId = null; |
| 166 | 173 | getSavedParams().clear(); |
| 167 | 174 | } |
| 175 | + | |
| 168 | 176 | } | ... | ... |
site/apt/release-notes.apt
| ... | ... | @@ -38,10 +38,14 @@ |
| 38 | 38 | |
| 39 | 39 | Notas de Versão |
| 40 | 40 | |
| 41 | -* v2.3.0 | |
| 41 | +* v2.3.1 | |
| 42 | 42 | |
| 43 | 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 | 49 | * {{{../2.2.2/}v2.2.2}} |
| 46 | 50 | |
| 47 | 51 | * {{{http://sourceforge.net/apps/mantisbt/demoiselle/view.php?id=752}0000752}} [Bug] Correção da exceção retornada pelo interceptador de ExceptionHandler. | ... | ... |