protected void validate(Widget widget) { if(widget == null) { throw new ResourceNotFoundException("The requested gadget does not exist in the gadget store."); } else if(widget.getWidgetStatus().equals(WidgetStatus.PREVIEW)) { throw new IllegalStateException("The requested gadget exists in the gadget store but is not published."); } } }
private boolean isPublishedWidget(Widget widget, List<Widget> trustedWidgetContainer, boolean trustedDomainObject) { Widget trustedWidget; if (trustedDomainObject) { trustedWidget = widget; } else { trustedWidget = getTrustedWidget(widget.getId(), trustedWidgetContainer); } return WidgetStatus.PUBLISHED.equals(trustedWidget.getWidgetStatus()); }
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()); } }