Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Newbie Help understanding Core Data



A long long time ago, prior to losing all my brain cells associated with programming, and prior to entering the Cocoa world, I wrote an app in C, for scheduling travel itineraries . I've been tempted to rewrite it in Obj C but am such a newbie it seems daunting, to say the very least. ( WARNING I only know enough to be dangerous. I'm an old guy, maybe too old).

Basically the app is a database of 100's of schedules. A calendar showing days you travel, each city and leg flown, arrival and departure times, hotel info and other stuff. I originally wrote it using structs in C. So I'm wondering if I can convert them to Core data entities? There would be a array of different calendars, each having different trips on certain days of the month, to various cities. Each calendar Day would either be a day off or a day on the trip or regular work day. Each trip would be a separate entity, and have one or more days with one or more legs between cities. I'd want to be able to sort for schedules that have certain trips to certain cities, or trips that have the highest per diem, or calenders that have certain days off. etc.

Playing with the object graph, I've created entities with attributes and relationships and I have come up with this:

Array of Calendars --> Calendar --> Each Day --> Trip/Off --> travel legs that day

Each Calendar is a separate entity, composed of attributes of month pay, total pre diem, etc and to-many relationships with Day entities?

Each Day is a separate entity, composed of attributes of what type of day (day off or work or travel) with a to-one relationship to a specific trip.

Each trip is a separate entity composed of attributes such as pay for trip, per diem, and a to-many relationship of multiple leg entities?

Each leg is a separate entity, composed of various attributes such as dep and arriv times, travel times, cities, hotel, phone, etc. and this has an inverse relationship to a specific trip.

I would load the data for each trip and each calendar by parsing a text file, not by a GUI interface, so I'm not sure how to go about all of this vis a vis controllers, etc. Seems like I'd have to have a controller for each type of entity. I'm tempted to just use arrays of dictionaries for the legs and trips, and the calendar would have an array of dictionaries for the days, and skip core data. After reading all the docs I'm still as confused as before. Most of the docs assume you are going to use the gui to load data, and I want to do it programatically, creating first the trip entities linked with multiple legs, etc. Then create the Calendars linked to specific trip entities. Where can I find sample code on doing this programatically?

Is this project do-able with Core Data? Can anyone give me some newbie-level pointers?

Thanks

Vince Ackerman
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.