Merge branch 'master' of ssh://repository.entgra.net:222/community/device-mgt-core into pr/feature/whitelabel

copy-new-hierarchical-grouping-with-wrapperClass
osh 2 years ago
commit ad7466ee1e

@ -25,7 +25,6 @@ public class HubspotChat {
private String trackingUrl; private String trackingUrl;
private String accessToken; private String accessToken;
private String senderActorId; private String senderActorId;
private long channelAccountId;
@XmlElement(name = "EnableHubspot") @XmlElement(name = "EnableHubspot")
public boolean isEnableHubspot() { public boolean isEnableHubspot() {
@ -61,12 +60,4 @@ public class HubspotChat {
public void setSenderActorId(String senderActorId) { public void setSenderActorId(String senderActorId) {
this.senderActorId = senderActorId; this.senderActorId = senderActorId;
} }
@XmlElement(name = "ChannelAccountId")
public long getChannelAccountId() {
return channelAccountId;
}
public void setChannelAccountId(long channelAccountId) {
this.channelAccountId = channelAccountId;
}
} }

@ -44,6 +44,8 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementExcept
import org.wso2.carbon.device.mgt.common.policy.mgt.Policy; import org.wso2.carbon.device.mgt.common.policy.mgt.Policy;
import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation; import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation;
import org.wso2.carbon.device.mgt.core.operation.mgt.OperationMgtConstants; import org.wso2.carbon.device.mgt.core.operation.mgt.OperationMgtConstants;
import org.wso2.carbon.device.mgt.core.operation.mgt.PolicyOperation;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.policy.mgt.common.PolicyAdministratorPoint; import org.wso2.carbon.policy.mgt.common.PolicyAdministratorPoint;
import org.wso2.carbon.policy.mgt.common.PolicyEvaluationException; import org.wso2.carbon.policy.mgt.common.PolicyEvaluationException;
import org.wso2.carbon.policy.mgt.common.PolicyManagementException; import org.wso2.carbon.policy.mgt.common.PolicyManagementException;
@ -96,6 +98,7 @@ public class PolicyEnforcementDelegatorImpl implements PolicyEnforcementDelegato
*/ */
if (devicePolicy == null || devicePolicy.getId() != policy.getId() || updatedPolicyIds.contains if (devicePolicy == null || devicePolicy.getId() != policy.getId() || updatedPolicyIds.contains
(policy.getId())) { (policy.getId())) {
this.markPreviousPolicyBundlesRepeated(device);
this.addPolicyRevokeOperation(deviceIdentifiers); this.addPolicyRevokeOperation(deviceIdentifiers);
this.addPolicyOperation(deviceIdentifiers, policy); this.addPolicyOperation(deviceIdentifiers, policy);
} }
@ -202,4 +205,29 @@ public class PolicyEnforcementDelegatorImpl implements PolicyEnforcementDelegato
throw new PolicyDelegationException(msg, e); throw new PolicyDelegationException(msg, e);
} }
} }
/**
* Update the previous pending policy operation's status as REPEATED
* @param device Device
* @throws PolicyDelegationException throws when getting pending operations
*/
public void markPreviousPolicyBundlesRepeated(Device device) throws PolicyDelegationException {
DeviceManagementProviderService deviceManagerService = PolicyManagementDataHolder.getInstance().
getDeviceManagementService();
try {
List<? extends Operation> operations = deviceManagerService.getPendingOperations(device);
for(Operation operation : operations) {
String operationCode = operation.getCode();
if(PolicyOperation.POLICY_OPERATION_CODE.equals(operationCode) ||
OperationMgtConstants.OperationCodes.POLICY_REVOKE.equals(operationCode)) {
operation.setStatus(Operation.Status.REPEATED);
deviceManagerService.updateOperation(device, operation);
}
}
} catch (OperationManagementException e) {
String msg = "Error occurred while retrieving pending operations of device id "+device.getId();
log.error(msg, e);
throw new PolicyDelegationException(msg, e);
}
}
} }

@ -31,7 +31,6 @@
<!-- access token - whenever the access token will be rotated, needs to be changed this with the new token --> <!-- access token - whenever the access token will be rotated, needs to be changed this with the new token -->
<AccessToken>access_token</AccessToken> <AccessToken>access_token</AccessToken>
<SenderActorId>sender_actorId</SenderActorId> <SenderActorId>sender_actorId</SenderActorId>
<ChannelAccountId>channel_AccountId</ChannelAccountId>
</HubspotChat> </HubspotChat>
<Billing> <Billing>
<HideBillGenerationInSuperTenant>false</HideBillGenerationInSuperTenant> <HideBillGenerationInSuperTenant>false</HideBillGenerationInSuperTenant>

Loading…
Cancel
Save