if (user == null) {
user = UserModel.ANONYMOUS;
}
// indicate origin repository
RepositoryModel model = getRepositoryModel();
if (StringUtils.isEmpty(model.originRepository)) {
if (model.isMirror) {
Fragment mirrorFrag = new Fragment("originRepository", "mirrorFragment", this);
Label lbl = new Label("originRepository", MessageFormat.format(getString("gb.mirrorOf"), "<b>" + model.origin + "</b>"));
mirrorFrag.add(lbl.setEscapeModelStrings(false));
add(mirrorFrag);
} else {
add(new Label("originRepository").setVisible(false));
}
} else {
RepositoryModel origin = app().repositories().getRepositoryModel(model.originRepository);
if (origin == null) {
// no origin repository
add(new Label("originRepository").setVisible(false));
} else if (!user.canView(origin)) {
// show origin repository without link