// We use copy on write lists to safely pass the reference to another actor for the iteration.
// We use copy on write lists to safely pass the reference to another actor for the iteration.
@ -289,7 +289,7 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware
try{
try{
newCfCtx.init();
newCfCtx.init();
}catch(Exceptione){
}catch(Exceptione){
throwCalculatedFieldException.builder().ctx(newCfCtx).eventEntity(newCfCtx.getEntityId()).cause(e).errorMessage("Failed to initialize CF context").build();
@ -114,7 +114,7 @@ public class CalculatedFieldCtx {
initialized=true;
initialized=true;
}catch(Exceptione){
}catch(Exceptione){
initialized=false;
initialized=false;
thrownewRuntimeException("Failed to init calculated field ctx. Invalid expression syntax.",e);
thrownewRuntimeException("Failed to initialize CF context. The script expression is invalid. Please check for syntax errors or unsupported functions.",e);
}
}
}else{
}else{
if(isValidExpression(expression)){
if(isValidExpression(expression)){
@ -128,7 +128,7 @@ public class CalculatedFieldCtx {
initialized=true;
initialized=true;
}else{
}else{
initialized=false;
initialized=false;
thrownewRuntimeException("Failed to init calculated field ctx. Invalid expression syntax.");
thrownewRuntimeException("Failed to initialize CF context. The expression has invalid syntax or unknown variables. Ensure all mathematical operators are correct.");
StringPROFILE_ASSET_ID_INFO_QUERY="SELECT tenant_id as tenantId, asset_profile_id as profileId, id as id FROM asset ORDER BY created_time ASC LIMIT %s OFFSET %s";
StringPROFILE_ASSET_ID_INFO_QUERY="SELECT tenant_id as tenantId, asset_profile_id as profileId, id as id FROM asset ORDER BY created_time ASC LIMIT %s OFFSET %s";
StringPROFILE_ASSET_ID_INFO_QUERY=String.format("SELECT tenant_id as tenantId, asset_profile_id as profileId, id as id FROM asset WHERE tenant_id = '%s' ORDER BY created_time ASC LIMIT %%s OFFSET %%s",tenantId);
StringPROFILE_ASSET_ID_INFO_QUERY=String.format("SELECT tenant_id as tenantId, asset_profile_id as profileId, id as id FROM asset WHERE tenant_id = '%s' ORDER BY created_time ASC LIMIT %%s OFFSET %%s",tenantId);
StringPROFILE_DEVICE_ID_INFO_QUERY="SELECT tenant_id as tenantId, device_profile_id as profileId, id as id FROM device ORDER BY created_time ASC LIMIT %s OFFSET %s";
StringPROFILE_DEVICE_ID_INFO_QUERY="SELECT tenant_id as tenantId, device_profile_id as profileId, id as id FROM device ORDER BY created_time ASC LIMIT %s OFFSET %s";
StringPROFILE_DEVICE_ID_INFO_QUERY=String.format("SELECT tenant_id as tenantId, device_profile_id as profileId, id as id FROM device WHERE tenant_id = '%s' ORDER BY created_time ASC LIMIT %%s OFFSET %%s",tenantId);
StringPROFILE_DEVICE_ID_INFO_QUERY=String.format("SELECT tenant_id as tenantId, device_profile_id as profileId, id as id FROM device WHERE tenant_id = '%s' ORDER BY created_time ASC LIMIT %%s OFFSET %%s",tenantId);