class ScreenService extends BasicService implements OwnerAPISupport<Screen> {

	@GET
	@Path("/screens/{id}")
	@Produces(MediaType.APPLICATION_JSON)
	public Screen getScreen(@PathParam("id") long screenId,
			@DefaultValue("true") @QueryParam("includeMetrics") boolean includeMetrics,
			@DefaultValue("false") @QueryParam("live") boolean live) {
		Screen result = null;

		if (screenId == 0) {
			result = new Screen();
			result.setName("Demo Screen");
			result.setShowOwners(true);

			User user = new User("d046998", "robert.wetzold@sap.com", "Robert", "Wetzold");
			user.updateDynamicValues();

			File movie = new File("-PrimeTime Teaser-");
			movie.setId(-1);

			Playlist playlist = new Playlist();

			Page page0 = new Page("Introduction");
			page0.addOwner(new Owner(user));
			page0.setPageType(PageType.MOVIE);
			page0.setFile(movie);
			page0.updateDynamicValues();

			PageReference pageRef0 = new PageReference(page0);
			pageRef0.setPageDisplayDurationOverride(12);
			playlist.addPageReference(pageRef0);

			Page page1 = new Page("Introduction");
			page1.addOwner(new Owner(user));
			page1.setPageType(PageType.TEXT);
			page1.setText("This is a demo for PrimeTime, your simple solution to create wall screen presentations, aka digital signage.");
			page1.updateDynamicValues();
			playlist.addPageReference(new PageReference(page1));

			Page page2 = new Page("Getting Started");
			page2.addOwner(new Owner(user));
			page2.setPageType(PageType.TEXT);
			page2.setText(
					"To get started, create your pages and put them together into your own playlist.</p><p>You can show one or multiple URLs, PDFs, images, movies, formatted texts or HTML.");
			page2.updateDynamicValues();
			playlist.addPageReference(new PageReference(page2));

			Page page3 = new Page("Contribute");
			page3.addOwner(new Owner(user));
			page3.setPageType(PageType.TEXT);
			page3.setText(
					"This is an open source tool by SAP. If you want to contribute, please feel invited to do so.");
			page3.updateDynamicValues();
			playlist.addPageReference(new PageReference(page3));

			String devUrl = ConfigUtil.getProperty(Consts.APP, Consts.PROP_DEVELOPMENTURL);
			if (StringUtils.isNoneEmpty(devUrl)) {
				Page page4 = new Page("Source Code");
				page4.addOwner(new Owner(user));
				page4.setUrl(devUrl);
				page4.updateDynamicValues();
				playlist.addPageReference(new PageReference(page4));
			}

			result.setPlaylist(playlist);
		} else {
			result = getExistingScreen(screenId, false);
			checkRemoteValidity(result);

			if (result.getOwners().isEmpty() && !isAdmin()) {
				throwUnauthorized();
			}
			if (result.isScreenshotMode() && live) {
				result.setPlaylist(getScreenshotPlaylist());
				result.setShowHeader(false);
				result.setShowFooter(false);
			}
			if (result.getPlaylist() != null) {
				result.getPlaylist().expand();
			}

			if (!includeMetrics) {
				removeMetrics(result);
			}
		}
		return result;
	}

}