package your.app.components;
// $LastChangedRevision: 5773 $ DO NOT EDIT. Make changes to MyTable.java instead.
import com.webobjects.eoaccess.*;
import com.webobjects.eocontrol.*;
import com.webobjects.foundation.*;
import java.math.*;
import java.util.*;
import org.apache.log4j.Logger;
@SuppressWarnings("all")
public abstract class _MyTable extends EOGenericRecord {
public static final String ENTITY_NAME = "MyTable";
// Attributes
public static final String ID_KEY = "id";
public static final String NAME_KEY = "name";
// Relationships
private static Logger LOG = Logger.getLogger(_MyTable.class);
public MyTable localInstanceIn(EOEditingContext editingContext) {
MyTable localInstance = (MyTable)EOUtilities.localInstanceOfObject(editingContext, this);
if (localInstance == null) {
throw new IllegalStateException("You attempted to localInstance " + this + ", which has not yet committed.");
}
return localInstance;
}
public Long id() {
return (Long) storedValueForKey("id");
}
public void setId(Long value) {
if (_MyTable.LOG.isDebugEnabled()) {
_MyTable.LOG.debug( "updating id from " + id() + " to " + value);
}
takeStoredValueForKey(value, "id");
}
public String name() {
return (String) storedValueForKey("name");
}
public void setName(String value) {
if (_MyTable.LOG.isDebugEnabled()) {
_MyTable.LOG.debug( "updating name from " + name() + " to " + value);
}
takeStoredValueForKey(value, "name");
}
public static MyTable createMyTable(EOEditingContext editingContext, Long id
, String name
) {
MyTable eo = (MyTable) EOUtilities.createAndInsertInstance(editingContext, _MyTable.ENTITY_NAME);
eo.setId(id);
eo.setName(name);
return eo;
}
public static NSArray<MyTable> fetchAllMyTables(EOEditingContext editingContext) {
return _MyTable.fetchAllMyTables(editingContext, null);
}
public static NSArray<MyTable> fetchAllMyTables(EOEditingContext editingContext, NSArray<EOSortOrdering> sortOrderings) {
return _MyTable.fetchMyTables(editingContext, null, sortOrderings);
}
public static NSArray<MyTable> fetchMyTables(EOEditingContext editingContext, EOQualifier qualifier, NSArray<EOSortOrdering> sortOrderings) {
EOFetchSpecification fetchSpec = new EOFetchSpecification(_MyTable.ENTITY_NAME, qualifier, sortOrderings);
fetchSpec.setIsDeep(true);
NSArray<MyTable> eoObjects = (NSArray<MyTable>)editingContext.objectsWithFetchSpecification(fetchSpec);
return eoObjects;
}
public static MyTable fetchMyTable(EOEditingContext editingContext, String keyName, Object value) {
return _MyTable.fetchMyTable(editingContext, new EOKeyValueQualifier(keyName, EOQualifier.QualifierOperatorEqual, value));
}
public static MyTable fetchMyTable(EOEditingContext editingContext, EOQualifier qualifier) {
NSArray<MyTable> eoObjects = _MyTable.fetchMyTables(editingContext, qualifier, null);
MyTable eoObject;
int count = eoObjects.count();
if (count == 0) {
eoObject = null;
}
else if (count == 1) {
eoObject = (MyTable)eoObjects.objectAtIndex(0);
}
else {
throw new IllegalStateException("There was more than one MyTable that matched the qualifier '" + qualifier + "'.");
}
return eoObject;
}
public static MyTable fetchRequiredMyTable(EOEditingContext editingContext, String keyName, Object value) {
return _MyTable.fetchRequiredMyTable(editingContext, new EOKeyValueQualifier(keyName, EOQualifier.QualifierOperatorEqual, value));
}
public static MyTable fetchRequiredMyTable(EOEditingContext editingContext, EOQualifier qualifier) {
MyTable eoObject = _MyTable.fetchMyTable(editingContext, qualifier);
if (eoObject == null) {
throw new NoSuchElementException("There was no MyTable that matched the qualifier '" + qualifier + "'.");
}
return eoObject;
}
public static MyTable localInstanceIn(EOEditingContext editingContext, MyTable eo) {
MyTable localInstance = (eo == null) ? null : (MyTable)EOUtilities.localInstanceOfObject(editingContext, eo);
if (localInstance == null && eo != null) {
throw new IllegalStateException("You attempted to localInstance " + eo + ", which has not yet committed.");
}
return localInstance;
}
}
// Generated by the WOLips Templateengine Plug-in at 07.09.2009 10:51:59
package your.app.components;
import com.webobjects.appserver.WOComponent;
import com.webobjects.appserver.WOContext;
import com.webobjects.eocontrol.EOFetchSpecification;
import com.webobjects.eocontrol.EOSortOrdering;
import com.webobjects.foundation.NSArray;
import com.webobjects.foundation.NSLog;
public class Main extends WOComponent {
private static final long serialVersionUID = 1L;
private NSArray fetchResult;
private MyTable aDisplayBoard;
public Main(WOContext context) {
super(context);
NSArray sortOrdering = new NSArray(new EOSortOrdering ("name", EOSortOrdering.CompareAscending));
EOFetchSpecification fs = new EOFetchSpecification ("MyTable", null, sortOrdering);
if(fs!=null){
fetchResult = session().defaultEditingContext().objectsWithFetchSpecification(fs);
NSLog.debug.appendln(fetchResult.toString());
}
}
public MyTable aDisplayBoard(){
return this.aDisplayBoard;
}
public void setADisplayBoard(MyTable newDisplayBoard) {
this.aDisplayBoard = newDisplayBoard;
}
public NSArray fetchResult(){
return fetchResult;
}
}
##################### WO ####################
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<webobject name="Table" />
<webobject name="Name"></webobject>:<br />
</body>
</html>
Table : WOTable {
list = fetchResult;
item = aDisplayBoard;
maxColumns = 2;
border = 1;
}
Name : WOString {
}
THX for help ..
Frank
:-)