Skip to content

Commit

Permalink
Subscription message in the footer
Browse files Browse the repository at this point in the history
Conflicts:
	gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/page/PageBase.java
  • Loading branch information
KaterynaHonchar committed Jan 25, 2017
1 parent 351f0e5 commit 68f2546
Showing 1 changed file with 43 additions and 1 deletion.
Expand Up @@ -187,9 +187,11 @@ public abstract class PageBase extends WebPage implements ModelServiceLocator {
private static final String ID_BC_NAME = "bcName";
private static final String ID_MAIN_POPUP = "mainPopup";
private static final String ID_MAIN_POPUP_BODY = "popupBody";
private static final String ID_SUBSCRIPTION_MESSAGE = "subscriptionMessage";
private static final String ID_LOGO = "logo";

private static final String OPERATION_GET_SYSTEM_CONFIG = DOT_CLASS + "getSystemConfiguration";
private static final String OPERATION_GET_DEPLOYMENT_INFORMATION = DOT_CLASS + "getDeploymentInformation";

private static final Trace LOGGER = TraceManager.getTrace(PageBase.class);

Expand Down Expand Up @@ -618,7 +620,25 @@ public boolean isVisible() {
});
add(version);

WebMarkupContainer feedbackContainer = new WebMarkupContainer(ID_FEEDBACK_CONTAINER);
Label subscriptionMessage = new Label(ID_SUBSCRIPTION_MESSAGE, createStringResource("PageBase.subscriptionMessage"));
subscriptionMessage.setOutputMarkupId(true);
subscriptionMessage.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;

@Override
public boolean isVisible() {
String subscriptionId = getSubscriptionId();
if (StringUtils.isEmpty(subscriptionId)) {
return true;
}
//TODO temporary condition is to check if subscriptionId contains any number
return !subscriptionId.matches(".*\\d.*");
}
});
add(subscriptionMessage);


WebMarkupContainer feedbackContainer = new WebMarkupContainer(ID_FEEDBACK_CONTAINER);
feedbackContainer.setOutputMarkupId(true);
add(feedbackContainer);

Expand Down Expand Up @@ -1530,6 +1550,20 @@ public AdminGuiConfigurationType loadAdminGuiConfiguration() {
}
}

public DeploymentInformationType loadDeploymentInformationType() {
DeploymentInformationType deploymentInformationType = null;
OperationResult result = new OperationResult(OPERATION_GET_DEPLOYMENT_INFORMATION);
try {
deploymentInformationType = getModelInteractionService().getDeploymentInformationConfiguration(result);
LOGGER.trace("Deployment information : {}", deploymentInformationType);
result.recordSuccess();
} catch (Exception ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load deployment information", ex);
result.recordFatalError("Couldn't load deployment information.", ex);
}
return deploymentInformationType;
}

public Breadcrumb redirectBack() {
List<Breadcrumb> breadcrumbs = getSessionStorage().getBreadcrumbs();
if (breadcrumbs.size() < 2) {
Expand All @@ -1550,6 +1584,14 @@ public Breadcrumb redirectBack() {
return breadcrumb;
}

private String getSubscriptionId() {
DeploymentInformationType deploymentInformationType = loadDeploymentInformationType();
if (deploymentInformationType == null) {
return null;
}
return deploymentInformationType.getSubscriptionIdentifier();
}

// TODO deduplicate with redirectBack
public RestartResponseException redirectBackViaRestartResponseException() {
List<Breadcrumb> breadcrumbs = getSessionStorage().getBreadcrumbs();
Expand Down

0 comments on commit 68f2546

Please sign in to comment.