Class<?>[] types = desc.getIdTypes();
String[] idSpaceNames = desc.getIdSpaceNames();
Object[] newId = new Object[types.length];
if ( idSpaceNames.length != types.length ) {
throw new RepositoryException("No ID SPACES ! " + desc.getItemDescriptorName());
}
// generate an id in our id space and return it
try {
for ( int i = 0; i < types.length; i++ ) {
if ( types[i] == String.class ) {
if ( i > 0 ) {
newId[i] = "dummyIdPart";
} else {
newId[i] = gen.generateStringId(idSpaceNames[i]);
}
} else {
long val = gen.generateLongId(idSpaceNames[i]);
if ( types[i] == Long.class ) {
newId[i] = val;
} else if ( types[i] == Float.class ) {
newId[i] = (float) val;
} else if ( types[i] == Double.class ) {
newId[i] = (double) val;
} else if ( types[i] == java.sql.Timestamp.class ) {
newId[i] = new java.sql.Timestamp(val);
} else if ( types[i] == java.util.Date.class ) {
newId[i] = new java.util.Date(val);
} else {
newId[i] = (int) val;
}
}
}
} catch ( IdGeneratorException ie ) {
throw new RepositoryException(ie);
}
return desc.generateGSAId(newId);
}