/** * Returns the name of the user who last modified the given resource.<p> * * @return the name of the user who last modified the given resource */ public String getUserLastModified() { String user = m_resource.getUserLastModified().toString(); try { user = getCurrentOuRelativeName( CmsPrincipal.readPrincipalIncludingHistory(getCms(), m_resource.getUserLastModified()).getName()); } catch (Throwable e) { LOG.info(e.getLocalizedMessage()); } return user; }
/** * Returns the name of the user who last modified the given resource.<p> * * @return the name of the user who last modified the given resource */ public String getUserLastModified() { String user = m_resource.getUserLastModified().toString(); try { user = getCurrentOuRelativeName(CmsPrincipal.readPrincipalIncludingHistory( getCms(), m_resource.getUserLastModified()).getName()); } catch (Throwable e) { LOG.error(e.getLocalizedMessage()); } return user; }
/** * Returns the user who made the last changes to the current resource.<p> * * @return the user who changed the resource */ protected String getLastModifiedUser() { CmsUUID userId = getCurrentResource().getUserLastModified(); try { return getCms().readUser(userId).getName(); } catch (CmsException e) { return ""; } }
/** * Returns the user who made the last changes to the current resource.<p> * * @return the user who changed the resource */ protected String getLastModifiedUser() { CmsUUID userId = getCurrentResource().getUserLastModified(); try { return getCms().readUser(userId).getName(); } catch (CmsException e) { return ""; } }
resource.getUserCreated(), resource.getDateLastModified(), resource.getUserLastModified(), resource.getDateReleased(), resource.getDateExpired(),
lastModifiedUser = resource.getUserLastModified();
lastModifiedUser = resource.getUserLastModified();
/** * @see org.opencms.workflow.CmsDefaultPublishResourceFormatter.I_PublishResourceValidator#getInfoForResource(org.opencms.file.CmsResource) */ public CmsPublishResourceInfo getInfoForResource(CmsResource resource) throws CmsException { String info; CmsPublishResourceInfo.Type infoType; CmsPublishResourceInfo infoObj; String publishUser = getOuAwareName(m_cms, m_cms.readUser(resource.getUserLastModified()).getName()); Date publishDate = new Date(resource.getDateLastModified()); info = Messages.get().getBundle(getLocale()).key( Messages.GUI_RESOURCE_PUBLISHED_BY_2, publishUser, publishDate); infoType = CmsPublishResourceInfo.Type.PUBLISHED; infoObj = new CmsPublishResourceInfo(info, infoType); return infoObj; } }
resource.getUserCreated(), resource.getDateLastModified(), resource.getUserLastModified(), resource.getDateReleased(), resource.getDateExpired(),
/** * @see org.opencms.db.I_CmsVfsDriver#transferResource(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.file.CmsResource, org.opencms.util.CmsUUID, org.opencms.util.CmsUUID) */ public void transferResource( CmsDbContext dbc, CmsProject project, CmsResource resource, CmsUUID createdUser, CmsUUID lastModifiedUser) throws CmsDataAccessException { if (createdUser == null) { createdUser = resource.getUserCreated(); } if (lastModifiedUser == null) { lastModifiedUser = resource.getUserLastModified(); } try { Query q = m_sqlManager.createQuery(dbc, project, C_RESOURCES_TRANSFER_RESOURCE); q.setParameter(1, resource.getResourceId().toString()); @SuppressWarnings("unchecked") List<I_CmsDAOResources> res = q.getResultList(); for (I_CmsDAOResources r : res) { r.setUserCreated(createdUser.toString()); r.setUserLastModified(lastModifiedUser.toString()); } } catch (PersistenceException e) { throw new CmsDataAccessException(Messages.get().container(Messages.ERR_JPA_PERSITENCE_1, e), e); } }
/** * Adds additional info items for broken links.<p> * * @param cms the CMS context to use * @param resource the resource from which the additional infos should be read * @param result the result in which to store the additional info */ private void addBrokenLinkAdditionalInfo(CmsObject cms, CmsResource resource, CmsBrokenLinkBean result) { String dateLastModifiedLabel = org.opencms.workplace.commons.Messages.get().getBundle( OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)).key( org.opencms.workplace.commons.Messages.GUI_LABEL_DATE_LAST_MODIFIED_0); String dateLastModified = CmsVfsService.formatDateTime(cms, resource.getDateLastModified()); String userLastModifiedLabel = org.opencms.workplace.commons.Messages.get().getBundle( OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)).key( org.opencms.workplace.commons.Messages.GUI_LABEL_USER_LAST_MODIFIED_0); String userLastModified = "" + resource.getUserLastModified(); try { userLastModified = cms.readUser(resource.getUserLastModified()).getName(); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); } result.addInfo(dateLastModifiedLabel, dateLastModified); result.addInfo(userLastModifiedLabel, userLastModified); }
m_userLastModified = cms.readUser(res.getUserLastModified()).getFullName(); } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e);
/** * Enumeration class for the mode parameter in the * {@link CmsDriverManager#readChangedResourcesInsideProject(CmsDbContext, CmsUUID, CmsReadChangedProjectResourceMode)} * method.<p> */ private static class CmsReadChangedProjectResourceMode { /** * Default constructor.<p> */ protected CmsReadChangedProjectResourceMode() { // noop } }
/** * @see org.opencms.gwt.shared.rpc.I_CmsCoreService#lockTempAndCheckModification(org.opencms.util.CmsUUID, long) */ public CmsLockInfo lockTempAndCheckModification(CmsUUID structureId, long modification) throws CmsRpcException { CmsObject cms = getCmsObject(); try { CmsResource resource = cms.readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION); if (resource.getDateLastModified() != modification) { CmsUser user = cms.readUser(resource.getUserLastModified()); return CmsLockInfo.forChangedResource(user.getFullName()); } } catch (Throwable e) { error(e); } try { return getLock(structureId); } catch (CmsException e) { return CmsLockInfo.forError(e.getLocalizedMessage()); } }
/** * Constructor, creates a new CmsFolder Object from the given CmsResource.<p> * * @param resource the base resource object to create a folder from */ public CmsFolder(CmsResource resource) { this( resource.getStructureId(), resource.getResourceId(), resource.getRootPath(), resource.getTypeId(), resource.getFlags(), resource.getProjectLastModified(), resource.getState(), resource.getDateCreated(), resource.getUserCreated(), resource.getDateLastModified(), resource.getUserLastModified(), resource.getDateReleased(), resource.getDateExpired(), resource.getVersion()); }
/** * Returns the virtual resource.<p> * * @return the virtual resource */ public CmsResource getResource() { return new CmsResource( m_base.getStructureId(), m_base.getResourceId(), m_rootPath, m_typeId, m_isFolder, m_base.getFlags(), m_base.getProjectLastModified(), m_base.getState(), m_base.getDateCreated(), m_base.getUserCreated(), m_base.getDateLastModified(), m_base.getUserLastModified(), m_base.getDateReleased(), m_base.getDateExpired(), m_base.getSiblingCount(), m_length, m_base.getDateContent(), m_base.getVersion()); }
/** * Constructor, creates a new file Object from the given resource with * an empty byte array as file content, if the resource does not * implement a file.<p> * * @param resource the base resource object to create a file from * @param doc the search document */ public CmsSearchResource(CmsResource resource, I_CmsSearchDocument doc) { this( resource.getStructureId(), resource.getResourceId(), resource.getRootPath(), resource.getTypeId(), resource.getFlags(), resource.getProjectLastModified(), resource.getState(), resource.getDateCreated(), resource.getUserCreated(), resource.getDateLastModified(), resource.getUserLastModified(), resource.getDateReleased(), resource.getDateExpired(), resource.getSiblingCount(), resource.getLength(), resource.getDateContent(), resource.getVersion(), doc); }
/** * Creates a new instance.<p> * * @param cms the current CMS context * @param res the resource to wrap */ public CmsJspResourceWrapper(CmsObject cms, CmsResource res) { super( res.getStructureId(), res.getResourceId(), res.getRootPath(), res.getTypeId(), res.isFolder(), res.getFlags(), res.getProjectLastModified(), res.getState(), res.getDateCreated(), res.getUserCreated(), res.getDateLastModified(), res.getUserLastModified(), res.getDateReleased(), res.getDateExpired(), res.getSiblingCount(), res.getLength(), res.getDateContent(), res.getVersion()); m_cms = cms; }
/** * Constructor, creates a new file Object from the given resource with * an empty byte array as file content, if the resource does not * implement a file.<p> * * @param resource the base resource object to create a file from */ public CmsFile(CmsResource resource) { this( resource.getStructureId(), resource.getResourceId(), resource.getRootPath(), resource.getTypeId(), resource.getFlags(), resource.getProjectLastModified(), resource.getState(), resource.getDateCreated(), resource.getUserCreated(), resource.getDateLastModified(), resource.getUserLastModified(), resource.getDateReleased(), resource.getDateExpired(), resource.getSiblingCount(), resource.getLength(), resource.getDateContent(), resource.getVersion(), // if the resource already is a file, keep contents that might have been already read resource instanceof CmsFile ? ((CmsFile)resource).getContents() : null); }
/** * Returns the base element data for the given element bean, without content or formatter info.<p> * * @param page the current container page * @param element the resource * * @return base element data * * @throws CmsException in case reading the data fails */ private CmsContainerElementData getBaseElementData(CmsResource page, CmsContainerElementBean element) throws CmsException { CmsResourceUtil resUtil = new CmsResourceUtil(m_cms, element.getResource()); CmsContainerElementData elementData = new CmsContainerElementData(); setElementInfo(element, elementData); elementData.setLastModifiedDate(element.getResource().getDateLastModified()); elementData.setLastModifiedByUser(m_cms.readUser(element.getResource().getUserLastModified()).getName()); elementData.setNavText(resUtil.getNavText()); Map<String, CmsXmlContentProperty> settingConfig = CmsXmlContentPropertyHelper.getPropertyInfo( m_cms, page, element.getResource()); elementData.setSettings( CmsXmlContentPropertyHelper.convertPropertiesToClientFormat( m_cms, element.getIndividualSettings(), settingConfig)); return elementData; }