> I suspect that you are just confusing yourself and making a trivial thing > hard. If you have an EO, you can just
Well, it wouldn't be the first time that is for sure. Maybe I'm just doing something that is wrong but I have a piece of code that I want to work even if I add more subclasses to this entity. Since I won't know ahead of time what the name of this entity will be I don't know how to convert an entity name to something that makes sense for the user. Maybe the code is easier to understand? NSMutableArray<ReportForPaymentType> reports = new NSMutableArray<ReportForPaymentType>(); EOEntity entity = new EOEnterpriseObjectClazz<EOEnterpriseObject>(MESAbstractPaymentInfo.ENTITY_NAME).entity(); NSArray<EOEntity> subEntities = entity.subEntities(); NSMutableArray<EOQualifier> qualifiers = new NSMutableArray<EOQualifier>(); qualifiers.addObject(MESAbstractPaymentInfo.DISPATCH.dot(MESDispatch.RESERVATION_DATE).greaterThanOrEqualTo(controller().startDate())); qualifiers.addObject(MESAbstractPaymentInfo.DISPATCH.dot(MESDispatch.RESERVATION_DATE).lessThanOrEqualTo(controller().endDate())); for(EOEntity subEntity : subEntities) { NSMutableArray<EOQualifier> subEntityQualifiers = (NSMutableArray<EOQualifier>)qualifiers.clone(); subEntityQualifiers.addObject(subEntity.restrictingQualifier()); NSArray<MESAbstractPaymentInfo> subEntityPayments = MESAbstractPaymentInfo.fetchMESAbstractPaymentInfos(controller().ec(), new EOAndQualifier(subEntityQualifiers), null); if(subEntityPayments.size() > 0) { // This is the part I want to change // I'd like to somehow get the "displayName" without having to get an object. // So that even if the result is 0 I can still create a report for the sub entity. MESAbstractPaymentInfo paymentInfo = subEntityPayments.get(0); ReportForPaymentType report = new ReportForPaymentType(); report.setPaymentType(paymentInfo.displayName()); report.setDispatchCount(subEntityPayments.size()); report.setTotalRevenue((BigDecimal)subEntityPayments.valueForKey("@sum.amount")); reports.addObject(report); } } I hope that makes some kind of sense... Johnny On Oct 26, 2012, at 10:29 AM, Chuck Hill <ch...@global-village.net> wrote: > > On 2012-10-26, at 1:25 PM, Johnny Miller wrote: > >> I never met David A. (although I really appreciate his sense of humor) but >> somehow I thought he was Irish - my mistake. > > He is a Norseman by way Minnesota. Ah Yup! > > Calling him Irish is going to give Kieran nightmares! > > >> The latter, an EO of that entity. I have an abstract entity and I want to >> get a pretty print name for the sub-entities. > > I suspect that you are just confusing yourself and making a trivial thing > hard. If you have an EO, you can just > > eo.getClass().getName() > > And EOEntity has these methods: > > String className() > Returns the name of the Enterprise Object class associated with the > receiver. > > String classNameWithoutPackage() > Return the name of the Enterprise Object class associated with the > receiver without the package information. > > > Chuck > >> >> On Oct 26, 2012, at 10:20 AM, Chuck Hill <ch...@global-village.net> wrote: >> >>> >>> On 2012-10-26, at 12:33 PM, Johnny Miller wrote: >>> >>>> Nothing could be sadder than an Irishman in a dry country. Sounds like >>>> some kind of war crime to me. >>> >>> Irish?!!? >>> >>> >>>> Another question: Once I have the EOEntity is there any way I can access >>>> a static method or field for that class? >>> >>> For the EOEntity class or an EO of that entity? >>> >>> >>> Chuck >>> >>> >>>> On Oct 26, 2012, at 9:05 AM, Chuck Hill <ch...@global-village.net> wrote: >>>> >>>>> Sounds like too much polyester in the hot sun has started to affect poor >>>>> David's mind! >>>>> >>>>> >>>>> On 2012-10-25, at 6:36 PM, David Avendasora wrote: >>>>> >>>>>> API Inconsistencies like this drive me crazy! >>>>>> >>>>>> What metaphor are we using? Parent/Child? Superclass/Subclass? >>>>>> >>>>>> Apparently the answer is "Yes". >>>>>> >>>>>> To get the EOEntity that myEntity inherits from you call >>>>>> myEOEntity.parent() >>>>>> >>>>>> Okay, Fine. We're using the Parent/Child metaphor. >>>>>> >>>>>> To get the EOEntities that inherit from myEntity you call >>>>>> myEntity.subEntities(). >>>>>> >>>>>> Wait. Whaaa??? WTF. Really? Two sides of one structure and you can't use >>>>>> the same metaphor? >>>>>> >>>>>> I tells ya, it makes me almost want to get up out of my rocking chair >>>>>> and dope-slap someone. >>>>>> >>>>>> But of course any impact that might have would be quickly erased by the >>>>>> simultaneous groveling hero-worship of the people who have made my >>>>>> coding life so easy that mixed metaphors piss me off. >>>>>> >>>>>> Dave >>>>>> >>>>>> >>>>>> On Oct 26, 2012, at 9:00 AM, Chuck Hill <ch...@global-village.net> wrote: >>>>>> >>>>>>> EOEntity.subEntities: >>>>>>> >>>>>>> subEntities >>>>>>> >>>>>>> public NSArray subEntities() >>>>>>> Returns a list of those entities that inherit from the receiver, or an >>>>>>> empty array if no entities inherit from the receiver. >>>>>>> Returns: An array of the receiver's sub-entities, or an empty array. >>>>>>> See Also: EOEntity.addSubEntity(EOEntity child), >>>>>>> EOEntity.parentEntity(), EOEntity.removeSubEntity(EOEntity child) >>>>>>> >>>>>>> >>>>>>> >>>>>>> On 2012-10-25, at 5:36 PM, Johnny Miller wrote: >>>>>>> >>>>>>>> What's the way to find all the entities that subclass a given entity? >>>>>>>> >>>>>>>> Thanks in advance, >>>>>>>> >>>>>>>> Aloha, >>>>>>>> Mr. Johnny Miller >>>>>>>> Web Development Manager >>>>>>>> Kahalawai Media Company >>>>>>>> Lahaina, HI 96761 >>>>>>>> tel: (808) 661-7962 | mobile: (808) 283-0791 >>>>>>>> website | e-mail >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> Do not post admin requests to the list. They will be ignored. >>>>>>>> Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) >>>>>>>> Help/Unsubscribe/Update your Subscription: >>>>>>>> https://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net >>>>>>>> >>>>>>>> This email sent to ch...@global-village.net >>>>>>> >>>>>>> -- >>>>>>> Chuck Hill Senior Consultant / VP Development >>>>>>> >>>>>>> Practical WebObjects - for developers who want to increase their >>>>>>> overall knowledge of WebObjects or who are trying to solve specific >>>>>>> problems. >>>>>>> http://www.global-village.net/gvc/practical_webobjects >>>>>>> >>>>>>> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest >>>>>>> Growing Companies in B.C! >>>>>>> Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking >>>>>>> of Canada’s Fastest-Growing Companies by PROFIT Magazine! >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Do not post admin requests to the list. They will be ignored. >>>>>>> Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) >>>>>>> Help/Unsubscribe/Update your Subscription: >>>>>>> https://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com >>>>>>> >>>>>>> This email sent to webobje...@avendasora.com >>>>>> >>>>>> >>>>>> ————————————————————————————— >>>>>> WebObjects - so easy that even Dave Avendasora can do it!™ >>>>>> ————————————————————————————— >>>>>> David Avendasora >>>>>> Senior Software Abuser >>>>>> Kaiten, Inc. >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> -- >>>>> Chuck Hill Senior Consultant / VP Development >>>>> >>>>> Practical WebObjects - for developers who want to increase their overall >>>>> knowledge of WebObjects or who are trying to solve specific problems. >>>>> http://www.global-village.net/gvc/practical_webobjects >>>>> >>>>> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest >>>>> Growing Companies in B.C! >>>>> Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of >>>>> Canada’s Fastest-Growing Companies by PROFIT Magazine! >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>> >>> -- >>> Chuck Hill Senior Consultant / VP Development >>> >>> Practical WebObjects - for developers who want to increase their overall >>> knowledge of WebObjects or who are trying to solve specific problems. >>> http://www.global-village.net/gvc/practical_webobjects >>> >>> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest >>> Growing Companies in B.C! >>> Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of >>> Canada’s Fastest-Growing Companies by PROFIT Magazine! >>> >>> >>> >>> >>> >>> >>> >>> >> > > -- > Chuck Hill Senior Consultant / VP Development > > Practical WebObjects - for developers who want to increase their overall > knowledge of WebObjects or who are trying to solve specific problems. > http://www.global-village.net/gvc/practical_webobjects > > Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing > Companies in B.C! > Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of > Canada’s Fastest-Growing Companies by PROFIT Magazine! > > > > > > > >
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com