Modify DeviceTypeCommonService

4.x.x
tcdlpds@gmail.com 4 years ago
parent 8278f8c011
commit b4d7497022

@ -46,7 +46,7 @@ import java.util.Map;
import java.util.StringJoiner;
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
public void addDeviceSubscription(String subscribedBy, List<Integer> deviceIds,

@ -371,10 +371,12 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
List<DeviceSubscriptionDTO> deviceSubscriptionDTOS = this.subscriptionDAO
.getDeviceSubscriptions(applicationDTO.getApplicationReleaseDTOs().get(0).getId(),
tenantId);
AtomicBoolean isAppSubscribable = new AtomicBoolean(true);
for (DeviceSubscriptionDTO deviceSubscriptionDTO : deviceSubscriptionDTOS) {
if (device.getId() == deviceSubscriptionDTO.getDeviceId() && !deviceSubscriptionDTO
.isUnsubscribed()) {
if (device.getId() == deviceSubscriptionDTO.getDeviceId() &&
(Operation.Status.PENDING.toString().equals(deviceSubscriptionDTO.getStatus())
|| Operation.Status.IN_PROGRESS.toString().equals(deviceSubscriptionDTO.getStatus()))) {
isAppSubscribable.set(false);
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.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.general.QREnrollmentDetails;
/**
* This implementation populates device type plugin management service.
@ -28,9 +29,10 @@ public interface DeviceTypeCommonService {
/**
* To get Enrollment QR code against Ownership type
*
* @param qrEnrollmentDetails QR Enrollment Details
* @return {@link QREnrollmentPayload} object with payload to generate QR, invalidPlatformConfigs
* and optionalPlatformConfigs.
* @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