Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/support-3.5' into support-3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Jan 28, 2017
2 parents 5edc6d7 + 84411ee commit c302810
Show file tree
Hide file tree
Showing 65 changed files with 3,217 additions and 184 deletions.
32 changes: 25 additions & 7 deletions build-system/pom.xml
Expand Up @@ -309,11 +309,27 @@
<!-- <version>20100725</version> -->
<version>20110809</version>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.5.1</version>
<exclusions>
<exclusion>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.8.3</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils-core</artifactId>
<version>1.8.3</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
Expand All @@ -324,12 +340,7 @@
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils-core</artifactId>
<version>1.8.0</version>
</dependency>
<dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.6</version>
Expand All @@ -342,6 +353,10 @@
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
</exclusion>
<exclusion>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -1462,7 +1477,10 @@
<!-- The xjc-plugin does not compile without dependency on this -->
<ignoredUnusedDeclaredDependency>org.apache.cxf:cxf-tools-common</ignoredUnusedDeclaredDependency>

</ignoredUnusedDeclaredDependencies>
<!-- Cannot help myself with this one (commons-configuration 1.6 causes this) TODO: revisit -->
<ignoredUnusedDeclaredDependency>commons-beanutils:commons-beanutils-core</ignoredUnusedDeclaredDependency>

</ignoredUnusedDeclaredDependencies>
<ignoredUsedUndeclaredDependencies>
<!-- There is some kind of conflict between these. TODO: clean up -->
<ignoredUsedUndeclaredDependency>xml-apis:xml-apis</ignoredUsedUndeclaredDependency>
Expand Down
9 changes: 9 additions & 0 deletions gui/admin-gui/pom.xml
Expand Up @@ -530,6 +530,11 @@
<artifactId>wicket-datetime</artifactId>
</dependency>

<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
</dependency>

<dependency>
<groupId>org.ocpsoft.prettytime</groupId>
<artifactId>prettytime</artifactId>
Expand Down Expand Up @@ -594,6 +599,10 @@
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils-core</artifactId>
Expand Down
Expand Up @@ -127,7 +127,7 @@
<div class="pull-right hidden-xs" wicket:id="version">
<b><wicket:message key="PageTemplate.version"/></b> <wicket:message key="pageBase.midPointVersion"/>
</div>
<wicket:message key="PageTemplate.copy"/>
<div wicket:id="subscriptionMessage"/>
</footer>
</div>

Expand Down
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,24 @@ 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;
}
return !WebComponentUtil.checkSubscriptionId(subscriptionId);
}
});
add(subscriptionMessage);


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

Expand Down Expand Up @@ -1530,6 +1549,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 +1583,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
Expand Up @@ -45,7 +45,9 @@
import com.sun.tools.xjc.reader.xmlschema.bindinfo.BIConversion;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.validator.routines.checkdigit.VerhoeffCheckDigit;
import org.apache.wicket.Component;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.Page;
Expand Down Expand Up @@ -1848,6 +1850,35 @@ public static Integer getIntegerParameter(PageParameters params, String key) {
return value.toInteger();
}

public static boolean checkSubscriptionId(String subscriptionId){
if (StringUtils.isEmpty(subscriptionId)) {
return false;
}
if (!NumberUtils.isDigits(subscriptionId)){
return false;
}
if (subscriptionId.length() < 8){
return false;
}
//TODO check subscription type according to type constants
String expDateStr = subscriptionId.substring(2, 6);
SimpleDateFormat dateFormat = new SimpleDateFormat("MMyy");
try {
Date expDate = dateFormat.parse(expDateStr);
Date currentDate = new Date(System.currentTimeMillis());;
if (expDate.before(currentDate)){
return false;
}
} catch (Exception ex){
return false;
}
VerhoeffCheckDigit checkDigit = new VerhoeffCheckDigit();
if (checkDigit.isValid(subscriptionId)){
return true;
}
return false;
}

public static void setSelectedTabFromPageParameters(TabbedPanel tabbed, PageParameters params, String paramName) {
IModel<List> tabsModel = tabbed.getTabs();

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2013 Evolveum
* Copyright (c) 2010-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -627,7 +627,7 @@ private String formatItemInfo(ResourceItemDefinitionType item, ItemPathType ref,
if (outbound != null) {
sb.append(" | ").append(getString("SchemaHandlingStep.out")).append(": ");
boolean first = true;
for (MappingSourceDeclarationType source : outbound.getSource()) {
for (VariableBindingDefinitionType source : outbound.getSource()) {
if (source != null) {
if (first) first = false; else sb.append(", ");
sb.append(formatPath(source.getPath()));
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2014 Evolveum
* Copyright (c) 2010-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -117,7 +117,7 @@ private void prepareActivationObject(ResourceActivationDefinitionType activation
} else {
for(MappingType mapping: activation.getExistence().getInbound()){
if(mapping.equals(new MappingType())){
MappingSourceDeclarationType source = new MappingSourceDeclarationType();
VariableBindingDefinitionType source = new VariableBindingDefinitionType();
source.setPath(new ItemPathType(EXISTENCE_DEFAULT_SOURCE));
mapping.getSource().add(source);
}
Expand All @@ -129,23 +129,23 @@ private void prepareActivationObject(ResourceActivationDefinitionType activation
} else {
for(MappingType outbound: activation.getAdministrativeStatus().getOutbound()){
if(outbound.equals(new MappingType())){
MappingSourceDeclarationType source = new MappingSourceDeclarationType();
VariableBindingDefinitionType source = new VariableBindingDefinitionType();
source.setPath(new ItemPathType(ADM_STATUS_OUT_SOURCE_DEFAULT));
outbound.getSource().add(source);

MappingTargetDeclarationType target = new MappingTargetDeclarationType();
VariableBindingDefinitionType target = new VariableBindingDefinitionType();
target.setPath(new ItemPathType(ADM_STATUS_OUT_TARGET_DEFAULT));
outbound.setTarget(target);
}
}

for(MappingType inbound: activation.getAdministrativeStatus().getInbound()){
if(inbound.equals(new MappingType())){
MappingSourceDeclarationType source = new MappingSourceDeclarationType();
VariableBindingDefinitionType source = new VariableBindingDefinitionType();
source.setPath(new ItemPathType(ADM_STATUS_IN_SOURCE_DEFAULT));
inbound.getSource().add(source);

MappingTargetDeclarationType target = new MappingTargetDeclarationType();
VariableBindingDefinitionType target = new VariableBindingDefinitionType();
target.setPath(new ItemPathType(ADM_STATUS_IN_TARGET_DEFAULT));
inbound.setTarget(target);
}
Expand All @@ -157,23 +157,23 @@ private void prepareActivationObject(ResourceActivationDefinitionType activation
} else {
for(MappingType outbound: activation.getValidFrom().getOutbound()){
if(outbound.equals(new MappingType())){
MappingSourceDeclarationType source = new MappingSourceDeclarationType();
VariableBindingDefinitionType source = new VariableBindingDefinitionType();
source.setPath(new ItemPathType(VALID_FROM_OUT_SOURCE_DEFAULT));
outbound.getSource().add(source);

MappingTargetDeclarationType target = new MappingTargetDeclarationType();
VariableBindingDefinitionType target = new VariableBindingDefinitionType();
target.setPath(new ItemPathType(VALID_FROM_OUT_TARGET_DEFAULT));
outbound.setTarget(target);
}
}

for(MappingType inbound: activation.getValidFrom().getInbound()){
if(inbound.equals(new MappingType())){
MappingSourceDeclarationType source = new MappingSourceDeclarationType();
VariableBindingDefinitionType source = new VariableBindingDefinitionType();
source.setPath(new ItemPathType(VALID_FROM_IN_SOURCE_DEFAULT));
inbound.getSource().add(source);

MappingTargetDeclarationType target = new MappingTargetDeclarationType();
VariableBindingDefinitionType target = new VariableBindingDefinitionType();
target.setPath(new ItemPathType(VALID_FROM_IN_TARGET_DEFAULT));
inbound.setTarget(target);
}
Expand All @@ -185,23 +185,23 @@ private void prepareActivationObject(ResourceActivationDefinitionType activation
} else {
for(MappingType outbound: activation.getValidTo().getOutbound()){
if(outbound.equals(new MappingType())){
MappingSourceDeclarationType source = new MappingSourceDeclarationType();
VariableBindingDefinitionType source = new VariableBindingDefinitionType();
source.setPath(new ItemPathType(VALID_TO_OUT_SOURCE_DEFAULT));
outbound.getSource().add(source);

MappingTargetDeclarationType target = new MappingTargetDeclarationType();
VariableBindingDefinitionType target = new VariableBindingDefinitionType();
target.setPath(new ItemPathType(VALID_TO_OUT_TARGET_DEFAULT));
outbound.setTarget(target);
}
}

for(MappingType inbound: activation.getValidTo().getInbound()){
if(inbound.equals(new MappingType())){
MappingSourceDeclarationType source = new MappingSourceDeclarationType();
VariableBindingDefinitionType source = new VariableBindingDefinitionType();
source.setPath(new ItemPathType(VALID_TO_IN_SOURCE_DEFAULT));
inbound.getSource().add(source);

MappingTargetDeclarationType target = new MappingTargetDeclarationType();
VariableBindingDefinitionType target = new VariableBindingDefinitionType();
target.setPath(new ItemPathType(VALID_TO_IN_TARGET_DEFAULT));
inbound.setTarget(target);
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2013 Evolveum
* Copyright (c) 2010-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -83,7 +83,7 @@ public MappingTypeDto(MappingType mapping, PrismContext prismContext){

oldMappingObject = mappingObject.clone();

for(MappingSourceDeclarationType mappingSource: mappingObject.getSource()){
for(VariableBindingDefinitionType mappingSource: mappingObject.getSource()){
if(mappingSource.getPath() != null && mappingSource.getPath().getItemPath() != null){
source.add(mappingSource.getPath().getItemPath().toString());
}
Expand Down Expand Up @@ -139,21 +139,21 @@ public MappingType prepareDtoToSave(PrismContext prismContext) throws SchemaExce
}

if(target != null){
MappingTargetDeclarationType mappingTarget = new MappingTargetDeclarationType();
VariableBindingDefinitionType mappingTarget = new VariableBindingDefinitionType();
mappingTarget.setPath(new ItemPathType(target));
mappingObject.setTarget(mappingTarget);
} else {
mappingObject.setTarget(null);
}

mappingObject.getSource().clear();
List<MappingSourceDeclarationType> mappingSourceList = new ArrayList<>();
List<VariableBindingDefinitionType> mappingSourceList = new ArrayList<>();
for(String s: source){
if(s == null){
continue;
}

MappingSourceDeclarationType mappingSource = new MappingSourceDeclarationType();
VariableBindingDefinitionType mappingSource = new VariableBindingDefinitionType();
mappingSource.setPath(new ItemPathType(s));
mappingSourceList.add(mappingSource);
}
Expand Down Expand Up @@ -346,7 +346,7 @@ public static String createMappingLabel(MappingType mapping, Trace LOGGER, Prism
}

if(!mapping.getSource().isEmpty()){
for(MappingSourceDeclarationType source: mapping.getSource()){
for(VariableBindingDefinitionType source: mapping.getSource()){
if(source.getPath() != null && source.getPath().getItemPath() != null
&& source.getPath().getItemPath().getSegments() != null){

Expand All @@ -367,7 +367,7 @@ public static String createMappingLabel(MappingType mapping, Trace LOGGER, Prism
sb.append("->");

if (mapping.getTarget() != null) {
MappingTargetDeclarationType target = mapping.getTarget();
VariableBindingDefinitionType target = mapping.getTarget();
if (target.getPath() != null && !ItemPath.isNullOrEmpty(target.getPath().getItemPath())) {
List<ItemPathSegment> segments = target.getPath().getItemPath().getSegments();
sb.append(segments.get(segments.size() - 1));
Expand Down

0 comments on commit c302810

Please sign in to comment.