Package org.openbravo.service.datasource
Class LinkToParentTreeDatasourceService
- java.lang.Object
-
- org.openbravo.service.datasource.BaseDataSourceService
-
- org.openbravo.service.datasource.DefaultDataSourceService
-
- org.openbravo.service.datasource.TreeDatasourceService
-
- org.openbravo.service.datasource.LinkToParentTreeDatasourceService
-
- All Implemented Interfaces:
DataSourceService
public class LinkToParentTreeDatasourceService extends TreeDatasourceService
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openbravo.service.datasource.TreeDatasourceService
TreeDatasourceService.CycleInHierarchyException, TreeDatasourceService.MultipleParentsException, TreeDatasourceService.TooManyTreeNodesException
-
-
Field Summary
-
Fields inherited from class org.openbravo.service.datasource.TreeDatasourceService
ROOT_NODE_CLIENT, ROOT_NODE_DB
-
-
Constructor Summary
Constructors Constructor Description LinkToParentTreeDatasourceService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addNewNode(org.codehaus.jettison.json.JSONObject bobProperties)
Classes that extend TreeDatasourceService this method must implement this method to handle the creation of a node in a tree tableprotected void
deleteNode(org.codehaus.jettison.json.JSONObject bobProperties)
Classes that extend TreeDatasourceService this method must implement this method to handle the deletion of a node in a tree tableprotected org.codehaus.jettison.json.JSONArray
fetchFilteredNodesForTreesWithMultiParentNodes(Map<String,String> parameters, Map<String,Object> datasourceParameters, TableTree tableTree, List<String> filteredNodes, String hqlTreeWhereClause, String hqlTreeWhereClauseRootNodes, boolean allowNotApplyingWhereClauseToChildren)
protected org.codehaus.jettison.json.JSONArray
fetchNodeChildren(Map<String,String> parameters, Map<String,Object> datasourceParameters, String parentId, String hqlWhereClause, String hqlWhereClauseRootNodes)
protected List<org.codehaus.jettison.json.JSONObject>
fetchParentsOfNode(Map<String,String> parameters, String parentId, String hqlWhereClause, String hqlWhereClauseRootNodes)
protected Map<String,Object>
getDatasourceSpecificParams(Map<String,String> parameters)
protected org.codehaus.jettison.json.JSONObject
getJSONObjectByNodeId(Map<String,String> parameters, Map<String,Object> datasourceParameters, String nodeId)
protected org.codehaus.jettison.json.JSONObject
getJSONObjectByRecordId(Map<String,String> parameters, String bobId, boolean fillNodeIdAndParentId)
protected org.codehaus.jettison.json.JSONObject
getJSONObjectByRecordId(Map<String,String> parameters, Map<String,Object> datasourceParameters, String bobId)
protected org.codehaus.jettison.json.JSONObject
moveNode(Map<String,String> parameters, String nodeId, String newParentId, String prevNodeId, String nextNodeId)
Updates the parent of a given node a returns its definition in a JSONObjectprotected boolean
nodeConformsToWhereClause(TableTree tableTree, String nodeId, String hqlWhereClause)
Method that checks if a node conforms to a hqlWhereClauseprotected boolean
nodeHasChildren(Entity entity, String nodeId, String hqlWhereClause)
Classes that extend TreeDatasourceService this method must implement this method to handle the check if a node has children in a tree tableint
reparentChildrenOfDeletedNode(Entity entity, String newParentId, String oldParentId)
Does the actual reparent-
Methods inherited from class org.openbravo.service.datasource.TreeDatasourceService
add, addNodeCommonAttributes, checkEditDatasourceAccess, checkFetchDatasourceAccess, fetch, getEntity, getParentRecordIdFromCriteria, remove, substituteParameters, update
-
Methods inherited from class org.openbravo.service.datasource.DefaultDataSourceService
add, addFetchParameters, fetch, fetch, getDataSourceProperties, getInitialProperties, remove
-
Methods inherited from class org.openbravo.service.datasource.BaseDataSourceService
getDataSource, getDataUrl, getEntity, getName, getTemplate, getWhereAndFilterClause, getWhereClause, handleExceptionUnsecuredDSAccess, setDataSource, setDataUrl, setEntity, setName, setWhereClause
-
-
-
-
Method Detail
-
addNewNode
protected void addNewNode(org.codehaus.jettison.json.JSONObject bobProperties)
Description copied from class:TreeDatasourceService
Classes that extend TreeDatasourceService this method must implement this method to handle the creation of a node in a tree table- Specified by:
addNewNode
in classTreeDatasourceService
-
deleteNode
protected void deleteNode(org.codehaus.jettison.json.JSONObject bobProperties)
Description copied from class:TreeDatasourceService
Classes that extend TreeDatasourceService this method must implement this method to handle the deletion of a node in a tree table- Specified by:
deleteNode
in classTreeDatasourceService
-
reparentChildrenOfDeletedNode
public int reparentChildrenOfDeletedNode(Entity entity, String newParentId, String oldParentId)
Does the actual reparent- Parameters:
entity
-newParentId
- new parent id to be used on the moved nodesoldParentId
- parent id of the nodes to be moved- Returns:
- the number of reparented nodes
-
fetchNodeChildren
protected org.codehaus.jettison.json.JSONArray fetchNodeChildren(Map<String,String> parameters, Map<String,Object> datasourceParameters, String parentId, String hqlWhereClause, String hqlWhereClauseRootNodes) throws org.codehaus.jettison.json.JSONException, TreeDatasourceService.TooManyTreeNodesException
- Specified by:
fetchNodeChildren
in classTreeDatasourceService
- Parameters:
parameters
-parentId
- id of the node whose children are to be retrievedhqlWhereClause
- hql where clase of the tab/selectorhqlWhereClauseRootNodes
- hql where clause that define what nodes are rootsdatasourceParameters
- specific datasource parameters- Throws:
org.codehaus.jettison.json.JSONException
TreeDatasourceService.TooManyTreeNodesException
- if the number of returned nodes were to be too high
-
nodeHasChildren
protected boolean nodeHasChildren(Entity entity, String nodeId, String hqlWhereClause)
Description copied from class:TreeDatasourceService
Classes that extend TreeDatasourceService this method must implement this method to handle the check if a node has children in a tree table- Overrides:
nodeHasChildren
in classTreeDatasourceService
-
moveNode
protected org.codehaus.jettison.json.JSONObject moveNode(Map<String,String> parameters, String nodeId, String newParentId, String prevNodeId, String nextNodeId) throws Exception
Updates the parent of a given node a returns its definition in a JSONObject- Specified by:
moveNode
in classTreeDatasourceService
- Throws:
Exception
-
getJSONObjectByNodeId
protected org.codehaus.jettison.json.JSONObject getJSONObjectByNodeId(Map<String,String> parameters, Map<String,Object> datasourceParameters, String nodeId) throws TreeDatasourceService.MultipleParentsException
- Specified by:
getJSONObjectByNodeId
in classTreeDatasourceService
- Parameters:
parameters
-nodeId
-datasourceParameters
- specific datasource parameters obtained using methodTreeDatasourceService.getDatasourceSpecificParams(Map)
- Returns:
- returns a json object with the definition of a node give its node id
- Throws:
TreeDatasourceService.MultipleParentsException
-
nodeConformsToWhereClause
protected boolean nodeConformsToWhereClause(TableTree tableTree, String nodeId, String hqlWhereClause)
Method that checks if a node conforms to a hqlWhereClause- Specified by:
nodeConformsToWhereClause
in classTreeDatasourceService
- Parameters:
tableTree
- tableTree that defines the tree category that defines the treenodeId
- id of the node to be checkedhqlWhereClause
- hql where clause to be applied
-
getJSONObjectByRecordId
protected org.codehaus.jettison.json.JSONObject getJSONObjectByRecordId(Map<String,String> parameters, String bobId, boolean fillNodeIdAndParentId)
-
getJSONObjectByRecordId
protected org.codehaus.jettison.json.JSONObject getJSONObjectByRecordId(Map<String,String> parameters, Map<String,Object> datasourceParameters, String bobId)
- Specified by:
getJSONObjectByRecordId
in classTreeDatasourceService
- Parameters:
parameters
- a map with the parameters of the requestdatasourceParameters
- specific datasource parameters obtained using methodTreeDatasourceService.getDatasourceSpecificParams(Map)
bobId
- id of the tree node- Returns:
- returns a json object with the definition of a node give its record id
-
fetchFilteredNodesForTreesWithMultiParentNodes
protected org.codehaus.jettison.json.JSONArray fetchFilteredNodesForTreesWithMultiParentNodes(Map<String,String> parameters, Map<String,Object> datasourceParameters, TableTree tableTree, List<String> filteredNodes, String hqlTreeWhereClause, String hqlTreeWhereClauseRootNodes, boolean allowNotApplyingWhereClauseToChildren) throws TreeDatasourceService.MultipleParentsException, TreeDatasourceService.TooManyTreeNodesException
-
fetchParentsOfNode
protected List<org.codehaus.jettison.json.JSONObject> fetchParentsOfNode(Map<String,String> parameters, String parentId, String hqlWhereClause, String hqlWhereClauseRootNodes) throws TreeDatasourceService.TooManyTreeNodesException
-
getDatasourceSpecificParams
protected Map<String,Object> getDatasourceSpecificParams(Map<String,String> parameters)
- Specified by:
getDatasourceSpecificParams
in classTreeDatasourceService
-
-