/** * @see org.opencms.main.CmsRuntimeException#createException(org.opencms.i18n.CmsMessageContainer, java.lang.Throwable) */ @Override public CmsRuntimeException createException(CmsMessageContainer container, Throwable cause) { return new CmsIllegalArgumentException(container, cause); } }
/** * Checks whether a name is a valid OpenCms resource name and throws an exception otherwise.<p> * * @param name the name to check */ public static void checkResourceName(String name) { try { CmsResource.checkResourceName(name); } catch (CmsIllegalArgumentException e) { throw new CmisNameConstraintViolationException(e.getLocalizedMessage(), e); } }
/** * @see org.opencms.main.CmsRuntimeException#createException(org.opencms.i18n.CmsMessageContainer, java.lang.Throwable) */ @Override public CmsRuntimeException createException(CmsMessageContainer container, Throwable cause) { return new CmsIllegalArgumentException(container, cause); } }
/** * Returns a list of container elements from a list with client id's.<p> * * @param clientIds list of client id's * @param pageRootPath the container page root path * * @return a list of element beans * @throws CmsException in case reading the element resource fails */ private List<CmsContainerElementBean> getCachedElements(List<String> clientIds, String pageRootPath) throws CmsException { List<CmsContainerElementBean> result = new ArrayList<CmsContainerElementBean>(); for (String id : clientIds) { try { result.add(getCachedElement(id, pageRootPath)); } catch (CmsIllegalArgumentException e) { log(e.getLocalizedMessage(), e); } } return result; }
/** * Sets the content Age.<p> * * @param contentAge the content Age to set */ public void setContentAge(long contentAge) { if (contentAge < 0) { String ageString = Long.toString(contentAge); throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_BAD_CONTENT_AGE_1, ageString)); } m_contentAge = contentAge; }
/** * @see com.vaadin.data.Validator#validate(java.lang.Object) */ public void validate(Object value) throws InvalidValueException { CmsScheduledJobInfo info = new CmsScheduledJobInfo(); String name = (String)value; try { info.setJobName(name); } catch (CmsIllegalArgumentException e) { throw new InvalidValueException(e.getLocalizedMessage(A_CmsUI.get().getLocale())); } } }
/** * @see org.opencms.xml.I_CmsXmlDocument#hasLocale(java.util.Locale) */ public boolean hasLocale(Locale locale) { if (locale == null) { throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_NULL_LOCALE_0)); } return m_locales.contains(locale); }
/** * @see com.vaadin.data.Validator#validate(java.lang.Object) */ public void validate(Object value) throws InvalidValueException { CmsScheduledJobInfo info = new CmsScheduledJobInfo(); // Job name may be needed in exception try { info.setJobName(m_fieldJobName.getValue()); } catch (CmsRuntimeException e) { throw new InvalidValueException(e.getLocalizedMessage(A_CmsUI.get().getLocale())); } String stringValue = (String)value; try { info.setCronExpression(stringValue); } catch (CmsIllegalArgumentException e) { throw new InvalidValueException(e.getLocalizedMessage(A_CmsUI.get().getLocale())); } } }
/** * @see org.opencms.xml.I_CmsXmlDocument#hasLocale(java.util.Locale) */ public boolean hasLocale(Locale locale) { if (locale == null) { throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_NULL_LOCALE_0)); } return m_locales.contains(locale); }
/** * @see com.vaadin.data.Validator#validate(java.lang.Object) */ public void validate(Object value) throws InvalidValueException { CmsScheduledJobInfo info = new CmsScheduledJobInfo(); String stringValue = (String)value; // Job name may be needed in exception try { info.setJobName(m_fieldJobName.getValue()); } catch (CmsRuntimeException e) { throw new InvalidValueException(e.getLocalizedMessage(A_CmsUI.get().getLocale())); } try { info.setClassName(stringValue); } catch (CmsIllegalArgumentException e) { throw new InvalidValueException(e.getLocalizedMessage(A_CmsUI.get().getLocale())); } } }
/** * Sets the content Age.<p> * * @param contentAge the content Age to set */ public void setContentAge(long contentAge) { if (contentAge < 0) { String ageString = Long.toString(contentAge); throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_BAD_CONTENT_AGE_1, ageString)); } m_contentAge = contentAge; }
/** * Sets the timestamp to limit the resources to be exported by date.<p> * * Only resources that have been modified after this date will be exported.<p> * * @param contentAge the timestamp to limit the resources to be exported by date * * @deprecated use {@link #setExportParams(CmsExportParameters)} instead */ @Deprecated public void setContentAge(long contentAge) { if (contentAge < 0) { String ageString = Long.toString(contentAge); throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_BAD_CONTENT_AGE_1, ageString)); } m_contentAge = contentAge; }
/** * Sets the file path, should be a zip file.<p> * * @param path the file path */ public void setPath(String path) { if (CmsStringUtil.isEmpty(path) || !path.trim().equals(path)) { throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_BAD_FILE_NAME_1, path)); } m_path = path; }
/** * Adds a list a messages instances to this multi message bundle.<p> * * @param messages the messages instance to add */ public void addMessages(List<CmsMessages> messages) { if (messages == null) { throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_MULTIMSG_EMPTY_LIST_0)); } Iterator<CmsMessages> i = messages.iterator(); while (i.hasNext()) { addMessages(i.next()); } }
/** * Sets the file path, should be a zip file.<p> * * @param path the file path */ public void setPath(String path) { if (CmsStringUtil.isEmpty(path) || !path.trim().equals(path)) { throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_BAD_FILE_NAME_1, path)); } m_path = path; }
/** * Sets the name of the export file in the real file system.<p> * * @param fileName the name of the export file in the real file system * * @deprecated use {@link #setExportParams(CmsExportParameters)} instead */ @Deprecated public void setFileName(String fileName) { if (CmsStringUtil.isEmpty(fileName) || !fileName.trim().equals(fileName)) { throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_BAD_FILE_NAME_1, fileName)); } m_fileName = fileName; }
/** * Adds a list a messages instances to this multi message bundle.<p> * * @param messages the messages instance to add */ public void addMessages(List messages) { if (messages == null) { throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_MULTIMSG_EMPTY_LIST_0)); } Iterator i = messages.iterator(); while (i.hasNext()) { addMessages((CmsMessages)i.next()); } }
/** * Sets the search index to use for the search. <p> * * @param index the search index to use for the search to set. * * @throws CmsIllegalArgumentException if null is given as argument */ public void setSearchIndex(CmsSearchIndex index) throws CmsIllegalArgumentException { if (index == null) { throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_INDEX_NULL_0)); } m_index = index; }
/** * Sets the timestamp to limit the resources to be exported by date.<p> * * Only resources that have been modified after this date will be exported.<p> * * @param contentAge the timestamp to limit the resources to be exported by date * * @deprecated use {@link #setExportParams(CmsExportParameters)} instead */ public void setContentAge(long contentAge) { if (contentAge < 0) { String ageString = Long.toString(contentAge); throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_BAD_CONTENT_AGE_1, ageString)); } m_contentAge = contentAge; }
/** * Sets the name of the export file in the real file system.<p> * * @param fileName the name of the export file in the real file system * * @deprecated use {@link #setExportParams(CmsExportParameters)} instead */ public void setFileName(String fileName) { if (CmsStringUtil.isEmpty(fileName) || !fileName.trim().equals(fileName)) { throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_BAD_FILE_NAME_1, fileName)); } m_fileName = fileName; }