Merge branch 'master' into 'master'

Modify DeviceTypeCommonService

See merge request entgra/carbon-device-mgt!717
revert-70ac1926
Dharmakeerthi Lasantha 4 years ago
commit 44b2621381

@ -46,7 +46,7 @@ import java.util.Map;
import java.util.StringJoiner; import java.util.StringJoiner;
public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements SubscriptionDAO { public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements SubscriptionDAO {
private static Log log = LogFactory.getLog(GenericSubscriptionDAOImpl.class); private static final Log log = LogFactory.getLog(GenericSubscriptionDAOImpl.class);
@Override @Override
public void addDeviceSubscription(String subscribedBy, List<Integer> deviceIds, public void addDeviceSubscription(String subscribedBy, List<Integer> deviceIds,

@ -371,10 +371,12 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
List<DeviceSubscriptionDTO> deviceSubscriptionDTOS = this.subscriptionDAO List<DeviceSubscriptionDTO> deviceSubscriptionDTOS = this.subscriptionDAO
.getDeviceSubscriptions(applicationDTO.getApplicationReleaseDTOs().get(0).getId(), .getDeviceSubscriptions(applicationDTO.getApplicationReleaseDTOs().get(0).getId(),
tenantId); tenantId);
AtomicBoolean isAppSubscribable = new AtomicBoolean(true); AtomicBoolean isAppSubscribable = new AtomicBoolean(true);
for (DeviceSubscriptionDTO deviceSubscriptionDTO : deviceSubscriptionDTOS) { for (DeviceSubscriptionDTO deviceSubscriptionDTO : deviceSubscriptionDTOS) {
if (device.getId() == deviceSubscriptionDTO.getDeviceId() && !deviceSubscriptionDTO if (device.getId() == deviceSubscriptionDTO.getDeviceId() &&
.isUnsubscribed()) { (Operation.Status.PENDING.toString().equals(deviceSubscriptionDTO.getStatus())
|| Operation.Status.IN_PROGRESS.toString().equals(deviceSubscriptionDTO.getStatus()))) {
isAppSubscribable.set(false); isAppSubscribable.set(false);
break; break;
} }

@ -0,0 +1,37 @@
/*
* Copyright (c) 2021, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.common.general;
public class QREnrollmentDetails {
String ownershipType;
String username;
String enrollmentMode;
public String getOwnershipType() { return ownershipType; }
public void setOwnershipType(String ownershipType) { this.ownershipType = ownershipType; }
public String getUsername() { return username; }
public void setUsername(String username) { this.username = username; }
public String getEnrollmentMode() { return enrollmentMode; }
public void setEnrollmentMode(String enrollmentMode) { this.enrollmentMode = enrollmentMode; }
}

@ -19,6 +19,7 @@ package org.wso2.carbon.device.mgt.common.spi;
import org.wso2.carbon.device.mgt.common.QREnrollmentPayload; import org.wso2.carbon.device.mgt.common.QREnrollmentPayload;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.general.QREnrollmentDetails;
/** /**
* This implementation populates device type plugin management service. * This implementation populates device type plugin management service.
@ -28,9 +29,10 @@ public interface DeviceTypeCommonService {
/** /**
* To get Enrollment QR code against Ownership type * To get Enrollment QR code against Ownership type
* *
* @param qrEnrollmentDetails QR Enrollment Details
* @return {@link QREnrollmentPayload} object with payload to generate QR, invalidPlatformConfigs * @return {@link QREnrollmentPayload} object with payload to generate QR, invalidPlatformConfigs
* and optionalPlatformConfigs. * and optionalPlatformConfigs.
* @throws DeviceManagementException if error occurred while generating the QR String for Ownership * @throws DeviceManagementException if error occurred while generating the QR String for Ownership
*/ */
QREnrollmentPayload getEnrollmentQRCode(String ownershipType) throws DeviceManagementException; QREnrollmentPayload getEnrollmentQRCode(QREnrollmentDetails qrEnrollmentDetails) throws DeviceManagementException;
} }

Loading…
Cancel
Save