public NSDictionary _newPrimaryKey(EOEnterpriseObject object, EOEntity entity) {
NSArray pkAttributes = entity.primaryKeyAttributes();
if (pkAttributes.count() > 1) {
throw new ERLuceneAdaptorException("Failed to generate primary key because " + entity.name() + " has a composite primary key.");
}
EOAttribute pkAttribute = (EOAttribute) pkAttributes.objectAtIndex(0);
Object pkValue = null;
String className = pkAttribute.className();
String valueType = pkAttribute.valueType();
if ("com.webobjects.foundation.NSData".equals(className)) {
// if(true==false) {
// ByteArrayBuffer buf = new ByteArrayBuffer();
// try {
// buf.write(entity.externalName().getBytes());
// buf.write('.');
// buf.write(new EOTemporaryGlobalID()._rawBytes());
// pkValue = new NSData(buf.getRawData());
// } catch (IOException e) {
// throw NSForwardException._runtimeExceptionForThrowable(e);
// }
// } else {
pkValue = new NSData(new EOTemporaryGlobalID()._rawBytes());
// }
} else {
throw new IllegalArgumentException("Unknown value type '" + valueType + "' for '" + object + "' of entity '" + entity.name() + "'.");
}
NSDictionary pk = new NSDictionary<String, Object>(pkValue, pkAttribute.name());
return pk;
}