class ScreenService extends BasicService implements OwnerAPISupport<Screen> {

	@GET
	@Path("/screens/bykey/{key}")
	@Produces(MediaType.APPLICATION_JSON)
	public Screen getScreenByKey(@PathParam("key") String key,
			@DefaultValue("true") @QueryParam("includeMetrics") boolean includeMetrics,
			@DefaultValue("false") @QueryParam("live") boolean live,
			@DefaultValue("false") @QueryParam("autoOnboard") boolean doOnboarding,
			@QueryParam("owner") String requestedOwner) {
		Screen existingScreen = ScreenDAO.getScreenByKey(key);
		if (existingScreen == null) {
			if (doOnboarding) {
				existingScreen = new Screen();
				User user = userUtil.getLoggedInDBUser(request);
				existingScreen.setMetric_user(user.getUserId());
				existingScreen.setKey(key);
				if (StringUtils.isEmpty(requestedOwner)) {
					existingScreen.setRequestedOwner(user.getUserId());
				} else {
					existingScreen.setRequestedOwner(requestedOwner);
				}

				existingScreen = ScreenDAO.saveNew(existingScreen);
			} else {
				throwNotFound();
			}
		} else {
			checkRemoteValidity(existingScreen);
		}

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

		if (!includeMetrics) {
			removeMetrics(existingScreen);
		}

		return existingScreen;
	}

}