diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/ApplicationManagementService.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/ApplicationManagementService.java index 54af6d1cfe..1c7e44a776 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/ApplicationManagementService.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/ApplicationManagementService.java @@ -20,7 +20,7 @@ package org.wso2.carbon.device.application.mgt.api.services; import io.swagger.annotations.*; import org.wso2.carbon.device.application.mgt.api.beans.ErrorResponse; -import org.wso2.carbon.device.application.mgt.core.dto.ApplicationList; +import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementServiceImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementServiceImpl.java index 82fbcbefd4..95043e8c99 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementServiceImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementServiceImpl.java @@ -21,7 +21,7 @@ package org.wso2.carbon.device.application.mgt.api.services.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.application.mgt.core.components.ApplicationManager; -import org.wso2.carbon.device.application.mgt.core.dto.ApplicationList; +import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList; import org.wso2.carbon.device.application.mgt.core.dto.Filter; import org.wso2.carbon.device.application.mgt.core.util.ApplicationManagementUtil; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/components/ApplicationManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/components/ApplicationManager.java index f14e734317..086d564d39 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/components/ApplicationManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/components/ApplicationManager.java @@ -19,12 +19,10 @@ package org.wso2.carbon.device.application.mgt.core.components; import org.wso2.carbon.device.application.mgt.core.dto.Application; -import org.wso2.carbon.device.application.mgt.core.dto.ApplicationList; +import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList; import org.wso2.carbon.device.application.mgt.core.dto.Filter; import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagerException; -import java.util.List; - public interface ApplicationManager { public void createApplication(Application application) throws ApplicationManagerException; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/components/impl/ApplicationManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/components/impl/ApplicationManagerImpl.java index 12e4ba519e..20fd44a346 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/components/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/components/impl/ApplicationManagerImpl.java @@ -21,16 +21,14 @@ package org.wso2.carbon.device.application.mgt.core.components.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.application.mgt.core.components.ApplicationManager; -import org.wso2.carbon.device.application.mgt.core.dao.ApplicationManagementDAO; +import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAO; import org.wso2.carbon.device.application.mgt.core.dto.Application; -import org.wso2.carbon.device.application.mgt.core.dto.ApplicationList; +import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList; import org.wso2.carbon.device.application.mgt.core.dto.Filter; import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagerException; import org.wso2.carbon.device.application.mgt.core.internal.ApplicationManagementDataHolder; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; -import java.util.List; - public class ApplicationManagerImpl implements ApplicationManager { private static final Log log = LogFactory.getLog(ApplicationManagerImpl.class); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationManagementDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationManagementDAO.java deleted file mode 100644 index 7020b9b20d..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationManagementDAO.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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.application.mgt.core.dao; - -import org.wso2.carbon.device.application.mgt.core.dto.Application; -import org.wso2.carbon.device.application.mgt.core.dto.ApplicationList; -import org.wso2.carbon.device.application.mgt.core.dto.Filter; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public interface ApplicationManagementDAO { - - public enum DatabaseType { - - H2("H2"), - MYSQL("MySQL"), - ORACLE("Oracle"), - POSTGRESQL("PostgreSQL"), - MSSQL("Microsoft SQL Server"); - - private final String value; - private static final Map lookup = new HashMap(); - - static { - for (DatabaseType databaseType : DatabaseType.values()) { - lookup.put(databaseType.getValue(), databaseType); - } - } - - DatabaseType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static DatabaseType lookup(String value) { - return lookup.get(value); - } - } - - public void createApplication(Application application) throws ApplicationManagementDAOException; - - public ApplicationList getApplications(Filter filter) throws ApplicationManagementDAOException; - -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationReleasesDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationReleasesDAO.java new file mode 100644 index 0000000000..b624467839 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationReleasesDAO.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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.application.mgt.core.dao; + +public interface ApplicationReleasesDAO { + +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationsDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationsDAO.java new file mode 100644 index 0000000000..3353b5cebb --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationsDAO.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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.application.mgt.core.dao; + +import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOException; +import org.wso2.carbon.device.application.mgt.core.dto.Application; +import org.wso2.carbon.device.application.mgt.core.dto.Filter; +import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList; + +public interface ApplicationsDAO { + + Application createApplication(Application application) throws ApplicationManagementDAOException; + + ApplicationList getApplications(Filter filter) throws ApplicationManagementDAOException; + + Application editApplication(Application application) throws ApplicationManagementDAOException; + + void deleteApplication (Application application)throws ApplicationManagementDAOException; + +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/CategoriesDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/CategoriesDAO.java new file mode 100644 index 0000000000..87ef7c6f8f --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/CategoriesDAO.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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.application.mgt.core.dao; + +public interface CategoriesDAO { +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/CommentsDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/CommentsDAO.java new file mode 100644 index 0000000000..98e97614ad --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/CommentsDAO.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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.application.mgt.core.dao; + +public interface CommentsDAO { +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/LifecycleStatesDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/LifecycleStatesDAO.java new file mode 100644 index 0000000000..94048146bc --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/LifecycleStatesDAO.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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.application.mgt.core.dao; + +public interface LifecycleStatesDAO { + +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/PlatformsDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/PlatformsDAO.java new file mode 100644 index 0000000000..381ff20f3a --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/PlatformsDAO.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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.application.mgt.core.dao; + +public interface PlatformsDAO { + +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ResourceTypesDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ResourceTypesDAO.java new file mode 100644 index 0000000000..901619c524 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ResourceTypesDAO.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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.application.mgt.core.dao; + +public interface ResourceTypesDAO { +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/SubscriptionsDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/SubscriptionsDAO.java new file mode 100644 index 0000000000..b2fcdaa8b4 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/SubscriptionsDAO.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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.application.mgt.core.dao; + +public interface SubscriptionsDAO { +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/VisibilitiesDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/VisibilitiesDAO.java new file mode 100644 index 0000000000..67c8d76389 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/VisibilitiesDAO.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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.application.mgt.core.dao; + +public interface VisibilitiesDAO { +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAO.java new file mode 100644 index 0000000000..4962a481ad --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAO.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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.application.mgt.core.dao.common; + +import org.apache.abdera.model.Categories; +import org.wso2.carbon.device.application.mgt.core.dao.*; +import org.wso2.carbon.device.application.mgt.core.dto.LifecycleState; + +public interface ApplicationManagementDAO extends ApplicationReleasesDAO, ApplicationsDAO, CategoriesDAO, CommentsDAO, + LifecycleStatesDAO, PlatformsDAO, ResourceTypesDAO, SubscriptionsDAO, VisibilitiesDAO { + +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationManagementDAOException.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOException.java similarity index 94% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationManagementDAOException.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOException.java index 4759d47817..b4401ae410 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationManagementDAOException.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOException.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.dao; +package org.wso2.carbon.device.application.mgt.core.dao.common; import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagerException; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationManagementDAOFactory.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java similarity index 88% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationManagementDAOFactory.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java index 3ec8fdb196..fca7134e50 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationManagementDAOFactory.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java @@ -16,23 +16,22 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.dao; +package org.wso2.carbon.device.application.mgt.core.dao.common; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.application.mgt.core.config.datasource.DataSourceConfig; import org.wso2.carbon.device.application.mgt.core.dao.impl.GenericAppManagementDAO; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; +import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil.DatabaseType; import javax.sql.DataSource; import java.sql.SQLException; -import java.util.HashMap; -import java.util.Map; public class ApplicationManagementDAOFactory { public static final String H2 = "H2"; - private ApplicationManagementDAO.DatabaseType databaseType; + private DatabaseType databaseType; private static DataSource dataSource; private static final Log log = LogFactory.getLog(ApplicationManagementDAOFactory.class); @@ -46,7 +45,7 @@ public class ApplicationManagementDAOFactory { } catch (SQLException e) { log.error("Error occurred while retrieving config.datasource connection", e); } - this.databaseType = ApplicationManagementDAO.DatabaseType.lookup(databaseEngine); + this.databaseType = DatabaseType.lookup(databaseEngine); } public ApplicationManagementDAO getApplicationManagementDAO(){ diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationManagementDAOUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOUtil.java similarity index 84% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationManagementDAOUtil.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOUtil.java index f68168d83f..11d9290cfe 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationManagementDAOUtil.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOUtil.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.dao; +package org.wso2.carbon.device.application.mgt.core.dao.common; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -38,7 +38,8 @@ public class ApplicationManagementDAOUtil { private static final Log log = LogFactory.getLog(ApplicationManagementDAOUtil.class); - public static Application loadApplication(ResultSet rs , ResultSet rsProperties) throws SQLException, JSONException { + public static Application loadApplication(ResultSet rs, ResultSet rsProperties, ResultSet rsTags) + throws SQLException, JSONException { Application application = new Application(); application.setId(rs.getInt("ID")); @@ -52,17 +53,23 @@ public class ApplicationManagementDAOUtil { application.setCreatedAt(rs.getDate("CREATED_AT")); application.setModifiedAt(rs.getDate("MODIFIED_AT")); - Platform applicationType = new Platform(); - applicationType.setName(rs.getString("APL_NAME")); - applicationType.setCode(rs.getString("APL_CODE")); - application.setApplicationType(applicationType); + Platform platform = new Platform(); + platform.setName(rs.getString("APL_NAME")); + platform.setCode(rs.getString("APL_CODE")); + application.setPlatform(platform); Map properties = new HashMap<>(); - while (rsProperties.next()){ + while (rsProperties.next()) { properties.put(rsProperties.getString("PROP_KEY"), rsProperties.getString("PROP_VAL")); } application.setProperties(properties); + List tags = new ArrayList<>(); + while ((rsTags.next())){ + tags.add(rsTags.getString("NAME")); + } + application.setTags(tags); + Category category = new Category(); category.setName(rs.getString("CAT_NAME")); application.setCategory(category); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/GenericAppManagementDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/GenericAppManagementDAO.java index 20412349c6..d68557a026 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/GenericAppManagementDAO.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/GenericAppManagementDAO.java @@ -18,12 +18,14 @@ */ package org.wso2.carbon.device.application.mgt.core.dao.impl; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.json.JSONException; -import org.wso2.carbon.device.application.mgt.core.dao.ApplicationManagementDAO; -import org.wso2.carbon.device.application.mgt.core.dao.ApplicationManagementDAOException; -import org.wso2.carbon.device.application.mgt.core.dao.ApplicationManagementDAOUtil; +import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAO; +import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOException; +import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOUtil; import org.wso2.carbon.device.application.mgt.core.dto.Application; -import org.wso2.carbon.device.application.mgt.core.dto.ApplicationList; +import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList; import org.wso2.carbon.device.application.mgt.core.dto.Filter; import org.wso2.carbon.device.application.mgt.core.dto.Pagination; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; @@ -37,14 +39,21 @@ import java.util.List; public class GenericAppManagementDAO implements ApplicationManagementDAO { - @Override - public void createApplication(Application application) throws ApplicationManagementDAOException { + private static final Log log = LogFactory.getLog(ApplicationManagementDAO.class); + @Override + public Application createApplication(Application application) throws ApplicationManagementDAOException { + return null; } @Override public ApplicationList getApplications(Filter filter) throws ApplicationManagementDAOException { + if(log.isDebugEnabled()){ + log.debug("Getting application data from the database"); + log.debug(String.format("Filter: limit=%s, offset=%", filter.getLimit(), filter.getOffset())); + } + Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; @@ -101,7 +110,13 @@ public class GenericAppManagementDAO implements ApplicationManagementDAO { stmt.setInt(1, rs.getInt("ID")); ResultSet rsProperties = stmt.executeQuery(); - applications.add(ApplicationManagementDAOUtil.loadApplication(rs, rsProperties)); + //Getting tags + sql = "SELECT * FROM APPM_APPLICATION_TAG WHERE APPLICATION_ID=?"; + stmt = conn.prepareStatement(sql); + stmt.setInt(1, rs.getInt("ID")); + ResultSet rsTags = stmt.executeQuery(); + + applications.add(ApplicationManagementDAOUtil.loadApplication(rs, rsProperties, rsTags)); length++; } @@ -120,4 +135,14 @@ public class GenericAppManagementDAO implements ApplicationManagementDAO { return applicationList; } + + @Override + public Application editApplication(Application application) throws ApplicationManagementDAOException { + return null; + } + + @Override + public void deleteApplication(Application application) throws ApplicationManagementDAOException { + + } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Application.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Application.java index babac2321c..d7dd21cf08 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Application.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Application.java @@ -30,9 +30,11 @@ public class Application { @Exclude private int id; + private String uuid; + private String name; - private String uuid; + private String shortDescription; private String description; @@ -46,9 +48,7 @@ public class Application { private List tags; - private Date createdAt; - - private Date modifiedAt; + private List subscriptions; private Platform platform; @@ -56,8 +56,14 @@ public class Application { private Map properties; - public Application() { - } + private String createdBy; + + private Date createdAt; + + private Date modifiedAt; + + private boolean published; + public int getId() { return id; @@ -67,6 +73,14 @@ public class Application { this.id = id; } + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + public String getName() { return name; } @@ -75,12 +89,12 @@ public class Application { this.name = name; } - public String getUuid() { - return uuid; + public String getShortDescription() { + return shortDescription; } - public void setUuid(String uuid) { - this.uuid = uuid; + public void setShortDescription(String shortDescription) { + this.shortDescription = shortDescription; } public String getDescription() { @@ -131,20 +145,12 @@ public class Application { this.tags = tags; } - public Date getCreatedAt() { - return createdAt; + public List getSubscriptions() { + return subscriptions; } - public void setCreatedAt(Date createdAt) { - this.createdAt = createdAt; - } - - public Date getModifiedAt() { - return modifiedAt; - } - - public void setModifiedAt(Date modifiedAt) { - this.modifiedAt = modifiedAt; + public void setSubscriptions(List subscriptions) { + this.subscriptions = subscriptions; } public Platform getPlatform() { @@ -170,4 +176,36 @@ public class Application { public void setProperties(Map properties) { this.properties = properties; } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getModifiedAt() { + return modifiedAt; + } + + public void setModifiedAt(Date modifiedAt) { + this.modifiedAt = modifiedAt; + } + + public boolean isPublished() { + return published; + } + + public void setPublished(boolean published) { + this.published = published; + } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/ApplicationRelease.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/ApplicationRelease.java new file mode 100644 index 0000000000..d328587fa5 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/ApplicationRelease.java @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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.application.mgt.core.dto; + +import java.util.Date; +import java.util.Map; + +public class ApplicationRelease { + + private enum ReleaseChannel { + PRODUCTION, ALPHA, BETA + } + + private int id; + + private int versionId; + + private String versionName; + + private String resource; + + private ReleaseChannel releaseChannel; + + private String releaseDetails; + + private Date createdAt; + + private Application application; + + private LifecycleState lifecycleState; + + private Date lifecycleStateModifiedAt; + + private String lifecycleStateModifiedBy; + + private Map properties; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getVersionId() { + return versionId; + } + + public void setVersionId(int versionId) { + this.versionId = versionId; + } + + public String getVersionName() { + return versionName; + } + + public void setVersionName(String versionName) { + this.versionName = versionName; + } + + public String getResource() { + return resource; + } + + public void setResource(String resource) { + this.resource = resource; + } + + public ReleaseChannel getReleaseChannel() { + return releaseChannel; + } + + public void setReleaseChannel(ReleaseChannel releaseChannel) { + this.releaseChannel = releaseChannel; + } + + public String getReleaseDetails() { + return releaseDetails; + } + + public void setReleaseDetails(String releaseDetails) { + this.releaseDetails = releaseDetails; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Application getApplication() { + return application; + } + + public void setApplication(Application application) { + this.application = application; + } + + public LifecycleState getLifecycleState() { + return lifecycleState; + } + + public void setLifecycleState(LifecycleState lifecycleState) { + this.lifecycleState = lifecycleState; + } + + public Date getLifecycleStateModifiedAt() { + return lifecycleStateModifiedAt; + } + + public void setLifecycleStateModifiedAt(Date lifecycleStateModifiedAt) { + this.lifecycleStateModifiedAt = lifecycleStateModifiedAt; + } + + public String getLifecycleStateModifiedBy() { + return lifecycleStateModifiedBy; + } + + public void setLifecycleStateModifiedBy(String lifecycleStateModifiedBy) { + this.lifecycleStateModifiedBy = lifecycleStateModifiedBy; + } + + public Map getProperties() { + return properties; + } + + public void setProperties(Map properties) { + this.properties = properties; + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Comment.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Comment.java new file mode 100644 index 0000000000..311c8f18cc --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Comment.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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.application.mgt.core.dto; + +public class Comment { + + private String id; + + private String comment; + + private int rating; + + private Comment parent; + + private String createdBy; + + private String createdAt; + + private String modifiedAt; + + private Application application; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + + public int getRating() { + return rating; + } + + public void setRating(int rating) { + this.rating = rating; + } + + public Comment getParent() { + return parent; + } + + public void setParent(Comment parent) { + this.parent = parent; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + public String getModifiedAt() { + return modifiedAt; + } + + public void setModifiedAt(String modifiedAt) { + this.modifiedAt = modifiedAt; + } + + public Application getApplication() { + return application; + } + + public void setApplication(Application application) { + this.application = application; + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Filter.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Filter.java index 95b5c8f183..575a74d723 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Filter.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Filter.java @@ -22,6 +22,10 @@ import java.util.Map; public class Filter { + public enum SortingOrder { + ASC, DESC + } + private int limit; private int offset; @@ -32,6 +36,10 @@ public class Filter { private String searchQuery; + private SortingOrder sortingOrder; + + private String sortBy; + public int getLimit() { return limit; } @@ -72,10 +80,28 @@ public class Filter { this.searchQuery = searchQuery; } + public SortingOrder getSortingOrder() { + return sortingOrder; + } + + public void setSortingOrder(SortingOrder sortingOrder) { + this.sortingOrder = sortingOrder; + } + + public String getSortBy() { + return sortBy; + } + + public void setSortBy(String sortBy) { + this.sortBy = sortBy; + } + public boolean hasCondition() { if (filterProperties != null || searchQuery != null || filter != null) { return true; } return false; } + + } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/LifecycleState.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/LifecycleState.java new file mode 100644 index 0000000000..d4899b3682 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/LifecycleState.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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.application.mgt.core.dto; + +public class LifecycleState { + + private String id; + + private String name; + + private String description; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Platform.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Platform.java index 18e876909a..da17697675 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Platform.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Platform.java @@ -35,6 +35,8 @@ public class Platform { private String iconName; + private List tags; + private String properties; private List applications; @@ -87,6 +89,14 @@ public class Platform { this.properties = properties; } + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + public List getApplications() { return applications; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/ResourceType.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/ResourceType.java new file mode 100644 index 0000000000..29c27dbd32 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/ResourceType.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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.application.mgt.core.dto; + +public class ResourceType { + + private String id; + + private String name; + + private String description; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Subscription.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Subscription.java new file mode 100644 index 0000000000..2874f9f8f5 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Subscription.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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.application.mgt.core.dto; + +import java.util.Date; + +public class Subscription { + + private ResourceType type; + + private String value; + + private Date createdAt; + + private Application application; + + private ApplicationRelease applicationRelease; + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public ResourceType getType() { + return type; + } + + public void setType(ResourceType type) { + this.type = type; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Application getApplication() { + return application; + } + + public void setApplication(Application application) { + this.application = application; + } + + public ApplicationRelease getApplicationRelease() { + return applicationRelease; + } + + public void setApplicationRelease(ApplicationRelease applicationRelease) { + this.applicationRelease = applicationRelease; + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Visibility.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Visibility.java new file mode 100644 index 0000000000..9e1364dd11 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/Visibility.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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.application.mgt.core.dto; + +import java.util.Date; + +public class Visibility { + + private ResourceType type; + + private String value; + + private Application application; + + private ApplicationRelease applicationRelease; + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public ResourceType getType() { + return type; + } + + public void setType(ResourceType type) { + this.type = type; + } + + public Application getApplication() { + return application; + } + + public void setApplication(Application application) { + this.application = application; + } + + public ApplicationRelease getApplicationRelease() { + return applicationRelease; + } + + public void setApplicationRelease(ApplicationRelease applicationRelease) { + this.applicationRelease = applicationRelease; + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/ApplicationList.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/lists/ApplicationList.java similarity index 85% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/ApplicationList.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/lists/ApplicationList.java index c089cbb388..fe3d1898ad 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/ApplicationList.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/lists/ApplicationList.java @@ -16,7 +16,10 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.dto; +package org.wso2.carbon.device.application.mgt.core.dto.lists; + +import org.wso2.carbon.device.application.mgt.core.dto.Application; +import org.wso2.carbon.device.application.mgt.core.dto.Pagination; import java.util.List; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementDataHolder.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementDataHolder.java index 82f629b533..a1bb0b6988 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementDataHolder.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementDataHolder.java @@ -18,7 +18,7 @@ */ package org.wso2.carbon.device.application.mgt.core.internal; -import org.wso2.carbon.device.application.mgt.core.dao.ApplicationManagementDAO; +import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAO; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; public class ApplicationManagementDataHolder { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementServiceComponent.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementServiceComponent.java index a03667b425..41efc1b8c1 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementServiceComponent.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementServiceComponent.java @@ -26,8 +26,8 @@ import org.wso2.carbon.device.application.mgt.core.components.ApplicationManager import org.wso2.carbon.device.application.mgt.core.components.impl.ApplicationManagerImpl; import org.wso2.carbon.device.application.mgt.core.config.ApplicationConfigurationManager; import org.wso2.carbon.device.application.mgt.core.config.datasource.DataSourceConfig; -import org.wso2.carbon.device.application.mgt.core.dao.ApplicationManagementDAO; -import org.wso2.carbon.device.application.mgt.core.dao.ApplicationManagementDAOFactory; +import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAO; +import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import javax.naming.NamingException; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ConnectionManagerUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ConnectionManagerUtil.java index 1bac612e71..dd0718cfbf 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ConnectionManagerUtil.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ConnectionManagerUtil.java @@ -29,8 +29,10 @@ import javax.naming.InitialContext; import javax.sql.DataSource; import java.sql.Connection; import java.sql.SQLException; +import java.util.HashMap; import java.util.Hashtable; import java.util.List; +import java.util.Map; public class ConnectionManagerUtil { @@ -40,6 +42,36 @@ public class ConnectionManagerUtil { CONNECTION_NOT_BORROWED, CONNECTION_BORROWED, CONNECTION_CLOSED } + public enum DatabaseType { + + H2("H2"), + MYSQL("MySQL"), + ORACLE("Oracle"), + POSTGRESQL("PostgreSQL"), + MSSQL("Microsoft SQL Server"); + + private final String value; + private static final Map lookup = new HashMap(); + + static { + for (DatabaseType databaseType : DatabaseType.values()) { + lookup.put(databaseType.getValue(), databaseType); + } + } + + DatabaseType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static DatabaseType lookup(String value) { + return lookup.get(value); + } + } + private static final ThreadLocal currentConnection = new ThreadLocal<>(); private static ThreadLocal currentTxState = new ThreadLocal<>(); private static DataSource dataSource;