/** * @see org.opencms.db.I_CmsVfsDriver#readParentFolder(org.opencms.db.CmsDbContext, CmsUUID, org.opencms.util.CmsUUID) */ public CmsFolder readParentFolder(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId) throws CmsDataAccessException { CmsFolder parent = null; try { Query q = m_sqlManager.createQuery(dbc, projectId, C_RESOURCES_READ_PARENT_BY_ID); q.setParameter(1, structureId.toString()); try { Object[] o = (Object[])q.getSingleResult(); parent = new CmsFolder(createResource(o, projectId)); } catch (NoResultException e) { // do nothing } } catch (PersistenceException e) { throw new CmsDataAccessException(Messages.get().container(Messages.ERR_JPA_PERSITENCE_1, e), e); } return parent; }
/** * Converts a resource to a folder (if possible).<p> * * @param resource the resource to convert * @return the converted resource * * @throws CmsVfsResourceNotFoundException if the resource is not a folder */ protected CmsFolder convertResourceToFolder(CmsResource resource) throws CmsVfsResourceNotFoundException { if (resource.isFolder()) { return new CmsFolder(resource); } throw new CmsVfsResourceNotFoundException( Messages.get().container(Messages.ERR_ACCESS_FILE_AS_FOLDER_1, resource.getRootPath())); }
/** * @see org.opencms.db.I_CmsVfsDriver#readParentFolder(org.opencms.db.CmsDbContext, CmsUUID, org.opencms.util.CmsUUID) */ public CmsFolder readParentFolder(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId) throws CmsDataAccessException { CmsFolder parent = null; ResultSet res = null; PreparedStatement stmt = null; Connection conn = null; try { conn = m_sqlManager.getConnection(dbc); stmt = m_sqlManager.getPreparedStatement(conn, projectId, "C_RESOURCES_READ_PARENT_BY_ID"); stmt.setString(1, structureId.toString()); res = stmt.executeQuery(); if (res.next()) { parent = new CmsFolder(createResource(res, projectId)); while (res.next()) { // do nothing only move through all rows because of mssql odbc driver } } } catch (SQLException e) { throw new CmsDbSqlException( Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)), e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, res); } return parent; }
/** * @see org.opencms.db.I_CmsVfsDriver#readParentFolder(org.opencms.db.CmsDbContext, CmsUUID, org.opencms.util.CmsUUID) */ public CmsFolder readParentFolder(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId) throws CmsDataAccessException { CmsFolder parent = null; ResultSet res = null; PreparedStatement stmt = null; Connection conn = null; try { conn = m_sqlManager.getConnection(dbc); stmt = m_sqlManager.getPreparedStatement(conn, projectId, "C_RESOURCES_READ_PARENT_BY_ID"); stmt.setString(1, structureId.toString()); res = stmt.executeQuery(); if (res.next()) { parent = new CmsFolder(createResource(res, projectId)); while (res.next()) { // do nothing only move through all rows because of mssql odbc driver } } } catch (SQLException e) { throw new CmsDbSqlException(Messages.get().container( Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)), e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, res); } return parent; }
return new CmsFolder( structureId, resourceId,
/** * Converts a resource to a folder (if possible).<p> * * @param resource the resource to convert * @return the converted resource * * @throws CmsVfsResourceNotFoundException if the resource is not a folder */ protected CmsFolder convertResourceToFolder(CmsResource resource) throws CmsVfsResourceNotFoundException { if (resource.isFolder()) { return new CmsFolder(resource); } throw new CmsVfsResourceNotFoundException(Messages.get().container( Messages.ERR_ACCESS_FILE_AS_FOLDER_1, resource.getRootPath())); }
return new CmsFolder( structureId, resourceId,
/** * Returns a clone of this Objects instance.<p> * * @return a clone of this instance */ @Override public Object clone() { CmsResource clone = new CmsFolder( getStructureId(), getResourceId(), getRootPath(), getTypeId(), getFlags(), getProjectLastModified(), getState(), getDateCreated(), getUserCreated(), getDateLastModified(), getUserLastModified(), getDateReleased(), getDateExpired(), getVersion()); if (isTouched()) { clone.setDateLastModified(getDateLastModified()); } return clone; }
} else { newResource = new CmsFolder( resource.getStructureId(), resource.getResourceId(),
CmsFolder restoredFolder = new CmsFolder( onlineResource.getStructureId(), onlineResource.getResourceId(),
CmsResource resource = new CmsFolder( new CmsUUID(), new CmsUUID(),
CmsResource resource = new CmsFolder( new CmsUUID(), new CmsUUID(),
return new CmsFolder( structureId, resourceId,
CmsResource resource = new CmsFolder( new CmsUUID(), new CmsUUID(),