Generating Source Files
To begin creating your custom classes, generate source files for the Studio and Talent entities. You'll use these source files as a basis for adding custom behavior to your enterprise objects. Generating source files in a Java Client application typically produces "skeletal" .java files for the associated class. These files are put in the ClientSideJava.subproj subproject. Note: To generate source files for an entity, you must have replaced the text "EOGenericRecord" in the Class Name and Client-Side Class Name fields with a package name concatenated with a class name.-
Generate source files.
In the Model Editor, select the entity for which you want to generate source files.
Choose Property Generate Client Java File.
In the Choose Class Name panel verify the file name and location ( ClientSideJava.subproj ) and click Save.
Click OK when you're asked if you want to insert the files in the subproject.
For the same entity, choose Property Generate Java FIle.
In the Choose Class Name panel verify the file name and location (main project) and click Save.
Click OK when you're asked if you want to insert the files in the main project.
Studio.java (ClientSideJava.subproj)
package businesslogic.client;
import com.apple.client.foundation.*;
import com.apple.client.eocontrol.*;
import java.util.*;
import java.math.BigDecimal;
public class Studio extends EOGenericRecord {
public static final String BudgetKey = "budget";
public static final String NameKey = "name";
public static final String MoviesKey = "movies";
public Studio(EOEditingContext context, EOClassDescription
classDesc, EOGlobalID gid) {
super(context, classDesc, gid);
}
public String name() {
return (String)storedValueForKey(NameKey);
}
public void setName(String value) {
takeStoredValueForKey(value,NameKey);
}
public Number budget() {
return (Number)storedValueForKey(BudgetKey);
}
public void setBudget(Number value) {
takeStoredValueForKey(value,BudgetKey);
}
public NSArray movies() {
return (NSArray)storedValueForKey(MoviesKey);
}
public void setMovies(NSMutableArray value) {
takeStoredValueForKey(value,MoviesKey);
}
public void addToMovies(EOEnterpriseObject object) {
NSMutableArray movies;
movies = (NSMutableArray)storedValueForKey(MoviesKey);
willChange();
movies.addObject(object);
}
public void removeFromMovies(EOEnterpriseObject object) {
NSMutableArray movies;
movies = (NSMutableArray)storedValueForKey(MoviesKey);
willChange();
movies.removeObject(object);
}
public void buyAllMoviesStarringTalent(Talent talent) {
invokeRemoteMethod
("clientSideRequestBuyAllMoviesStarringTalent",
new Object[] {talent});
}
}
© 1999 Apple Computer, Inc. (Last Updated 13 Sep 99)