/** * Creates a clone of this context info object.<p> * * @see java.lang.Object#clone() */ @Override public Object clone() { CmsContextInfo result = new CmsContextInfo(); result.m_encoding = m_encoding; result.m_frozen = false; result.m_locale = m_locale; result.m_localeName = m_localeName; result.m_project = m_project; result.m_projectName = m_projectName; result.m_remoteAddr = m_remoteAddr; result.m_requestedUri = m_requestedUri; result.m_requestTime = m_requestTime; result.m_siteRoot = m_siteRoot; result.m_user = m_user; result.m_userName = m_userName; return result; }
/** * Creates a clone of this context info object.<p> * * @see java.lang.Object#clone() */ @Override public Object clone() { CmsContextInfo result = new CmsContextInfo(); result.m_encoding = m_encoding; result.m_frozen = false; result.m_locale = m_locale; result.m_localeName = m_localeName; result.m_project = m_project; result.m_projectName = m_projectName; result.m_isSecureRequest = m_isSecureRequest; result.m_remoteAddr = m_remoteAddr; result.m_requestedUri = m_requestedUri; result.m_requestTime = m_requestTime; result.m_siteRoot = m_siteRoot; result.m_user = m_user; result.m_userName = m_userName; return result; }
/** * Returns an initialized CmsObject with the user initialized as provided, * with the "Online" project selected and "/" set as the current site root.<p> * * Note: Only the default users 'Guest' and 'Export' can initialized with * this method, all other user names will throw an Exception.<p> * * @param user the user name to initialize, can only be * {@link org.opencms.db.CmsDefaultUsers#getUserGuest()} or * {@link org.opencms.db.CmsDefaultUsers#getUserExport()} * * @return an initialized CmsObject with the given users permissions * * @throws CmsException if an invalid user name was provided, or if something else goes wrong * * @see org.opencms.db.CmsDefaultUsers#getUserGuest() * @see org.opencms.db.CmsDefaultUsers#getUserExport() * @see OpenCms#initCmsObject(String) * @see #initCmsObject(CmsObject, CmsContextInfo) */ protected CmsObject initCmsObject(String user) throws CmsException { return initCmsObject(null, new CmsContextInfo(user)); }
/** * Returns an initialized CmsObject with the user initialized as provided, * with the "Online" project selected and "/" set as the current site root.<p> * * Note: Only the default users 'Guest' and 'Export' can initialized with * this method, all other user names will throw an Exception.<p> * * @param user the user name to initialize, can only be * {@link org.opencms.db.CmsDefaultUsers#getUserGuest()} or * {@link org.opencms.db.CmsDefaultUsers#getUserExport()} * * @return an initialized CmsObject with the given users permissions * * @throws CmsException if an invalid user name was provided, or if something else goes wrong * * @see org.opencms.db.CmsDefaultUsers#getUserGuest() * @see org.opencms.db.CmsDefaultUsers#getUserExport() * @see OpenCms#initCmsObject(String) * @see #initCmsObject(CmsObject, CmsContextInfo) */ protected CmsObject initCmsObject(String user) throws CmsException { return initCmsObject(null, new CmsContextInfo(user)); }
/** * Returns an independent copy of the provided CmsObject.<p> * * This can be useful in case a permanent reference to a CmsObject is stored. * Changing the request context values (for example project, siteroot) in the new CmsObject * will have no side effects to the CmsObject it was copied form.<p> * * The request time (<code>{@link CmsRequestContext#getRequestTime()}</code>) * is set to the current time.<p> * * @param cms the CmsObject to create a copy of * * @return an independent copy of the provided CmsObject * * @throws CmsException in case the initialization failed * * @see OpenCms#initCmsObject(CmsObject) * @see OpenCms#initCmsObject(CmsObject, CmsContextInfo) * @see OpenCms#initCmsObject(String) */ protected CmsObject initCmsObject(CmsObject cms) throws CmsException { CmsContextInfo contextInfo = new CmsContextInfo(cms.getRequestContext()); contextInfo.setRequestTime(CmsContextInfo.CURRENT_TIME); return initCmsObject(contextInfo); }
/** * Returns an independent copy of the provided CmsObject.<p> * * This can be useful in case a permanent reference to a CmsObject is stored. * Changing the request context values (for example project, siteroot) in the new CmsObject * will have no side effects to the CmsObject it was copied form.<p> * * The request time (<code>{@link CmsRequestContext#getRequestTime()}</code>) * is set to the current time.<p> * * @param cms the CmsObject to create a copy of * * @return an independent copy of the provided CmsObject * * @throws CmsException in case the initialization failed * * @see OpenCms#initCmsObject(CmsObject) * @see OpenCms#initCmsObject(CmsObject, CmsContextInfo) * @see OpenCms#initCmsObject(String) */ protected CmsObject initCmsObject(CmsObject cms) throws CmsException { CmsContextInfo contextInfo = new CmsContextInfo(cms.getRequestContext()); contextInfo.setRequestTime(CmsContextInfo.CURRENT_TIME); return initCmsObject(contextInfo); }
CmsContextInfo contextInfo = new CmsContextInfo( user, project,
CmsContextInfo contextInfo = new CmsContextInfo(m_adminCms.getRequestContext()); contextInfo.setUserName(principal); CmsObject newCms = initCmsObject(m_adminCms, contextInfo);
CmsContextInfo contextInfo = new CmsContextInfo( user, project,
/** * Revives this publish job.<p> * * @param adminCms an admin cms object * @param publishList a publish list * * @throws CmsException if something goes wrong */ public void revive(CmsObject adminCms, CmsPublishList publishList) throws CmsException { CmsContextInfo context = new CmsContextInfo(adminCms.readUser(m_userId).getName()); CmsProject project = adminCms.readProject(m_projectId); context.setLocale(m_locale); m_cms = OpenCms.initCmsObject(adminCms, context); m_cms.getRequestContext().setCurrentProject(project); m_publishList = publishList; m_publishList.revive(m_cms); }
/** * Revives this publish job.<p> * * @param adminCms an admin cms object * @param publishList a publish list * * @throws CmsException if something goes wrong */ public void revive(CmsObject adminCms, CmsPublishList publishList) throws CmsException { CmsContextInfo context = new CmsContextInfo(adminCms.readUser(m_userId).getName()); CmsProject project = adminCms.readProject(m_projectId); context.setLocale(m_locale); m_cms = OpenCms.initCmsObject(adminCms, context); m_cms.getRequestContext().setCurrentProject(project); m_publishList = publishList; m_publishList.revive(m_cms); }
m_jobInfo.setContextInfo(new CmsContextInfo()); } else {
CmsContextInfo contextInfo = new CmsContextInfo(); contextInfo.setProjectName(tmpProject.getName()); contextInfo.setUserName(cmsAdmin.getRequestContext().getCurrentUser().getName());
CmsContextInfo contextInfo = new CmsContextInfo(m_adminCms.getRequestContext()); contextInfo.setUserName(principal); CmsObject newCms = initCmsObject(m_adminCms, contextInfo);
CmsContextInfo contextInfo = new CmsContextInfo(); contextInfo.setProjectName(projectName); contextInfo.setUserName(cmsAdmin.getRequestContext().getCurrentUser().getName());
CmsContextInfo ctxInfo = new CmsContextInfo(exportCms.getRequestContext()); ctxInfo.setLocale(locale); locCms = OpenCms.initCmsObject(exportCms, ctxInfo);
/** * Creates a CmsObjectWrapper for the current session.<p> * * @param session the current session * @param connection the tree connection * * @return the correctly configured CmsObjectWrapper for this session * * @throws CmsException if something goes wrong */ public CmsObjectWrapper getCms(SrvSession session, TreeConnection connection) throws CmsException { String userName = session.getClientInformation().getUserName(); userName = CmsJlanUsers.translateUser(userName); CmsContextInfo contextInfo = new CmsContextInfo(m_cms.getRequestContext()); contextInfo.setUserName(userName); CmsObject newCms = OpenCms.initCmsObject(m_cms, contextInfo); newCms.getRequestContext().setSiteRoot(getRoot()); newCms.getRequestContext().setCurrentProject(getProject()); CmsObjectWrapper result = new CmsObjectWrapper(newCms, getWrappers()); result.setAddByteOrderMark(m_addByteOrderMark); result.getRequestContext().setAttribute(CmsXmlContent.AUTO_CORRECTION_ATTRIBUTE, Boolean.TRUE); return result; }
m_cms = OpenCms.initCmsObject( CmsUgcModuleAction.getAdminCms(), new CmsContextInfo(m_configuration.getUserForGuests().get().getName())); m_cms.getRequestContext().setSiteRoot(cms.getRequestContext().getSiteRoot()); } else {
job.setContextInfo(new CmsContextInfo());
CmsContextInfo dC = new CmsContextInfo();