|
|
@ -75,7 +75,7 @@ import javax.ws.rs.core.Response;
|
|
|
|
@Path("/applications")
|
|
|
|
@Path("/applications")
|
|
|
|
public class ApplicationManagementPublisherAPIImpl implements ApplicationManagementPublisherAPI {
|
|
|
|
public class ApplicationManagementPublisherAPIImpl implements ApplicationManagementPublisherAPI {
|
|
|
|
|
|
|
|
|
|
|
|
private static Log log = LogFactory.getLog(ApplicationManagementPublisherAPIImpl.class);
|
|
|
|
private static final Log log = LogFactory.getLog(ApplicationManagementPublisherAPIImpl.class);
|
|
|
|
|
|
|
|
|
|
|
|
@POST
|
|
|
|
@POST
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -97,7 +97,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
} catch (UnexpectedServerErrorException e) {
|
|
|
|
} catch (UnexpectedServerErrorException e) {
|
|
|
|
String msg = "Error Occured when getting supported device types by Entgra IoTS";
|
|
|
|
String msg = "Error Occured when getting supported device types by Entgra IoTS";
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
String msg = "Error occurred while getting the application list for publisher ";
|
|
|
|
String msg = "Error occurred while getting the application list for publisher ";
|
|
|
@ -127,7 +127,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
} catch(ForbiddenException e){
|
|
|
|
} catch(ForbiddenException e){
|
|
|
|
String msg = "You don't have permission to access the application. application id: " + appId;
|
|
|
|
String msg = "You don't have permission to access the application. application id: " + appId;
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.FORBIDDEN).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.FORBIDDEN).entity(msg).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (ApplicationManagementException e) {
|
|
|
|
catch (ApplicationManagementException e) {
|
|
|
@ -158,7 +158,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
} catch(ForbiddenException e){
|
|
|
|
} catch(ForbiddenException e){
|
|
|
|
String msg = "You don't have permission to access the application release. application release UUID: : "
|
|
|
|
String msg = "You don't have permission to access the application release. application release UUID: : "
|
|
|
|
+ uuid;
|
|
|
|
+ uuid;
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.FORBIDDEN).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.FORBIDDEN).entity(msg).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (ApplicationManagementException e) {
|
|
|
|
catch (ApplicationManagementException e) {
|
|
|
@ -426,10 +426,10 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
.entity("Successfully uploaded artifacts for the application " + applicationReleaseUuid).build();
|
|
|
|
.entity("Successfully uploaded artifacts for the application " + applicationReleaseUuid).build();
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
String msg = "Couldn't found an application release which has application release UUID "
|
|
|
|
String msg = "Couldn't found an application release which has application release UUID "
|
|
|
|
+ applicationReleaseUuid + ". HEnce please verify the application release UUID again and execute "
|
|
|
|
+ applicationReleaseUuid + ". Hence please verify the application release UUID again and execute "
|
|
|
|
+ "the operation";
|
|
|
|
+ "the operation";
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).build();
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
String msg = "Error occurred while updating the application image artifacts for application release uuid: "
|
|
|
|
String msg = "Error occurred while updating the application image artifacts for application release uuid: "
|
|
|
|
+ applicationReleaseUuid;
|
|
|
|
+ applicationReleaseUuid;
|
|
|
@ -441,7 +441,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@PUT
|
|
|
|
@PUT
|
|
|
|
@Consumes({"multipart/mixed", MediaType.MULTIPART_FORM_DATA})
|
|
|
|
@Consumes({"multipart/mixed", MediaType.MULTIPART_FORM_DATA})
|
|
|
|
@Path("/ent-app-artifact/{deviceType}//{uuid}")
|
|
|
|
@Path("/ent-app-artifact/{deviceType}/{uuid}")
|
|
|
|
public Response updateApplicationArtifact(
|
|
|
|
public Response updateApplicationArtifact(
|
|
|
|
@PathParam("deviceType") String deviceType,
|
|
|
|
@PathParam("deviceType") String deviceType,
|
|
|
|
@PathParam("uuid") String applicationReleaseUuid,
|
|
|
|
@PathParam("uuid") String applicationReleaseUuid,
|
|
|
@ -456,15 +456,24 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
.entity("Successfully uploaded artifacts for the application release. UUID is "
|
|
|
|
.entity("Successfully uploaded artifacts for the application release. UUID is "
|
|
|
|
+ applicationReleaseUuid).build();
|
|
|
|
+ applicationReleaseUuid).build();
|
|
|
|
} catch (RequestValidatingException e) {
|
|
|
|
} catch (RequestValidatingException e) {
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
String msg =
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
|
|
|
|
"Couldn't find the binary file with the request. Hence invoke the API with updating application"
|
|
|
|
|
|
|
|
+ " artifact";
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
String msg = "Couldn't find an application which has application release UUID: " + applicationReleaseUuid;
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).build();
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
|
|
|
|
} catch (BadRequestException e) {
|
|
|
|
|
|
|
|
String msg = "Found an invalid device type: " + deviceType + " with the request";
|
|
|
|
|
|
|
|
log.error(msg);
|
|
|
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
log.error("Error occurred while updating the image artifacts of the application with the uuid "
|
|
|
|
String msg = "Error occurred while updating the image artifacts of the application with the uuid "
|
|
|
|
+ applicationReleaseUuid, e);
|
|
|
|
+ applicationReleaseUuid;
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -479,8 +488,9 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
Application application = applicationManager.updateApplication(applicationId, applicationUpdateWrapper);
|
|
|
|
Application application = applicationManager.updateApplication(applicationId, applicationUpdateWrapper);
|
|
|
|
return Response.status(Response.Status.OK).entity(application).build();
|
|
|
|
return Response.status(Response.Status.OK).entity(application).build();
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
log.error(e.getMessage());
|
|
|
|
String msg = "Couldn't find an application for application id: " + applicationId;
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).build();
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
} catch (BadRequestException e) {
|
|
|
|
} catch (BadRequestException e) {
|
|
|
|
String msg = "Error occurred while modifying the application. Found bad request payload for updating the "
|
|
|
|
String msg = "Error occurred while modifying the application. Found bad request payload for updating the "
|
|
|
|
+ "application";
|
|
|
|
+ "application";
|
|
|
@ -711,11 +721,10 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
return Response.status(Response.Status.OK).entity(lifecycleStates).build();
|
|
|
|
return Response.status(Response.Status.OK).entity(lifecycleStates).build();
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
String msg = "Couldn't found an application release for UUID: " + releaseUuid;
|
|
|
|
String msg = "Couldn't found an application release for UUID: " + releaseUuid;
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
String msg =
|
|
|
|
String msg = "Error occurred while getting lifecycle states for application release UUID: " + releaseUuid;
|
|
|
|
"Error occurred while getting lifecycle states for application release UUID: " + releaseUuid;
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -761,7 +770,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
return Response.status(Response.Status.OK).entity(dataHandler.getLifecycleConfiguration()).build();
|
|
|
|
return Response.status(Response.Status.OK).entity(dataHandler.getLifecycleConfiguration()).build();
|
|
|
|
} catch (LifecycleManagementException e) {
|
|
|
|
} catch (LifecycleManagementException e) {
|
|
|
|
String msg = "Error Occurred while accessing lifecycle manager.";
|
|
|
|
String msg = "Error Occurred while accessing lifecycle manager.";
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -777,7 +786,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
return Response.status(Response.Status.OK).entity(tags).build();
|
|
|
|
return Response.status(Response.Status.OK).entity(tags).build();
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
String msg = "Error Occurred while getting registered tags.";
|
|
|
|
String msg = "Error Occurred while getting registered tags.";
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -796,15 +805,15 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
return Response.status(Response.Status.OK).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.OK).entity(msg).build();
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
String msg = e.getMessage();
|
|
|
|
String msg = e.getMessage();
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
} catch (BadRequestException e) {
|
|
|
|
} catch (BadRequestException e) {
|
|
|
|
String msg = e.getMessage();
|
|
|
|
String msg = e.getMessage();
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
String msg = "Error Occurred while deleting registered tag.";
|
|
|
|
String msg = "Error Occurred while deleting registered tag.";
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -822,15 +831,15 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
return Response.status(Response.Status.OK).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.OK).entity(msg).build();
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
String msg = e.getMessage();
|
|
|
|
String msg = e.getMessage();
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
} catch (ForbiddenException e) {
|
|
|
|
} catch (ForbiddenException e) {
|
|
|
|
String msg = e.getMessage();
|
|
|
|
String msg = e.getMessage();
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.FORBIDDEN).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.FORBIDDEN).entity(msg).build();
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
String msg = "Error Occurred while deleting unused tag.";
|
|
|
|
String msg = "Error Occurred while deleting unused tag.";
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -849,15 +858,15 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
return Response.status(Response.Status.OK).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.OK).entity(msg).build();
|
|
|
|
} catch (BadRequestException e) {
|
|
|
|
} catch (BadRequestException e) {
|
|
|
|
String msg = e.getMessage();
|
|
|
|
String msg = e.getMessage();
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
String msg = e.getMessage();
|
|
|
|
String msg = e.getMessage();
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
String msg = "Error Occurred while updating registered tag.";
|
|
|
|
String msg = "Error Occurred while updating registered tag.";
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -874,11 +883,11 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
return Response.status(Response.Status.OK).entity(tags).build();
|
|
|
|
return Response.status(Response.Status.OK).entity(tags).build();
|
|
|
|
} catch (BadRequestException e) {
|
|
|
|
} catch (BadRequestException e) {
|
|
|
|
String msg = e.getMessage();
|
|
|
|
String msg = e.getMessage();
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
String msg = "Error Occurred while adding new tag.";
|
|
|
|
String msg = "Error Occurred while adding new tag.";
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -896,11 +905,11 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
return Response.status(Response.Status.OK).entity(applicationTags).build();
|
|
|
|
return Response.status(Response.Status.OK).entity(applicationTags).build();
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
String msg = e.getMessage();
|
|
|
|
String msg = e.getMessage();
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
String msg = "Error Occurred while adding new tags for application which has application ID: " + appId + ".";
|
|
|
|
String msg = "Error Occurred while adding new tags for application which has application ID: " + appId + ".";
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -916,7 +925,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
return Response.status(Response.Status.OK).entity(categories).build();
|
|
|
|
return Response.status(Response.Status.OK).entity(categories).build();
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
String msg = "Error Occurred while getting registered categories.";
|
|
|
|
String msg = "Error Occurred while getting registered categories.";
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|