public Context addPage(Page page) { Page existingPageWithSameKey = pagesByPath.putIfAbsent(page.getKey(), page); if (existingPageWithSameKey != null) { throw new IllegalArgumentException(format("Page '%s' cannot be loaded. Another page with key '%s' already exists.", page.getName(), page.getKey())); } return this; }
private void checkPluginExists(Page page) { String pluginKey = page.getPluginKey(); checkState(pluginRepository.hasPlugin(pluginKey), "Page '%s' references plugin '%s' that does not exist", page.getName(), pluginKey); }
private void checkCoreExtensionExists(Page page) { String coreExtensionName = page.getPluginKey(); checkState(coreExtensionRepository.isInstalled(coreExtensionName), "Page '%s' references Core Extension '%s' which is not installed", page.getName(), coreExtensionName); }
private static void writePages(JsonWriter json, List<Page> pages) { json.beginArray(); pages.forEach(p -> json.beginObject() .prop("key", p.getKey()) .prop("name", p.getName()) .endObject()); json.endArray(); }
private static void writePage(JsonWriter json, Page page) { json.beginObject() .prop("key", page.getKey()) .prop("name", page.getName()) .endObject(); }
@Test public void full_test() { Page result = underTest .setComponentQualifiers(PROJECT, MODULE) .setScope(COMPONENT) .setAdmin(true) .build(); assertThat(result.getKey()).isEqualTo("governance/project_dump"); assertThat(result.getPluginKey()).isEqualTo("governance"); assertThat(result.getName()).isEqualTo("Project Dump"); assertThat(result.getComponentQualifiers()).containsOnly(PROJECT, MODULE); assertThat(result.getScope()).isEqualTo(COMPONENT); assertThat(result.isAdmin()).isTrue(); }
private void writePages(JsonWriter json) { json.name("globalPages").beginArray(); for (Page page : pageRepository.getGlobalPages(false)) { json.beginObject() .prop("key", page.getKey()) .prop("name", page.getName()) .endObject(); } json.endArray(); }
@Override public void handle(Request request, Response response) throws Exception { boolean isSysAdmin = userSession.isSystemAdministrator(); try (JsonWriter json = response.newJsonWriter()) { json.beginObject(); json.prop("showUpdateCenter", isSysAdmin && config.getBoolean(ProcessProperties.Property.SONAR_UPDATECENTER_ACTIVATE.getKey()).orElse(false)); json.name("extensions").beginArray(); if (isSysAdmin) { for (Page page : pageRepository.getGlobalPages(true)) { json.beginObject() .prop("key", page.getKey()) .prop("name", page.getName()) .endObject(); } } json.endArray().endObject(); } } }
Page myPage = ... // the Page object Date date = new Date(); SimpleDateFormat df = new SimpleDateFormat("_yyyy-MM-dd_HH-mm"); String newName = myPage.getName() + df.format(date); pageManager.copy(myPage, newName, null, true, false);
@Override public Object instantiateItem(ViewGroup container, int position) { Page page = pages.get(position); Magazine magazine = dispatcher.getMagazine(); WebView webView = new WebView( activity ); ActionBar.LayoutParams params = new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ); webView.setLayoutParams(params); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl( magazine.getFileLocation() + "/" + page.getName()); container.addView( webView ); return webView; }
Page p = (Page)getIntent().getExtras().getSerializable("Page"); Toast.makeText(this, "Name: " + p.getName() + ", Description:" + p.getDescription(), Toast.LENGTH_LONG).show();
Page p = (Page)getIntent().getExtras().getSerializable("Page"); Toast.makeText(this, "Name: " + p.getName() + ", Description:" + p.getDescription(), Toast.LENGTH_LONG).show();
public Context addPage(Page page) { Page existingPageWithSameKey = pagesByPath.putIfAbsent(page.getKey(), page); if (existingPageWithSameKey != null) { throw new IllegalArgumentException(format("Page '%s' cannot be loaded. Another page with key '%s' already exists.", page.getName(), page.getKey())); } return this; }
private void checkPluginExists(Page page) { String pluginKey = page.getPluginKey(); checkState(pluginRepository.hasPlugin(pluginKey), "Page '%s' references plugin '%s' that does not exist", page.getName(), pluginKey); }
private void checkCoreExtensionExists(Page page) { String coreExtensionName = page.getPluginKey(); checkState(coreExtensionRepository.isInstalled(coreExtensionName), "Page '%s' references Core Extension '%s' which is not installed", page.getName(), coreExtensionName); }
private static void writePage(JsonWriter json, Page page) { json.beginObject() .prop("key", page.getKey()) .prop("name", page.getName()) .endObject(); }
private static void writePages(JsonWriter json, List<Page> pages) { json.beginArray(); pages.forEach(p -> json.beginObject() .prop("key", p.getKey()) .prop("name", p.getName()) .endObject()); json.endArray(); } }
FacebookClient facebookClient = new DefaultFacebookClient("register a facebook application with required permissions, get that application token and paste here"); User user = facebookClient.fetchObject("me", User.class); Connection<User> myFriends = facebookClient.fetchConnection("me/friends", User.class); for(User friend:myFriends.getData()) { Connection<Page> myMovies = facebookClient.fetchConnection(friend.getId() + "/movies", Page.class); content = content + "Name: " + friend.getName(); for(Page page:myMovies.getData()) { content = content + "\n" + "Movies: " + page.getName() + "\n"; } }
private void writePages(JsonWriter json) { json.name("globalPages").beginArray(); for (Page page : pageRepository.getGlobalPages(false)) { json.beginObject() .prop("key", page.getKey()) .prop("name", page.getName()) .endObject(); } json.endArray(); }
@Override public void handle(Request request, Response response) throws Exception { boolean isSysAdmin = userSession.isSystemAdministrator(); try (JsonWriter json = response.newJsonWriter()) { json.beginObject(); json.prop("showUpdateCenter", isSysAdmin && config.getBoolean(ProcessProperties.Property.SONAR_UPDATECENTER_ACTIVATE.getKey()).orElse(false)); json.name("extensions").beginArray(); if (isSysAdmin) { for (Page page : pageRepository.getGlobalPages(true)) { json.beginObject() .prop("key", page.getKey()) .prop("name", page.getName()) .endObject(); } } json.endArray().endObject(); } } }