Project

General

Profile

Actions

feature request #7600

closed

public setters for entity collections

Added by Andreas Kohlbecker over 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
New
Category:
cdmlib
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Severity:
normal

Description

In model classes the setters for entity collections are protected or do not exist at all.
Only add*() and remove*() methods exists.

This turned out to be inconvinient when using the entity classes in ui frameworks like vaadin:


Der Grund weshalb ich die Adapter/DTOs benötige ist oft nur die Tatsache, dass man keinen Zugriff auf Collections in den CdmEntities hat, sondern immer die entsprechenden add*() und remove*() Methoden verwenden muss. Dies verträgt sich mit UI-Frameworks wie Vaadin ganz und gar nicht und ich muss für alle CdmKlassen immer setFoo(Collection foos) in addFoo(Foo foo) und removeFoo(Foo foo) übersetzen. Das machen diese AdapterDTOs.

Was spricht denn überhaupt dagegen die set*(Collection<? extends CdmBase> entities) Methoden im Model publik zu machen? Für Hibernate sollte das keine Probleme bereiten, in den Codebeispielen dort ist dies Standard.


In many cases the add*() and remove*() methods contain important business logic which would be short-circuited if the set*() method would be public.

Suggestion:

  1. rename all existing protected set*(Collection<> c) methods to _set*
  2. create a public set*(Collection<> c) method which internally uses the add*() and remove*() methods like:
    public void setAnnotations(Set<Annotation> annotations) {
        List<Annotation> currentAnnotations = new ArrayList<>(name.getAnnotations());
        List<Annotation> annotationsSeen = new ArrayList<>();
        for(Annotation a : annotations){
            if(a == null){
                continue;
            }
            if(!currentAnnotations.contains(a)){
                name.addAnnotation(a);
            }
            annotationsSeen.add(a);
        }
        for(Annotation a : currentAnnotations){
            if(!annotationsSeen.contains(a)){
                name.removeAnnotation(a);
            }
        }
    }

The above code could be generalized by implementing an EntityCollectionSetterAdapter.class which internally operates with java.lang.reflect.Method which are passes to the adapter in the constructor.


Related issues

Related to EDIT - bug #7910: TeamOrPersonField: readonly exception on bindig dataClosedAndreas Kohlbecker

Actions
Copied to EDIT - bug #8496: Improve public setters for entity collectionsNewAndreas Kohlbecker

Actions
Actions #1

Updated by Andreas Kohlbecker over 4 years ago

with commmit:a55fe58a I implemented the suggested setter for annotations. This implementation is not generic and should be replaced by a generic implementation though.

Actions #2

Updated by Andreas Müller over 4 years ago

  • Copied to feature request #7847: Use separate column for row state instead of symbol in titleCache column added
Actions #3

Updated by Andreas Müller over 4 years ago

  • Copied to deleted (feature request #7847: Use separate column for row state instead of symbol in titleCache column)
Actions #4

Updated by Andreas Kohlbecker about 4 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 30
Actions #5

Updated by Andreas Kohlbecker about 4 years ago

  • Description updated (diff)
  • Status changed from In Progress to Feedback
  • Target version changed from Unassigned CDM tickets to Release 5.5
  • % Done changed from 30 to 50

The EntityCollectionSetterAdapter is implemented and being used for Team.teamMembers and AnnotatableEntity.annotations

I think we can close this issue now since we now have an easy to use means to allow model beans having writable bean properties.

Please review.

Actions #6

Updated by Andreas Kohlbecker about 4 years ago

  • Status changed from Feedback to In Progress
  • Assignee changed from Andreas Müller to Andreas Kohlbecker
  • % Done changed from 50 to 40

EntityCollectionSetterAdapter is causing problems in the http-invoker during serialization:

login : admin
editor version : 5.5.0.qualifier
server : localhost (localhost-dev)
schema version : 5.0.0.0.20180514
os : Linux 4.4.0-130-generic amd64
java : 1.8.0_25
org.eclipse.swt.SWTException: Failed to execute runnable (org.springframework.remoting.RemoteAccessException: Could not access HTTP invoker remote service at [http://localhost:8080/remoting/term.service]; nested exception is java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: eu.etaxonomy.cdm.model.EntityCollectionSetterAdapter)
    at org.eclipse.swt.SWT.error(SWT.java:4533)
    at org.eclipse.swt.SWT.error(SWT.java:4448)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4536)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4154)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.block(ModalContext.java:165)
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:369)
    at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:481)
    at eu.etaxonomy.taxeditor.store.CdmStoreConnector.start(CdmStoreConnector.java:147)
    at eu.etaxonomy.taxeditor.store.CdmStore.connect(CdmStore.java:261)
    at eu.etaxonomy.taxeditor.store.CdmStore.connect(CdmStore.java:216)
    at eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog$9$1.run(RemotingLoginDialog.java:520)
    at org.eclipse.ui.internal.UILockListener.doPendingWork(UILockListener.java:162)
    at org.eclipse.ui.internal.UISynchronizer$3.run(UISynchronizer.java:154)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4536)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4154)
    at eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog.open(RemotingLoginDialog.java:212)
    at eu.etaxonomy.taxeditor.handler.e4.ShowRemotingLoginWindowHandlerE4.execute(ShowRemotingLoginWindowHandlerE4.java:38)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:282)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:264)
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
    at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:152)
    at org.eclipse.core.commands.Command.executeWithChecks(Command.java:494)
    at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:488)
    at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)
    at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:433)
    at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.handleWidgetSelection(AbstractContributionItem.java:454)
    at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem$3.handleEvent(AbstractContributionItem.java:482)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5227)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1340)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4561)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4151)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:693)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
    at eu.etaxonomy.taxeditor.Application.start(Application.java:24)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
Caused by: org.springframework.remoting.RemoteAccessException: Could not access HTTP invoker remote service at [http://localhost:8080/remoting/term.service]; nested exception is java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: eu.etaxonomy.cdm.model.EntityCollectionSetterAdapter
    at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.convertHttpInvokerAccessException(HttpInvokerClientInterceptor.java:216)
    at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:147)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
    at com.sun.proxy.$Proxy39.findWithoutFlush(Unknown Source)
    at eu.etaxonomy.cdm.api.cache.CdmServiceCacher.findByUuid(CdmServiceCacher.java:93)
    at eu.etaxonomy.cdm.api.cache.CdmCacher.load(CdmCacher.java:134)
    at eu.etaxonomy.cdm.model.common.DefinedTermBase.getTermByClassAndUUID_aroundBody20(DefinedTermBase.java:540)
    at eu.etaxonomy.cdm.model.common.DefinedTermBase.getTermByClassAndUUID(DefinedTermBase.java:1)
    at eu.etaxonomy.cdm.model.name.Rank.getTermByUuid(Rank.java:230)
    at eu.etaxonomy.cdm.model.name.Rank.initDefaultTerms_aroundBody174(Rank.java:1016)
    at eu.etaxonomy.cdm.model.name.Rank.initDefaultTerms(Rank.java:1)
    at eu.etaxonomy.taxeditor.store.CdmStoreConnector$1$2.run(CdmStoreConnector.java:210)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
    ... 59 more
Caused by: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: eu.etaxonomy.cdm.model.EntityCollectionSetterAdapter
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1355)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
    at org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor.doReadRemoteInvocationResult(AbstractHttpInvokerRequestExecutor.java:292)
    at org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor.readRemoteInvocationResult(AbstractHttpInvokerRequestExecutor.java:243)
    at org.springframework.remoting.httpinvoker.HttpComponentsHttpInvokerRequestExecutor.doExecuteRequest(HttpComponentsHttpInvokerRequestExecutor.java:232)
    at eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor.doExecuteRequest(CdmServiceRequestExecutor.java:61)
    at org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor.executeRequest(AbstractHttpInvokerRequestExecutor.java:138)
    at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.executeRequest(HttpInvokerClientInterceptor.java:194)
    at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.executeRequest(HttpInvokerClientInterceptor.java:176)
    at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:144)
    ... 72 more
Caused by: java.io.NotSerializableException: eu.etaxonomy.cdm.model.EntityCollectionSetterAdapter
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
    at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
    at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
    at org.springframework.remoting.rmi.RemoteInvocationSerializingExporter.doWriteRemoteInvocationResult(RemoteInvocationSerializingExporter.java:176)
    at org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter.writeRemoteInvocationResult(HttpInvokerServiceExporter.java:174)
    at org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter.writeRemoteInvocationResult(HttpInvokerServiceExporter.java:150)
    at org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter.handleRequest(HttpInvokerServiceExporter.java:75)
    at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:51)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:871)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:213)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1613)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:541)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1592)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1239)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:481)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1561)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1141)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.Server.handle(Server.java:564)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
    at java.lang.Thread.run(Thread.java:745)
Actions #7

Updated by Andreas Kohlbecker about 4 years ago

Another serialization issue:

login : admin
editor version : 5.5.0.qualifier
server : localhost (localhost-dev)
schema version : 5.0.0.0.20180514
os : Linux 4.4.0-130-generic amd64
java : 1.8.0_25
org.eclipse.swt.SWTException: Failed to execute runnable (org.springframework.remoting.RemoteAccessException: Could not access HTTP invoker remote service at [http://localhost:8080/remoting/term.service]; nested exception is java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: java.lang.reflect.Method)
    at org.eclipse.swt.SWT.error(SWT.java:4533)
    at org.eclipse.swt.SWT.error(SWT.java:4448)
...

So we can't cache the method in the adapter class.

Actions #8

Updated by Andreas Kohlbecker about 4 years ago

  • Related to bug #7910: TeamOrPersonField: readonly exception on bindig data added
Actions #9

Updated by Andreas Kohlbecker about 4 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 40 to 100

I think it is save now to close this issue.

Actions #10

Updated by Andreas Müller about 4 years ago

  • Status changed from Closed to Resolved
  • Assignee changed from Andreas Kohlbecker to Andreas Müller
  • % Done changed from 100 to 90

Reopen for doing review.

Actions #11

Updated by Andreas Müller about 4 years ago

  • Status changed from Resolved to Feedback
  • Assignee changed from Andreas Müller to Andreas Kohlbecker

Can you leave a note what you have final done (some commits have been "reverted" I see). Is it correct that only AnnotatableEntities.setAnnotations and Team.setTeamMembers. If yes we should relabel this ticket and open a follow up for the general issue (all collections).

I don't like the protected "_setTeamMembers" so much. It is not typical Java syntax to start a method with underscore. Also a comment is missing what this message is for. As it has no call hierarchy one may think it is not in use anymore. Is this true or is it used for calling via reflection? If the later is true it should be shortly mentioned in javadoc or comments.

Actions #12

Updated by Andreas Kohlbecker about 4 years ago

  • Status changed from Feedback to Resolved

I don't like the protected "_setTeamMembers" so much. It is not typical Java syntax to start a method with underscore. Also a comment is missing what this message is for. As it has no call hierarchy one may think it is not in use anymore. Is this true or is it used for calling via reflection? If the later is true it should be shortly mentioned in javadoc or comments.

The method is an old remain from a merge from cate2 code into the cdm on 2010-03-10 a784f00fdc. It is no longer needed and should be removed.

BTW: I did some research re garding methods starting with an underscore and found that starting methods with underscores are not against the oracle java coding conventions (https://www.oracle.com/technetwork/java/codeconventions-135099.html)

Reverted commits:

I can't see any commit related to this issue which has been reverted, which one are you referring to?

Summary of changes made for this issue

  • EntityCollectionSetterAdapter implemented
  • Documentation for EntityCollectionSetterAdapter in form of java doc at the EntityCollectionSetterAdapter.class
  • using EntityCollectionSetterAdapter for AnnotatableEntity.annotations and Team.teamMembers
Actions #13

Updated by Andreas Kohlbecker about 4 years ago

last comment updated

Actions #14

Updated by Andreas Kohlbecker about 4 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 90 to 100

_setTeamMembers(..) removed and closing ticket.

Actions #15

Updated by Andreas Müller about 4 years ago

Andreas Kohlbecker wrote:

BTW: I did some research re garding methods starting with an underscore and found that starting methods with underscores are not against the oracle java coding conventions (https://www.oracle.com/technetwork/java/codeconventions-135099.htm)

for me this link does not work. It gives "We can't find the page you were looking for". Is it correct?

Actions #16

Updated by Andreas Kohlbecker about 4 years ago

this is quite stange .. anyway I edited me last comment and updated the link (https://www.oracle.com/technetwork/java/codeconventions-135099.html)

Actions #17

Updated by Andreas Müller over 3 years ago

  • Copied to bug #8496: Improve public setters for entity collections added
Actions #18

Updated by Andreas Müller over 3 years ago

There is an open issue with the current implementation. I created a new ticket: #8496

Actions

Also available in: Atom PDF