Add doc-url template variable

rm-10583
Lasantha Dharmakeerthi 10 months ago
commit fb3f22b182

@ -124,6 +124,7 @@ public final class DeviceManagementConstants {
public static final String DEVICE_ENROLLMENT_MAIL_KEY = "enrollment";
public static final String TEMPLATE_NAME_PART_JOINER = "-";
public static final String ENROLLMENT_TYPE_SPLITTER = "_";
public static final String DOC_URL = "doc-url";
}
public static final class OperationAttributes {

@ -18,6 +18,7 @@
package io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt;
import io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt.documentation.DocConfiguration;
import io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt.whitelabel.WhiteLabelConfiguration;
import javax.xml.bind.annotation.XmlElement;
@ -26,6 +27,7 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "MetaDataConfiguration")
public class MetaDataConfiguration {
private WhiteLabelConfiguration whiteLabelConfiguration;
private DocConfiguration docConfiguration;
@XmlElement(name = "WhiteLabelConfiguration", required = true)
public WhiteLabelConfiguration getWhiteLabelConfiguration() {
@ -35,4 +37,13 @@ public class MetaDataConfiguration {
public void setWhiteLabelConfiguration(WhiteLabelConfiguration whiteLabelConfiguration) {
this.whiteLabelConfiguration = whiteLabelConfiguration;
}
@XmlElement(name = "DocConfiguration", required = true)
public DocConfiguration getDocConfiguration() {
return docConfiguration;
}
public void setDocConfiguration(DocConfiguration docConfiguration) {
this.docConfiguration = docConfiguration;
}
}

@ -0,0 +1,36 @@
/*
* Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt.documentation;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "DocConfiguration")
public class DocConfiguration {
private String docUrl;
@XmlElement(name = "DocUrl", required = true)
public String getDocUrl() {
return docUrl;
}
public void setDocUrl(String docUrl) {
this.docUrl = docUrl;
}
}

@ -1564,6 +1564,8 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
new TypedValue<>(String.class, DeviceManagerUtil.getServerBaseHttpsUrl()));
params.put(io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants.EmailAttributes.SERVER_BASE_URL_HTTP,
new TypedValue<>(String.class, DeviceManagerUtil.getServerBaseHttpUrl()));
params.put(DeviceManagementConstants.EmailAttributes.DOC_URL,
new TypedValue<>(String.class, DeviceManagerUtil.getDocUrl()));
try {
EmailContext ctx =
new EmailContext.EmailContextBuilder(new ContentProviderInfo(templateName, params),

@ -19,6 +19,8 @@ package io.entgra.device.mgt.core.device.mgt.core.util;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt.MetaDataConfiguration;
import io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt.documentation.DocConfiguration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpResponse;
@ -1276,4 +1278,14 @@ public final class DeviceManagerUtil {
+ deviceGroup.getGroupId();
}
}
/**
* Retrieve the documentation url
* @return documentation url
*/
public static String getDocUrl() {
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance().getDeviceManagementConfig();
DocConfiguration docConfiguration = deviceManagementConfig.getMetaDataConfiguration().getDocConfiguration();
return docConfiguration.getDocUrl();
}
}

@ -159,5 +159,10 @@
<MaximumMessageBufferSize>640</MaximumMessageBufferSize>
</RemoteSessionConfiguration>
<DefaultGroupsConfiguration>BYOD,COPE</DefaultGroupsConfiguration>
<MetaDataConfiguration>
<DocConfiguration>
<DocUrl>https://docs.entgra.io/uem/6.0.0</DocUrl>
</DocConfiguration>
</MetaDataConfiguration>
</DeviceMgtConfiguration>

@ -201,6 +201,9 @@
<DefaultImagesLocation>default</DefaultImagesLocation>
</WhiteLabelImages>
</WhiteLabelConfiguration>
<DocConfiguration>
<DocUrl>https://docs.entgra.io/uem/6.0.0</DocUrl>
</DocConfiguration>
</MetaDataConfiguration>
<OperationTimeoutConfigurations>

@ -344,6 +344,11 @@
<DefaultImagesLocation>default</DefaultImagesLocation>
</WhiteLabelImages>
</WhiteLabelConfiguration>
<DocConfiguration>
{% if product_conf is defined %}
<DocUrl>https://docs.entgra.io/uem/{{product_conf.server_version}}</DocUrl>
{% endif %}
</DocConfiguration>
</MetaDataConfiguration>
<OperationTimeoutConfigurations>
<OperationTimeouts>

Loading…
Cancel
Save