Class PgUtils
java.lang.Object
io.openems.backend.metadata.odoo.postgres.PgUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static void
addChatterMessage
(Credentials credentials, String model, int id, String message) Adds a message in Odoo Chatter ('mail.thread').static ZonedDateTime
Return the Field of the ResultSet.static ZonedDateTime
getAsDateOrElse
(ResultSet rs, Field field, ZonedDateTime other) Return the Field of the ResultSet; or default value on error.static int
Return the Field of the ResultSet.static Integer
getAsIntegerOrElse
(ResultSet rs, Field field, Integer other) Return the Field of the ResultSet; or default value on error.static String
getAsString
(ResultSet rs, Field field) Return the Field of the ResultSet.static String
getAsStringOrElse
(ResultSet rs, Field field, String other) Return the Field of the ResultSet; or default value on error.static void
write
(Credentials credentials, String model, Integer[] ids, FieldValue<?>... fieldValues) Update a record in Odoo.
-
Constructor Details
-
PgUtils
public PgUtils()
-
-
Method Details
-
addChatterMessage
protected static void addChatterMessage(Credentials credentials, String model, int id, String message) throws OpenemsException Adds a message in Odoo Chatter ('mail.thread').- Parameters:
credentials
- the Odoo credentialsmodel
- Odoo model (e.g. 'res.partner')id
- id of modelmessage
- the message- Throws:
OpenemsException
- on error
-
write
public static void write(Credentials credentials, String model, Integer[] ids, FieldValue<?>... fieldValues) throws OpenemsException Update a record in Odoo.- Parameters:
credentials
- the Odoo credentialsmodel
- the Odoo modelids
- ids of model to updatefieldValues
- fields and values that should be written- Throws:
OpenemsException
- on error
-
getAsString
Return the Field of the ResultSet.- Parameters:
rs
- the ResultSetfield
- the EdgeDevice- Returns:
- the value as String
- Throws:
SQLException
- on errorOpenemsException
- on null
-
getAsStringOrElse
Return the Field of the ResultSet; or default value on error.- Parameters:
rs
- the ResultSetfield
- the EdgeDevice fieldother
- the default value- Returns:
- the value as String
-
getAsInt
Return the Field of the ResultSet.- Parameters:
rs
- the ResultSetfield
- the EdgeDevice- Returns:
- the value as Integer
- Throws:
SQLException
- on error
-
getAsIntegerOrElse
Return the Field of the ResultSet; or default value on error.- Parameters:
rs
- the ResultSetfield
- the EdgeDevice fieldother
- the default value- Returns:
- the value as Integer
-
getAsDate
public static ZonedDateTime getAsDate(ResultSet rs, Field field) throws SQLException, OpenemsException Return the Field of the ResultSet.- Parameters:
rs
- the ResultSetfield
- the EdgeDevice field- Returns:
- the value as ZonedDateTime
- Throws:
SQLException
- SQL-ErrorOpenemsException
- OpenEMS-Error
-
getAsDateOrElse
Return the Field of the ResultSet; or default value on error.- Parameters:
rs
- the ResultSetfield
- the EdgeDevice fieldother
- the default value- Returns:
- the value as ZonedDateTime
-