mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Improve and refactor APPM source
This commit is contained in:
parent
33521bcb90
commit
f130351a15
@ -232,7 +232,7 @@ public interface ApplicationManager {
|
||||
|
||||
void validateBinaryArtifact(Attachment binaryFile) throws RequestValidatingException;
|
||||
|
||||
void addAplicationCategories(List<String> categories) throws ApplicationManagementException;
|
||||
void addApplicationCategories(List<String> categories) throws ApplicationManagementException;
|
||||
|
||||
List<Tag> getRegisteredTags() throws ApplicationManagementException;
|
||||
|
||||
|
||||
@ -276,14 +276,14 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
|
||||
+ "AP_APP_REVIEW.USERNAME AS USERNAME, "
|
||||
+ "AP_APP_REVIEW.ROOT_PARENT_ID AS ROOT_PARENT_ID, "
|
||||
+ "AP_APP_REVIEW.IMMEDIATE_PARENT_ID AS IMMEDIATE_PARENT_ID, "
|
||||
+ "AP_APP_REVIEW.RATING AS RATING "
|
||||
+ "AP_APP_REVIEW.RATING AS RATING, "
|
||||
+ "AP_APP_RELEASE.UUID AS UUID, "
|
||||
+ "AP_APP_RELEASE.VERSION AS VERSION "
|
||||
+ "FROM AP_APP_REVIEW INNER JOIN AP_APP_RELEASE ON "
|
||||
+ "AP_APP_REVIEW.AP_APP_RELEASE_ID = AP_APP_RELEASE.ID "
|
||||
+ "WHERE AP_APP_REVIEW.AP_APP_RELEASE_ID = ? AND "
|
||||
+ "AP_APP_REVIEW.ROOT_PARENT_ID = ? AND "
|
||||
+ "AP_APP_REVIEW.ACTIVE_REVIEW = true "
|
||||
+ "AP_APP_REVIEW.ACTIVE_REVIEW = true AND "
|
||||
+ "AP_APP_REVIEW.TENANT_ID = ? "
|
||||
+ "LIMIT ? OFFSET ?";
|
||||
try (PreparedStatement statement = conn.prepareStatement(sql)) {
|
||||
@ -331,7 +331,7 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
|
||||
+ "AP_APP_RELEASE.VERSION AS VERSION "
|
||||
+ "FROM AP_APP_REVIEW INNER JOIN AP_APP_RELEASE ON "
|
||||
+ "AP_APP_REVIEW.AP_APP_RELEASE_ID = AP_APP_RELEASE.ID "
|
||||
+ "WHERE AP_APP_REVIEW.AP_APP_RELEASE_ID (",
|
||||
+ "WHERE AP_APP_REVIEW.AP_APP_RELEASE_ID IN (",
|
||||
") AND AP_APP_REVIEW.ROOT_PARENT_ID = ? AND "
|
||||
+ "AP_APP_REVIEW.ACTIVE_REVIEW = true AND "
|
||||
+ "AP_APP_REVIEW.TENANT_ID = ? "
|
||||
@ -387,7 +387,7 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
|
||||
+ "AP_APP_RELEASE.VERSION AS VERSION "
|
||||
+ "FROM AP_APP_REVIEW INNER JOIN AP_APP_RELEASE ON "
|
||||
+ "AP_APP_REVIEW.AP_APP_RELEASE_ID = AP_APP_RELEASE.ID "
|
||||
+ "WHERE AP_APP_REVIEW.AP_APP_RELEASE_ID (",
|
||||
+ "WHERE AP_APP_REVIEW.AP_APP_RELEASE_ID IN (",
|
||||
") AND AP_APP_REVIEW.ROOT_PARENT_ID = ? AND "
|
||||
+ "AP_APP_REVIEW.ACTIVE_REVIEW = true AND "
|
||||
+ "AP_APP_REVIEW.USERNAME = ? AND "
|
||||
@ -517,7 +517,6 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
|
||||
for (String uuid : uuids) {
|
||||
ps.setObject(index++, uuid);
|
||||
}
|
||||
ps.setInt(index++, tenantId);
|
||||
ps.setInt(index, tenantId);
|
||||
try (ResultSet rs = ps.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
|
||||
@ -1582,7 +1582,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAplicationCategories(List<String> categories) throws ApplicationManagementException {
|
||||
public void addApplicationCategories(List<String> categories) throws ApplicationManagementException {
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
|
||||
try {
|
||||
ConnectionManagerUtil.beginDBTransaction();
|
||||
|
||||
@ -85,7 +85,7 @@ public class ApplicationManagementServiceComponent {
|
||||
|
||||
ApplicationManager applicationManager = ApplicationManagementUtil.getApplicationManagerInstance();
|
||||
applicationManager
|
||||
.addAplicationCategories(ConfigurationManager.getInstance().getConfiguration().getAppCategories());
|
||||
.addApplicationCategories(ConfigurationManager.getInstance().getConfiguration().getAppCategories());
|
||||
DataHolder.getInstance().setApplicationManager(applicationManager);
|
||||
bundleContext.registerService(ApplicationManager.class.getName(), applicationManager, null);
|
||||
|
||||
|
||||
@ -203,7 +203,7 @@ public class ApplicationManagementTest extends BaseTestCase {
|
||||
categories.add("Test Category");
|
||||
categories.add("Test Category2");
|
||||
ApplicationManager manager = new ApplicationManagerImpl();
|
||||
manager.addAplicationCategories(categories);
|
||||
manager.addApplicationCategories(categories);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user