Update operations status when serve startup #503

Merged
tcdlpds merged 5 commits from pasindu/device-mgt-core:operationImprovement into master 3 months ago

The fix is related for the -
Support ticket - https://support.entgra.net/issues/9668

Implementation -

  1. Implement APIs for operation configuration and save the config in metadata repository.
  2. Implement method for update the operations status when server startup.

API details

Api - /api/device-mgt-config/v1.0/operation-configuration
Scope key - admin:operation_config:manage

Request body format -

{
"deviceTypes" : ["switchgear_controlbox"],
"initialOperationStatus" : "IN_PROGRESS",
"requiredStatusChange" : "ERROR"
}

Note : deviceTypes is an array of strings.

The fix is related for the - Support ticket - https://support.entgra.net/issues/9668 Implementation - 1. Implement APIs for operation configuration and save the config in metadata repository. 2. Implement method for update the operations status when server startup. --- API details Api - /api/device-mgt-config/v1.0/operation-configuration Scope key - admin:operation_config:manage Request body format - { "deviceTypes" : ["switchgear_controlbox"], "initialOperationStatus" : "IN_PROGRESS", "requiredStatusChange" : "ERROR" } Note : deviceTypes is an array of strings.
pasindu force-pushed operationImprovement from 5843ff88a2 to eeab5b2d40 3 months ago
pasindu force-pushed operationImprovement from eeab5b2d40 to 2538c83dc5 3 months ago
pasindu force-pushed operationImprovement from 2538c83dc5 to 70a25549ae 3 months ago
pasindu force-pushed operationImprovement from 70a25549ae to 5a57dbac9b 3 months ago
charithag approved these changes 3 months ago
tcdlpds requested changes 3 months ago
UserRoleCreateObserver userRoleCreateObserver = new UserRoleCreateObserver();
bundleContext.registerService(ServerStartupObserver.class.getName(), userRoleCreateObserver, null);
OperationStartupHandler operationStartupHandler = new OperationStartupHandler();
Owner

Shall we save the service in the DataHolder also?

Shall we save the service in the DataHolder also?
Poster

Fixed with f59208f6e7

Fixed with f59208f6e79f729a06e0349c04c19662c1977045
tcdlpds marked this conversation as resolved
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.core.ServerStartupObserver;
public class OperationStartupHandler implements ServerStartupObserver {
Owner

Why haven't we used already implemented class to have this functionality?

Why haven't we used already implemented class to have this functionality?
Poster

In device-mgt core component there were only Server startup observer use for the UserRoleCreateObserver service so I created a separate class for this operation startup service.

In device-mgt core component there were only Server startup observer use for the UserRoleCreateObserver service so I created a separate class for this operation startup service.
tcdlpds marked this conversation as resolved
} catch (MetadataManagementException e) {
String msg = "Error occurred while retrieving operation configuration";
log.error(msg, e);
throw new OperationConfigException(e);
Owner

Throw message and the error, please check all the places and do the modification.

Throw message and the error, please check all the places and do the modification.
Poster

Fixed with 6d324c084a

Fixed with 6d324c084ae58325f2aac0c804416fbad3f3aefc
tcdlpds marked this conversation as resolved
sql += " AND STATUS=?";
}
stmt = connection.prepareStatement(sql);
Owner

Let's use try-with-resources, then we can remove the finally block also. Please check all the relevant places and do the modifications.

Let's use try-with-resources, then we can remove the finally block also. Please check all the relevant places and do the modifications.
Poster

Fixed with 87b98a6cb5

Fixed with 87b98a6cb55719eb0b7b408243d899e22bccce43
tcdlpds marked this conversation as resolved
pasindu force-pushed operationImprovement from 14a589f42a to 87b98a6cb5 3 months ago
pasindu requested review from tcdlpds 3 months ago
pasindu force-pushed operationImprovement from f071a68e3a to 0272bda2ce 3 months ago
tcdlpds merged commit 00686e75d1 into master 3 months ago
pasindu deleted branch operationImprovement 3 months ago

Reviewers

charithag approved these changes 3 months ago
tcdlpds was requested for review 3 months ago
The pull request has been merged as 00686e75d1.
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: community/device-mgt-core#503
Loading…
There is no content yet.