/** * Returns the container-page type id, but returns -1 instead of throwing an exception when an error happens.<p> * * @return the container-page type id */ public static int getContainerPageTypeIdSafely() { try { return getContainerPageTypeId(); } catch (CmsLoaderException e) { if (LOG.isDebugEnabled()) { LOG.debug(e.getLocalizedMessage(), e); } return -1; } }
/** * @see org.opencms.workplace.galleries.A_CmsAjaxGallery#getGalleryTypeId() */ @Override public int getGalleryTypeId() { try { this.m_galleryTypeId = OpenCms.getResourceManager().getResourceType(GALLERYTYPE_NAME).getTypeId(); } catch (CmsLoaderException e) { // resource type not found, log error if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } return this.m_galleryTypeId; }
/** * @see org.opencms.workplace.galleries.A_CmsAjaxGallery#getGalleryTypeId() */ @Override public int getGalleryTypeId() { try { m_galleryTypeId = OpenCms.getResourceManager().getResourceType(GALLERYTYPE_NAME).getTypeId(); } catch (CmsLoaderException e) { // resource type not found, log error if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } return m_galleryTypeId; }
/** * @see org.opencms.workplace.galleries.A_CmsAjaxGallery#getGalleryTypeId() */ @Override public int getGalleryTypeId() { try { m_galleryTypeId = OpenCms.getResourceManager().getResourceType(GALLERYTYPE_NAME).getTypeId(); } catch (CmsLoaderException e) { // resource type not found, log error if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } return m_galleryTypeId; }
/** * @see org.opencms.workplace.galleries.A_CmsAjaxGallery#getGalleryTypeId() */ @Override public int getGalleryTypeId() { try { m_galleryTypeId = OpenCms.getResourceManager().getResourceType(GALLERYTYPE_NAME).getTypeId(); } catch (CmsLoaderException e) { // resource type not found, log error if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } return m_galleryTypeId; }
/** * @see org.opencms.workplace.galleries.A_CmsAjaxGallery#getGalleryTypeId() */ @Override public int getGalleryTypeId() { try { m_galleryTypeId = OpenCms.getResourceManager().getResourceType(GALLERYTYPE_NAME).getTypeId(); } catch (CmsLoaderException e) { // resource type not found, log error if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } return m_galleryTypeId; }
/** * @see org.opencms.workplace.galleries.A_CmsAjaxGallery#getGalleryTypeId() */ @Override public int getGalleryTypeId() { try { m_galleryTypeId = OpenCms.getResourceManager().getResourceType(GALLERYTYPE_NAME).getTypeId(); } catch (CmsLoaderException e) { // resource type not found, log error if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } return m_galleryTypeId; }
/** * @see org.opencms.workplace.galleries.A_CmsAjaxGallery#getGalleryTypeId() */ @Override public int getGalleryTypeId() { try { this.m_galleryTypeId = OpenCms.getResourceManager().getResourceType(GALLERYTYPE_NAME).getTypeId(); } catch (CmsLoaderException e) { // resource type not found, log error if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } return this.m_galleryTypeId; }
/** * @see org.opencms.workplace.galleries.A_CmsAjaxGallery#getGalleryTypeId() */ @Override public int getGalleryTypeId() { try { this.m_galleryTypeId = OpenCms.getResourceManager().getResourceType(GALLERYTYPE_NAME).getTypeId(); } catch (CmsLoaderException e) { // resource type not found, log error if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } return this.m_galleryTypeId; }
/** * @see org.opencms.workplace.galleries.A_CmsAjaxGallery#getGalleryTypeId() */ @Override public int getGalleryTypeId() { try { this.m_galleryTypeId = OpenCms.getResourceManager().getResourceType(GALLERYTYPE_NAME).getTypeId(); } catch (CmsLoaderException e) { // resource type not found, log error if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } return this.m_galleryTypeId; }
/** * @see org.opencms.workplace.galleries.A_CmsAjaxGallery#getGalleryTypeId() */ @Override public int getGalleryTypeId() { try { this.m_galleryTypeId = OpenCms.getResourceManager().getResourceType(GALLERYTYPE_NAME).getTypeId(); } catch (CmsLoaderException e) { // resource type not found, log error if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } return this.m_galleryTypeId; }
/** * Gets the types for which a given resource is configured as a detail page.<p> * * @param resource a resource for which we want to find the detail page types * * @return the list of resource types for which the given page is configured as a detail page */ protected List<I_CmsResourceType> getDetailTypesForPage(CmsResource resource) { Collection<String> typesForPage = m_detailTypesByPage.get(resource.getRootPath()); String parentPath = CmsFileUtil.removeTrailingSeparator(CmsResource.getParentFolder(resource.getRootPath())); Collection<String> typesForFolder = m_detailTypesByPage.get(parentPath); Set<String> allTypes = new HashSet<String>(); allTypes.addAll(typesForPage); allTypes.addAll(typesForFolder); List<I_CmsResourceType> resTypes = new ArrayList<I_CmsResourceType>(); CmsResourceManager resMan = OpenCms.getResourceManager(); for (String typeName : allTypes) { try { I_CmsResourceType resType = resMan.getResourceType(typeName); resTypes.add(resType); } catch (CmsLoaderException e) { LOG.warn("Invalid resource type name" + typeName + "! " + e.getLocalizedMessage(), e); } } return resTypes; }
/** * Initializes the values for the notification widgets.<p> */ public void initNotification() { if (m_dialogContext.getResources().size() == 1) { CmsResource resource = m_dialogContext.getResources().get(0); try { m_availabilityInfo = getAvailabilityInfo(A_CmsUI.getCmsObject(), resource); m_initialNotificationInterval = "" + m_availabilityInfo.getNotificationInterval(); m_initialNotificationEnabled = Boolean.valueOf(m_availabilityInfo.isNotificationEnabled()); } catch (CmsLoaderException e) { LOG.error(e.getLocalizedMessage(), e); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); } } }
/** * @see org.opencms.workplace.galleries.A_CmsAjaxGallery#getGalleryItemsTypeId() */ @Override public int getGalleryItemsTypeId() { int imageId; try { imageId = OpenCms.getResourceManager().getResourceType( CmsResourceTypeImage.getStaticTypeName()).getTypeId(); } catch (CmsLoaderException e1) { // should really never happen LOG.warn(e1.getLocalizedMessage(), e1); imageId = CmsResourceTypeImage.getStaticTypeId(); } return imageId; }
/** * Gets the formatter configuration for a resource.<p> * * @param cms the current CMS context * @param res the resource for which the formatter configuration should be retrieved * * @return the configuration of formatters for the resource */ public CmsFormatterConfiguration getFormatters(CmsObject cms, CmsResource res) { try { int resTypeId = res.getTypeId(); return getFormatters( cms, OpenCms.getResourceManager().getResourceType(resTypeId), getFormattersFromSchema(cms, res)); } catch (CmsLoaderException e) { LOG.warn(e.getLocalizedMessage(), e); return null; } }
/** * Checks if the cache needs to be updated for the resource, and if so, marks the structure id for updating.<p> * * @param structureId the structure id for the resource * @param rootPath the path of the resource * @param typeId the resource type id */ private void checkIfUpdateIsNeeded(CmsUUID structureId, String rootPath, int typeId) { try { I_CmsResourceType resType = OpenCms.getResourceManager().getResourceType(typeId); if ((resType instanceof CmsResourceTypeXmlContent) && !OpenCms.getResourceManager().matchResourceType( CmsResourceTypeXmlContainerPage.RESOURCE_TYPE_NAME, typeId)) { markForUpdate(structureId); } } catch (CmsLoaderException e) { // resource type not found, just log an error LOG.error(e.getLocalizedMessage(), e); } }
/** * Gets the default view name ( = explorer type) for the given type.<p> * * @param typeName a resource type name * @return the default view for the given type */ String getDefaultView(String typeName) { String result = m_defaultViewRules.getViewForType(typeName); if (result == null) { result = "view_other"; try { if (OpenCms.getResourceManager().hasResourceType(typeName) && OpenCms.getResourceManager().getResourceType(typeName).isFolder()) { result = "view_folders"; } } catch (CmsLoaderException e) { LOG.error(e.getLocalizedMessage(), e); } } return result; }
/** * Returns the image resources of the gallery folder which are edited in the dialog form.<p> * * @return the images of the gallery folder which are edited in the dialog form */ protected List<CmsResource> getImages() { // get all image resources of the folder int imageId; try { imageId = OpenCms.getResourceManager().getResourceType( CmsResourceTypeImage.getStaticTypeName()).getTypeId(); } catch (CmsLoaderException e1) { // should really never happen LOG.warn(e1.getLocalizedMessage(), e1); imageId = CmsResourceTypeImage.getStaticTypeId(); } CmsResourceFilter filter = CmsResourceFilter.IGNORE_EXPIRATION.addRequireType(imageId); try { return getCms().readResources(getParamResource(), filter, false); } catch (CmsException e) { // log, should never happen if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(getLocale())); } return Collections.emptyList(); } }
/** * Returns a lucene document factory for given resource.<p> * * The type of the document factory is selected by the type of the resource * and the MIME type of the resource content, according to the configuration in <code>opencms-search.xml</code>.<p> * * @param resource a cms resource * @return a lucene document factory or null */ public I_CmsDocumentFactory getDocumentFactory(CmsResource resource) { // first get the MIME type of the resource String mimeType = OpenCms.getResourceManager().getMimeType(resource.getRootPath(), null, "unknown"); String resourceType = null; try { resourceType = OpenCms.getResourceManager().getResourceType(resource.getTypeId()).getTypeName(); } catch (CmsLoaderException e) { // ignore, unknown resource type, resource can not be indexed LOG.info(e.getLocalizedMessage(), e); } return getDocumentFactory(resourceType, mimeType); }
LOG.error(e.getLocalizedMessage(), e);