fragment.setOutputMarkupId(true);
container.add(fragment);
if (mode == UserModalPage.Mode.ADMIN) {
// add Syncope propagation status
PropagationStatus syncope = new PropagationStatus();
syncope.setResource("Syncope");
syncope.setStatus(PropagationTaskExecStatus.SUCCESS);
List<PropagationStatus> propagations = new ArrayList<PropagationStatus>();
propagations.add(syncope);
propagations.addAll(subject.getPropagationStatusTOs());
fragment.add(new Label("info",
((subject instanceof UserTO) && ((UserTO) subject).getUsername() != null)
? ((UserTO) subject).getUsername()
: ((subject instanceof RoleTO) && ((RoleTO) subject).getName() != null)
? ((RoleTO) subject).getName()
: String.valueOf(subject.getId())));
final ListView<PropagationStatus> propRes = new ListView<PropagationStatus>("resources",
propagations) {
private static final long serialVersionUID = -1020475259727720708L;
@Override
protected void populateItem(final ListItem<PropagationStatus> item) {
final PropagationStatus propTO = (PropagationStatus) item.getDefaultModelObject();
final ListView attributes = getConnObjectView(propTO);
final Fragment attrhead;
if (attributes.getModelObject() == null || attributes.getModelObject().isEmpty()) {
attrhead = new Fragment("attrhead", "emptyAttrHeadFrag", page);
} else {
attrhead = new Fragment("attrhead", "attrHeadFrag", page);
}
item.add(attrhead);
item.add(attributes);
attrhead.add(new Label("resource", propTO.getResource()));
attrhead.add(new Label("propagation", propTO.getStatus() == null
? "UNDEFINED" : propTO.getStatus().toString()));
final Image image;
final String alt, title;
final ModalWindow failureWindow = new ModalWindow("failureWindow");
final AjaxLink<?> failureWindowLink = new AjaxLink<Void>("showFailureWindow") {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(AjaxRequestTarget target) {
failureWindow.show(target);
}
};
switch (propTO.getStatus()) {
case SUCCESS:
case SUBMITTED:
case CREATED:
image = new Image("icon", IMG_STATUSES + Status.ACTIVE.toString()
+ Constants.PNG_EXT);
alt = "success icon";
title = "success";
failureWindow.setVisible(false);
failureWindowLink.setEnabled(false);
break;
default:
image = new Image("icon", IMG_STATUSES + Status.SUSPENDED.toString()
+ Constants.PNG_EXT);
alt = "failure icon";
title = "failure";
}
image.add(new Behavior() {
private static final long serialVersionUID = 1469628524240283489L;
@Override
public void onComponentTag(final Component component, final ComponentTag tag) {
tag.put("alt", alt);
tag.put("title", title);
}
});
final FailureMessageModalPage executionFailureMessagePage;
if (propTO.getFailureReason() == null) {
executionFailureMessagePage =
new FailureMessageModalPage(failureWindow.getContentId(), StringUtils.EMPTY);
} else {
executionFailureMessagePage =
new FailureMessageModalPage(failureWindow.getContentId(), propTO.getFailureReason());
}
failureWindow.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;