feat: Add FaceAI handoff URL builder and enhance race storage metadata handling
All checks were successful
Publish FaceAI Container / publish (push) Successful in 9m53s

This commit is contained in:
MaddoScientisto 2026-04-19 16:12:48 +02:00
commit 4f003bb5a9
5 changed files with 214 additions and 37 deletions

View file

@ -148,6 +148,14 @@ private boolean faceAiLookupHasResolvedPhoto(Object foto) {
&& faceAiLookupLong(faceAiLookupInvoke(foto, "getId_foto", null, null)) > 0L;
}
private boolean faceAiLookupMatchesRace(Object foto, long raceId) {
if (raceId <= 0L) {
return true;
}
return faceAiLookupLong(faceAiLookupInvoke(foto, "getId_gara", null, null)) == raceId;
}
private Object faceAiLookupResolvePhoto(Class fotoClass, Constructor constructor, Object apFull, String photoId, String normalizedPhotoId, String fileName, long raceId, long[] puntoFotoIds) throws Exception {
Method findByPrimaryKey = fotoClass.getMethod("findByPrimaryKey", new Class[] { long.class });
Method findByFoto = fotoClass.getMethod("findByFoto", new Class[] { String.class });
@ -158,7 +166,7 @@ private Object faceAiLookupResolvePhoto(Class fotoClass, Constructor constructor
if (photoId.matches("^\\d+$")) {
Object foto = faceAiLookupInstantiateFoto(fotoClass, constructor, apFull);
findByPrimaryKey.invoke(foto, new Object[] { Long.valueOf(Long.parseLong(photoId)) });
if (faceAiLookupHasResolvedPhoto(foto)) {
if (faceAiLookupHasResolvedPhoto(foto) && faceAiLookupMatchesRace(foto, raceId)) {
return foto;
}
}
@ -166,8 +174,7 @@ private Object faceAiLookupResolvePhoto(Class fotoClass, Constructor constructor
String[] fotoCandidates = new String[] {
photoId,
normalizedPhotoId,
compositeFileName,
fileName
compositeFileName
};
for (int index = 0; index < fotoCandidates.length; index++) {
String candidate = faceAiLookupTrim(fotoCandidates[index]);
@ -177,7 +184,7 @@ private Object faceAiLookupResolvePhoto(Class fotoClass, Constructor constructor
Object foto = faceAiLookupInstantiateFoto(fotoClass, constructor, apFull);
findByFoto.invoke(foto, new Object[] { candidate });
if (faceAiLookupHasResolvedPhoto(foto)) {
if (faceAiLookupHasResolvedPhoto(foto) && faceAiLookupMatchesRace(foto, raceId)) {
return foto;
}
}
@ -212,6 +219,14 @@ private Object faceAiLookupResolvePhoto(Class fotoClass, Constructor constructor
}
}
if (fileName.length() > 0 && raceId <= 0L && faceAiLookupIsSafeValue(fileName)) {
Object foto = faceAiLookupInstantiateFoto(fotoClass, constructor, apFull);
findByFoto.invoke(foto, new Object[] { fileName });
if (faceAiLookupHasResolvedPhoto(foto)) {
return foto;
}
}
return faceAiLookupInstantiateFoto(fotoClass, constructor, apFull);
}