return weather;
}
@Override
public void rebuildMetadata(final String username) {
Guest guest = null;
// Accept guest ID as well as username
try {
guest = guestService.getGuest(username);
if(guest==null) {
// Try to treat arg as guestId
Long guestId = Long.valueOf(username);
if(guestId!=null) {
guest = guestService.getGuestById(guestId);
}
}
}
catch (Exception e) {
// Might get exception if username doesn't exist and non-numeric
guest=null;
}
// Check if we succeeded, return. This isn't really right because we don't get
// error reporting, but would take to long to fix error reporting right now.
// TODO: fix error reporting
if(guest==null) {
return;
}
String entityName = JPAUtils.getEntityName(LocationFacet.class);
final Query nativeQuery = em.createNativeQuery(String.format("SELECT DISTINCT apiKeyId FROM %s WHERE guestId=%s", entityName, guest.getId()));
final List<BigInteger> resultList = nativeQuery.getResultList();
for (BigInteger apiKeyId : resultList) {
if(apiKeyId!=null && apiKeyId.longValue()>0) {
rebuildMetadata(guest.username, apiKeyId.longValue());
}