/** * Returns all relations for the given resource matching the given filter.<p> * * @param dbc the current db context * @param resource the resource to retrieve the relations for * @param filter the filter to match the relation * * @return all {@link CmsRelation} objects for the given resource matching the given filter * * @throws CmsException if something goes wrong * * @see CmsSecurityManager#getRelationsForResource(CmsRequestContext, CmsResource, CmsRelationFilter) */ public List getRelationsForResource(CmsDbContext dbc, CmsResource resource, CmsRelationFilter filter) throws CmsException { CmsUUID projectId = getProjectIdForContext(dbc); return m_vfsDriver.readRelations(dbc, projectId, resource, filter); }
/** * Returns all relations for the given resource matching the given filter.<p> * * @param dbc the current db context * @param resource the resource to retrieve the relations for * @param filter the filter to match the relation * * @return all relations for the given resource matching the given filter * * @throws CmsException if something goes wrong * * @see CmsSecurityManager#getRelationsForResource(CmsRequestContext, CmsResource, CmsRelationFilter) */ public List<CmsRelation> getRelationsForResource(CmsDbContext dbc, CmsResource resource, CmsRelationFilter filter) throws CmsException { CmsUUID projectId = getProjectIdForContext(dbc); return getVfsDriver(dbc).readRelations(dbc, projectId, resource, filter); }
/** * @see org.opencms.db.I_CmsVfsDriver#updateRelations(CmsDbContext, CmsProject, CmsResource) */ public void updateRelations(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource) throws CmsDataAccessException { // delete online relations I_CmsVfsDriver vfsDriver = m_driverManager.getVfsDriver(dbc); vfsDriver.deleteRelations(dbc, onlineProject.getUuid(), offlineResource, CmsRelationFilter.TARGETS); CmsUUID projectId; if (!dbc.getProjectId().isNullUUID()) { projectId = CmsProject.ONLINE_PROJECT_ID; } else { projectId = dbc.currentProject().getUuid(); } // copy offline to online relations CmsUUID dbcProjectId = dbc.getProjectId(); dbc.setProjectId(CmsUUID.getNullUUID()); Iterator<CmsRelation> itRelations = m_driverManager.getVfsDriver(dbc).readRelations( dbc, projectId, offlineResource, CmsRelationFilter.TARGETS).iterator(); dbc.setProjectId(dbcProjectId); while (itRelations.hasNext()) { vfsDriver.createRelation(dbc, onlineProject.getUuid(), itRelations.next()); } }
/** * @see org.opencms.db.I_CmsVfsDriver#updateRelations(CmsDbContext, CmsProject, CmsResource) */ public void updateRelations(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource) throws CmsDataAccessException { // delete online relations I_CmsVfsDriver vfsDriver = m_driverManager.getVfsDriver(dbc); vfsDriver.deleteRelations(dbc, onlineProject.getUuid(), offlineResource, CmsRelationFilter.TARGETS); CmsUUID projectId; if (!dbc.getProjectId().isNullUUID()) { projectId = CmsProject.ONLINE_PROJECT_ID; } else { projectId = dbc.currentProject().getUuid(); } // copy offline to online relations CmsUUID dbcProjectId = dbc.getProjectId(); dbc.setProjectId(CmsUUID.getNullUUID()); Iterator<CmsRelation> itRelations = m_driverManager.getVfsDriver(dbc).readRelations( dbc, projectId, offlineResource, CmsRelationFilter.TARGETS).iterator(); dbc.setProjectId(dbcProjectId); while (itRelations.hasNext()) { vfsDriver.createRelation(dbc, onlineProject.getUuid(), itRelations.next()); } }
/** * Returns the list of organizational units the given resource belongs to.<p> * * @param dbc the current database context * @param resource the resource * * @return list of {@link CmsOrganizationalUnit} objects * * @throws CmsException if something goes wrong */ public List getResourceOrgUnits(CmsDbContext dbc, CmsResource resource) throws CmsException { try { dbc.getRequestContext().setAttribute(I_CmsVfsDriver.REQ_ATTR_RESOURCE_OUS, Boolean.TRUE); return m_vfsDriver.readRelations( dbc, dbc.currentProject().getUuid(), resource, CmsRelationFilter.TARGETS.filterIncludeChildren()); } finally { dbc.getRequestContext().removeAttribute(I_CmsVfsDriver.REQ_ATTR_RESOURCE_OUS); } }
/** * @see org.opencms.db.I_CmsVfsDriver#updateRelations(CmsDbContext, CmsProject, CmsResource) */ public void updateRelations(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource) throws CmsDataAccessException { // delete online relations m_driverManager.getVfsDriver().deleteRelations( dbc, onlineProject.getUuid(), offlineResource, CmsRelationFilter.TARGETS); CmsUUID projectId; if (!dbc.getProjectId().isNullUUID()) { projectId = CmsProject.ONLINE_PROJECT_ID; } else { projectId = dbc.currentProject().getUuid(); } // copy offline to online relations CmsUUID dbcProjectId = dbc.getProjectId(); dbc.setProjectId(CmsUUID.getNullUUID()); Iterator itRelations = m_driverManager.getVfsDriver().readRelations( dbc, projectId, offlineResource, CmsRelationFilter.TARGETS).iterator(); dbc.setProjectId(dbcProjectId); while (itRelations.hasNext()) { m_driverManager.getVfsDriver().createRelation(dbc, onlineProject.getUuid(), (CmsRelation)itRelations.next()); } }
List relations = m_vfsDriver.readRelations( dbc, CmsProject.ONLINE_PROJECT_ID,
List<CmsRelation> relations = vfsDriver.readRelations( dbc, CmsProject.ONLINE_PROJECT_ID,