mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Refactoring
This commit is contained in:
parent
d8ff31b628
commit
a1806eb87e
@ -22,7 +22,13 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.device.application.mgt.common.exception.UnsupportedDatabaseEngineException;
|
||||
import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager;
|
||||
import org.wso2.carbon.device.application.mgt.core.dao.*;
|
||||
import org.wso2.carbon.device.application.mgt.core.dao.ApplicationDAO;
|
||||
import org.wso2.carbon.device.application.mgt.core.dao.ApplicationReleaseDAO;
|
||||
import org.wso2.carbon.device.application.mgt.core.dao.CategoryDAO;
|
||||
import org.wso2.carbon.device.application.mgt.core.dao.LifecycleStateDAO;
|
||||
import org.wso2.carbon.device.application.mgt.core.dao.PlatformDAO;
|
||||
import org.wso2.carbon.device.application.mgt.core.dao.SubscriptionDAO;
|
||||
import org.wso2.carbon.device.application.mgt.core.dao.VisibilityDAO;
|
||||
import org.wso2.carbon.device.application.mgt.core.dao.impl.application.GenericApplicationDAOImpl;
|
||||
import org.wso2.carbon.device.application.mgt.core.dao.impl.application.release.GenericApplicationReleaseDAOImpl;
|
||||
import org.wso2.carbon.device.application.mgt.core.dao.impl.application.release.OracleApplicationDAOImpl;
|
||||
|
||||
@ -73,11 +73,10 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
||||
application.setModifiedAt(new Date());
|
||||
Platform platform = DataHolder.getInstance().getPlatformManager()
|
||||
.getPlatform(application.getUser().getTenantId(), application.getPlatform().getIdentifier());
|
||||
|
||||
if (platform == null) {
|
||||
throw new NotFoundException("Invalid platform is provided for the application " + application.getUuid());
|
||||
}
|
||||
|
||||
application.setPlatform(platform);
|
||||
Category category = DataHolder.getInstance().getCategoryManager()
|
||||
.getCategory(application.getCategory().getName());
|
||||
if (category == null) {
|
||||
@ -86,9 +85,6 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
||||
application.setCategory(category);
|
||||
try {
|
||||
ConnectionManagerUtil.beginDBTransaction();
|
||||
|
||||
// Validating the platform
|
||||
application.setPlatform(platform);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Application creation pre-conditions are met and the platform mentioned by identifier "
|
||||
+ platform.getIdentifier() + " is found");
|
||||
@ -104,7 +100,6 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
||||
lifecycle.setLifecycleStateModifiedAt(new Date());
|
||||
lifecycle.setGetLifecycleStateModifiedBy(application.getUser().getUserName());
|
||||
application.setCurrentLifecycle(lifecycle);
|
||||
|
||||
application = DAOFactory.getApplicationDAO().createApplication(application);
|
||||
DataHolder.getInstance().getVisibilityManager().put(application.getId(), application.getVisibility());
|
||||
ConnectionManagerUtil.commitDBTransaction();
|
||||
@ -142,7 +137,6 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
||||
+ " is not found. Please give a valid platform identifier.");
|
||||
}
|
||||
application.setPlatform(platform);
|
||||
|
||||
if (application.getCategory() != null) {
|
||||
String applicationCategoryName = application.getCategory().getName();
|
||||
if (applicationCategoryName == null || applicationCategoryName.isEmpty()) {
|
||||
@ -158,7 +152,6 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
||||
}
|
||||
application.setCategory(category);
|
||||
}
|
||||
|
||||
try {
|
||||
ConnectionManagerUtil.beginDBTransaction();
|
||||
ApplicationDAO applicationDAO = DAOFactory.getApplicationDAO();
|
||||
|
||||
@ -44,9 +44,8 @@ public class CategoryManagerImpl implements CategoryManager {
|
||||
"Application category name cannot be null. Application category creation failed.");
|
||||
}
|
||||
if (getCategory(category.getName()) != null) {
|
||||
throw new ApplicationCategoryManagementException(
|
||||
"Application category wth the name " + category.getName() + " "
|
||||
+ "exists already. Please select a different name");
|
||||
throw new ApplicationCategoryManagementException("Application category wth the name " + category.getName()
|
||||
+ "exists already. Please select a different name");
|
||||
}
|
||||
try {
|
||||
ConnectionManagerUtil.beginDBTransaction();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user