Resolve comments

otp-db-change
osh 1 year ago
parent b978e31ab0
commit dae8c09761

@ -88,8 +88,7 @@ public class Extension {
SubscriptionManager, SubscriptionManager,
VisibilityManager, VisibilityManager,
ApplicationStorageManager, ApplicationStorageManager,
PlatformStorageManager, PlatformStorageManager
MetadataManagementService
} }
} }

@ -458,7 +458,6 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp
stmt.setString(5, vppAssociationDTO.getPricingParam()); stmt.setString(5, vppAssociationDTO.getPricingParam());
stmt.setInt(6, vppAssociationDTO.getId()); stmt.setInt(6, vppAssociationDTO.getId());
stmt.setLong(7, tenantId); stmt.setLong(7, tenantId);
stmt.executeUpdate();
if (stmt.executeUpdate() == 1) { if (stmt.executeUpdate() == 1) {
return vppAssociationDTO; return vppAssociationDTO;
} }

@ -27,7 +27,6 @@ import io.entgra.device.mgt.core.application.mgt.core.serviceprovider.ISServiceP
import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException;
import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException;
import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService;
import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -117,23 +116,19 @@ public class APIUtil {
} }
public static MetadataManagementService getMetadataManager() { public static MetadataManagementService getMetadataManager() {
try { if (metadataManagementService == null) {
if (metadataManagementService == null) { synchronized (APIUtil.class) {
synchronized (APIUtil.class) { if (metadataManagementService == null) {
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
metadataManagementService =
(MetadataManagementService) ctx.getOSGiService(MetadataManagementService.class, null);
if (metadataManagementService == null) { if (metadataManagementService == null) {
metadataManagementService = ApplicationManagementUtil.getDeviceManagerInstance(); String msg = "MetadataManagement Manager service has not initialized.";
if (metadataManagementService == null) { log.error(msg);
String msg = "MetadataManagement Service service has not initialized."; throw new IllegalStateException(msg);
log.error(msg);
throw new IllegalStateException(msg);
}
} }
} }
} }
} catch (Exception e) {
String msg = "Error occurred while getting the vpp manager";
log.error(msg);
throw new IllegalStateException(msg);
} }
return metadataManagementService; return metadataManagementService;
} }

@ -210,14 +210,6 @@ public class ApplicationManagementUtil {
// TODO: implement as an extension // TODO: implement as an extension
return new VppApplicationManagerImpl(); return new VppApplicationManagerImpl();
} }
public static MetadataManagementService getDeviceManagerInstance() throws InvalidConfigurationException {
ConfigurationManager configurationManager = ConfigurationManager.getInstance();
Extension extension = configurationManager.getExtension(Extension.Name.MetadataManagementService);
return getInstance(extension, MetadataManagementService.class);
}
/** /**
* This is useful to delete application artifacts if any error occurred while creating release/application * This is useful to delete application artifacts if any error occurred while creating release/application
* after uploading the artifacts * after uploading the artifacts

Loading…
Cancel
Save