Improve functionality and fix formatting issues

apim420
Dharmakeerthi Lasantha 1 year ago
parent 78aee58c1a
commit 3bf6f7dd75

@ -1286,7 +1286,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
this.changeLifecycleState(applicationReleaseDTO, lifecycleChanger);
}
}
if (applicationDTO.getType().equals("ENTERPRISE") || applicationDTO.getType().equals("PUBLIC") ) {
if (Constants.ENTERPRISE_APP_TYPE.equals(applicationDTO.getType()) || Constants.PUBLIC_APP_TYPE.equals(applicationDTO.getType())) {
persistAppIconInfo(applicationReleaseDTO);
}
applicationReleaseEntities.add(applicationReleaseDTO);
@ -1726,8 +1726,8 @@ public class ApplicationManagerImpl implements ApplicationManager {
List<Metadata> allMetadata;
allMetadata = APIUtil.getMetadataManagementService().retrieveAllMetadata();
if (allMetadata != null && !allMetadata.isEmpty()) {
for(Metadata metadata : allMetadata){
if(Constants.SHOW_ALL_ROLES.equals(metadata.getMetaKey())){
for (Metadata metadata : allMetadata) {
if (Constants.SHOW_ALL_ROLES.equals(metadata.getMetaKey())) {
String metaValue = metadata.getMetaValue();
if (metaValue != null) {
JSONObject jsonObject;

@ -713,7 +713,17 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
Activity activity = addAppOperationOnDevices(applicationDTO, deviceIdentifiers, deviceType, action, properties);
activityList.add(activity);
for (DeviceIdentifier identifier : deviceIdentifiers) {
log.info(String.format("App %s triggered", action), appInstallLogContextBuilder.setAppId(String.valueOf(applicationDTO.getId())).setAppName(applicationDTO.getName()).setAppType(applicationDTO.getType()).setSubType(subType).setTenantId(tenantId).setTenantDomain(tenantDomain).setDevice(String.valueOf(identifier)).setUserName(username).setAction(action).build());
log.info(String.format("App %s triggered", action), appInstallLogContextBuilder
.setAppId(String.valueOf(applicationDTO.getId()))
.setAppName(applicationDTO.getName())
.setAppType(applicationDTO.getType())
.setSubType(subType)
.setTenantId(tenantId)
.setTenantDomain(tenantDomain)
.setDevice(String.valueOf(identifier))
.setUserName(username)
.setAction(action)
.build());
}
}

@ -94,6 +94,9 @@ public class Constants {
public static final String MSI = "MSI";
public static final String APPX = "APPX";
public static final String ENTERPRISE_APP_TYPE = "ENTERPRISE";
public static final String PUBLIC_APP_TYPE = "ENTERPRISE";
private static final Map<String, String> AGENT_DATA = new HashMap<>();
static {
AGENT_DATA.put("android", "android-agent.apk");

@ -17,6 +17,7 @@
*/
package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl;
import com.google.common.base.Strings;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException;
import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException;
import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata;
@ -34,6 +35,7 @@ import org.apache.commons.logging.LogFactory;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.springframework.util.StringUtils;
import org.wso2.carbon.CarbonConstants;
import org.wso2.carbon.base.MultitenantConstants;
import org.wso2.carbon.context.CarbonContext;
@ -72,6 +74,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import static io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants.PRIMARY_USER_STORE;
@ -136,7 +139,7 @@ public class RoleManagementServiceImpl implements RoleManagementService {
if (limit == 0){
limit = Constants.DEFAULT_PAGE_LIMIT;
}
if (domain != null && !domain.isEmpty()) {
if (!Strings.isNullOrEmpty(domain)) {
username = domain + '/' + username;
}
Metadata metadata;
@ -149,7 +152,7 @@ public class RoleManagementServiceImpl implements RoleManagementService {
JSONObject jsonObject = (JSONObject) parser.parse(metaValue);
boolean decision = (boolean) jsonObject.get(Constants.IS_USER_ABLE_TO_VIEW_ALL_ROLES);
if (decision) {
if (userStore == null || "".equals(userStore)){
if (Strings.isNullOrEmpty(userStore)){
userStore = PRIMARY_USER_STORE;
}
try {

@ -719,7 +719,14 @@ public class OperationManagerImpl implements OperationManager {
DeviceCacheManagerImpl.getInstance().removeDeviceFromCache(deviceId, tenantId);
break;
}
log.info("Device Connected", deviceConnectivityLogContextBuilder.setDeviceId(deviceId.getId()).setDeviceType(deviceId.getType()).setActionTag("PENDING_OPERATION").setTenantDomain(tenantDomain).setTenantId(String.valueOf(tenantId)).setUserName(userName).build());
log.info("Device Connected", deviceConnectivityLogContextBuilder
.setDeviceId(deviceId.getId())
.setDeviceType(deviceId.getType())
.setActionTag("PENDING_OPERATION")
.setTenantDomain(tenantDomain)
.setTenantId(String.valueOf(tenantId))
.setUserName(userName)
.build());
return getOperations(deviceId, Operation.Status.PENDING, enrolmentId);
}

@ -344,7 +344,15 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
device.getType() + " upon the user '" + device.getEnrolmentInfo().getOwner() +
"'");
}
log.info("Device enrolled successfully", deviceEnrolmentLogContextBuilder.setDeviceId(String.valueOf(existingDevice.getId())).setDeviceType(String.valueOf(existingDevice.getType())).setOwner(newEnrolmentInfo.getOwner()).setOwnership(String.valueOf(newEnrolmentInfo.getOwnership())).setTenantID(String.valueOf(tenantId)).setTenantDomain(tenantDomain).setUserName(userName).build());
log.info("Device enrolled successfully", deviceEnrolmentLogContextBuilder
.setDeviceId(String.valueOf(existingDevice.getId()))
.setDeviceType(String.valueOf(existingDevice.getType()))
.setOwner(newEnrolmentInfo.getOwner())
.setOwnership(String.valueOf(newEnrolmentInfo.getOwnership()))
.setTenantID(String.valueOf(tenantId))
.setTenantDomain(tenantDomain)
.setUserName(userName)
.build());
status = true;
} else {
log.warn("Unable to update device enrollment for device : " + device.getDeviceIdentifier() +

@ -298,7 +298,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
newParentPath = DeviceGroupConstants.HierarchicalGroup.SEPERATOR;
}
childrenGroup.setParentPath(newParentPath);
if (!newParentPath.equals(DeviceGroupConstants.HierarchicalGroup.SEPERATOR)) {
if (!DeviceGroupConstants.HierarchicalGroup.SEPERATOR.equals(newParentPath)) {
String[] groupIds = newParentPath.split(DeviceGroupConstants.HierarchicalGroup.SEPERATOR);
int latestGroupId = Integer.parseInt(groupIds[groupIds.length - 1]);
childrenGroup.setParentGroupId(latestGroupId);

Loading…
Cancel
Save