/** * Validates fields that may contain a URL * * @param widget {@link org.apache.rave.model.Widget} to validate * @param errors {@link org.springframework.validation.Errors} */ private void validateUrlFields(Widget widget, Errors errors) { String url = widget.getUrl(); if (StringUtils.isNotBlank(url) && !urlValidator.isValid(url)) { errors.rejectValue(FIELD_URL, "widget.url.malformed"); } String screenshotUrl = widget.getScreenshotUrl(); if (StringUtils.isNotBlank(screenshotUrl) && !urlValidator.isValid(screenshotUrl)) { errors.rejectValue("screenshotUrl", "widget.screenshotUrl.malformed"); } String thumbnailUrl = widget.getThumbnailUrl(); if (StringUtils.isNotBlank(thumbnailUrl) && !urlValidator.isValid(thumbnailUrl)) { errors.rejectValue("thumbnailUrl", "widget.thumbnailUrl.malformed"); } String titleUrl = widget.getTitleUrl(); if (StringUtils.isNotBlank(titleUrl) && !urlValidator.isValid(titleUrl)) { errors.rejectValue("titleUrl", "widget.titleUrl.malformed"); } }
public Widget(org.apache.rave.model.Widget base) { this.id = base.getId(); this.title = base.getTitle(); this.titleUrl = base.getTitleUrl(); this.url = base.getUrl(); this.thumbnailUrl = base.getThumbnailUrl(); this.screenshotUrl = base.getScreenshotUrl(); this.type = base.getType(); this.author = base.getAuthor(); this.authorEmail = base.getAuthorEmail(); this.description = base.getDescription(); this.status = base.getWidgetStatus(); this.disable = base.isDisableRendering(); this.disabledMessage = base.getDisableRenderingMessage(); this.featured = base.isFeatured(); this.properties = base.getProperties(); }
private void updateProperties(Widget source, JpaWidget converted) { converted.setEntityId(source.getId() == null ? null : Long.parseLong(source.getId())); converted.setUrl(source.getUrl()); converted.setType(source.getType()); converted.setTitle(source.getTitle()); converted.setTitleUrl(source.getTitleUrl()); converted.setUrl(source.getUrl()); converted.setThumbnailUrl(source.getThumbnailUrl()); converted.setScreenshotUrl(source.getScreenshotUrl()); converted.setAuthor(source.getAuthor()); converted.setAuthorEmail(source.getAuthorEmail()); converted.setDescription(source.getDescription()); converted.setWidgetStatus(source.getWidgetStatus()); converted.setComments(source.getComments()); converted.setOwnerId(source.getOwnerId()); converted.setDisableRendering(source.isDisableRendering()); converted.setRatings(source.getRatings()); converted.setTags(source.getTags()); converted.setCategories(source.getCategories()); converted.setFeatured(source.isFeatured()); converted.setProperties(source.getProperties()); } }