Class ComponentInstanceTable
- java.lang.Object
-
- org.silverpeas.core.persistence.jdbc.AbstractTable<T>
-
- org.silverpeas.core.admin.persistence.Table<ComponentInstanceRow>
-
- org.silverpeas.core.admin.persistence.ComponentInstanceTable
-
@Repository public class ComponentInstanceTable extends Table<ComponentInstanceRow>
A ComponentInstanceTable object manages the ST_ComponentInstance table.
-
-
Field Summary
Fields Modifier and Type Field Description static String
UPDATE_ST_COMPONENT_INSTANCE_SET
static String
WHERE_ID
-
Constructor Summary
Constructors Constructor Description ComponentInstanceTable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createComponentInstance(ComponentInstanceRow instance)
Inserts in the database a new instance row.protected ComponentInstanceRow
fetchComponentInstance(ResultSet rs)
Fetch the current instance row from a resultSet.protected ComponentInstanceRow
fetchRow(ResultSet rs)
Builds a new row object which values are retrieved from the given ResultSet.String[]
getAllComponentInstanceIdsInSpace(int spaceId)
Returns all the instance ids in a given spaceComponentInstanceRow[]
getAllComponentInstancesInSpace(int spaceId)
Returns all the instances in a given spaceComponentInstanceRow[]
getAllMatchingComponentInstances(ComponentInstanceRow sampleInstance)
Returns the ComponentInstance whose fields match those of the given sample instance fields.ComponentInstanceRow
getComponentInstance(int id)
Returns the instance with the given id.ComponentInstanceRow
getComponentInstanceOfUserRole(int userRoleId)
Returns the ComponentInstance of a given user role.ComponentInstanceRow[]
getRemovedComponents()
Returns all components which has been removed but not definitely deletedboolean
isComponentIntoBasket(int spaceId, String name)
Check if a named component already exists in given spacevoid
moveComponentInstance(int spaceId, int componentId)
protected void
prepareInsert(String insertQuery, PreparedStatement insert, ComponentInstanceRow row)
protected void
prepareUpdate(String updateQuery, PreparedStatement update, ComponentInstanceRow row)
void
removeComponentInstance(int id)
Delete a component instance and all his user role sets.void
restoreComponentFromBasket(int id)
Remove the space from the basket Space will be available againvoid
sendComponentToBasket(int id, String tempLabel, String userId)
Delete the space and all his component instances.void
updateComponentInheritance(int componentId, boolean inheritanceBlocked)
void
updateComponentInstance(ComponentInstanceRow instance)
Updates in the database an instance row.void
updateComponentOrder(int componentId, int orderNum)
-
Methods inherited from class org.silverpeas.core.admin.persistence.Table
addIdToQuery, addParamToQuery, addParamToQuery, aliasColumns, checkGroupExistence, checkUserExistence, getCount, getCount, getIds, getIds, getIds, getIds, getNotNullString, getRows, performPrepareStatementParams, updateRelation
-
Methods inherited from class org.silverpeas.core.persistence.jdbc.AbstractTable
getInteger, getInteger, getMatchingRows, getNextId, getRows, getRows, getRows, getRows, getRows, getRows, getRows, getUniqueRow, getUniqueRow, getUniqueRow, getUniqueRow, getUniqueRow, getUniqueRow, getUniqueRow, insertRow, truncate, updateRelation, updateRelation, updateRow
-
-
-
-
Field Detail
-
UPDATE_ST_COMPONENT_INSTANCE_SET
public static final String UPDATE_ST_COMPONENT_INSTANCE_SET
- See Also:
- Constant Field Values
-
WHERE_ID
public static final String WHERE_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
fetchComponentInstance
protected ComponentInstanceRow fetchComponentInstance(ResultSet rs) throws SQLException
Fetch the current instance row from a resultSet.- Parameters:
rs
- result set- Returns:
- the current instance row from a resultSet.
- Throws:
SQLException
- on error
-
getComponentInstance
public ComponentInstanceRow getComponentInstance(int id) throws SQLException
Returns the instance with the given id.- Parameters:
id
- the unique identifier of the component instance- Returns:
- the instance with the given id.
- Throws:
SQLException
- on error
-
getComponentInstanceOfUserRole
public ComponentInstanceRow getComponentInstanceOfUserRole(int userRoleId) throws SQLException
Returns the ComponentInstance of a given user role.- Parameters:
userRoleId
- id of user role- Returns:
- the ComponentInstance of a given user role.
- Throws:
SQLException
- on error
-
getAllComponentInstancesInSpace
public ComponentInstanceRow[] getAllComponentInstancesInSpace(int spaceId) throws SQLException
Returns all the instances in a given space- Parameters:
spaceId
- the space id- Returns:
- all the instances in a given space
- Throws:
SQLException
- on error
-
getAllComponentInstanceIdsInSpace
public String[] getAllComponentInstanceIdsInSpace(int spaceId) throws SQLException
Returns all the instance ids in a given space- Parameters:
spaceId
- the space id- Returns:
- all the instance ids in a given space
- Throws:
SQLException
- on error
-
getRemovedComponents
public ComponentInstanceRow[] getRemovedComponents() throws SQLException
Returns all components which has been removed but not definitely deleted- Returns:
- all components which has been removed but not definitely deleted
- Throws:
SQLException
- on error
-
getAllMatchingComponentInstances
public ComponentInstanceRow[] getAllMatchingComponentInstances(ComponentInstanceRow sampleInstance) throws SQLException
Returns the ComponentInstance whose fields match those of the given sample instance fields.- Parameters:
sampleInstance
- a row with the fields of the component instance- Returns:
- the ComponentInstance whose fields match those of the given sample instance fields.
- Throws:
SQLException
- on error
-
createComponentInstance
public void createComponentInstance(ComponentInstanceRow instance) throws SQLException
Inserts in the database a new instance row.- Parameters:
instance
- a row with the fields of a component instance- Throws:
SQLException
- on error
-
prepareInsert
protected void prepareInsert(String insertQuery, PreparedStatement insert, ComponentInstanceRow row) throws SQLException
- Specified by:
prepareInsert
in classAbstractTable<ComponentInstanceRow>
- Throws:
SQLException
-
updateComponentOrder
public void updateComponentOrder(int componentId, int orderNum) throws SQLException
- Throws:
SQLException
-
updateComponentInheritance
public void updateComponentInheritance(int componentId, boolean inheritanceBlocked) throws SQLException
- Throws:
SQLException
-
updateComponentInstance
public void updateComponentInstance(ComponentInstanceRow instance) throws SQLException
Updates in the database an instance row.- Parameters:
instance
- the row with the fields of the component instance- Throws:
SQLException
-
isComponentIntoBasket
public boolean isComponentIntoBasket(int spaceId, String name) throws SQLException
Check if a named component already exists in given space- Parameters:
spaceId
- the space idname
- the name of a component- Throws:
SQLException
- on error
-
sendComponentToBasket
public void sendComponentToBasket(int id, String tempLabel, String userId) throws SQLException
Delete the space and all his component instances.- Parameters:
id
- the component idtempLabel
- the temporary labeluserId
- the user id that deletes the space- Throws:
AdminPersistenceException
- on errorSQLException
-
restoreComponentFromBasket
public void restoreComponentFromBasket(int id) throws SQLException
Remove the space from the basket Space will be available again- Parameters:
id
- the component id- Throws:
SQLException
- on error
-
moveComponentInstance
public void moveComponentInstance(int spaceId, int componentId) throws SQLException
- Throws:
SQLException
-
prepareUpdate
protected void prepareUpdate(String updateQuery, PreparedStatement update, ComponentInstanceRow row) throws SQLException
- Specified by:
prepareUpdate
in classAbstractTable<ComponentInstanceRow>
- Throws:
SQLException
-
removeComponentInstance
public void removeComponentInstance(int id) throws SQLException
Delete a component instance and all his user role sets.- Parameters:
id
- the component instance identifier- Throws:
SQLException
- on error
-
fetchRow
protected ComponentInstanceRow fetchRow(ResultSet rs) throws SQLException
Description copied from class:AbstractTable
Builds a new row object which values are retrieved from the given ResultSet.- Specified by:
fetchRow
in classAbstractTable<ComponentInstanceRow>
- Parameters:
rs
- the result set from which the row will be fetched.- Returns:
- the entity in the row.
- Throws:
SQLException
- on SQL error.
-
-