• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: "Static" objects in EC (was: multi-instance sync woes)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "Static" objects in EC (was: multi-instance sync woes)


  • Subject: Re: "Static" objects in EC (was: multi-instance sync woes)
  • From: Chuck Hill <email@hidden>
  • Date: Tue, 25 Nov 2014 23:57:05 +0000
  • Thread-topic: "Static" objects in EC (was: multi-instance sync woes)


On 2014-11-25, 3:22 PM, "OC" wrote:

Oh, by the way...

On 26. 11. 2014, at 0:03, OC <email@hidden> wrote:
It is an ancient and rather convoluted code whose purpose was more-or-less to simulate a shared editing context, which -- can't recall clearly now -- either was buggy then, or there was some other problem with the thing.

... I have checked the project documentation, and seems the "other problem" were relationships.

There are objects of a given entity; most of them have normal lifecycle like a normal EO, but some of them are "static": conceptually, they should be hard-coded in the application.

Something like, hmmm, say the app manages print templates. There are a couple of hard-coded ones, and the user can create his own ones as well.

All the objects -- "static" and normal as well -- need to go to relationships, which (far as I understand EOF and unless I'm missing something) prevents not just the shared EC, but also the otherwise-best solution of having these "static" objects in-memory only, without actually storing them in the DB.

Do they have to be in the same relationship?  Could you have two, one for the hard-coded and one for the normal objects?  They could both share a common interface.  Then you could use custom attribute types to create a POJO based on the attribute value for the hard coded ones.  I don’t think you can easily use a relationship (as opposed to an attribute) as EOF will want it to have  GID.  So code like

public ITemplate printTemplate() {
   return builtInTemplateFromAttribute() != null ? builtInTemplateFromAttribute() : userCreatedTemplate();
}



The current PK-based solution is ugly, but to be frank, I can't see much better one. Well, instead of fixed PKs I can use an identifier, which will get rid of all the ugly fixed-PK code, but still

Well, that would save you some of the headache you have been dealing with today in terms of PK duplication.  You would have to deal with unique constraint violations, but not GID craziness.



(a) the "static" objects will have to be stored in the database
(b) thus the application, when launched, must go through the drudgery of syncing the desired state (as defined by some plists in the app bundle) and what's stored in the DB
(c) and, although it would be best if all the "static" objects were shared (but for the (b) above, they are R/O), it does not seem possible, and each EC is bound to contain a copy of them...

I don't like this, but I can't see a better approach. If you can, I'll be pretty grateful as soon as the refactoring time comes :)

My idea above is the best I have at the moment.  Maybe it will inspire something better from someone else.


Thanks again and all the best,
OC

Always a pleasure.

Chuck

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: "Static" objects in EC (was: multi-instance sync woes)
      • From: OC <email@hidden>
References: 
 >multi-instance sync woes (From: OC <email@hidden>)
 >Re: multi-instance sync woes (From: Chuck Hill <email@hidden>)
 >Re: multi-instance sync woes (From: OC <email@hidden>)
 >Re: multi-instance sync woes (From: Chuck Hill <email@hidden>)
 >Re: multi-instance sync woes (From: OC <email@hidden>)
 >Re: multi-instance sync woes (From: Chuck Hill <email@hidden>)
 >Re: multi-instance sync woes (From: OC <email@hidden>)
 >"Static" objects in EC (was: multi-instance sync woes) (From: OC <email@hidden>)

  • Prev by Date: Re: multi-instance sync woes
  • Next by Date: Re: SQL Server plugin framework
  • Previous by thread: "Static" objects in EC (was: multi-instance sync woes)
  • Next by thread: Re: "Static" objects in EC (was: multi-instance sync woes)
  • Index(es):
    • Date
    • Thread