|
|
|
@ -75,7 +75,7 @@ import javax.ws.rs.core.Response;
|
|
|
|
|
@Path("/applications")
|
|
|
|
|
public class ApplicationManagementPublisherAPIImpl implements ApplicationManagementPublisherAPI {
|
|
|
|
|
|
|
|
|
|
private static Log log = LogFactory.getLog(ApplicationManagementPublisherAPIImpl.class);
|
|
|
|
|
private static final Log log = LogFactory.getLog(ApplicationManagementPublisherAPIImpl.class);
|
|
|
|
|
|
|
|
|
|
@POST
|
|
|
|
|
@Override
|
|
|
|
@ -97,7 +97,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
|
} catch (UnexpectedServerErrorException e) {
|
|
|
|
|
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();
|
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
|
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();
|
|
|
|
|
} catch(ForbiddenException e){
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
catch (ApplicationManagementException e) {
|
|
|
|
@ -158,7 +158,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
|
} catch(ForbiddenException e){
|
|
|
|
|
String msg = "You don't have permission to access the application release. application release UUID: : "
|
|
|
|
|
+ uuid;
|
|
|
|
|
log.error(msg);
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.FORBIDDEN).entity(msg).build();
|
|
|
|
|
}
|
|
|
|
|
catch (ApplicationManagementException e) {
|
|
|
|
@ -426,10 +426,10 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
|
.entity("Successfully uploaded artifacts for the application " + applicationReleaseUuid).build();
|
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
|
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";
|
|
|
|
|
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) {
|
|
|
|
|
String msg = "Error occurred while updating the application image artifacts for application release uuid: "
|
|
|
|
|
+ applicationReleaseUuid;
|
|
|
|
@ -441,7 +441,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
|
@Override
|
|
|
|
|
@PUT
|
|
|
|
|
@Consumes({"multipart/mixed", MediaType.MULTIPART_FORM_DATA})
|
|
|
|
|
@Path("/ent-app-artifact/{deviceType}//{uuid}")
|
|
|
|
|
@Path("/ent-app-artifact/{deviceType}/{uuid}")
|
|
|
|
|
public Response updateApplicationArtifact(
|
|
|
|
|
@PathParam("deviceType") String deviceType,
|
|
|
|
|
@PathParam("uuid") String applicationReleaseUuid,
|
|
|
|
@ -456,15 +456,24 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
|
.entity("Successfully uploaded artifacts for the application release. UUID is "
|
|
|
|
|
+ applicationReleaseUuid).build();
|
|
|
|
|
} catch (RequestValidatingException e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
|
|
|
|
|
String msg =
|
|
|
|
|
"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) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).build();
|
|
|
|
|
String msg = "Couldn't find an application which has application release UUID: " + applicationReleaseUuid;
|
|
|
|
|
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) {
|
|
|
|
|
log.error("Error occurred while updating the image artifacts of the application with the uuid "
|
|
|
|
|
+ applicationReleaseUuid, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
|
|
|
|
|
String msg = "Error occurred while updating the image artifacts of the application with the uuid "
|
|
|
|
|
+ applicationReleaseUuid;
|
|
|
|
|
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);
|
|
|
|
|
return Response.status(Response.Status.OK).entity(application).build();
|
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
|
log.error(e.getMessage());
|
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).build();
|
|
|
|
|
String msg = "Couldn't find an application for application id: " + applicationId;
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
|
} catch (BadRequestException e) {
|
|
|
|
|
String msg = "Error occurred while modifying the application. Found bad request payload for updating the "
|
|
|
|
|
+ "application";
|
|
|
|
@ -711,11 +721,10 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
|
return Response.status(Response.Status.OK).entity(lifecycleStates).build();
|
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
|
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();
|
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
|
String msg =
|
|
|
|
|
"Error occurred while getting lifecycle states for application release UUID: " + releaseUuid;
|
|
|
|
|
String msg = "Error occurred while getting lifecycle states for application release UUID: " + releaseUuid;
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
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();
|
|
|
|
|
} catch (LifecycleManagementException e) {
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -777,7 +786,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
|
return Response.status(Response.Status.OK).entity(tags).build();
|
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -796,15 +805,15 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
|
return Response.status(Response.Status.OK).entity(msg).build();
|
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
|
String msg = e.getMessage();
|
|
|
|
|
log.error(msg);
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
|
} catch (BadRequestException e) {
|
|
|
|
|
String msg = e.getMessage();
|
|
|
|
|
log.error(msg);
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -822,15 +831,15 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
|
return Response.status(Response.Status.OK).entity(msg).build();
|
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
|
String msg = e.getMessage();
|
|
|
|
|
log.error(msg);
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
|
} catch (ForbiddenException e) {
|
|
|
|
|
String msg = e.getMessage();
|
|
|
|
|
log.error(msg);
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.FORBIDDEN).entity(msg).build();
|
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -849,15 +858,15 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
|
return Response.status(Response.Status.OK).entity(msg).build();
|
|
|
|
|
} catch (BadRequestException e) {
|
|
|
|
|
String msg = e.getMessage();
|
|
|
|
|
log.error(msg);
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
|
String msg = e.getMessage();
|
|
|
|
|
log.error(msg);
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -874,11 +883,11 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
|
return Response.status(Response.Status.OK).entity(tags).build();
|
|
|
|
|
} catch (BadRequestException e) {
|
|
|
|
|
String msg = e.getMessage();
|
|
|
|
|
log.error(msg);
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -896,11 +905,11 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
|
return Response.status(Response.Status.OK).entity(applicationTags).build();
|
|
|
|
|
} catch (NotFoundException e) {
|
|
|
|
|
String msg = e.getMessage();
|
|
|
|
|
log.error(msg);
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -916,7 +925,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
|
|
|
|
|
return Response.status(Response.Status.OK).entity(categories).build();
|
|
|
|
|
} catch (ApplicationManagementException e) {
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|