Re: [data] dto and isNew
Or a protected abstract Object getPrimaryKey(Dto dto). We can get the EM over an injected QueryInvocationContext. On Thu, May 15, 2014 at 9:06 PM, Romain Manni-Bucau rmannibu...@gmail.comwrote: I think a protected findEntity(id) in the mapper can be enough. Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2014-05-07 22:29 GMT+02:00 Thomas Hug thomas@gmail.com: Hi Romain, See your point. But if we only get the DTO - with what would we call the find? Could even be that the PK is a DTO or encoded / encrypted and needs to go through the mapper first. Maybe we can provide some convenience methods in the base mapper? On Tue, May 6, 2014 at 7:41 PM, Romain Manni-Bucau rmannibu...@gmail.comwrote: Hi guys, DTO feature is awesome but doesn't work in update mode since isNew doesn't use a managed entity. When using a mapper we should call find and pass it to the mapper (or create a new unmanaged entity if not found). So mapper signature should be Entity toEntity(Entity, DTO) no? Otherwise users need to do the find in the mapper...almost eveytime. wdyt? Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau
[jira] [Commented] (DELTASPIKE-588) Repositories from Data module should be deactivatable
[ https://issues.apache.org/jira/browse/DELTASPIKE-588?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14000775#comment-14000775 ] Gerhard Petracek commented on DELTASPIKE-588: - mocking partial beans requires something like: {code} public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (isMockedMethod(method)) { return method.invoke(this, args); } //... } private boolean isMockedMethod(Method method) { try { return getClass().getDeclaredMethod(method.getName(), method.getParameterTypes()) != null; } catch (NoSuchMethodException e) { return false; } } {code} in the InvocationHandler. Repositories from Data module should be deactivatable - Key: DELTASPIKE-588 URL: https://issues.apache.org/jira/browse/DELTASPIKE-588 Project: DeltaSpike Issue Type: Improvement Components: Data-Module Reporter: Karl Kildén Assignee: Thomas Hug Priority: Minor Unit testing with Test-Control is great. However since you don't control the actual implementation of the Repositories from data-module they are to hard to mock away. Either provide a built in project stage for this purpose - ProjectStage.MockFriendlyUnitTest or make it Deactivatable like other components are. The end user would benefit a lot from being able to mock away repositories in certain unit tests. -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Comment Edited] (DELTASPIKE-588) Repositories from Data module should be deactivatable
[ https://issues.apache.org/jira/browse/DELTASPIKE-588?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14000775#comment-14000775 ] Gerhard Petracek edited comment on DELTASPIKE-588 at 5/17/14 12:40 PM: --- mocking partial beans requires something like: {code} public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (isMockedMethod(method)) { return method.invoke(this, args); } //... } private boolean isMockedMethod(Method method) { try { return getClass().getDeclaredMethod(method.getName(), method.getParameterTypes()) != null; } catch (NoSuchMethodException e) { return false; } } {code} in the InvocationHandler. The mocked InvocationHandler needs to be something like: {code} @Typed() public class MockedPartialBean extends CustomPartialBeanHandler implements PartialBean { //mocked method implementations } {code} was (Author: gpetracek): mocking partial beans requires something like: {code} public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (isMockedMethod(method)) { return method.invoke(this, args); } //... } private boolean isMockedMethod(Method method) { try { return getClass().getDeclaredMethod(method.getName(), method.getParameterTypes()) != null; } catch (NoSuchMethodException e) { return false; } } {code} in the InvocationHandler. Repositories from Data module should be deactivatable - Key: DELTASPIKE-588 URL: https://issues.apache.org/jira/browse/DELTASPIKE-588 Project: DeltaSpike Issue Type: Improvement Components: Data-Module Reporter: Karl Kildén Assignee: Thomas Hug Priority: Minor Unit testing with Test-Control is great. However since you don't control the actual implementation of the Repositories from data-module they are to hard to mock away. Either provide a built in project stage for this purpose - ProjectStage.MockFriendlyUnitTest or make it Deactivatable like other components are. The end user would benefit a lot from being able to mock away repositories in certain unit tests. -- This message was sent by Atlassian JIRA (v6.2#6252)
Re: [data] dto and isNew
It's the PK, not the Entity ;) In SimpleQueryInOutMapperBase, it could be something like @Inject private QueryInvocationContext context; protected abstract Object getPrimaryKey(Dto dto); protected E findEntity(Object pk) { return (E) context.getEntityManager().find(context.getEntityClass(), pk); } @Override public Object mapParameter(final Object parameter) { Object pk = getPrimaryKey((Dto) parameter); if (pk != null) { E entity = findEntity(pk); return toEntity(entity, (Dto) parameter); } return toEntity(newEntity(), (Dto) parameter); } On Sat, May 17, 2014 at 1:57 PM, Romain Manni-Bucau rmannibu...@gmail.comwrote: would work while return is E and not Object ;) Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2014-05-17 11:47 GMT+02:00 Thomas Hug thomas@gmail.com: Or a protected abstract Object getPrimaryKey(Dto dto). We can get the EM over an injected QueryInvocationContext. On Thu, May 15, 2014 at 9:06 PM, Romain Manni-Bucau rmannibu...@gmail.comwrote: I think a protected findEntity(id) in the mapper can be enough. Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2014-05-07 22:29 GMT+02:00 Thomas Hug thomas@gmail.com: Hi Romain, See your point. But if we only get the DTO - with what would we call the find? Could even be that the PK is a DTO or encoded / encrypted and needs to go through the mapper first. Maybe we can provide some convenience methods in the base mapper? On Tue, May 6, 2014 at 7:41 PM, Romain Manni-Bucau rmannibu...@gmail.comwrote: Hi guys, DTO feature is awesome but doesn't work in update mode since isNew doesn't use a managed entity. When using a mapper we should call find and pass it to the mapper (or create a new unmanaged entity if not found). So mapper signature should be Entity toEntity(Entity, DTO) no? Otherwise users need to do the find in the mapper...almost eveytime. wdyt? Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau
[jira] [Updated] (DELTASPIKE-306) Examples for the features of the JSF module
[ https://issues.apache.org/jira/browse/DELTASPIKE-306?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gerhard Petracek updated DELTASPIKE-306: Assignee: Rafael Benevides Examples for the features of the JSF module --- Key: DELTASPIKE-306 URL: https://issues.apache.org/jira/browse/DELTASPIKE-306 Project: DeltaSpike Issue Type: Task Components: Examples, JSF-Module Affects Versions: 0.4 Reporter: Rudy De Busscher Assignee: Rafael Benevides Fix For: 0.8 Attachments: DELTASPIKE-306.patch Creates examples for the features of the JSF module - ViewScoped - JSFMessage - Type-safe view-config - ... -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Updated] (DELTASPIKE-372) WeldContainerControl should stop contexts during shutdown
[ https://issues.apache.org/jira/browse/DELTASPIKE-372?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gerhard Petracek updated DELTASPIKE-372: Assignee: Rafael Benevides WeldContainerControl should stop contexts during shutdown - Key: DELTASPIKE-372 URL: https://issues.apache.org/jira/browse/DELTASPIKE-372 Project: DeltaSpike Issue Type: Bug Components: CdiControl Affects Versions: 0.3-incubating Reporter: Martin Kouba Assignee: Rafael Benevides Fix For: 0.8 As described in DELTASPIKE-370 the Weld core does only invalidate application context during shutdown. Given that the other started contexts are not invalidated properly. -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Updated] (DELTASPIKE-372) WeldContainerControl should stop contexts during shutdown
[ https://issues.apache.org/jira/browse/DELTASPIKE-372?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gerhard Petracek updated DELTASPIKE-372: Fix Version/s: 0.8 WeldContainerControl should stop contexts during shutdown - Key: DELTASPIKE-372 URL: https://issues.apache.org/jira/browse/DELTASPIKE-372 Project: DeltaSpike Issue Type: Bug Components: CdiControl Affects Versions: 0.3-incubating Reporter: Martin Kouba Fix For: 0.8 As described in DELTASPIKE-370 the Weld core does only invalidate application context during shutdown. Given that the other started contexts are not invalidated properly. -- This message was sent by Atlassian JIRA (v6.2#6252)