mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Refactored the source code
This commit is contained in:
parent
c3f04eeed0
commit
7278408b44
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
* Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
* Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
|
||||
@ -175,7 +175,10 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
||||
} catch (UserStoreException e) {
|
||||
throw new ApplicationManagementException(
|
||||
"User-store exception while checking whether the user " + userName + " of tenant " + tenantId
|
||||
+ " has the publisher permission");
|
||||
+ " has the publisher permission", e);
|
||||
} catch (ApplicationManagementDAOException e) {
|
||||
throw new ApplicationManagementException(
|
||||
"DAO exception while getting applications for the user " + userName + " of tenant " + tenantId, e);
|
||||
} finally {
|
||||
ConnectionManagerUtil.closeDBConnection();
|
||||
}
|
||||
@ -526,14 +529,15 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
||||
ApplicationRelease applicationRelease = DataHolder.getInstance().getApplicationReleaseManager()
|
||||
.getReleaseByUuid(applicationUuid);
|
||||
if (applicationRelease == null) {
|
||||
throw new NotFoundException(
|
||||
throw new ApplicationManagementException(
|
||||
"Application with UUID " + applicationUuid + " does not exist.");
|
||||
}
|
||||
return applicationRelease;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationRelease updateRelease(int appId, ApplicationRelease applicationRelease) throws ApplicationManagementException {
|
||||
public ApplicationRelease updateRelease(int appId, ApplicationRelease applicationRelease) throws
|
||||
ApplicationManagementException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -787,17 +791,15 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
||||
!SortingOrder.DESC.toString().equals(filter.getSortBy())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if (filter.getAppType() != null) {
|
||||
Boolean isValidRequest = false;
|
||||
for (ApplicationType applicationType: ApplicationType.values()){
|
||||
if(applicationType.toString().equals(filter.getAppType())){
|
||||
for (ApplicationType applicationType : ApplicationType.values()) {
|
||||
if (applicationType.toString().equals(filter.getAppType())) {
|
||||
isValidRequest = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isValidRequest){
|
||||
if (!isValidRequest) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ import org.apache.cxf.jaxrs.ext.multipart.Attachment;
|
||||
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
|
||||
import org.wso2.carbon.device.application.mgt.common.*;
|
||||
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationStorageManagementException;
|
||||
import org.wso2.carbon.device.application.mgt.core.exception.ValidationException;
|
||||
import org.wso2.carbon.device.application.mgt.publisher.api.APIUtil;
|
||||
import org.wso2.carbon.device.application.mgt.publisher.api.services.ApplicationManagementAPI;
|
||||
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException;
|
||||
@ -58,12 +59,10 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
|
||||
|
||||
private static Log log = LogFactory.getLog(ApplicationManagementAPIImpl.class);
|
||||
|
||||
|
||||
@GET
|
||||
@Override
|
||||
@Consumes("application/json")
|
||||
public Response getApplications(
|
||||
@Valid Filter filter) {
|
||||
public Response getApplications(@Valid Filter filter) {
|
||||
ApplicationManager applicationManager = APIUtil.getApplicationManager();
|
||||
|
||||
try {
|
||||
@ -73,9 +72,7 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
|
||||
("Couldn't find any application for requested query.").build();
|
||||
}
|
||||
return Response.status(Response.Status.OK).entity(applications).build();
|
||||
} catch (NotFoundException e) {
|
||||
return Response.status(Response.Status.NOT_FOUND).build();
|
||||
} catch (ApplicationManagementException e) {
|
||||
} catch (ApplicationManagementException e) {
|
||||
String msg = "Error occurred while getting the application list for publisher ";
|
||||
log.error(msg, e);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user