當前位置: 首頁>>代碼示例>>Java>>正文


Java WicketUtils.newRepositoryParameter方法代碼示例

本文整理匯總了Java中com.gitblit.wicket.WicketUtils.newRepositoryParameter方法的典型用法代碼示例。如果您正苦於以下問題:Java WicketUtils.newRepositoryParameter方法的具體用法?Java WicketUtils.newRepositoryParameter怎麽用?Java WicketUtils.newRepositoryParameter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.gitblit.wicket.WicketUtils的用法示例。


在下文中一共展示了WicketUtils.newRepositoryParameter方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ForkPage

import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
public ForkPage(PageParameters params) {
	super(params);

	setVersioned(false);
	
	GitBlitWebSession session = GitBlitWebSession.get();

	RepositoryModel repository = getRepositoryModel();
	UserModel user = session.getUser();
	boolean canFork = user.canFork(repository);

	if (!canFork) {
		// redirect to the summary page if this repository is not empty
		GitBlitWebSession.get().cacheErrorMessage(
				MessageFormat.format(getString("gb.forkNotAuthorized"), repository.name));
		throw new GitblitRedirectException(SummaryPage.class, WicketUtils.newRepositoryParameter(repository.name));
	}

	String fork = GitBlit.self().getFork(user.username, repository.name);
	if (fork != null) {
		// redirect to user's fork
		throw new GitblitRedirectException(SummaryPage.class, WicketUtils.newRepositoryParameter(fork));
	}

	add(new Label("forkText", getString("gb.preparingFork")));

	if (!session.isForking()) {
		// prepare session
		session.isForking(true);

		// fork it
		ForkThread forker = new ForkThread(repository, session);
		forker.start();
	}
}
 
開發者ID:warpfork,項目名稱:gitblit,代碼行數:36,代碼來源:ForkPage.java

示例2: registerNavLinks

import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
private List<NavLink> registerNavLinks() {
	Repository r = getRepository();
	RepositoryModel model = getRepositoryModel();

	PageParameters params = null;
	PageParameters objectParams = null;
	if (!StringUtils.isEmpty(repositoryName)) {
		params = WicketUtils.newRepositoryParameter(getRepositoryName());
		objectParams = params;

		// preserve the objectid iff the objectid directly (or indirectly) refers to a ref
		if (isCommitPage() && !StringUtils.isEmpty(objectId)) {
			RevCommit commit = JGitUtils.getCommit(r, objectId);
			if (commit != null) {
				String bestId = getBestCommitId(commit);
				if (!commit.getName().equals(bestId)) {
					objectParams = WicketUtils.newObjectParameter(getRepositoryName(), bestId);
				}
			}
		}
	}
	List<NavLink> navLinks = new ArrayList<NavLink>();


	// standard links
	if (RefLogUtils.getRefLogBranch(r) == null) {
		navLinks.add(new PageNavLink("gb.summary", SummaryPage.class, params));
	} else {
		navLinks.add(new PageNavLink("gb.summary", SummaryPage.class, params));
		//			pages.put("overview", new PageRegistration("gb.overview", OverviewPage.class, params));
		navLinks.add(new PageNavLink("gb.reflog", ReflogPage.class, params));
	}

	if (!model.hasCommits) {
		return navLinks;
	}

	navLinks.add(new PageNavLink("gb.commits", LogPage.class, objectParams));
	navLinks.add(new PageNavLink("gb.tree", TreePage.class, objectParams));
	if (app().tickets().isReady() && (app().tickets().isAcceptingNewTickets(model) || app().tickets().hasTickets(model))) {
		PageParameters tParams = WicketUtils.newOpenTicketsParameter(getRepositoryName());
		navLinks.add(new PageNavLink("gb.tickets", TicketsPage.class, tParams));
	}
	navLinks.add(new PageNavLink("gb.docs", DocsPage.class, objectParams, true));
	if (app().settings().getBoolean(Keys.web.allowForking, true)) {
		navLinks.add(new PageNavLink("gb.forks", ForksPage.class, params, true));
	}
	navLinks.add(new PageNavLink("gb.compare", ComparePage.class, params, true));

	// conditional links
	// per-repository extra navlinks
	if (JGitUtils.getPagesBranch(r) != null) {
		ExternalNavLink pagesLink = new ExternalNavLink("gb.pages", PagesServlet.asLink(
				getRequest().getRelativePathPrefixToContextRoot(), getRepositoryName(), null), true);
		navLinks.add(pagesLink);
	}

	UserModel user = UserModel.ANONYMOUS;
	if (GitBlitWebSession.get().isLoggedIn()) {
		user = GitBlitWebSession.get().getUser();
	}

	// add repository nav link extensions
	List<RepositoryNavLinkExtension> extensions = app().plugins().getExtensions(RepositoryNavLinkExtension.class);
	for (RepositoryNavLinkExtension ext : extensions) {
		navLinks.addAll(ext.getNavLinks(user, model));
	}

	return navLinks;
}
 
開發者ID:tomaswolf,項目名稱:gerrit-gitblit-plugin,代碼行數:71,代碼來源:RepositoryPage.java

示例3: newRepositoryParameter

import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
protected PageParameters newRepositoryParameter() {
	return WicketUtils.newRepositoryParameter(repositoryName);
}
 
開發者ID:tomaswolf,項目名稱:gerrit-gitblit-plugin,代碼行數:4,代碼來源:RepositoryPage.java

示例4: registerPages

import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
private Map<String, PageRegistration> registerPages() {
		PageParameters params = null;
		if (!StringUtils.isEmpty(repositoryName)) {
			params = WicketUtils.newRepositoryParameter(repositoryName);
		}
		Map<String, PageRegistration> pages = new LinkedHashMap<String, PageRegistration>();

		Repository r = getRepository();
		RepositoryModel model = getRepositoryModel();

		// standard links
		if (PushLogUtils.getPushLogBranch(r) == null) {
			pages.put("summary", new PageRegistration("gb.summary", SummaryPage.class, params));
		} else {
			pages.put("summary", new PageRegistration("gb.summary", SummaryPage.class, params));
//			pages.put("overview", new PageRegistration("gb.overview", OverviewPage.class, params));
			pages.put("pushes", new PageRegistration("gb.pushes", PushesPage.class, params));
		}		
		pages.put("commits", new PageRegistration("gb.commits", LogPage.class, params));
		pages.put("tree", new PageRegistration("gb.tree", TreePage.class, params));
		pages.put("compare", new PageRegistration("gb.compare", ComparePage.class, params, true));
		if (GitBlit.getBoolean(Keys.web.allowForking, true)) {
			pages.put("forks", new PageRegistration("gb.forks", ForksPage.class, params, true));
		}

		// conditional links
		// per-repository extra page links
		if (model.useTickets && TicgitUtils.getTicketsBranch(r) != null) {
			pages.put("tickets", new PageRegistration("gb.tickets", TicketsPage.class, params, true));
		}
		if (model.showReadme || model.useDocs) {
			pages.put("docs", new PageRegistration("gb.docs", DocsPage.class, params, true));
		}
		if (JGitUtils.getPagesBranch(r) != null) {
			OtherPageLink pagesLink = new OtherPageLink("gb.pages", PagesServlet.asLink(
					getRequest().getRelativePathPrefixToContextRoot(), repositoryName, null), true);
			pages.put("pages", pagesLink);
		}

		// Conditionally add edit link
		showAdmin = false;
		if (GitBlit.getBoolean(Keys.web.authenticateAdminPages, true)) {
			boolean allowAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, false);
			showAdmin = allowAdmin && GitBlitWebSession.get().canAdmin();
		} else {
			showAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, false);
		}
		isOwner = GitBlitWebSession.get().isLoggedIn()
				&& (model.isOwner(GitBlitWebSession.get()
						.getUsername()));
		if (showAdmin || isOwner) {
			pages.put("edit", new PageRegistration("gb.edit", EditRepositoryPage.class, params));
		}
		return pages;
	}
 
開發者ID:warpfork,項目名稱:gitblit,代碼行數:56,代碼來源:RepositoryPage.java

示例5: registerPages

import com.gitblit.wicket.WicketUtils; //導入方法依賴的package包/類
private Map<String, PageRegistration> registerPages() {
	PageParameters params = null;
	if (!StringUtils.isEmpty(repositoryName)) {
		params = WicketUtils.newRepositoryParameter(repositoryName);
	}
	Map<String, PageRegistration> pages = new LinkedHashMap<String, PageRegistration>();

	// standard links
	pages.put("repositories", new PageRegistration("gb.repositories", RepositoriesPage.class));
	pages.put("summary", new PageRegistration("gb.summary", SummaryPage.class, params));
	pages.put("log", new PageRegistration("gb.log", LogPage.class, params));
	pages.put("branches", new PageRegistration("gb.branches", BranchesPage.class, params));
	pages.put("tags", new PageRegistration("gb.tags", TagsPage.class, params));
	pages.put("tree", new PageRegistration("gb.tree", TreePage.class, params));
	if (GitBlit.getBoolean(Keys.web.allowForking, true)) {
		pages.put("forks", new PageRegistration("gb.forks", ForksPage.class, params));
	}

	// conditional links
	Repository r = getRepository();
	RepositoryModel model = getRepositoryModel();

	// per-repository extra page links
	if (model.useTickets && TicgitUtils.getTicketsBranch(r) != null) {
		pages.put("tickets", new PageRegistration("gb.tickets", TicketsPage.class, params));
	}
	if (model.useDocs) {
		pages.put("docs", new PageRegistration("gb.docs", DocsPage.class, params));
	}
	if (JGitUtils.getPagesBranch(r) != null) {
		OtherPageLink pagesLink = new OtherPageLink("gb.pages", PagesServlet.asLink(
				getRequest().getRelativePathPrefixToContextRoot(), repositoryName, null));
		pages.put("pages", pagesLink);
	}

	// Conditionally add edit link
	showAdmin = false;
	if (GitBlit.getBoolean(Keys.web.authenticateAdminPages, true)) {
		boolean allowAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, false);
		showAdmin = allowAdmin && GitBlitWebSession.get().canAdmin();
	} else {
		showAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, false);
	}
	isOwner = GitBlitWebSession.get().isLoggedIn()
			&& (model.isOwner(GitBlitWebSession.get()
					.getUsername()));
	if (showAdmin || isOwner) {
		pages.put("edit", new PageRegistration("gb.edit", EditRepositoryPage.class, params));
	}
	return pages;
}
 
開發者ID:BullShark,項目名稱:IRCBlit,代碼行數:52,代碼來源:RepositoryPage.java


注:本文中的com.gitblit.wicket.WicketUtils.newRepositoryParameter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。