Class ParamValueDAO
java.lang.Object
ru.bgcrm.dao.CommonDAO
org.bgerp.dao.param.ParamValueDAO
- Direct Known Subclasses:
ParamValueDAO
Parameter values DAO. The primary required public methods are sorted alphabetically.
Dependency methods even public, called by those, are placed directly after the first usage.
-
Nested Class Summary
Nested classes/interfaces inherited from class CommonDAO
CommonDAO.ObjectExtractor<T>, CommonDAO.RecordUpdater<T> -
Field Summary
FieldsFields inherited from class CommonDAO
con, SQL_AND, SQL_DELETE, SQL_DELETE_FROM, SQL_DESC, SQL_DISTINCT, SQL_FROM, SQL_GROUP_BY, SQL_INNER_JOIN, SQL_INSERT_IGNORE_INTO, SQL_INSERT_INTO, SQL_LEFT_JOIN, SQL_LIMIT, SQL_ON_DUP_KEY_UPDATE, SQL_ORDER_BY, SQL_REPLACE, SQL_SELECT, SQL_SELECT_ALL_FROM, SQL_SELECT_COUNT_ROWS, SQL_SET, SQL_UNION_ALL, SQL_UPDATE, SQL_VALUES, SQL_VALUES_1, SQL_VALUES_2, SQL_VALUES_3, SQL_VALUES_4, SQL_VALUES_5, SQL_WHERE -
Constructor Summary
ConstructorsConstructorDescriptionParamValueDAO(Connection con) ParamValueDAO(Connection con, boolean history, int userId) -
Method Summary
Modifier and TypeMethodDescriptionvoidcopyParam(int fromObjectId, int toObjectId, int paramId) Copies a parameter from an object to an objectvoidcopyParam(int fromObjectId, int fromParamId, int toObjectId, int toParamId) Copies a parameter from an object to an object.voidcopyParams(int fromObjectId, int toObjectId, String copyMapping) Copies parameters from an object to another object according to the given configurationvoidcopyParams(int fromObjectId, int toObjectId, Collection<Integer> paramIds) Copies parameters from an object to an objectvoiddeleteParams(String objectType, int id) Deletes object's parametersgetParamAddress(int id, int paramId) Returns values of an object's address parametergetParamAddress(int id, int paramId, boolean loadDirs) Returns values of an object's address parametergetParamAddress(int id, int paramId, boolean loadDirs, String formatName) Returns values of an object's address parametergetParamAddress(int id, int paramId, int position) Returns an object's address parametergetParamBlob(int id, int paramId) Selects a value for parameter type 'blob'getParamDate(int id, int paramId) Selects a value for parameter type 'date'getParamDateTime(int id, int paramId) Selects a value for parameter type 'datetime'getParamEmail(int id, int paramId) Selects values for parameter type 'email'getParamEmail(int id, int paramId, int position) Deprecated.getParamFile(int id, int paramId) Selects values for parameter type 'file'getParamFile(int id, int paramId, int position) Selects a value for parameter type 'file'getParamList(int id, int paramId) Selects a parameter value with type 'list'getParamListCount(int id, int paramId) Selects a parameter value with type 'listcount'getParamListCountWithTitles(int id, int paramId) Deprecated.getParamListWithComments(int id, int paramId) Selects a parameter value with type 'list' with value commentsgetParamListWithTitles(int id, int paramId) Deprecated.getParamListWithTitlesAndComments(int id, int paramId) Deprecated.getParamMoney(int id, int paramId) Selects a parameter value with type 'money'getParamPhone(int id, int paramId) Selects a parameter value with type 'phone'static ParameterPhoneValueItemgetParamText(int id, int paramId) Selects a value of parameter type 'text'getParamTree(int id, int paramId) Selects a parameter value with type 'tree'getParamTreeCount(int id, int paramId) Selects parameter values with type 'treecount'getParamTreeWithTitles(int id, int paramId) Deprecated.booleanisParameterFilled(int id, Parameter param) Checks whether the parameter is filled for the object with code idloadParameters(List<Parameter> paramList, int id, boolean offEncryption) Loads parameter's valuesvoidobjectIdInvert(String objectType, int currentObjectId) Moves parameters from object code to -object code.parameters(Id object) voidupdateParamAddress(int id, int paramId, int position, ParameterAddressValue value) Updates, appends and deletes an address parameter valuevoidupdateParamBlob(int id, int paramId, String value) Updates value for parameter type 'blob'voidupdateParamDate(int id, int paramId, Date value) Updates value for parameter type 'date'voidupdateParamDateTime(int id, int paramId, Date value) Updates value for parameter type 'datetime'voidupdateParamEmail(int id, int paramId, int position, ParameterEmailValue value) Updates values for parameter type 'email'voidupdateParamEmail(int id, int paramId, List<ParameterEmailValue> values) Updates values for parameter type 'email'voidupdateParamFile(int id, int paramId, int position, String comment, FileData fileData) Deprecated.voidupdateParamFile(int id, int paramId, int position, FileData fileData) Updates values for parameter type 'file'voidupdateParamList(int id, int paramId, Map<Integer, String> values) Deprecated.voidupdateParamList(int id, int paramId, Set<Integer> values) Updates values without comments for parameter type 'list'voidupdateParamListCount(int id, int paramId, Map<Integer, ?> values) Updates values for parameter type 'listcount'voidupdateParamListCount(int id, int paramId, Map<Integer, Double> values, Map<Integer, String> valuesComments) Deprecated.voidupdateParamListWithComments(int id, int paramId, Map<Integer, String> values) Updates values with comments for parameter type 'list'voidupdateParamMoney(int id, int paramId, String value) Updates value for parameter type 'money'voidupdateParamMoney(int id, int paramId, BigDecimal value) Updates value for parameter type 'money'voidupdateParamPhone(int id, int paramId, ParameterPhoneValue value) Updates values for parameter type 'phone'voidupdateParamsAddressOnHouseUpdate(int houseId) Updates address parameter strings for a house.voidupdateParamText(int id, int paramId, String value) Updates value for parameter type 'text'voidupdateParamTree(int id, int paramId, Set<String> values) Updates values for parameter type 'tree'voidupdateParamTreeCount(int id, int paramId, Map<String, BigDecimal> values) Updates values for parameter type 'treecount'Methods inherited from class CommonDAO
deleteById, foundRows, getById, getGroupedIds, getGroupedIds, getIds, getIds, getPageLimit, getPeriodSql, lastInsertId, setPeriodParamValue, setRecordCount, update, updateColumn, updateIds, updateIds, updateOrInsert
-
Field Details
-
TABLE_NAMES
-
COPY_PARAMS_SEPARATORS
- See Also:
-
-
Constructor Details
-
ParamValueDAO
-
ParamValueDAO
-
-
Method Details
-
copyParam
Copies a parameter from an object to an object- Parameters:
fromObjectId- object ID of the sourcetoObjectId- object ID of the targetparamId- the parameter's code- Throws:
SQLException
-
copyParam
public void copyParam(int fromObjectId, int fromParamId, int toObjectId, int toParamId) throws SQLException Copies a parameter from an object to an object. Parameters must be of the same type.- Parameters:
fromObjectId- object ID of the sourcefromParamId- param ID of the sourcetoObjectId- object ID of the targettoParamId- param ID of the target- Throws:
SQLException
-
copyParams
Copies parameters from an object to another object according to the given configuration- Parameters:
fromObjectId- the source objecttoObjectId- the target objectcopyMapping- the configuration- Throws:
SQLException
-
copyParams
public void copyParams(int fromObjectId, int toObjectId, Collection<Integer> paramIds) throws SQLException Copies parameters from an object to an object- Parameters:
fromObjectId- object ID of the sourcetoObjectId- object ID of the targetparamIds- the parameters' codes- Throws:
SQLException
-
deleteParams
Deletes object's parameters- Parameters:
objectType- object typeid- object ID- Throws:
SQLException
-
getParamAddress
Returns an object's address parameter- Parameters:
id- - object codeparamId- - param IDposition- - position, starting from 1, if the parameter has multiple values set- Returns:
- the value
- Throws:
SQLException
-
getParamAddress
public SortedMap<Integer, ParameterAddressValue> getParamAddress(int id, int paramId) throws SQLException Returns values of an object's address parameter- Parameters:
id- - object codeparamId- - param ID- Returns:
- key - position, value - the value at the position
- Throws:
SQLException
-
getParamAddress
public SortedMap<Integer, ParameterAddressValue> getParamAddress(int id, int paramId, boolean loadDirs) throws SQLException Returns values of an object's address parameter- Parameters:
id- - object codeparamId- - param IDloadDirs- - flag whether directories need to be loaded, so thatParameterAddressValue.getHouse()is correctly filled- Returns:
- key - position, value - the value at the position
- Throws:
SQLException
-
getParamAddress
public SortedMap<Integer, ParameterAddressValue> getParamAddress(int id, int paramId, boolean loadDirs, String formatName) throws SQLException Returns values of an object's address parameter- Parameters:
id- - object codeparamId- - param IDloadDirs- - flag whether directories need to be loaded, so thatParameterAddressValue.getHouse()is correctly filledformatName- - name of the address format from the configuration, used to format the address value- Returns:
- key - position, value - the value at the position
- Throws:
SQLException
-
getParamBlob
Selects a value for parameter type 'blob'- Parameters:
id- object IDparamId- param ID- Returns:
- the value
- Throws:
SQLException
-
getParamDate
Selects a value for parameter type 'date'- Parameters:
id- object IDparamId- param ID- Returns:
- the value
- Throws:
SQLException
-
getParamDateTime
Selects a value for parameter type 'datetime'- Parameters:
id- object IDparamId- param ID- Returns:
- the value
- Throws:
SQLException
-
getParamEmail
public SortedMap<Integer, ParameterEmailValue> getParamEmail(int id, int paramId) throws SQLException Selects values for parameter type 'email'- Parameters:
id- object IDparamId- param ID- Returns:
- key - param value position, value - a value itself
- Throws:
SQLException
-
getParamFile
Selects a value for parameter type 'file'- Parameters:
id- object IDparamId- param IDposition- position number for multiple values- Returns:
- the value
- Throws:
SQLException
-
getParamFile
Selects values for parameter type 'file'- Parameters:
id- object IDparamId- param ID- Returns:
- map with key equals value's position
- Throws:
SQLException
-
getParamList
Selects a parameter value with type 'list'- Parameters:
id- object IDparamId-- Returns:
- Set with value codes
- Throws:
SQLException
-
getParamListWithComments
Selects a parameter value with type 'list' with value comments- Parameters:
id- object IDparamId- param ID- Returns:
- key - value code, value - the comment
- Throws:
SQLException
-
getParamListCount
Selects a parameter value with type 'listcount'- Parameters:
id- object IDparamId- param ID- Returns:
- a map with key equals value IDs and values counts
- Throws:
SQLException
-
getParamMoney
Selects a parameter value with type 'money'- Parameters:
id- object IDparamId- param ID- Returns:
- the value or
null - Throws:
SQLException
-
getParamPhone
Selects a parameter value with type 'phone'- Parameters:
id- object IDparamId- param ID- Returns:
- the value or
null - Throws:
SQLException
-
getParamPhoneValueItemFromRs
public static ParameterPhoneValueItem getParamPhoneValueItemFromRs(ResultSet rs) throws SQLException - Throws:
SQLException
-
getParamText
Selects a value of parameter type 'text'- Parameters:
id- object IDparamId- param ID- Returns:
- the value
- Throws:
SQLException
-
getParamTree
Selects a parameter value with type 'tree'- Parameters:
id- object IDparamId- param ID- Returns:
- set of values
- Throws:
SQLException
-
getParamTreeCount
Selects parameter values with type 'treecount'- Parameters:
id- object IDparamId- param ID- Returns:
- map with a key equal to the parameter value ID, and the value - value amount (count)
- Throws:
SQLException
-
isParameterFilled
-
objectIdInvert
Moves parameters from object code to -object code. Used when converting a not-fully-created process with a negative code into a created one.- Parameters:
objectType-currentObjectId-- Throws:
SQLException
-
parameters
- Parameters:
object- customer or process- Returns:
- the parameters map, key - parameter ID
- Throws:
SQLException
-
updateParamAddress
public void updateParamAddress(int id, int paramId, int position, ParameterAddressValue value) throws SQLException Updates, appends and deletes an address parameter value- Parameters:
id- - entity IDparamId- - param IDposition- - starting from 1 value's position, 0 - appends a value with position MAX+1value- - the value,null- delete value from the position ifposition> 0, else delete all the values- Throws:
SQLException
-
updateParamsAddressOnHouseUpdate
Updates address parameter strings for a house. Used after changes in address directories, to generate correct strings with address parameters.- Parameters:
houseId- house code- Throws:
SQLException
-
updateParamBlob
Updates value for parameter type 'blob'- Parameters:
id- object IDparamId- param IDvalue- the value, null or empty string - delete the value- Throws:
SQLException
-
updateParamDate
Updates value for parameter type 'date'- Parameters:
id- object IDparamId- param IDvalue- the value,null- delete- Throws:
SQLException
-
updateParamDateTime
Updates value for parameter type 'datetime'- Parameters:
id- object IDparamId- param IDvalue- the value,null- delete- Throws:
SQLException
-
updateParamEmail
public void updateParamEmail(int id, int paramId, List<ParameterEmailValue> values) throws SQLException Updates values for parameter type 'email'- Parameters:
id- object IDparamId- param IDvalues- the values,nullor empty - delete values in DB- Throws:
SQLException
-
updateParamEmail
public void updateParamEmail(int id, int paramId, int position, ParameterEmailValue value) throws SQLException Updates values for parameter type 'email'- Parameters:
id- object IDparamId- param IDposition- values' position, starting from 1,0add a new value with positionMAX + 1value- the value,nulldelete the values from thepositionmore than 0, delete all values ifpositionis 0- Throws:
SQLException
-
updateParamFile
Updates values for parameter type 'file'- Parameters:
id- object IDparamId- param IDposition- position for multiple values, when is 0 - adding with new positionsfileData- value for the given position, ifnull- removes a value from the position or all values withposition== -1- Throws:
Exception
-
updateParamList
Updates values without comments for parameter type 'list'- Parameters:
id- object IDparamId- param IDvalues- the values- Throws:
SQLException
-
updateParamListWithComments
public void updateParamListWithComments(int id, int paramId, Map<Integer, String> values) throws SQLExceptionUpdates values with comments for parameter type 'list'- Parameters:
id- object IDparamId- param IDvalues- the values map, keys represent values, values - comments- Throws:
SQLException
-
updateParamListCount
Updates values for parameter type 'listcount'- Parameters:
id- entity IDparamId- param IDvalues- map with key = value ID, and values with possible types:String,BigDecimal- Throws:
SQLException
-
updateParamMoney
Updates value for parameter type 'money'- Parameters:
id- object IDparamId- param IDvalue- the value, whennull- delete- Throws:
SQLException
-
updateParamMoney
Updates value for parameter type 'money'- Parameters:
id- object IDparamId- parm ID.value- the value, whennullor a blank string - delete- Throws:
SQLException
-
updateParamPhone
Updates values for parameter type 'phone'- Parameters:
id- object IDparamId- param IDvalue- the values,nullor emptyitemList- delete values- Throws:
SQLException
-
updateParamText
Updates value for parameter type 'text'- Parameters:
id- object IDparamId- param IDvalue- the value,nullor emtpy string - delete value- Throws:
SQLException
-
updateParamTree
Updates values for parameter type 'tree'- Parameters:
id- object IDparamId- param IDvalues- the values,nullor empty set - delete values- Throws:
SQLException
-
updateParamTreeCount
public void updateParamTreeCount(int id, int paramId, Map<String, BigDecimal> values) throws SQLException Updates values for parameter type 'treecount'- Parameters:
id- object IDparamId- param IDvalues- the values map (key - treecount value ID, value - 'count'),nullor emtpy map - delete values- Throws:
SQLException
-
loadParameters
public List<ParameterValue> loadParameters(List<Parameter> paramList, int id, boolean offEncryption) throws SQLException Loads parameter's values- Parameters:
paramList- parameters listid- entity idoffEncryption- decrypt pseudo encrypted values- Throws:
SQLException
-
getParamEmail
@Deprecated public ParameterEmailValue getParamEmail(int id, int paramId, int position) throws SQLException Deprecated.Selects a value for parameter type 'email'- Parameters:
id- object IDparamId- param IDposition- param value position- Returns:
- the value
- Throws:
SQLException
-
getParamListWithTitles
Deprecated.Selects a parameter value with type 'list' with value titles- Parameters:
id- object IDparamId- param ID- Returns:
- the values
- Throws:
SQLException
-
getParamListWithTitlesAndComments
@Deprecated public List<IdTitleComment> getParamListWithTitlesAndComments(int id, int paramId) throws SQLException Deprecated.Selects a parameter value with type 'list' with value titles and comments- Parameters:
id- object IDparamId- param ID- Returns:
- the values
- Throws:
SQLException
-
getParamListCountWithTitles
@Deprecated public List<IdTitle> getParamListCountWithTitles(int id, int paramId) throws SQLException Deprecated.Selects a parameter value with type 'listcount' with value titles- Parameters:
id- object IDparamId- param ID- Returns:
- the values
- Throws:
SQLException
-
getParamTreeWithTitles
@Deprecated public List<IdStringTitle> getParamTreeWithTitles(int id, int paramId) throws SQLException Deprecated.Values of an object's parameter with type 'tree' with text titles- Parameters:
id- object IDparamId- param ID- Returns:
- the values
- Throws:
SQLException
-
updateParamFile
@Deprecated public void updateParamFile(int id, int paramId, int position, String comment, FileData fileData) throws Exception Deprecated.- Throws:
Exception
-
updateParamList
@Deprecated public void updateParamList(int id, int paramId, Map<Integer, String> values) throws SQLExceptionDeprecated.- Throws:
SQLException
-
updateParamListCount
@Deprecated public void updateParamListCount(int id, int paramId, Map<Integer, Double> values, Map<Integer, throws SQLExceptionString> valuesComments) Deprecated.- Throws:
SQLException
-