Modify Entity Class name

feature/appm-store/pbac
lasanthaDLPDS 6 years ago
parent 03dc9e8810
commit b06a908f5f

@ -42,7 +42,7 @@ import javax.ws.rs.core.Response;
@SwaggerDefinition( @SwaggerDefinition(
info = @Info( info = @Info(
version = "1.0.0", version = "1.0.0",
title = "ApplicationEntity Management Common Service", title = "ApplicationDTO Management Common Service",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = "name", value = "ApplicationManagementArtifactDownloadService"), @ExtensionProperty(name = "name", value = "ApplicationManagementArtifactDownloadService"),
@ -52,7 +52,7 @@ import javax.ws.rs.core.Response;
) )
) )
@Path("/artifact") @Path("/artifact")
@Api(value = "ApplicationEntity Management Artifact Downloading Service", description = "This API carries all application management artifact downloading services") @Api(value = "ApplicationDTO Management Artifact Downloading Service", description = "This API carries all application management artifact downloading services")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public interface ArtifactDownloadAPI { public interface ArtifactDownloadAPI {

@ -40,7 +40,7 @@ import javax.ws.rs.core.Response;
@SwaggerDefinition( @SwaggerDefinition(
info = @Info( info = @Info(
version = "1.0.0", version = "1.0.0",
title = "ApplicationEntity Management Common Service", title = "ApplicationDTO Management Common Service",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = "name", value = "ApplicationManagementCommonService"), @ExtensionProperty(name = "name", value = "ApplicationManagementCommonService"),
@ -50,7 +50,7 @@ import javax.ws.rs.core.Response;
) )
) )
@Path("/config") @Path("/config")
@Api(value = "ApplicationEntity Management Common Service", description = "This API carries all application management common services") @Api(value = "ApplicationDTO Management Common Service", description = "This API carries all application management common services")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public interface ConfigRetrieveAPI { public interface ConfigRetrieveAPI {

@ -33,7 +33,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
/** /**
* Implementation of ApplicationEntity Management related APIs. * Implementation of ApplicationDTO Management related APIs.
*/ */
@Produces({"application/json"}) @Produces({"application/json"})
@Path("/artifact") @Path("/artifact")

@ -32,7 +32,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
/** /**
* Implementation of ApplicationEntity Management related APIs. * Implementation of ApplicationDTO Management related APIs.
*/ */
@Produces({"application/json"}) @Produces({"application/json"})
@Path("/config") @Path("/config")

@ -1,225 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
* Copyright (c) 2019, 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>application-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.application.mgt.artifact.retrieve.api</artifactId>
<version>3.2.2-SNAPSHOT</version>
<packaging>war</packaging>
<name>WSO2 Carbon - Application Management Artifact_Retrieve API</name>
<description>WSO2 Carbon - Application Management API for getting application artifacts</description>
<url>http://wso2.org</url>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<packagingExcludes>WEB-INF/lib/*cxf*.jar</packagingExcludes>
<warName>api#application-mgt-artifact-retrieve#v1.0</warName>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>deploy</id>
<build>
<defaultGoal>compile</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy todir="${basedir}/../../../repository/deployment/server/webapps" overwrite="true">
<fileset dir="${basedir}/target">
<include name="api#application-mgt-artifact-retrieve#v1.0.war" />
</fileset>
</copy>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>client</id>
<build>
<defaultGoal>test</defaultGoal>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.utils</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.logging</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.json.wso2</groupId>
<artifactId>json</artifactId>
</dependency>
<dependency>
<groupId>commons-codec.wso2</groupId>
<artifactId>commons-codec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.application.mgt.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.application.mgt.common</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-core</artifactId>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.orbit.com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.wso2.orbit.com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.orbit.com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.application.mgt.addons</artifactId>
</dependency>
</dependencies>
</project>

@ -1,19 +0,0 @@
package org.wso2.carbon.device.application.mgt.artifact.retrieve.api.services;/* Copyright (c) 2019, 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.
*/
public interface AppArtifactRetrievalAPI {
}

@ -1,19 +0,0 @@
package org.wso2.carbon.device.application.mgt.artifact.retrieve.api.services.impl;/* Copyright (c) 2019, 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.
*/
public class AppArtifactRetrivaalAPIImpl {
}

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Copyright (c) 2019, 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.
-->
<!-- This file contains the list of permissions that are associated with URL end points
of the web app. Each permission should contain the name, permission path ,API path
(URL) , HTTP method and OAUTH2 authorization scope (not-required).
When defining dynamic paths for APIs, path variables are denoted by '*' notation.
For ex:
Actual API endpoint: devicemgt_admin/1.0.0/devices/{device-id}
URL to be represented here: /devices/*
NOTE: All the endpoints of the web app should be available in this file. Otherwise
it will result 403 error at the runtime.
-->
<PermissionConfiguration>
<APIVersion></APIVersion>
</PermissionConfiguration>

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
* Copyright (c) 2019, 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.
-->
<!--
This file defines class loading policy of the whole container. But this behaviour can be overridden by individual webapps by putting this file into the META-INF/ directory.
-->
<Classloading xmlns="http://wso2.org/projects/as/classloading">
<!-- Parent-first or child-first. Default behaviour is child-first.-->
<ParentFirst>false</ParentFirst>
<!--
Default environments that contains provides to all the webapps. This can be overridden by individual webapps by specifing required environments
Tomcat environment is the default and every webapps gets it even if they didn't specify it.
e.g. If a webapps requires CXF, they will get both Tomcat and CXF.
-->
<Environments>CXF,Carbon</Environments>
</Classloading>

@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Copyright (c) 2019, 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.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:cxf="http://cxf.apache.org/core"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
<jaxrs:server id="applicationMgtCommonService" address="/">
<jaxrs:serviceBeans>
<ref bean="applicationMgtCommonServiceBean"/>
<ref bean="swaggerResource"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jsonProvider"/>
<ref bean="multipartProvider"/>
<ref bean="swaggerWriter"/>
</jaxrs:providers>
</jaxrs:server>
<bean id="swaggerConfig" class="io.swagger.jaxrs.config.BeanConfig">
<property name="resourcePackage" value="org.wso2.carbon.device.application.mgt.publisher.api"/>
<property name="version" value="1.0"/>
<property name="host" value="localhost:9443"/>
<property name="schemes" value="https" />
<property name="basePath" value="/api/application-mgt-publisher/v1.0"/>
<property name="title" value="Application Management Admin Service API Definitions"/>
<property name="contact" value="dev@wso2.org"/>
<property name="license" value="Apache 2.0"/>
<property name="licenseUrl" value="http://www.apache.org/licenses/LICENSE-2.0.html"/>
<property name="scan" value="true"/>
</bean>
<bean id="org.wso2.carbon.device.application.mgt.addons.ValidationInterceptor" class="org.wso2.carbon.device.application.mgt.addons.ValidationInterceptor"/>
<bean id="swaggerWriter" class="io.swagger.jaxrs.listing.SwaggerSerializers" />
<bean id="swaggerResource" class="io.swagger.jaxrs.listing.ApiListingResource" />
<bean id="applicationMgtCommonServiceBean" class="org.wso2.carbon.device.application.mgt.api.impl.AppMgtArtifactRetrieveAPIImpl"/>
<bean id="jsonProvider" class="org.wso2.carbon.device.application.mgt.addons.JSONMessageHandler"/>
<bean id="multipartProvider" class="org.wso2.carbon.device.application.mgt.addons.MultipartCustomProvider"/>
<cxf:bus>
<cxf:inInterceptors>
<ref bean="org.wso2.carbon.device.application.mgt.addons.ValidationInterceptor"/>
</cxf:inInterceptors>
</cxf:bus>
</beans>

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Copyright (c) 2019, 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.
-->
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>Application Management Webapp</display-name>
<servlet>
<description>JAX-WS/JAX-RS Application Management Endpoint</description>
<display-name>JAX-WS/JAX-RS Servlet</display-name>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<!-- configure a security filter -->
<init-param>
<param-name>swagger.security.filter</param-name>
<param-value>ApiAuthorizationFilterImpl</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
<context-param>
<param-name>doAuthentication</param-name>
<param-value>false</param-value>
</context-param>
<!-- Below configuration is used to redirect http requests to https -->
<security-constraint>
<web-resource-collection>
<web-resource-name>ApplicationMgt-Admin</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<!--publish to apim-->
<context-param>
<param-name>managed-api-enabled</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>managed-api-owner</param-name>
<param-value>admin</param-value>
</context-param>
<context-param>
<param-name>isSharedWithAllTenants</param-name>
<param-value>true</param-value>
</context-param>
<filter>
<filter-name>ApiOriginFilter</filter-name>
<filter-class>org.wso2.carbon.device.application.mgt.addons.ApiOriginFilter</filter-class>
</filter>
<filter>
<filter-name>HttpHeaderSecurityFilter</filter-name>
<filter-class>org.apache.catalina.filters.HttpHeaderSecurityFilter</filter-class>
<init-param>
<param-name>hstsEnabled</param-name>
<param-value>false</param-value>
</init-param>
</filter>
<filter>
<filter-name>ContentTypeBasedCachePreventionFilter</filter-name>
<filter-class>org.wso2.carbon.ui.filters.cache.ContentTypeBasedCachePreventionFilter</filter-class>
<init-param>
<param-name>patterns</param-name>
<param-value>text/html" ,application/json" ,text/plain</param-value>
</init-param>
<init-param>
<param-name>filterAction</param-name>
<param-value>enforce</param-value>
</init-param>
<init-param>
<param-name>httpHeaders</param-name>
<param-value>Cache-Control: no-store, no-cache, must-revalidate, private</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>HttpHeaderSecurityFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>ContentTypeBasedCachePreventionFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>ApiOriginFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>

@ -18,13 +18,13 @@
*/ */
package org.wso2.carbon.device.application.mgt.common; package org.wso2.carbon.device.application.mgt.common;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
public class AppOperation { public class AppOperation {
private static final long serialVersionUID = 7603215716452548282L; private static final long serialVersionUID = 7603215716452548282L;
private ApplicationEntity application; private ApplicationDTO application;
private int tenantId; private int tenantId;
private String activityId; private String activityId;
private String scheduledDateTime; private String scheduledDateTime;
@ -73,11 +73,11 @@ public class AppOperation {
this.type = type; this.type = type;
} }
public ApplicationEntity getApplication() { public ApplicationDTO getApplication() {
return application; return application;
} }
public void setApplication(ApplicationEntity application) { public void setApplication(ApplicationDTO application) {
this.application = application; this.application = application;
} }

@ -18,24 +18,24 @@
*/ */
package org.wso2.carbon.device.application.mgt.common; package org.wso2.carbon.device.application.mgt.common;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
import java.util.List; import java.util.List;
/** /**
* Represents a list of {@link ApplicationEntity}. * Represents a list of {@link ApplicationDTO}.
*/ */
public class ApplicationList { public class ApplicationList {
private List<ApplicationEntity> applications; private List<ApplicationDTO> applications;
private Pagination pagination; private Pagination pagination;
public List<ApplicationEntity> getApplications() { public List<ApplicationDTO> getApplications() {
return applications; return applications;
} }
public void setApplications(List<ApplicationEntity> applications) { public void setApplications(List<ApplicationDTO> applications) {
this.applications = applications; this.applications = applications;
} }

@ -21,7 +21,7 @@ package org.wso2.carbon.device.application.mgt.common;
import java.io.Serializable; import java.io.Serializable;
/** /**
* This class represents the Enterprise ApplicationEntity information. * This class represents the Enterprise ApplicationDTO information.
*/ */
public class EnterpriseApplication extends AndroidApplication implements Serializable { public class EnterpriseApplication extends AndroidApplication implements Serializable {

@ -37,7 +37,7 @@ public class EnterpriseInstallationDetails {
@ApiModelProperty( @ApiModelProperty(
name = "applicationUUID", name = "applicationUUID",
value = "ApplicationEntity ID", value = "ApplicationDTO ID",
required = true, required = true,
example = "4354c752-109f-11e8-b642-0ed5f89f718b" example = "4354c752-109f-11e8-b642-0ed5f89f718b"
) )

@ -16,18 +16,16 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.application.mgt.common.entity; package org.wso2.carbon.device.application.mgt.common.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.device.application.mgt.common.User;
import org.wso2.carbon.device.mgt.core.dto.DeviceType;
import java.util.List; import java.util.List;
@ApiModel(value = "ApplicationEntity", description = "ApplicationEntity represents the an ApplicationEntity in ApplicationEntity Store") @ApiModel(value = "ApplicationDTO", description = "ApplicationDTO represents an Application details.")
public class ApplicationEntity { public class ApplicationDTO {
@ApiModelProperty(name = "id", @ApiModelProperty(name = "id",
value = "The ID given to the application when it is stored in the APPM database") value = "The ID given to the application when it is stored in the APPM database")
@ -44,7 +42,7 @@ public class ApplicationEntity {
private String description; private String description;
@ApiModelProperty(name = "appCategory", @ApiModelProperty(name = "appCategory",
value = "CategoryEntity of the application", value = "Category of the application",
required = true, required = true,
example = "Educational, Gaming, Travel, Entertainment etc") example = "Educational, Gaming, Travel, Entertainment etc")
private String appCategory; private String appCategory;
@ -92,7 +90,7 @@ public class ApplicationEntity {
private int appRating; private int appRating;
@ApiModelProperty(name = "status", @ApiModelProperty(name = "status",
value = "ApplicationEntity status", value = "Application status",
required = true, required = true,
example = "REMOVED, ACTIVE") example = "REMOVED, ACTIVE")
private String status; private String status;
@ -100,7 +98,7 @@ public class ApplicationEntity {
@ApiModelProperty(name = "applicationReleases", @ApiModelProperty(name = "applicationReleases",
value = "List of application releases", value = "List of application releases",
required = true) required = true)
private List<ApplicationReleaseEntity> applicationReleases; private List<ApplicationReleaseDTO> applicationReleases;
public int getId() { public int getId() {
return id; return id;
@ -154,11 +152,11 @@ public class ApplicationEntity {
this.paymentCurrency = paymentCurrency; this.paymentCurrency = paymentCurrency;
} }
public List<ApplicationReleaseEntity> getApplicationReleases() { public List<ApplicationReleaseDTO> getApplicationReleases() {
return applicationReleases; return applicationReleases;
} }
public void setApplicationReleases(List<ApplicationReleaseEntity> applicationReleases) { public void setApplicationReleases(List<ApplicationReleaseDTO> applicationReleases) {
this.applicationReleases = applicationReleases; this.applicationReleases = applicationReleases;
} }

@ -16,15 +16,15 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.application.mgt.common.entity; package org.wso2.carbon.device.application.mgt.common.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.codehaus.jackson.annotate.JsonIgnoreProperties;
@ApiModel(value = "ApplicationReleaseEntity", description = "This class holds the details when releasing an ApplicationEntity to application store") @ApiModel(value = "ApplicationReleaseDTO", description = "This class holds the details when releasing an ApplicationDTO to application store")
@JsonIgnoreProperties({"appHashValue"}) @JsonIgnoreProperties({"appHashValue"})
public class ApplicationReleaseEntity { public class ApplicationReleaseDTO {
@ApiModelProperty(name = "id", @ApiModelProperty(name = "id",
value = "ID of the application release") value = "ID of the application release")
@ -43,7 +43,7 @@ public class ApplicationReleaseEntity {
private String uuid; private String uuid;
@ApiModelProperty(name = "installerName", @ApiModelProperty(name = "installerName",
value = "ApplicationEntity storing location") value = "ApplicationDTO storing location")
private String installerName; private String installerName;
@ApiModelProperty(name = "bannerName", @ApiModelProperty(name = "bannerName",
@ -104,7 +104,7 @@ public class ApplicationReleaseEntity {
private String url; private String url;
@ApiModelProperty(name = "supportedOsVersions", @ApiModelProperty(name = "supportedOsVersions",
value = "ApplicationEntity release supported OS versions") value = "ApplicationDTO release supported OS versions")
private String supportedOsVersions; private String supportedOsVersions;
@ApiModelProperty(name = "currentState", @ApiModelProperty(name = "currentState",
@ -112,10 +112,10 @@ public class ApplicationReleaseEntity {
private String currentState; private String currentState;
@ApiModelProperty(name = "packageName", @ApiModelProperty(name = "packageName",
value = "ApplicationEntity bundle identifier") value = "ApplicationDTO bundle identifier")
private String packageName; private String packageName;
public ApplicationReleaseEntity() { public ApplicationReleaseDTO() {
} }
public int getRatedUsers() { public int getRatedUsers() {

@ -1,4 +1,4 @@
package org.wso2.carbon.device.application.mgt.common.entity;/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. package org.wso2.carbon.device.application.mgt.common.dto;/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
* *
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License, * Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except
@ -15,7 +15,7 @@ package org.wso2.carbon.device.application.mgt.common.entity;/* Copyright (c) 20
* under the License. * under the License.
*/ */
public class CategoryEntity { public class CategoryDTO {
int id; int id;
String categoryName; String categoryName;

@ -16,7 +16,7 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.application.mgt.common.entity; package org.wso2.carbon.device.application.mgt.common.dto;
import java.sql.Timestamp; import java.sql.Timestamp;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -24,8 +24,8 @@ import io.swagger.annotations.ApiModelProperty;
import java.util.List; import java.util.List;
@ApiModel(value = "LifecycleStateEntity", description = "LifecycleStateEntity represents the Lifecycle state for an application release") @ApiModel(value = "LifecycleStateDTO", description = "LifecycleStateDTO represents the Lifecycle state for an application release")
public class LifecycleStateEntity { public class LifecycleStateDTO {
@ApiModelProperty(name = "id", @ApiModelProperty(name = "id",
value = "ID of the application release lifecycle", value = "ID of the application release lifecycle",

@ -1,4 +1,4 @@
package org.wso2.carbon.device.application.mgt.common.entity;/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. package org.wso2.carbon.device.application.mgt.common.dto;/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
* *
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License, * Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except
@ -15,7 +15,7 @@ package org.wso2.carbon.device.application.mgt.common.entity;/* Copyright (c) 20
* under the License. * under the License.
*/ */
public class TagEntity { public class TagDTO {
int id; int id;

@ -36,7 +36,7 @@ public class Application {
private String description; private String description;
@ApiModelProperty(name = "appCategory", @ApiModelProperty(name = "appCategory",
value = "CategoryEntity of the application", value = "CategoryDTO of the application",
required = true, required = true,
example = "Educational, Gaming, Travel, Entertainment etc") example = "Educational, Gaming, Travel, Entertainment etc")
private String appCategory; private String appCategory;

@ -21,7 +21,7 @@ package org.wso2.carbon.device.application.mgt.common.response;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "ApplicationReleaseEntity", description = "This class holds the details when releasing an ApplicationEntity to application store") @ApiModel(value = "ApplicationReleaseDTO", description = "This class holds the details when releasing an ApplicationDTO to application store")
public class ApplicationRelease { public class ApplicationRelease {
@ApiModelProperty(name = "description", @ApiModelProperty(name = "description",
@ -37,7 +37,7 @@ public class ApplicationRelease {
private String uuid; private String uuid;
@ApiModelProperty(name = "installerPath", @ApiModelProperty(name = "installerPath",
value = "ApplicationEntity storing location") value = "ApplicationDTO storing location")
private String installerPath; private String installerPath;
@ApiModelProperty(name = "bannerPath", @ApiModelProperty(name = "bannerPath",
@ -86,7 +86,7 @@ public class ApplicationRelease {
private String url; private String url;
@ApiModelProperty(name = "supportedOsVersions", @ApiModelProperty(name = "supportedOsVersions",
value = "ApplicationEntity release supported OS versions") value = "ApplicationDTO release supported OS versions")
private String supportedOsVersions; private String supportedOsVersions;
public String getReleaseType() { public String getReleaseType() {

@ -20,11 +20,11 @@ package org.wso2.carbon.device.application.mgt.common.services;
import org.apache.cxf.jaxrs.ext.multipart.Attachment; import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.wso2.carbon.device.application.mgt.common.ApplicationArtifact; import org.wso2.carbon.device.application.mgt.common.ApplicationArtifact;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.ApplicationList; import org.wso2.carbon.device.application.mgt.common.ApplicationList;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationReleaseEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO;
import org.wso2.carbon.device.application.mgt.common.Filter; import org.wso2.carbon.device.application.mgt.common.Filter;
import org.wso2.carbon.device.application.mgt.common.entity.LifecycleStateEntity; import org.wso2.carbon.device.application.mgt.common.dto.LifecycleStateDTO;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException;
import org.wso2.carbon.device.application.mgt.common.exception.RequestValidatingException; import org.wso2.carbon.device.application.mgt.common.exception.RequestValidatingException;
import org.wso2.carbon.device.application.mgt.common.response.Application; import org.wso2.carbon.device.application.mgt.common.response.Application;
@ -33,7 +33,6 @@ import org.wso2.carbon.device.application.mgt.common.wrapper.ApplicationWrapper;
import java.io.InputStream; import java.io.InputStream;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* This interface manages the application creation, deletion and editing of the application. * This interface manages the application creation, deletion and editing of the application.
@ -43,9 +42,9 @@ public interface ApplicationManager {
/** /**
* Creates an application. * Creates an application.
* *
* @param applicationWrapper ApplicationEntity that need to be created. * @param applicationWrapper Application that need to be created.
* @return Created application * @return Created application
* @throws ApplicationManagementException ApplicationEntity Management Exception * @throws ApplicationManagementException ApplicationDTO Management Exception
*/ */
Application createApplication(ApplicationWrapper applicationWrapper, ApplicationArtifact applicationArtifact) Application createApplication(ApplicationWrapper applicationWrapper, ApplicationArtifact applicationArtifact)
throws ApplicationManagementException, RequestValidatingException; throws ApplicationManagementException, RequestValidatingException;
@ -53,18 +52,18 @@ public interface ApplicationManager {
/** /**
* Updates an already existing application. * Updates an already existing application.
* *
* @param application ApplicationEntity that need to be updated. * @param application Application that need to be updated.
* @param applicationId ID of the application * @param applicationId ID of the application
* @return Updated ApplicationEntity * @return Updated Application
* @throws ApplicationManagementException ApplicationEntity Management Exception * @throws ApplicationManagementException ApplicationDTO Management Exception
*/ */
ApplicationEntity updateApplication(int applicationId, ApplicationEntity application) throws ApplicationManagementException; ApplicationDTO updateApplication(int applicationId, ApplicationDTO application) throws ApplicationManagementException;
/** /**
* Delete an application identified by the unique ID. * Delete an application identified by the unique ID.
* *
* @param applicationId ID for tha application * @param applicationId ID for tha application
* @throws ApplicationManagementException ApplicationEntity Management Exception * @throws ApplicationManagementException ApplicationDTO Management Exception
*/ */
List<String> deleteApplication(int applicationId) throws ApplicationManagementException; List<String> deleteApplication(int applicationId) throws ApplicationManagementException;
@ -73,7 +72,7 @@ public interface ApplicationManager {
* *
* @param applicationId ID of tha application * @param applicationId ID of tha application
* @param releaseUuid UUID of tha application release * @param releaseUuid UUID of tha application release
* @throws ApplicationManagementException ApplicationEntity Management Exception * @throws ApplicationManagementException ApplicationDTO Management Exception
*/ */
String deleteApplicationRelease(int applicationId, String releaseUuid) throws ApplicationManagementException; String deleteApplicationRelease(int applicationId, String releaseUuid) throws ApplicationManagementException;
@ -82,69 +81,69 @@ public interface ApplicationManager {
* *
* @param filter Search filter * @param filter Search filter
* @return Applications that matches the given filter criteria. * @return Applications that matches the given filter criteria.
* @throws ApplicationManagementException ApplicationEntity Management Exception * @throws ApplicationManagementException ApplicationDTO Management Exception
*/ */
ApplicationList getApplications(Filter filter, String deviceTypeName) throws ApplicationManagementException; ApplicationList getApplications(Filter filter, String deviceTypeName) throws ApplicationManagementException;
/** /**
* To get the ApplicationEntity for given Id. * To get the ApplicationDTO for given Id.
* *
* @param id id of the ApplicationEntity * @param id id of the ApplicationDTO
* @param state state of the ApplicationEntity * @param state state of the ApplicationDTO
* @return the ApplicationEntity identified by the ID * @return the ApplicationDTO identified by the ID
* @throws ApplicationManagementException ApplicationEntity Management Exception. * @throws ApplicationManagementException ApplicationDTO Management Exception.
*/ */
ApplicationEntity getApplicationById(int id, String state) throws ApplicationManagementException; ApplicationDTO getApplicationById(int id, String state) throws ApplicationManagementException;
/** /**
* To get the ApplicationEntity for given application relase UUID. * To get the ApplicationDTO for given application relase UUID.
* *
* @param uuid UUID of the ApplicationEntity * @param uuid UUID of the ApplicationDTO
* @param state state of the ApplicationEntity * @param state state of the ApplicationDTO
* @return the ApplicationEntity identified by the ID * @return the ApplicationDTO identified by the ID
* @throws ApplicationManagementException ApplicationEntity Management Exception. * @throws ApplicationManagementException ApplicationDTO Management Exception.
*/ */
ApplicationEntity getApplicationByUuid(String uuid, String state) throws ApplicationManagementException; ApplicationDTO getApplicationByUuid(String uuid, String state) throws ApplicationManagementException;
/** /**
* To get an application associated with the release. * To get an application associated with the release.
* *
* @param appReleaseUUID UUID of the app release * @param appReleaseUUID UUID of the app release
* @return {@link ApplicationEntity} associated with the release * @return {@link ApplicationDTO} associated with the release
* @throws ApplicationManagementException If unable to retrieve {@link ApplicationEntity} associated with the given UUID * @throws ApplicationManagementException If unable to retrieve {@link ApplicationDTO} associated with the given UUID
*/ */
ApplicationEntity getApplicationByRelease(String appReleaseUUID) throws ApplicationManagementException; ApplicationDTO getApplicationByRelease(String appReleaseUUID) throws ApplicationManagementException;
/** /**
* To get all the releases of a particular ApplicationEntity. * To get all the releases of a particular ApplicationDTO.
* *
* @param applicationId ID of the ApplicationEntity . * @param applicationId ID of the ApplicationDTO .
* @param releaseUuid UUID of the ApplicationEntity Release. * @param releaseUuid UUID of the ApplicationDTO Release.
* @return the LifecycleStateEntity of the ApplicationEntity releases related with the particular ApplicationEntity. * @return the LifecycleStateDTO of the ApplicationDTO releases related with the particular ApplicationDTO.
* @throws ApplicationManagementException ApplicationEntity Management Exception. * @throws ApplicationManagementException ApplicationDTO Management Exception.
*/ */
LifecycleStateEntity getLifecycleState(int applicationId, String releaseUuid) throws ApplicationManagementException; LifecycleStateDTO getLifecycleState(int applicationId, String releaseUuid) throws ApplicationManagementException;
/** /**
* To get all the releases of a particular ApplicationEntity. * To get all the releases of a particular ApplicationDTO.
* *
* @param applicationId ID of the ApplicationEntity. * @param applicationId ID of the ApplicationDTO.
* @param releaseUuid UUID of the ApplicationEntity Release. * @param releaseUuid UUID of the ApplicationDTO Release.
* @param state Lifecycle state to change the app * @param state Lifecycle state to change the app
* @throws ApplicationManagementException ApplicationEntity Management Exception. * @throws ApplicationManagementException ApplicationDTO Management Exception.
*/ */
void changeLifecycleState(int applicationId, String releaseUuid, LifecycleStateEntity state) void changeLifecycleState(int applicationId, String releaseUuid, LifecycleStateDTO state)
throws ApplicationManagementException; throws ApplicationManagementException;
/** /**
* To update release images such as icons, banner and screenshots. * To update release images such as icons, banner and screenshots.
* *
* @param appId ID of the ApplicationEntity * @param appId ID of the ApplicationDTO
* @param uuid uuid of the ApplicationEntity * @param uuid uuid of the ApplicationDTO
* @param iconFileStream icon file of the release * @param iconFileStream icon file of the release
* @param bannerFileStream bannerFileStream of the release. * @param bannerFileStream bannerFileStream of the release.
* @param attachments screenshot attachments of the release * @param attachments screenshot attachments of the release
* @throws ApplicationManagementException ApplicationEntity Management Exception. * @throws ApplicationManagementException ApplicationDTO Management Exception.
*/ */
void updateApplicationImageArtifact(int appId, String uuid, InputStream iconFileStream, InputStream void updateApplicationImageArtifact(int appId, String uuid, InputStream iconFileStream, InputStream
bannerFileStream, List<InputStream> attachments) throws ApplicationManagementException; bannerFileStream, List<InputStream> attachments) throws ApplicationManagementException;
@ -153,23 +152,23 @@ public interface ApplicationManager {
/** /**
* To update release images. * To update release images.
* *
* @param appId ID of the ApplicationEntity * @param appId ID of the ApplicationDTO
* @param deviceType Applicable device type of the application * @param deviceType Applicable device type of the application
* @param uuid uuid of the ApplicationEntity * @param uuid uuid of the ApplicationDTO
* @param binaryFile binaryFile of the release. * @param binaryFile binaryFile of the release.
* @throws ApplicationManagementException ApplicationEntity Management Exception. * @throws ApplicationManagementException ApplicationDTO Management Exception.
*/ */
void updateApplicationArtifact(int appId, String deviceType, String uuid, InputStream binaryFile) void updateApplicationArtifact(int appId, String deviceType, String uuid, InputStream binaryFile)
throws ApplicationManagementException; throws ApplicationManagementException;
/** /**
* To create an application release for an ApplicationEntity. * To create an application release for an ApplicationDTO.
* *
* @param applicationId ID of the ApplicationEntity * @param applicationId ID of the ApplicationDTO
* @param applicationRelease ApplicatonRelease that need to be be created. * @param applicationRelease ApplicatonRelease that need to be be created.
* @return the unique id of the application release, if the application release succeeded else -1 * @return the unique id of the application release, if the application release succeeded else -1
*/ */
ApplicationReleaseEntity createRelease(int applicationId, ApplicationReleaseEntity applicationRelease) ApplicationReleaseDTO createRelease(int applicationId, ApplicationReleaseDTO applicationRelease)
throws ApplicationManagementException; throws ApplicationManagementException;
/*** /***
@ -177,23 +176,46 @@ public interface ApplicationManager {
* @param applicationId ID of the application * @param applicationId ID of the application
* @param releaseUuid UUID of the application release * @param releaseUuid UUID of the application release
* @param deviceType Supported device type of the application * @param deviceType Supported device type of the application
* @param applicationRelease {@link ApplicationReleaseEntity} * @param applicationRelease {@link ApplicationReleaseDTO}
* @param binaryFileStram {@link InputStream} of the binary file * @param binaryFileStram {@link InputStream} of the binary file
* @param iconFileStream {@link InputStream} of the icon * @param iconFileStream {@link InputStream} of the icon
* @param bannerFileStream {@link InputStream} of the banner * @param bannerFileStream {@link InputStream} of the banner
* @param attachments {@link List} of {@link InputStream} of attachments * @param attachments {@link List} of {@link InputStream} of attachments
* @return If the application release is updated correctly True returns, otherwise retuen False * @return If the application release is updated correctly True returns, otherwise retuen False
*/ */
boolean updateRelease(int applicationId, String releaseUuid, String deviceType, ApplicationReleaseEntity applicationRelease, boolean updateRelease(int applicationId, String releaseUuid, String deviceType, ApplicationReleaseDTO applicationRelease,
InputStream binaryFileStram, InputStream iconFileStream, InputStream bannerFileStream, InputStream binaryFileStram, InputStream iconFileStream, InputStream bannerFileStream,
List<InputStream> attachments) throws ApplicationManagementException; List<InputStream> attachments) throws ApplicationManagementException;
void validateAppCreatingRequest(ApplicationWrapper applicationWrapper, Attachment binaryFile, Attachment iconFile, /***
Attachment bannerFile, List<Attachment> attachmentList) throws RequestValidatingException; * To validate the application creating request
*
* @param applicationWrapper {@link ApplicationDTO}
* @throws RequestValidatingException if the payload contains invalid inputs.
*/
void validateAppCreatingRequest(ApplicationWrapper applicationWrapper) throws RequestValidatingException;
/***
*
* @param applicationReleaseWrapper {@link ApplicationReleaseDTO}
* @param applicationType Type of the application
* @throws RequestValidatingException throws if payload does not satisfy requrements.
*/
void validateReleaseCreatingRequest(ApplicationReleaseWrapper applicationReleaseWrapper,
String applicationType) throws RequestValidatingException;
/***
*
* @param binaryFile Uploading binary fila. i.e .apk or .ipa
* @param iconFile Icon file for the application.
* @param bannerFile Banner file for the application.
* @param attachmentList Screenshot list.
* @param applicationType Type of the application.
* @throws RequestValidatingException If request doesn't contains required attachments.
*/
void isValidAttachmentSet(Attachment binaryFile, Attachment iconFile, Attachment bannerFile,
List<Attachment> attachmentList, String applicationType) throws RequestValidatingException;
void validateReleaseCreatingRequest(ApplicationReleaseWrapper applicationReleaseWrapper, String applicationType,
Attachment binaryFile, Attachment iconFile, Attachment bannerFile, List<Attachment> attachmentList)
throws RequestValidatingException;
void addAplicationCategories(List<String> categories) throws ApplicationManagementException; void addAplicationCategories(List<String> categories) throws ApplicationManagementException;

@ -19,8 +19,7 @@
package org.wso2.carbon.device.application.mgt.common.services; package org.wso2.carbon.device.application.mgt.common.services;
import org.apache.cxf.jaxrs.ext.multipart.Attachment; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationReleaseEntity;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationStorageManagementException; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationStorageManagementException;
import org.wso2.carbon.device.application.mgt.common.exception.RequestValidatingException; import org.wso2.carbon.device.application.mgt.common.exception.RequestValidatingException;
import org.wso2.carbon.device.application.mgt.common.exception.ResourceManagementException; import org.wso2.carbon.device.application.mgt.common.exception.ResourceManagementException;
@ -29,22 +28,22 @@ import java.io.InputStream;
import java.util.List; import java.util.List;
/** /**
* This manages all the storage related requirements of ApplicationEntity. * This manages all the storage related requirements of ApplicationDTO.
*/ */
public interface ApplicationStorageManager { public interface ApplicationStorageManager {
/** /**
* To upload image artifacts related with an ApplicationEntity. * To upload image artifacts related with an ApplicationDTO.
* *
* @param applicationRelease ApplicationReleaseEntity Object * @param applicationRelease ApplicationReleaseDTO Object
* @param iconFile Icon File input stream * @param iconFile Icon File input stream
* @param bannerFile Banner File input stream * @param bannerFile Banner File input stream
* @throws ResourceManagementException Resource Management Exception. * @throws ResourceManagementException Resource Management Exception.
*/ */
ApplicationReleaseEntity uploadImageArtifacts(ApplicationReleaseEntity applicationRelease, ApplicationReleaseDTO uploadImageArtifacts(ApplicationReleaseDTO applicationRelease,
InputStream iconFile, InputStream bannerFile, List<InputStream> screenshots) throws ResourceManagementException; InputStream iconFile, InputStream bannerFile, List<InputStream> screenshots) throws ResourceManagementException;
/** /**
* To upload image artifacts related with an ApplicationEntity. * To upload image artifacts related with an ApplicationDTO.
* *
* @param applicationRelease Release of the application * @param applicationRelease Release of the application
* @param iconFile Icon File input stream * @param iconFile Icon File input stream
@ -52,35 +51,35 @@ public interface ApplicationStorageManager {
* @param screenshots Input Streams of screenshots * @param screenshots Input Streams of screenshots
* @throws ResourceManagementException Resource Management Exception. * @throws ResourceManagementException Resource Management Exception.
*/ */
ApplicationReleaseEntity updateImageArtifacts(ApplicationReleaseEntity applicationRelease, InputStream iconFile, ApplicationReleaseDTO updateImageArtifacts(ApplicationReleaseDTO applicationRelease, InputStream iconFile,
InputStream bannerFile, List<InputStream> screenshots) throws ResourceManagementException; InputStream bannerFile, List<InputStream> screenshots) throws ResourceManagementException;
/** /**
* To upload release artifacts for an ApplicationEntity. * To upload release artifacts for an ApplicationDTO.
* *
* @param applicationRelease ApplicationEntity Release Object. * @param applicationRelease ApplicationDTO Release Object.
* @param appType ApplicationEntity Type. * @param appType ApplicationDTO Type.
* @param deviceType Compatible device tipe of the application. * @param deviceType Compatible device tipe of the application.
* @param binaryFile Binary File for the release. * @param binaryFile Binary File for the release.
* @throws ResourceManagementException Resource Management Exception. * @throws ResourceManagementException Resource Management Exception.
*/ */
ApplicationReleaseEntity uploadReleaseArtifact(ApplicationReleaseEntity applicationRelease, String appType, String deviceType, ApplicationReleaseDTO uploadReleaseArtifact(ApplicationReleaseDTO applicationRelease, String appType, String deviceType,
InputStream binaryFile) throws ResourceManagementException, RequestValidatingException; InputStream binaryFile) throws ResourceManagementException;
/** /**
* To upload release artifacts for an ApplicationEntity. * To upload release artifacts for an ApplicationDTO.
* *
* @param applicationRelease applicationRelease ApplicationEntity release of a particular application. * @param applicationRelease applicationRelease ApplicationDTO release of a particular application.
* @param appType Type of the application. * @param appType Type of the application.
* @param deviceType Compatible device tipe of the application. * @param deviceType Compatible device tipe of the application.
* @param binaryFile Binary File for the release. * @param binaryFile Binary File for the release.
* @throws ApplicationStorageManagementException Resource Management Exception. * @throws ApplicationStorageManagementException Resource Management Exception.
*/ */
ApplicationReleaseEntity updateReleaseArtifacts(ApplicationReleaseEntity applicationRelease, String appType, String deviceType, ApplicationReleaseDTO updateReleaseArtifacts(ApplicationReleaseDTO applicationRelease, String appType, String deviceType,
InputStream binaryFile) throws ApplicationStorageManagementException, RequestValidatingException; InputStream binaryFile) throws ApplicationStorageManagementException, RequestValidatingException;
/** /**
* To delete the artifacts related with particular ApplicationEntity Release. * To delete the artifacts related with particular ApplicationDTO Release.
* *
* @param directoryPath Hash value of the application artifact. * @param directoryPath Hash value of the application artifact.
* @throws ApplicationStorageManagementException Not Found Exception. * @throws ApplicationStorageManagementException Not Found Exception.
@ -88,10 +87,10 @@ public interface ApplicationStorageManager {
void deleteApplicationReleaseArtifacts(String directoryPath) throws ApplicationStorageManagementException; void deleteApplicationReleaseArtifacts(String directoryPath) throws ApplicationStorageManagementException;
/** /**
* To delete all release artifacts related with particular ApplicationEntity Release. * To delete all release artifacts related with particular ApplicationDTO Release.
* *
* @param directoryPaths Hash values of the ApplicationEntity. * @param directoryPaths Hash values of the ApplicationDTO.
* @throws ApplicationStorageManagementException ApplicationEntity Storage Management Exception * @throws ApplicationStorageManagementException ApplicationDTO Storage Management Exception
*/ */
void deleteAllApplicationReleaseArtifacts(List<String> directoryPaths) throws ApplicationStorageManagementException; void deleteAllApplicationReleaseArtifacts(List<String> directoryPaths) throws ApplicationStorageManagementException;

@ -27,7 +27,7 @@ public interface AppmDataHandler {
* Get UI configuration which is defined in the app-manager.xml * Get UI configuration which is defined in the app-manager.xml
* *
* @return {@link UIConfiguration} UI configuration * @return {@link UIConfiguration} UI configuration
* @throws ApplicationManagementException Exceptions of the ApplicationEntity management. * @throws ApplicationManagementException Exceptions of the ApplicationDTO management.
*/ */
UIConfiguration getUIConfiguration() throws ApplicationManagementException; UIConfiguration getUIConfiguration() throws ApplicationManagementException;

@ -25,7 +25,7 @@ import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import java.util.List; import java.util.List;
/** /**
* This interface manages all the operations related with ApplicationEntity Subscription. * This interface manages all the operations related with ApplicationDTO Subscription.
*/ */
public interface SubscriptionManager { public interface SubscriptionManager {
/** /**
@ -70,10 +70,10 @@ public interface SubscriptionManager {
/** /**
* To uninstall an application from a given list of devices. * To uninstall an application from a given list of devices.
* @param applicationUUID ApplicationEntity ID * @param applicationUUID ApplicationDTO ID
* @param deviceList Device list * @param deviceList Device list
* @return Failed Device List which the application was unable to uninstall * @return Failed Device List which the application was unable to uninstall
* @throws ApplicationManagementException ApplicationEntity Management Exception * @throws ApplicationManagementException ApplicationDTO Management Exception
*/ */
List<DeviceIdentifier> uninstallApplication(String applicationUUID, List<DeviceIdentifier> deviceList) List<DeviceIdentifier> uninstallApplication(String applicationUUID, List<DeviceIdentifier> deviceList)
throws ApplicationManagementException; throws ApplicationManagementException;

@ -21,7 +21,7 @@ package org.wso2.carbon.device.application.mgt.common.wrapper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "ApplicationReleaseEntity", description = "This class holds the details when releasing an ApplicationEntity to application store") @ApiModel(value = "ApplicationReleaseDTO", description = "This class holds the details when releasing an ApplicationDTO to application store")
public class ApplicationReleaseWrapper { public class ApplicationReleaseWrapper {
@ApiModelProperty(name = "description", @ApiModelProperty(name = "description",
@ -54,7 +54,7 @@ public class ApplicationReleaseWrapper {
private String url; private String url;
@ApiModelProperty(name = "supportedOsVersions", @ApiModelProperty(name = "supportedOsVersions",
value = "ApplicationEntity release supported OS versions") value = "ApplicationDTO release supported OS versions")
private String supportedOsVersions; private String supportedOsVersions;
public String getReleaseType() { public String getReleaseType() {

@ -23,7 +23,7 @@ import io.swagger.annotations.ApiModelProperty;
import java.util.List; import java.util.List;
@ApiModel(value = "ApplicationWrapper", description = "ApplicationWrapper represents the an ApplicationEntity in ApplicationEntity Store") @ApiModel(value = "ApplicationWrapper", description = "ApplicationWrapper represents the an ApplicationDTO in ApplicationDTO Store")
public class ApplicationWrapper { public class ApplicationWrapper {
@ -38,7 +38,7 @@ public class ApplicationWrapper {
private String description; private String description;
@ApiModelProperty(name = "appCategory", @ApiModelProperty(name = "appCategory",
value = "CategoryEntity of the application", value = "CategoryDTO of the application",
required = true, required = true,
example = "Educational, Gaming, Travel, Entertainment etc") example = "Educational, Gaming, Travel, Entertainment etc")
private String appCategory; private String appCategory;

@ -19,43 +19,43 @@
package org.wso2.carbon.device.application.mgt.core.dao; package org.wso2.carbon.device.application.mgt.core.dao;
import org.wso2.carbon.device.application.mgt.common.*; import org.wso2.carbon.device.application.mgt.common.*;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationReleaseEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO;
import org.wso2.carbon.device.application.mgt.common.entity.CategoryEntity; import org.wso2.carbon.device.application.mgt.common.dto.CategoryDTO;
import org.wso2.carbon.device.application.mgt.common.entity.TagEntity; import org.wso2.carbon.device.application.mgt.common.dto.TagDTO;
import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException; import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException;
import java.util.List; import java.util.List;
/** /**
* ApplicationDAO is responsible for handling all the Database related operations related with ApplicationEntity Management. * ApplicationDAO is responsible for handling all the Database related operations related with ApplicationDTO Management.
*/ */
public interface ApplicationDAO { public interface ApplicationDAO {
/** /**
* To create an application. * To create an application.
* *
* @param application ApplicationEntity that need to be created. * @param application ApplicationDTO that need to be created.
* @return Created Application. * @return Created Application.
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
int createApplication(ApplicationEntity application, int tenantId) throws ApplicationManagementDAOException; int createApplication(ApplicationDTO application, int tenantId) throws ApplicationManagementDAOException;
/** /**
* To add tags for a particular application. * To add tags for a particular application.
* *
* @param tags tags that need to be added for a application. * @param tags tags that need to be added for a application.
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
void addTags(List<String> tags, int tenantId) throws ApplicationManagementDAOException; void addTags(List<String> tags, int tenantId) throws ApplicationManagementDAOException;
List<TagEntity> getAllTags(int tenantId) throws ApplicationManagementDAOException; List<TagDTO> getAllTags(int tenantId) throws ApplicationManagementDAOException;
List<Integer> getTagIdsForTagNames (List<String> tagNames, int tenantId) throws ApplicationManagementDAOException; List<Integer> getTagIdsForTagNames (List<String> tagNames, int tenantId) throws ApplicationManagementDAOException;
void addTagMapping (List<Integer> tagIds, int applicationId, int tenantId) throws ApplicationManagementDAOException; void addTagMapping (List<Integer> tagIds, int applicationId, int tenantId) throws ApplicationManagementDAOException;
List<CategoryEntity> getAllCategories(int tenantId) throws ApplicationManagementDAOException; List<CategoryDTO> getAllCategories(int tenantId) throws ApplicationManagementDAOException;
void addCategories(List<String> categories, int tenantId) throws ApplicationManagementDAOException; void addCategories(List<String> categories, int tenantId) throws ApplicationManagementDAOException;
@ -68,7 +68,7 @@ public interface ApplicationDAO {
* @param appName appName that need to identify application. * @param appName appName that need to identify application.
* @param type type that need to identify application. * @param type type that need to identify application.
* @param tenantId tenantId that need to identify application. * @param tenantId tenantId that need to identify application.
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
boolean isExistApplication(String appName, String type, int tenantId) throws ApplicationManagementDAOException; boolean isExistApplication(String appName, String type, int tenantId) throws ApplicationManagementDAOException;
@ -77,8 +77,8 @@ public interface ApplicationDAO {
* *
* @param filter Filter criteria. * @param filter Filter criteria.
* @param tenantId Id of the tenant. * @param tenantId Id of the tenant.
* @return ApplicationEntity list * @return ApplicationDTO list
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
ApplicationList getApplications(Filter filter, int tenantId) throws ApplicationManagementDAOException; ApplicationList getApplications(Filter filter, int tenantId) throws ApplicationManagementDAOException;
@ -86,7 +86,7 @@ public interface ApplicationDAO {
* To get the UUID of latest app release that satisfy the given criteria. * To get the UUID of latest app release that satisfy the given criteria.
* *
* @param appId application id * @param appId application id
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
String getUuidOfLatestRelease(int appId) throws ApplicationManagementDAOException; String getUuidOfLatestRelease(int appId) throws ApplicationManagementDAOException;
@ -97,9 +97,9 @@ public interface ApplicationDAO {
* @param tenantId ID of the tenant. * @param tenantId ID of the tenant.
* @param appType Type of the application. * @param appType Type of the application.
* @return the application * @return the application
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
ApplicationEntity getApplication(String appName, String appType, int tenantId) throws ApplicationManagementDAOException; ApplicationDTO getApplication(String appName, String appType, int tenantId) throws ApplicationManagementDAOException;
/** /**
* To get the application with the given id * To get the application with the given id
@ -107,9 +107,9 @@ public interface ApplicationDAO {
* @param id ID of the application. * @param id ID of the application.
* @param tenantId ID of the tenant. * @param tenantId ID of the tenant.
* @return the application * @return the application
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
ApplicationEntity getApplicationById(String id, int tenantId) throws ApplicationDTO getApplicationById(String id, int tenantId) throws
ApplicationManagementDAOException; ApplicationManagementDAOException;
/** /**
@ -118,9 +118,9 @@ public interface ApplicationDAO {
* @param applicationId Id of the application to be retrieved. * @param applicationId Id of the application to be retrieved.
* @param tenantId ID of the tenant. * @param tenantId ID of the tenant.
* @return the application * @return the application
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
ApplicationEntity getApplicationById(int applicationId, int tenantId) throws ApplicationManagementDAOException; ApplicationDTO getApplicationById(int applicationId, int tenantId) throws ApplicationManagementDAOException;
/** /**
* To get the application with the given uuid * To get the application with the given uuid
@ -128,9 +128,9 @@ public interface ApplicationDAO {
* @param releaseUuid UUID of the application release. * @param releaseUuid UUID of the application release.
* @param tenantId ID of the tenant. * @param tenantId ID of the tenant.
* @return the application * @return the application
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
ApplicationEntity getApplicationByUUID(String releaseUuid, int tenantId) throws ApplicationManagementDAOException; ApplicationDTO getApplicationByUUID(String releaseUuid, int tenantId) throws ApplicationManagementDAOException;
/** /**
* To get the application with the given uuid * To get the application with the given uuid
@ -138,7 +138,7 @@ public interface ApplicationDAO {
* @param appId ID of the application * @param appId ID of the application
* @param tenantId Tenant Id * @param tenantId Tenant Id
* @return the boolean value * @return the boolean value
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
boolean verifyApplicationExistenceById(int appId, int tenantId) throws ApplicationManagementDAOException; boolean verifyApplicationExistenceById(int appId, int tenantId) throws ApplicationManagementDAOException;
@ -148,36 +148,36 @@ public interface ApplicationDAO {
* @param appName name of the application. * @param appName name of the application.
* @param appType type of the application. * @param appType type of the application.
* @param tenantId ID of the tenant. * @param tenantId ID of the tenant.
* @return ID of the ApplicationEntity. * @return ID of the ApplicationDTO.
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
int getApplicationId(String appName, String appType, int tenantId) throws ApplicationManagementDAOException; int getApplicationId(String appName, String appType, int tenantId) throws ApplicationManagementDAOException;
/** /**
* To edit the given application. * To edit the given application.
* *
* @param application ApplicationEntity that need to be edited. * @param application ApplicationDTO that need to be edited.
* @param tenantId Tenant ID of the ApplicationEntity. * @param tenantId Tenant ID of the ApplicationDTO.
* @return Updated ApplicationEntity. * @return Updated ApplicationDTO.
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
ApplicationEntity editApplication(ApplicationEntity application, int tenantId) throws ApplicationManagementDAOException; ApplicationDTO editApplication(ApplicationDTO application, int tenantId) throws ApplicationManagementDAOException;
/** /**
* To delete the application * To delete the application
* *
* @param appId ID of the application. * @param appId ID of the application.
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
void deleteApplication(int appId) throws ApplicationManagementDAOException; void deleteApplication(int appId) throws ApplicationManagementDAOException;
/** /**
* To get the application count that satisfies gives search query. * To get the application count that satisfies gives search query.
* *
* @param filter ApplicationEntity Filter. * @param filter ApplicationDTO Filter.
* @param tenantId Id of the tenant * @param tenantId Id of the tenant
* @return count of the applications * @return count of the applications
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
int getApplicationCount(Filter filter, int tenantId) throws ApplicationManagementDAOException; int getApplicationCount(Filter filter, int tenantId) throws ApplicationManagementDAOException;
@ -187,18 +187,18 @@ public interface ApplicationDAO {
* @param tags Tags which are going to delete. * @param tags Tags which are going to delete.
* @param applicationId ID of the application to delete the tags. * @param applicationId ID of the application to delete the tags.
* @param tenantId Tenant Id * @param tenantId Tenant Id
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
void deleteTags(List<String> tags, int applicationId, int tenantId) throws ApplicationManagementDAOException; void deleteTags(List<String> tags, int applicationId, int tenantId) throws ApplicationManagementDAOException;
/** /**
* To get an {@link ApplicationEntity} associated with the given release * To get an {@link ApplicationDTO} associated with the given release
* *
* @param appReleaseUUID UUID of the {@link ApplicationReleaseEntity} * @param appReleaseUUID UUID of the {@link ApplicationReleaseDTO}
* @param tenantId ID of the tenant * @param tenantId ID of the tenant
* @return {@link ApplicationEntity} associated with the given release UUID * @return {@link ApplicationDTO} associated with the given release UUID
* @throws ApplicationManagementDAOException if unable to fetch the ApplicationEntity from the data store. * @throws ApplicationManagementDAOException if unable to fetch the ApplicationDTO from the data store.
*/ */
ApplicationEntity getApplicationByRelease(String appReleaseUUID, int tenantId) throws ApplicationManagementDAOException; ApplicationDTO getApplicationByRelease(String appReleaseUUID, int tenantId) throws ApplicationManagementDAOException;
} }

@ -18,7 +18,7 @@
*/ */
package org.wso2.carbon.device.application.mgt.core.dao; package org.wso2.carbon.device.application.mgt.core.dao;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationReleaseEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO;
import org.wso2.carbon.device.application.mgt.common.ApplicationReleaseArtifactPaths; import org.wso2.carbon.device.application.mgt.common.ApplicationReleaseArtifactPaths;
import org.wso2.carbon.device.application.mgt.common.Rating; import org.wso2.carbon.device.application.mgt.common.Rating;
import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException; import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException;
@ -26,18 +26,18 @@ import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManageme
import java.util.List; import java.util.List;
/** /**
* This is responsible for ApplicationEntity Release related DAO operations. * This is responsible for ApplicationDTO Release related DAO operations.
*/ */
public interface ApplicationReleaseDAO { public interface ApplicationReleaseDAO {
/** /**
* To create an ApplicationEntity release. * To create an ApplicationDTO release.
* *
* @param applicationRelease ApplicationEntity Release that need to be created. * @param applicationRelease ApplicationDTO Release that need to be created.
* @return Unique ID of the relevant release. * @return Unique ID of the relevant release.
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
ApplicationReleaseEntity createRelease(ApplicationReleaseEntity applicationRelease, int appId, int tenantId) throws ApplicationReleaseDTO createRelease(ApplicationReleaseDTO applicationRelease, int appId, int tenantId) throws
ApplicationManagementDAOException; ApplicationManagementDAOException;
/** /**
@ -48,54 +48,54 @@ public interface ApplicationReleaseDAO {
* @param releaseType type of the release * @param releaseType type of the release
* @param tenantId tenantId of the application * @param tenantId tenantId of the application
* @return ApplicationReleaseEntity for the particular version of the given application * @return ApplicationReleaseDTO for the particular version of the given application
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
ApplicationReleaseEntity getRelease(String applicationName,String applicationType, String versionName, ApplicationReleaseDTO getRelease(String applicationName,String applicationType, String versionName,
String releaseType, int tenantId) throws String releaseType, int tenantId) throws
ApplicationManagementDAOException; ApplicationManagementDAOException;
/** /**
* To get all the releases of a particular application. * To get all the releases of a particular application.
* *
* @param applicationId Id of the ApplicationEntity * @param applicationId Id of the application
* @param tenantId tenant id of the application * @param tenantId tenant id of the application
* @return list of the application releases * @return list of the application releases
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
List<ApplicationReleaseEntity> getReleases(int applicationId, int tenantId) throws List<ApplicationReleaseDTO> getReleases(int applicationId, int tenantId) throws
ApplicationManagementDAOException; ApplicationManagementDAOException;
/** /**
* To get the release by state. * To get the release by state.
* *
* @param appId Id of the ApplicationEntity * @param appId Id of the ApplicationDTO
* @param tenantId tenant id of the application * @param tenantId tenant id of the application
* @param state state of the application * @param state state of the application
* @return list of the application releases * @return list of the application releases
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
List<ApplicationReleaseEntity> getReleaseByState(int appId, int tenantId, String state) List<ApplicationReleaseDTO> getReleaseByState(int appId, int tenantId, String state)
throws ApplicationManagementDAOException; throws ApplicationManagementDAOException;
/** /**
* To update an ApplicationEntity release. * To update an ApplicationDTO release.
* *
* @param applicationRelease ApplicationReleaseEntity that need to be updated. * @param applicationRelease ApplicationReleaseDTO that need to be updated.
* @param applicationId Id of the application. * @param applicationId Id of the application.
* @param tenantId Id of the tenant * @param tenantId Id of the tenant
* @return the updated ApplicationEntity Release * @return the updated ApplicationDTO Release
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception
*/ */
ApplicationReleaseEntity updateRelease(int applicationId, ApplicationReleaseEntity applicationRelease, int tenantId) throws ApplicationReleaseDTO updateRelease(int applicationId, ApplicationReleaseDTO applicationRelease, int tenantId) throws
ApplicationManagementDAOException; ApplicationManagementDAOException;
/** /**
* To update an ApplicationEntity release. * To update an ApplicationDTO release.
* @param uuid UUID of the ApplicationReleaseEntity that need to be updated. * @param uuid UUID of the ApplicationReleaseDTO that need to be updated.
* @param rating given stars for the application. * @param rating given stars for the application.
* @param ratedUsers number of users who has rated for the application release. * @param ratedUsers number of users who has rated for the application release.
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception
*/ */
void updateRatingValue(String uuid, double rating, int ratedUsers) throws ApplicationManagementDAOException; void updateRatingValue(String uuid, double rating, int ratedUsers) throws ApplicationManagementDAOException;
@ -104,7 +104,7 @@ public interface ApplicationReleaseDAO {
* *
* @param uuid UUID of the application Release. * @param uuid UUID of the application Release.
* @param tenantId Tenant Id * @param tenantId Tenant Id
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
Rating getRating(String uuid, int tenantId) throws ApplicationManagementDAOException; Rating getRating(String uuid, int tenantId) throws ApplicationManagementDAOException;
@ -112,9 +112,9 @@ public interface ApplicationReleaseDAO {
/** /**
* To delete a particular release. * To delete a particular release.
* *
* @param id ID of the ApplicationEntity which the release need to be deleted. * @param id ID of the ApplicationDTO which the release need to be deleted.
* @param version Version of the ApplicationEntity Release * @param version Version of the ApplicationDTO Release
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
void deleteRelease(int id, String version) throws ApplicationManagementDAOException; void deleteRelease(int id, String version) throws ApplicationManagementDAOException;
@ -124,9 +124,9 @@ public interface ApplicationReleaseDAO {
* @param applicationId ID of the application. * @param applicationId ID of the application.
* @param releaseUuid UUID of the application release. * @param releaseUuid UUID of the application release.
* @param tenantId Tenant Id * @param tenantId Tenant Id
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
ApplicationReleaseEntity getReleaseByIds(int applicationId, String releaseUuid, int tenantId) throws ApplicationReleaseDTO getReleaseByIds(int applicationId, String releaseUuid, int tenantId) throws
ApplicationManagementDAOException; ApplicationManagementDAOException;
/** /**
@ -135,7 +135,7 @@ public interface ApplicationReleaseDAO {
* @param appId ID of the application. * @param appId ID of the application.
* @param uuid UUID of the application release. * @param uuid UUID of the application release.
* @param tenantId Tenant Id * @param tenantId Tenant Id
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
boolean verifyReleaseExistence(int appId, String uuid, int tenantId) throws ApplicationManagementDAOException; boolean verifyReleaseExistence(int appId, String uuid, int tenantId) throws ApplicationManagementDAOException;
@ -145,7 +145,7 @@ public interface ApplicationReleaseDAO {
* @param appId ID of the application. * @param appId ID of the application.
* @param hashVal Hash value of the application release. * @param hashVal Hash value of the application release.
* @param tenantId Tenant Id * @param tenantId Tenant Id
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
boolean verifyReleaseExistenceByHash(int appId, String hashVal, int tenantId) boolean verifyReleaseExistenceByHash(int appId, String hashVal, int tenantId)
throws ApplicationManagementDAOException; throws ApplicationManagementDAOException;
@ -155,7 +155,7 @@ public interface ApplicationReleaseDAO {
* *
* @param appId ID of the application. * @param appId ID of the application.
* @param tenantId Tenant Id * @param tenantId Tenant Id
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException Application Management DAO Exception.
*/ */
String getPackageName(int appId, int tenantId) throws ApplicationManagementDAOException; String getPackageName(int appId, int tenantId) throws ApplicationManagementDAOException;
@ -164,10 +164,19 @@ public interface ApplicationReleaseDAO {
* *
* @param uuid UUID of the application release. * @param uuid UUID of the application release.
* @param tenantId Tenant Id * @param tenantId Tenant Id
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException Application Management DAO Exception.
*/ */
boolean verifyReleaseExistenceByUuid(String uuid, int tenantId) throws ApplicationManagementDAOException; boolean verifyReleaseExistenceByUuid(String uuid, int tenantId) throws ApplicationManagementDAOException;
ApplicationReleaseArtifactPaths getReleaseArtifactPaths(String uuid, int tenantId) throws ApplicationManagementDAOException; ApplicationReleaseArtifactPaths getReleaseArtifactPaths(String uuid, int tenantId) throws ApplicationManagementDAOException;
/***
*
* @param packageName Application release package name
* @param tenantId Tenant ID
* @return True if application release package name already exist in the IoT server, Otherwise returns False.
* @throws ApplicationManagementDAOException Application Management DAO Exception.
*/
boolean isAppExisitForPackageName (String packageName, int tenantId) throws ApplicationManagementDAOException;
} }

@ -18,7 +18,7 @@
*/ */
package org.wso2.carbon.device.application.mgt.core.dao; package org.wso2.carbon.device.application.mgt.core.dao;
import org.wso2.carbon.device.application.mgt.common.entity.LifecycleStateEntity; import org.wso2.carbon.device.application.mgt.common.dto.LifecycleStateDTO;
import org.wso2.carbon.device.application.mgt.core.exception.LifeCycleManagementDAOException; import org.wso2.carbon.device.application.mgt.core.exception.LifeCycleManagementDAOException;
import java.util.List; import java.util.List;
@ -35,7 +35,7 @@ public interface LifecycleStateDAO {
* @return Latest Lifecycle State for the given application release * @return Latest Lifecycle State for the given application release
* @throws LifeCycleManagementDAOException Lifecycle Management DAO Exception. * @throws LifeCycleManagementDAOException Lifecycle Management DAO Exception.
*/ */
LifecycleStateEntity getLatestLifeCycleStateByReleaseID(int applicationReleaseId) throws LifeCycleManagementDAOException; LifecycleStateDTO getLatestLifeCycleStateByReleaseID(int applicationReleaseId) throws LifeCycleManagementDAOException;
/** /**
* To get the latest lifecycle state for the given application id and the application release UUID. * To get the latest lifecycle state for the given application id and the application release UUID.
@ -45,7 +45,7 @@ public interface LifecycleStateDAO {
* @return Latest Lifecycle State for the given application release * @return Latest Lifecycle State for the given application release
* @throws LifeCycleManagementDAOException Lifecycle Management DAO Exception. * @throws LifeCycleManagementDAOException Lifecycle Management DAO Exception.
*/ */
LifecycleStateEntity getLatestLifeCycleState(int appId, String uuid) throws LifeCycleManagementDAOException; LifecycleStateDTO getLatestLifeCycleState(int appId, String uuid) throws LifeCycleManagementDAOException;
/** /**
* To get all changed lifecycle states for the given application release id. * To get all changed lifecycle states for the given application release id.
@ -54,23 +54,23 @@ public interface LifecycleStateDAO {
* @return Lifecycle States for the given application release * @return Lifecycle States for the given application release
* @throws LifeCycleManagementDAOException Lifecycle Management DAO Exception. * @throws LifeCycleManagementDAOException Lifecycle Management DAO Exception.
*/ */
List<LifecycleStateEntity> getLifecycleStates(int appReleaseId) throws LifeCycleManagementDAOException; List<LifecycleStateDTO> getLifecycleStates(int appReleaseId) throws LifeCycleManagementDAOException;
/** /**
* To add new lifecycle states for the given application release. * To add new lifecycle states for the given application release.
* @param uuid Id of the application release. * @param uuid Id of the application release.
* @param appId Id of the application. * @param appId Id of the application.
* @param state LifecycleStateEntity. * @param state LifecycleStateDTO.
* @param tenantId Tenant id * @param tenantId Tenant id
* *
* @throws LifeCycleManagementDAOException Lifecycle Management DAO Exception. * @throws LifeCycleManagementDAOException Lifecycle Management DAO Exception.
*/ */
void addLifecycleState(LifecycleStateEntity state, int appId, String uuid, int tenantId) void addLifecycleState(LifecycleStateDTO state, int appId, String uuid, int tenantId)
throws LifeCycleManagementDAOException; throws LifeCycleManagementDAOException;
/** /**
* To delete a specific lifecycle state for application release. * To delete a specific lifecycle state for application release.
* @param identifier Id of the LifecycleStateEntity. * @param identifier Id of the LifecycleStateDTO.
* *
* @throws LifeCycleManagementDAOException Lifecycle Management DAO Exception. * @throws LifeCycleManagementDAOException Lifecycle Management DAO Exception.
*/ */

@ -18,8 +18,8 @@
*/ */
package org.wso2.carbon.device.application.mgt.core.dao; package org.wso2.carbon.device.application.mgt.core.dao;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationReleaseEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO;
import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException; import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup; import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup;
@ -38,8 +38,8 @@ public interface SubscriptionDAO {
* @param tenantId id of the tenant * @param tenantId id of the tenant
* @param subscribedBy username of the user who subscribe the application * @param subscribedBy username of the user who subscribe the application
* @param deviceList List of {@link Device} which the application is installed on * @param deviceList List of {@link Device} which the application is installed on
* @param appId id of the {@link ApplicationEntity} which installs * @param appId id of the {@link ApplicationDTO} which installs
* @param releaseId id of the {@link ApplicationReleaseEntity} * @param releaseId id of the {@link ApplicationReleaseDTO}
* @throws ApplicationManagementDAOException If unable to add a mapping between device and application * @throws ApplicationManagementDAOException If unable to add a mapping between device and application
*/ */
void subscribeDeviceToApplication(int tenantId, String subscribedBy, List<Device> deviceList, int appId, void subscribeDeviceToApplication(int tenantId, String subscribedBy, List<Device> deviceList, int appId,
@ -52,8 +52,8 @@ public interface SubscriptionDAO {
* @param tenantId id of the tenant * @param tenantId id of the tenant
* @param subscribedBy username of the user who subscribe the application * @param subscribedBy username of the user who subscribe the application
* @param userList list of user names of the users whose devices are subscribed to the application * @param userList list of user names of the users whose devices are subscribed to the application
* @param appId id of the {@link ApplicationEntity} which installs * @param appId id of the {@link ApplicationDTO} which installs
* @param releaseId id of the {@link ApplicationReleaseEntity} * @param releaseId id of the {@link ApplicationReleaseDTO}
* @throws ApplicationManagementDAOException If unable to add a mapping between device and application * @throws ApplicationManagementDAOException If unable to add a mapping between device and application
*/ */
void subscribeUserToApplication(int tenantId, String subscribedBy, List<String> userList, int appId, int releaseId) void subscribeUserToApplication(int tenantId, String subscribedBy, List<String> userList, int appId, int releaseId)
@ -66,8 +66,8 @@ public interface SubscriptionDAO {
* @param tenantId id of the tenant * @param tenantId id of the tenant
* @param subscribedBy username of the user who subscribe the application * @param subscribedBy username of the user who subscribe the application
* @param roleList list of roles which belongs devices are subscribed to the application * @param roleList list of roles which belongs devices are subscribed to the application
* @param appId id of the {@link ApplicationEntity} which installs * @param appId id of the {@link ApplicationDTO} which installs
* @param releaseId id of the {@link ApplicationReleaseEntity} * @param releaseId id of the {@link ApplicationReleaseDTO}
* @throws ApplicationManagementDAOException If unable to add a mapping between device and application * @throws ApplicationManagementDAOException If unable to add a mapping between device and application
*/ */
void subscribeRoleToApplication(int tenantId, String subscribedBy, List<String> roleList, int appId, int releaseId) void subscribeRoleToApplication(int tenantId, String subscribedBy, List<String> roleList, int appId, int releaseId)
@ -80,8 +80,8 @@ public interface SubscriptionDAO {
* @param tenantId id of the tenant * @param tenantId id of the tenant
* @param subscribedBy username of the user who subscribe the application * @param subscribedBy username of the user who subscribe the application
* @param groupList list of {@link DeviceGroup} which belongs the devices that are subscribed to the application * @param groupList list of {@link DeviceGroup} which belongs the devices that are subscribed to the application
* @param appId id of the {@link ApplicationEntity} which installs * @param appId id of the {@link ApplicationDTO} which installs
* @param releaseId id of the {@link ApplicationReleaseEntity} * @param releaseId id of the {@link ApplicationReleaseDTO}
* @throws ApplicationManagementDAOException If unable to add a mapping between device and application * @throws ApplicationManagementDAOException If unable to add a mapping between device and application
*/ */
void subscribeGroupToApplication(int tenantId, String subscribedBy, List<DeviceGroup> groupList, int appId, void subscribeGroupToApplication(int tenantId, String subscribedBy, List<DeviceGroup> groupList, int appId,

@ -22,10 +22,10 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.json.JSONException; import org.json.JSONException;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.PaginationRequest; import org.wso2.carbon.device.application.mgt.common.PaginationRequest;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationReleaseEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO;
import org.wso2.carbon.device.application.mgt.common.exception.ReviewManagementException; import org.wso2.carbon.device.application.mgt.common.exception.ReviewManagementException;
import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager;
import org.wso2.carbon.device.application.mgt.common.services.ApplicationStorageManager; import org.wso2.carbon.device.application.mgt.common.services.ApplicationStorageManager;
@ -55,10 +55,10 @@ public class Util {
// * @throws SQLException SQL Exception // * @throws SQLException SQL Exception
// * @throws JSONException JSONException. // * @throws JSONException JSONException.
// */ // */
// public static List<ApplicationEntity> loadApplications(ResultSet rs) throws SQLException, JSONException { // public static List<ApplicationDTO> loadApplications(ResultSet rs) throws SQLException, JSONException {
// //
// List<ApplicationEntity> applications = new ArrayList<>(); // List<ApplicationDTO> applications = new ArrayList<>();
// ApplicationEntity application = null; // ApplicationDTO application = null;
// int applicationId = -1; // int applicationId = -1;
// boolean hasNext = rs.next(); // boolean hasNext = rs.next();
// //
@ -68,7 +68,7 @@ public class Util {
// applications.add(application); // applications.add(application);
// } // }
// applicationId = rs.getInt("APP_ID"); // applicationId = rs.getInt("APP_ID");
// application = new ApplicationEntity(); // application = new ApplicationDTO();
// application.setTags(new ArrayList<>()); // application.setTags(new ArrayList<>());
// application.setUnrestrictedRoles(new ArrayList<>()); // application.setUnrestrictedRoles(new ArrayList<>());
// application.setId(applicationId); // application.setId(applicationId);
@ -115,10 +115,10 @@ public class Util {
* @throws SQLException SQL Exception * @throws SQLException SQL Exception
* @throws JSONException JSONException. * @throws JSONException JSONException.
*/ */
public static List<ApplicationEntity> loadApplications(ResultSet rs) throws SQLException, JSONException { public static List<ApplicationDTO> loadApplications(ResultSet rs) throws SQLException, JSONException {
List<ApplicationEntity> applications = new ArrayList<>(); List<ApplicationDTO> applications = new ArrayList<>();
ApplicationEntity application = null; ApplicationDTO application = null;
int applicationId = -1; int applicationId = -1;
boolean hasNext = rs.next(); boolean hasNext = rs.next();
@ -127,7 +127,7 @@ public class Util {
if (application != null) { if (application != null) {
applications.add(application); applications.add(application);
} }
application = new ApplicationEntity(); application = new ApplicationDTO();
application.setApplicationReleases(new ArrayList<>()); application.setApplicationReleases(new ArrayList<>());
applicationId = rs.getInt("APP_ID"); applicationId = rs.getInt("APP_ID");
application.setId(applicationId); application.setId(applicationId);
@ -140,7 +140,7 @@ public class Util {
application.setAppRating(rs.getInt("APP_RATING")); application.setAppRating(rs.getInt("APP_RATING"));
application.setDeviceTypeId(rs.getInt("APP_DEVICE_TYPE_ID")); application.setDeviceTypeId(rs.getInt("APP_DEVICE_TYPE_ID"));
} else { } else {
ApplicationReleaseEntity appRelease = new ApplicationReleaseEntity(); ApplicationReleaseDTO appRelease = new ApplicationReleaseDTO();
appRelease.setDescription(rs.getString("RELEASE_DESCRIPTION")); appRelease.setDescription(rs.getString("RELEASE_DESCRIPTION"));
appRelease.setUuid(rs.getString("RELEASE_UUID")); appRelease.setUuid(rs.getString("RELEASE_UUID"));
appRelease.setReleaseType(rs.getString("RELEASE_TYPE")); appRelease.setReleaseType(rs.getString("RELEASE_TYPE"));
@ -173,19 +173,19 @@ public class Util {
* To create application object from the result set retrieved from the Database. * To create application object from the result set retrieved from the Database.
* *
* @param rs ResultSet * @param rs ResultSet
* @return ApplicationEntity that is retrieved from the Database. * @return ApplicationDTO that is retrieved from the Database.
* @throws SQLException SQL Exception * @throws SQLException SQL Exception
* @throws JSONException JSONException. * @throws JSONException JSONException.
*/ */
public static ApplicationEntity loadApplication(ResultSet rs) throws SQLException, JSONException { public static ApplicationDTO loadApplication(ResultSet rs) throws SQLException, JSONException {
ApplicationEntity application = null; ApplicationDTO application = null;
int applicatioId; int applicatioId;
int iteration = 0; int iteration = 0;
if (rs != null) { if (rs != null) {
while (rs.next()) { while (rs.next()) {
if (iteration == 0) { if (iteration == 0) {
application = new ApplicationEntity(); application = new ApplicationDTO();
application.setTags(new ArrayList<>()); application.setTags(new ArrayList<>());
application.setUnrestrictedRoles(new ArrayList<>()); application.setUnrestrictedRoles(new ArrayList<>());
applicatioId = rs.getInt("APP_ID"); applicatioId = rs.getInt("APP_ID");
@ -215,14 +215,14 @@ public class Util {
} }
/** /**
* Populates {@link ApplicationReleaseEntity} object with the result obtained from the database. * Populates {@link ApplicationReleaseDTO} object with the result obtained from the database.
* *
* @param resultSet {@link ResultSet} from obtained from the database * @param resultSet {@link ResultSet} from obtained from the database
* @return {@link ApplicationReleaseEntity} object populated with the data * @return {@link ApplicationReleaseDTO} object populated with the data
* @throws SQLException If unable to populate {@link ApplicationReleaseEntity} object with the data * @throws SQLException If unable to populate {@link ApplicationReleaseDTO} object with the data
*/ */
public static ApplicationReleaseEntity loadApplicationRelease(ResultSet resultSet) throws SQLException { public static ApplicationReleaseDTO loadApplicationRelease(ResultSet resultSet) throws SQLException {
ApplicationReleaseEntity applicationRelease = new ApplicationReleaseEntity(); ApplicationReleaseDTO applicationRelease = new ApplicationReleaseDTO();
applicationRelease.setId(resultSet.getInt("RELEASE_ID")); applicationRelease.setId(resultSet.getInt("RELEASE_ID"));
applicationRelease.setVersion(resultSet.getString("RELEASE_VERSION")); applicationRelease.setVersion(resultSet.getString("RELEASE_VERSION"));
applicationRelease.setUuid(resultSet.getString("UUID")); applicationRelease.setUuid(resultSet.getString("UUID"));
@ -274,7 +274,7 @@ public class Util {
commentManagementConfig.getPaginationConfiguration().getCommentListPageSize()); commentManagementConfig.getPaginationConfiguration().getCommentListPageSize());
} else { } else {
throw new ReviewManagementException( throw new ReviewManagementException(
"ApplicationEntity Management configuration has not initialized. Please check the application-mgt.xml file."); "ApplicationDTO Management configuration has not initialized. Please check the application-mgt.xml file.");
} }
} }
return paginationRequest; return paginationRequest;
@ -292,7 +292,7 @@ public class Util {
applicationManager = applicationManager =
(ApplicationManager) ctx.getOSGiService(ApplicationManager.class, null); (ApplicationManager) ctx.getOSGiService(ApplicationManager.class, null);
if (applicationManager == null) { if (applicationManager == null) {
String msg = "ApplicationEntity Manager service has not initialized."; String msg = "ApplicationDTO Manager service has not initialized.";
log.error(msg); log.error(msg);
throw new IllegalStateException(msg); throw new IllegalStateException(msg);
} }
@ -303,7 +303,7 @@ public class Util {
} }
/** /**
* To get the ApplicationEntity Storage Manager from the osgi context. * To get the ApplicationDTO Storage Manager from the osgi context.
* @return ApplicationStoreManager instance in the current osgi context. * @return ApplicationStoreManager instance in the current osgi context.
*/ */
public static ApplicationStorageManager getApplicationStorageManager() { public static ApplicationStorageManager getApplicationStorageManager() {
@ -314,7 +314,7 @@ public class Util {
applicationStorageManager = (ApplicationStorageManager) ctx applicationStorageManager = (ApplicationStorageManager) ctx
.getOSGiService(ApplicationStorageManager.class, null); .getOSGiService(ApplicationStorageManager.class, null);
if (applicationStorageManager == null) { if (applicationStorageManager == null) {
String msg = "ApplicationEntity Storage Manager service has not initialized."; String msg = "ApplicationDTO Storage Manager service has not initialized.";
log.error(msg); log.error(msg);
throw new IllegalStateException(msg); throw new IllegalStateException(msg);
} }

@ -51,7 +51,7 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
@Override @Override
public boolean addReview(Review review, String uuid, int tenantId) throws ReviewManagementDAOException { public boolean addReview(Review review, String uuid, int tenantId) throws ReviewManagementDAOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to add review for application release. ApplicationEntity UUID: " + uuid); log.debug("Request received in DAO Layer to add review for application release. ApplicationDTO UUID: " + uuid);
} }
PreparedStatement statement = null; PreparedStatement statement = null;
ResultSet rs = null; ResultSet rs = null;
@ -93,7 +93,7 @@ public class ReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug( log.debug(
"Request received in DAO Layer to check whether user have already commented or not for the " "Request received in DAO Layer to check whether user have already commented or not for the "
+ "application release. ApplicationEntity UUID: " + uuid + " comment owner: " + username + + "application release. ApplicationDTO UUID: " + uuid + " comment owner: " + username +
" tenant-id " + tenantId); " tenant-id " + tenantId);
} }
Connection conn; Connection conn;

@ -22,20 +22,19 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.json.JSONException; import org.json.JSONException;
import org.wso2.carbon.device.application.mgt.common.AppLifecycleState; import org.wso2.carbon.device.application.mgt.common.AppLifecycleState;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.ApplicationList; import org.wso2.carbon.device.application.mgt.common.ApplicationList;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationReleaseEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO;
import org.wso2.carbon.device.application.mgt.common.entity.CategoryEntity; import org.wso2.carbon.device.application.mgt.common.dto.CategoryDTO;
import org.wso2.carbon.device.application.mgt.common.Filter; import org.wso2.carbon.device.application.mgt.common.Filter;
import org.wso2.carbon.device.application.mgt.common.Pagination; import org.wso2.carbon.device.application.mgt.common.Pagination;
import org.wso2.carbon.device.application.mgt.common.entity.TagEntity; import org.wso2.carbon.device.application.mgt.common.dto.TagDTO;
import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException; import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException;
import org.wso2.carbon.device.application.mgt.core.dao.ApplicationDAO; import org.wso2.carbon.device.application.mgt.core.dao.ApplicationDAO;
import org.wso2.carbon.device.application.mgt.core.dao.common.Util; import org.wso2.carbon.device.application.mgt.core.dao.common.Util;
import org.wso2.carbon.device.application.mgt.core.dao.impl.AbstractDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.AbstractDAOImpl;
import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException; import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException;
import java.sql.Array;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -53,10 +52,10 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
private static final Log log = LogFactory.getLog(GenericApplicationDAOImpl.class); private static final Log log = LogFactory.getLog(GenericApplicationDAOImpl.class);
@Override @Override
public int createApplication(ApplicationEntity application, int tenantId) throws ApplicationManagementDAOException { public int createApplication(ApplicationDTO application, int tenantId) throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to create an application"); log.debug("Request received in DAO Layer to create an application");
log.debug("ApplicationEntity Details : "); log.debug("ApplicationDTO Details : ");
log.debug("App Name : " + application.getName() + " App Type : " + application.getType()); log.debug("App Name : " + application.getName() + " App Type : " + application.getType());
} }
Connection conn; Connection conn;
@ -443,7 +442,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} }
@Override @Override
public ApplicationEntity getApplication(String appName, String appType, int tenantId) throws public ApplicationDTO getApplication(String appName, String appType, int tenantId) throws
ApplicationManagementDAOException { ApplicationManagementDAOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Getting application with the type(" + appType + " and Name " + appName + log.debug("Getting application with the type(" + appType + " and Name " + appName +
@ -488,7 +487,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} }
@Override @Override
public ApplicationEntity getApplicationById(String id, int tenantId) throws public ApplicationDTO getApplicationById(String id, int tenantId) throws
ApplicationManagementDAOException { ApplicationManagementDAOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Getting application with the id:" + id); log.debug("Getting application with the id:" + id);
@ -530,7 +529,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} }
@Override @Override
public ApplicationEntity getApplicationByUUID(String releaseUuid, int tenantId) throws public ApplicationDTO getApplicationByUUID(String releaseUuid, int tenantId) throws
ApplicationManagementDAOException { ApplicationManagementDAOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Getting application with the release UUID: " + releaseUuid + " from the database"); log.debug("Getting application with the release UUID: " + releaseUuid + " from the database");
@ -577,7 +576,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} }
@Override @Override
public ApplicationEntity getApplicationById(int applicationId, int tenantId) throws public ApplicationDTO getApplicationById(int applicationId, int tenantId) throws
ApplicationManagementDAOException { ApplicationManagementDAOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Getting application with the id (" + applicationId + ") from the database"); log.debug("Getting application with the id (" + applicationId + ") from the database");
@ -656,11 +655,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} }
@Override @Override
public ApplicationEntity editApplication(ApplicationEntity application, int tenantId) throws ApplicationManagementDAOException { public ApplicationDTO editApplication(ApplicationDTO application, int tenantId) throws ApplicationManagementDAOException {
int paramIndex = 1; int paramIndex = 1;
Connection conn; Connection conn;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ApplicationEntity existingApplication = this.getApplicationById(application.getId(), tenantId); ApplicationDTO existingApplication = this.getApplicationById(application.getId(), tenantId);
if (existingApplication == null) { if (existingApplication == null) {
throw new ApplicationManagementDAOException("There doesn't have an application for updating"); throw new ApplicationManagementDAOException("There doesn't have an application for updating");
@ -770,7 +769,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} }
@Override @Override
public List<TagEntity> getAllTags(int tenantId) throws ApplicationManagementDAOException { public List<TagDTO> getAllTags(int tenantId) throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to get all tags"); log.debug("Request received in DAO Layer to get all tags");
} }
@ -778,7 +777,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
try { try {
List<TagEntity> tagEntities = new ArrayList<>(); List<TagDTO> tagEntities = new ArrayList<>();
String sql = "SELECT " String sql = "SELECT "
+ "AP_APP_TAG.ID AS ID, " + "AP_APP_TAG.ID AS ID, "
+ "AP_APP_TAG.TAG AS TAG " + "AP_APP_TAG.TAG AS TAG "
@ -790,10 +789,10 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
rs = stmt.executeQuery(); rs = stmt.executeQuery();
while(rs.next()){ while(rs.next()){
TagEntity tagEntity = new TagEntity(); TagDTO tagDTO = new TagDTO();
tagEntity.setId(rs.getInt("ID")); tagDTO.setId(rs.getInt("ID"));
tagEntity.setTagName(rs.getString("TAG")); tagDTO.setTagName(rs.getString("TAG"));
tagEntities.add(tagEntity); tagEntities.add(tagDTO);
} }
return tagEntities; return tagEntities;
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
@ -807,7 +806,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} }
@Override @Override
public List<CategoryEntity> getAllCategories(int tenantId) throws ApplicationManagementDAOException { public List<CategoryDTO> getAllCategories(int tenantId) throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to get all tags"); log.debug("Request received in DAO Layer to get all tags");
} }
@ -815,7 +814,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
try { try {
List<CategoryEntity> categories = new ArrayList<>(); List<CategoryDTO> categories = new ArrayList<>();
String sql = "SELECT " String sql = "SELECT "
+ "AP_APP_CATEGORY.ID AS ID, " + "AP_APP_CATEGORY.ID AS ID, "
+ "AP_APP_CATEGORY.CATEGORY AS CATEGORY " + "AP_APP_CATEGORY.CATEGORY AS CATEGORY "
@ -827,7 +826,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
rs = stmt.executeQuery(); rs = stmt.executeQuery();
while(rs.next()){ while(rs.next()){
CategoryEntity category = new CategoryEntity(); CategoryDTO category = new CategoryDTO();
category.setId(rs.getInt("ID")); category.setId(rs.getInt("ID"));
category.setCategoryName(rs.getString("CATEGORY")); category.setCategoryName(rs.getString("CATEGORY"));
categories.add(category); categories.add(category);
@ -1003,7 +1002,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} }
@Override @Override
public ApplicationEntity getApplicationByRelease(String appReleaseUUID, int tenantId) public ApplicationDTO getApplicationByRelease(String appReleaseUUID, int tenantId)
throws ApplicationManagementDAOException { throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Getting application with the UUID (" + appReleaseUUID + ") from the database"); log.debug("Getting application with the UUID (" + appReleaseUUID + ") from the database");
@ -1034,10 +1033,10 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
log.debug("Successfully retrieved details of the application with the UUID " + appReleaseUUID); log.debug("Successfully retrieved details of the application with the UUID " + appReleaseUUID);
} }
ApplicationEntity application = null; ApplicationDTO application = null;
while (rs.next()) { while (rs.next()) {
ApplicationReleaseEntity appRelease = Util.loadApplicationRelease(rs); ApplicationReleaseDTO appRelease = Util.loadApplicationRelease(rs);
application = new ApplicationEntity(); application = new ApplicationDTO();
application.setId(rs.getInt("APP_ID")); application.setId(rs.getInt("APP_ID"));
application.setName(rs.getString("APP_NAME")); application.setName(rs.getString("APP_NAME"));
@ -1053,7 +1052,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
application.setUnrestrictedRoles(unrestrictedRoleList); application.setUnrestrictedRoles(unrestrictedRoleList);
List<ApplicationReleaseEntity> applicationReleaseList = new ArrayList<>(); List<ApplicationReleaseDTO> applicationReleaseList = new ArrayList<>();
applicationReleaseList.add(appRelease); applicationReleaseList.add(appRelease);
application.setApplicationReleases(applicationReleaseList); application.setApplicationReleases(applicationReleaseList);

@ -21,7 +21,7 @@ package org.wso2.carbon.device.application.mgt.core.dao.impl.application.release
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationReleaseEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO;
import org.wso2.carbon.device.application.mgt.common.ApplicationReleaseArtifactPaths; import org.wso2.carbon.device.application.mgt.common.ApplicationReleaseArtifactPaths;
import org.wso2.carbon.device.application.mgt.common.Rating; import org.wso2.carbon.device.application.mgt.common.Rating;
import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException; import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException;
@ -38,21 +38,21 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* GenericApplicationReleaseDAOImpl holds the implementation of ApplicationReleaseEntity related DAO operations. * GenericApplicationReleaseDAOImpl holds the implementation of ApplicationReleaseDTO related DAO operations.
*/ */
public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements ApplicationReleaseDAO { public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements ApplicationReleaseDAO {
private static final Log log = LogFactory.getLog(GenericApplicationReleaseDAOImpl.class); private static final Log log = LogFactory.getLog(GenericApplicationReleaseDAOImpl.class);
/** /**
* To insert the ApplicationEntity Release Details. * To insert the ApplicationDTO Release Details.
* *
* @param appId Id of the application * @param appId Id of the application
* @param applicationRelease ApplicationEntity Release the properties of which that need to be inserted. * @param applicationRelease ApplicationDTO Release the properties of which that need to be inserted.
* @param tenantId Tenant Id * @param tenantId Tenant Id
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
@Override public ApplicationReleaseEntity createRelease(ApplicationReleaseEntity applicationRelease, int appId, int tenantId) @Override public ApplicationReleaseDTO createRelease(ApplicationReleaseDTO applicationRelease, int appId, int tenantId)
throws ApplicationManagementDAOException { throws ApplicationManagementDAOException {
Connection connection; Connection connection;
PreparedStatement statement = null; PreparedStatement statement = null;
@ -128,9 +128,9 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
* @param versionName version name of the application. * @param versionName version name of the application.
* @param releaseType type of the application release. * @param releaseType type of the application release.
* @param tenantId Tenant Id * @param tenantId Tenant Id
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
@Override public ApplicationReleaseEntity getRelease(String applicationName, String applicationType, String versionName, @Override public ApplicationReleaseDTO getRelease(String applicationName, String applicationType, String versionName,
String releaseType, int tenantId) throws ApplicationManagementDAOException { String releaseType, int tenantId) throws ApplicationManagementDAOException {
//todo no usage //todo no usage
Connection connection; Connection connection;
@ -178,9 +178,9 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
* @param applicationId ID of the application. * @param applicationId ID of the application.
* @param releaseUuid UUID of the application release. * @param releaseUuid UUID of the application release.
* @param tenantId Tenant Id * @param tenantId Tenant Id
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
@Override public ApplicationReleaseEntity getReleaseByIds(int applicationId, String releaseUuid, int tenantId) @Override public ApplicationReleaseDTO getReleaseByIds(int applicationId, String releaseUuid, int tenantId)
throws ApplicationManagementDAOException { throws ApplicationManagementDAOException {
Connection connection; Connection connection;
@ -226,14 +226,14 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
* *
* @param applicationId Id of the application. * @param applicationId Id of the application.
* @param tenantId Tenant Id * @param tenantId Tenant Id
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
@Override public List<ApplicationReleaseEntity> getReleases(int applicationId, int tenantId) @Override public List<ApplicationReleaseDTO> getReleases(int applicationId, int tenantId)
throws ApplicationManagementDAOException { throws ApplicationManagementDAOException {
Connection connection; Connection connection;
PreparedStatement statement = null; PreparedStatement statement = null;
ResultSet resultSet = null; ResultSet resultSet = null;
List<ApplicationReleaseEntity> applicationReleases = new ArrayList<>(); List<ApplicationReleaseDTO> applicationReleases = new ArrayList<>();
String sql = "SELECT AR.ID AS RELEASE_ID, AR.VERSION AS RELEASE_VERSION, AR.UUID, AR.RELEASE_TYPE " String sql = "SELECT AR.ID AS RELEASE_ID, AR.VERSION AS RELEASE_VERSION, AR.UUID, AR.RELEASE_TYPE "
+ "AS RELEASE_TYPE, AR.PACKAGE_NAME AS PACKAGE_NAME, AR.APP_PRICE, AR.STORED_LOCATION, AR.ICON_LOCATION, " + "AS RELEASE_TYPE, AR.PACKAGE_NAME AS PACKAGE_NAME, AR.APP_PRICE, AR.STORED_LOCATION, AR.ICON_LOCATION, "
+ "AR.BANNER_LOCATION, AR.SC_1_LOCATION AS SCREEN_SHOT_1, AR.SC_2_LOCATION AS SCREEN_SHOT_2, " + "AR.BANNER_LOCATION, AR.SC_1_LOCATION AS SCREEN_SHOT_1, AR.SC_2_LOCATION AS SCREEN_SHOT_2, "
@ -249,7 +249,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
while (resultSet.next()) { while (resultSet.next()) {
ApplicationReleaseEntity applicationRelease = Util.loadApplicationRelease(resultSet); ApplicationReleaseDTO applicationRelease = Util.loadApplicationRelease(resultSet);
applicationReleases.add(applicationRelease); applicationReleases.add(applicationRelease);
} }
return applicationReleases; return applicationReleases;
@ -267,12 +267,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
//todo this has to be removed //todo this has to be removed
@Override @Override
public List<ApplicationReleaseEntity> getReleaseByState(int appId, int tenantId, String state) throws public List<ApplicationReleaseDTO> getReleaseByState(int appId, int tenantId, String state) throws
ApplicationManagementDAOException { ApplicationManagementDAOException {
Connection connection; Connection connection;
PreparedStatement statement = null; PreparedStatement statement = null;
ResultSet resultSet = null; ResultSet resultSet = null;
List<ApplicationReleaseEntity> applicationReleases = new ArrayList<>(); List<ApplicationReleaseDTO> applicationReleases = new ArrayList<>();
String sql = "SELECT AR.ID AS RELEASE_ID, AR.VERSION AS RELEASE_VERSION, AR.UUID AS UUID, AR.RELEASE_TYPE AS " String sql = "SELECT AR.ID AS RELEASE_ID, AR.VERSION AS RELEASE_VERSION, AR.UUID AS UUID, AR.RELEASE_TYPE AS "
+ "RELEASE_TYPE, AR.PACKAGE_NAME AS PACKAGE_NAME, AR.APP_PRICE AS APP_PRICE, AR.STORED_LOCATION AS " + "RELEASE_TYPE, AR.PACKAGE_NAME AS PACKAGE_NAME, AR.APP_PRICE AS APP_PRICE, AR.STORED_LOCATION AS "
+ "STORED_LOCATION, AR.BANNER_LOCATION AS BANNER_LOCATION, ICON_LOCATION, AR.SC_1_LOCATION AS " + "STORED_LOCATION, AR.BANNER_LOCATION AS BANNER_LOCATION, ICON_LOCATION, AR.SC_1_LOCATION AS "
@ -292,7 +292,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
while (resultSet.next()) { while (resultSet.next()) {
ApplicationReleaseEntity appRelease = Util.loadApplicationRelease(resultSet); ApplicationReleaseDTO appRelease = Util.loadApplicationRelease(resultSet);
applicationReleases.add(appRelease); applicationReleases.add(appRelease);
} }
return applicationReleases; return applicationReleases;
@ -313,7 +313,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
* *
* @param uuid UUID of the application Release. * @param uuid UUID of the application Release.
* @param rating given stars for the application release. * @param rating given stars for the application release.
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
@Override public void updateRatingValue(String uuid, double rating, int ratedUsers) @Override public void updateRatingValue(String uuid, double rating, int ratedUsers)
throws ApplicationManagementDAOException { throws ApplicationManagementDAOException {
@ -342,7 +342,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
* To retrieve rating of an application release. * To retrieve rating of an application release.
* *
* @param uuid UUID of the application Release. * @param uuid UUID of the application Release.
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
@Override public Rating getRating(String uuid, int tenantId) throws ApplicationManagementDAOException { @Override public Rating getRating(String uuid, int tenantId) throws ApplicationManagementDAOException {
Connection connection; Connection connection;
@ -377,11 +377,11 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
/** /**
* To insert the application release properties. * To insert the application release properties.
* *
* @param applicationRelease ApplicationEntity Release the properties of which that need to be inserted. * @param applicationRelease ApplicationDTO Release the properties of which that need to be inserted.
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
@Override @Override
public ApplicationReleaseEntity updateRelease(int applicationId, ApplicationReleaseEntity applicationRelease, int tenantId) public ApplicationReleaseDTO updateRelease(int applicationId, ApplicationReleaseDTO applicationRelease, int tenantId)
throws ApplicationManagementDAOException { throws ApplicationManagementDAOException {
Connection connection; Connection connection;
PreparedStatement statement = null; PreparedStatement statement = null;
@ -430,7 +430,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
* *
* @param id Id of the application Release. * @param id Id of the application Release.
* @param version version name of the application release. * @param version version name of the application release.
* @throws ApplicationManagementDAOException ApplicationEntity Management DAO Exception. * @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/ */
@Override public void deleteRelease(int id, String version) throws ApplicationManagementDAOException { @Override public void deleteRelease(int id, String version) throws ApplicationManagementDAOException {
Connection connection; Connection connection;
@ -477,7 +477,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Successfully retrieved basic details of the application release with the application ID " log.debug("Successfully retrieved basic details of the application release with the application ID "
+ appId + " ApplicationEntity release hash value: " + hashVal); + appId + " ApplicationDTO release hash value: " + hashVal);
} }
return rs.next(); return rs.next();
} catch (SQLException e) { } catch (SQLException e) {
@ -551,7 +551,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Successfully retrieved basic details of the application release with the application ID " log.debug("Successfully retrieved basic details of the application release with the application ID "
+ appId + " ApplicationEntity release uuid: " + uuid); + appId + " ApplicationDTO release uuid: " + uuid);
} }
return rs.next(); return rs.next();
} catch (SQLException e) { } catch (SQLException e) {
@ -656,4 +656,31 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
} }
} }
@Override
public boolean isAppExisitForPackageName (String packageName, int tenantId) throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Verifying application release existence for package name:" + packageName);
}
Connection conn;
try {
conn = this.getDBConnection();
String sql = "SELECT AR.ID AS RELEASE_ID "
+ "FROM AP_APP_RELEASE AS AR "
+ "WHERE AR.PACKAGE_NAME = ? AND AR.TENANT_ID = ? LIMIT 1";
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setString(1, packageName);
stmt.setInt(2, tenantId);
try (ResultSet rs = stmt.executeQuery()) {
return rs.next();
}
}
} catch (SQLException e) {
throw new ApplicationManagementDAOException(
"Error occurred while getting application release details for package name: " + packageName, e);
} catch (DBConnectionException e) {
throw new ApplicationManagementDAOException("Error occurred while obtaining the DB connection.", e);
}
}
} }

@ -19,7 +19,7 @@
package org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate; package org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate;
import org.wso2.carbon.device.application.mgt.common.AppLifecycleState; import org.wso2.carbon.device.application.mgt.common.AppLifecycleState;
import org.wso2.carbon.device.application.mgt.common.entity.LifecycleStateEntity; import org.wso2.carbon.device.application.mgt.common.dto.LifecycleStateDTO;
import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException; import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException;
import org.wso2.carbon.device.application.mgt.core.dao.LifecycleStateDAO; import org.wso2.carbon.device.application.mgt.core.dao.LifecycleStateDAO;
import org.wso2.carbon.device.application.mgt.core.dao.common.Util; import org.wso2.carbon.device.application.mgt.core.dao.common.Util;
@ -41,7 +41,7 @@ import java.util.List;
public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements LifecycleStateDAO { public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements LifecycleStateDAO {
@Override @Override
public LifecycleStateEntity getLatestLifeCycleStateByReleaseID(int applicationReleaseId) throws LifeCycleManagementDAOException { public LifecycleStateDTO getLatestLifeCycleStateByReleaseID(int applicationReleaseId) throws LifeCycleManagementDAOException {
Connection conn = null; Connection conn = null;
PreparedStatement stmt = null; PreparedStatement stmt = null;
@ -65,7 +65,7 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
} }
} }
public LifecycleStateEntity getLatestLifeCycleState(int appId, String uuid) throws LifeCycleManagementDAOException{ public LifecycleStateDTO getLatestLifeCycleState(int appId, String uuid) throws LifeCycleManagementDAOException{
Connection conn = null; Connection conn = null;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
@ -122,8 +122,8 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
} }
@Override @Override
public List<LifecycleStateEntity> getLifecycleStates(int appReleaseId) throws LifeCycleManagementDAOException { public List<LifecycleStateDTO> getLifecycleStates(int appReleaseId) throws LifeCycleManagementDAOException {
List<LifecycleStateEntity> lifecycleStates = new ArrayList<>(); List<LifecycleStateDTO> lifecycleStates = new ArrayList<>();
Connection conn = null; Connection conn = null;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
@ -135,7 +135,7 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
stmt.setInt(1,appReleaseId); stmt.setInt(1,appReleaseId);
rs = stmt.executeQuery(); rs = stmt.executeQuery();
while (rs.next()) { while (rs.next()) {
LifecycleStateEntity lifecycleState = new LifecycleStateEntity(); LifecycleStateDTO lifecycleState = new LifecycleStateDTO();
lifecycleState.setId(rs.getInt("ID")); lifecycleState.setId(rs.getInt("ID"));
lifecycleState.setCurrentState(rs.getString("CURRENT_STATE")); lifecycleState.setCurrentState(rs.getString("CURRENT_STATE"));
lifecycleState.setPreviousState(rs.getString("PREVIOUS_STATE")); lifecycleState.setPreviousState(rs.getString("PREVIOUS_STATE"));
@ -155,7 +155,7 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
} }
@Override @Override
public void addLifecycleState(LifecycleStateEntity state, int appId, String uuid, int tenantId) throws LifeCycleManagementDAOException { public void addLifecycleState(LifecycleStateDTO state, int appId, String uuid, int tenantId) throws LifeCycleManagementDAOException {
Connection conn = null; Connection conn = null;
PreparedStatement stmt = null; PreparedStatement stmt = null;
try { try {
@ -213,11 +213,11 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
} }
} }
private LifecycleStateEntity constructLifecycle(ResultSet rs) throws LifeCycleManagementDAOException { private LifecycleStateDTO constructLifecycle(ResultSet rs) throws LifeCycleManagementDAOException {
LifecycleStateEntity lifecycleState = null; LifecycleStateDTO lifecycleState = null;
try { try {
if (rs !=null && rs.next()) { if (rs !=null && rs.next()) {
lifecycleState = new LifecycleStateEntity(); lifecycleState = new LifecycleStateDTO();
lifecycleState.setId(rs.getInt("ID")); lifecycleState.setId(rs.getInt("ID"));
lifecycleState.setCurrentState(rs.getString("CURRENT_STATE")); lifecycleState.setCurrentState(rs.getString("CURRENT_STATE"));
lifecycleState.setPreviousState(rs.getString("PREVIOUS_STATE")); lifecycleState.setPreviousState(rs.getString("PREVIOUS_STATE"));

@ -21,7 +21,7 @@ package org.wso2.carbon.device.application.mgt.core.exception;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException;
/** /**
* Exception thrown during the ApplicationEntity Management DAO operations. * Exception thrown during the ApplicationDTO Management DAO operations.
*/ */
public class ApplicationManagementDAOException extends ApplicationManagementException { public class ApplicationManagementDAOException extends ApplicationManagementException {

@ -29,9 +29,8 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.commons.validator.routines.UrlValidator; import org.apache.commons.validator.routines.UrlValidator;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationReleaseEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO;
import org.wso2.carbon.device.application.mgt.common.ApplicationType; import org.wso2.carbon.device.application.mgt.common.ApplicationType;
import org.wso2.carbon.device.application.mgt.common.DeviceTypes; import org.wso2.carbon.device.application.mgt.common.DeviceTypes;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationStorageManagementException; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationStorageManagementException;
@ -44,11 +43,9 @@ import org.wso2.carbon.device.application.mgt.core.util.Constants;
import org.wso2.carbon.device.application.mgt.core.util.StorageManagementUtil; import org.wso2.carbon.device.application.mgt.core.util.StorageManagementUtil;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import javax.activation.DataHandler;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import java.io.*; import java.io.*;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -80,7 +77,7 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
} }
@Override @Override
public ApplicationReleaseEntity uploadImageArtifacts(ApplicationReleaseEntity applicationRelease, InputStream iconFileStream, public ApplicationReleaseDTO uploadImageArtifacts(ApplicationReleaseDTO applicationRelease, InputStream iconFileStream,
InputStream bannerFileStream, List<InputStream> screenShotStreams) InputStream bannerFileStream, List<InputStream> screenShotStreams)
throws ResourceManagementException { throws ResourceManagementException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
@ -90,6 +87,7 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
String scStoredLocation = null; String scStoredLocation = null;
try { try {
// todo handle WEB CLIP and save data in different folder (uuid)
artifactDirectoryPath = storagePath + applicationRelease.getAppHashValue(); artifactDirectoryPath = storagePath + applicationRelease.getAppHashValue();
StorageManagementUtil.createArtifactDirectory(artifactDirectoryPath); StorageManagementUtil.createArtifactDirectory(artifactDirectoryPath);
iconStoredLocation = artifactDirectoryPath + File.separator + applicationRelease.getIconName(); iconStoredLocation = artifactDirectoryPath + File.separator + applicationRelease.getIconName();
@ -128,7 +126,7 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
throw new ApplicationStorageManagementException("IO Exception while saving the screens hots for " + throw new ApplicationStorageManagementException("IO Exception while saving the screens hots for " +
"the application " + applicationRelease.getUuid(), e); "the application " + applicationRelease.getUuid(), e);
} catch (ApplicationStorageManagementException e) { } catch (ApplicationStorageManagementException e) {
throw new ApplicationStorageManagementException("ApplicationEntity Management DAO exception while trying to " throw new ApplicationStorageManagementException("ApplicationDTO Management DAO exception while trying to "
+ "update the screen-shot count for the application " + applicationRelease.getUuid() + + "update the screen-shot count for the application " + applicationRelease.getUuid() +
" for the tenant id " + tenantId, e); " for the tenant id " + tenantId, e);
} }
@ -136,7 +134,7 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
@Override @Override
public ApplicationReleaseEntity updateImageArtifacts(ApplicationReleaseEntity applicationRelease, InputStream public ApplicationReleaseDTO updateImageArtifacts(ApplicationReleaseDTO applicationRelease, InputStream
iconFileStream, InputStream bannerFileStream, List<InputStream> screenShotStreams) iconFileStream, InputStream bannerFileStream, List<InputStream> screenShotStreams)
throws ResourceManagementException { throws ResourceManagementException {
@ -171,27 +169,22 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
screenShotStreams); screenShotStreams);
return applicationRelease; return applicationRelease;
} catch (ApplicationStorageManagementException e) { } catch (ApplicationStorageManagementException e) {
throw new ApplicationStorageManagementException("ApplicationEntity Storage exception while trying to" throw new ApplicationStorageManagementException("ApplicationDTO Storage exception while trying to"
+ " update the screen-shot count for the application Release " + applicationRelease.getUuid() + + " update the screen-shot count for the application Release " + applicationRelease.getUuid() +
" for the tenant " + tenantId, e); " for the tenant " + tenantId, e);
} }
} }
@Override @Override
public ApplicationReleaseEntity uploadReleaseArtifact(ApplicationReleaseEntity applicationRelease, String appType, public ApplicationReleaseDTO uploadReleaseArtifact(ApplicationReleaseDTO applicationReleaseDTO, String appType,
String deviceType, InputStream binaryFile) throws ResourceManagementException, RequestValidatingException { String deviceType, InputStream binaryFile) throws ResourceManagementException {
try { try {
// move version and package getting code into separate method and check whether package exist in db
if (ApplicationType.WEB_CLIP.toString().equals(appType)) { if (ApplicationType.WEB_CLIP.toString().equals(appType)) {
applicationRelease.setVersion(Constants.DEFAULT_VERSION); applicationReleaseDTO.setVersion(Constants.DEFAULT_VERSION);
UrlValidator urlValidator = new UrlValidator(); applicationReleaseDTO.setInstallerName(applicationReleaseDTO.getUrl());
if (applicationRelease.getUrl() == null || !urlValidator.isValid(applicationRelease.getUrl())) { applicationReleaseDTO.setAppHashValue(null);
String msg = "Request payload doesn't contains Web Clip URL with application release object or Web Clip URL is invalid"; return applicationReleaseDTO;
log.error(msg);
throw new RequestValidatingException(msg);
}
applicationRelease.setInstallerName(applicationRelease.getUrl());
applicationRelease.setAppHashValue(null);
return applicationRelease;
} }
String artifactDirectoryPath; String artifactDirectoryPath;
String md5OfApp; String md5OfApp;
@ -200,9 +193,8 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
md5OfApp = getMD5(new ByteArrayInputStream(content)); md5OfApp = getMD5(new ByteArrayInputStream(content));
if (md5OfApp == null) { if (md5OfApp == null) {
String msg = String msg = "Error occurred while md5sum value retrieving process: application UUID "
"Error occurred while md5sum value retrieving process: application UUID " + applicationRelease + applicationReleaseDTO.getUuid();
.getUuid();
log.error(msg); log.error(msg);
throw new ApplicationStorageManagementException(msg); throw new ApplicationStorageManagementException(msg);
} }
@ -210,16 +202,16 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
artifactDirectoryPath = storagePath + md5OfApp; artifactDirectoryPath = storagePath + md5OfApp;
if (DeviceTypes.ANDROID.toString().equalsIgnoreCase(deviceType)) { if (DeviceTypes.ANDROID.toString().equalsIgnoreCase(deviceType)) {
ApkMeta apkMeta = ArtifactsParser.readAndroidManifestFile(new ByteArrayInputStream(content)); ApkMeta apkMeta = ArtifactsParser.readAndroidManifestFile(new ByteArrayInputStream(content));
applicationRelease.setVersion(apkMeta.getVersionName()); applicationReleaseDTO.setVersion(apkMeta.getVersionName());
applicationRelease.setPackageName(apkMeta.getPackageName()); applicationReleaseDTO.setPackageName(apkMeta.getPackageName());
} else if (DeviceTypes.IOS.toString().equalsIgnoreCase(deviceType)) { } else if (DeviceTypes.IOS.toString().equalsIgnoreCase(deviceType)) {
NSDictionary plistInfo = ArtifactsParser.readiOSManifestFile(binaryFile); NSDictionary plistInfo = ArtifactsParser.readiOSManifestFile(binaryFile);
applicationRelease applicationReleaseDTO
.setVersion(plistInfo.objectForKey(ArtifactsParser.IPA_BUNDLE_VERSION_KEY).toString()); .setVersion(plistInfo.objectForKey(ArtifactsParser.IPA_BUNDLE_VERSION_KEY).toString());
applicationRelease applicationReleaseDTO
.setPackageName(plistInfo.objectForKey(ArtifactsParser.IPA_BUNDLE_IDENTIFIER_KEY).toString()); .setPackageName(plistInfo.objectForKey(ArtifactsParser.IPA_BUNDLE_IDENTIFIER_KEY).toString());
} else { } else {
String msg = "ApplicationEntity Type doesn't match with supporting application types " + applicationRelease String msg = "Application Type doesn't match with supporting application types " + applicationReleaseDTO
.getUuid(); .getUuid();
log.error(msg); log.error(msg);
throw new ApplicationStorageManagementException(msg); throw new ApplicationStorageManagementException(msg);
@ -227,30 +219,29 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Artifact Directory Path for saving the application release related artifacts related with " log.debug("Artifact Directory Path for saving the application release related artifacts related with "
+ "application UUID " + applicationRelease.getUuid() + " is " + artifactDirectoryPath); + "application UUID " + applicationReleaseDTO.getUuid() + " is " + artifactDirectoryPath);
} }
StorageManagementUtil.createArtifactDirectory(artifactDirectoryPath); StorageManagementUtil.createArtifactDirectory(artifactDirectoryPath);
artifactPath = artifactDirectoryPath + File.separator + applicationRelease.getInstallerName(); artifactPath = artifactDirectoryPath + File.separator + applicationReleaseDTO.getInstallerName();
saveFile(new ByteArrayInputStream(content), artifactPath); saveFile(new ByteArrayInputStream(content), artifactPath);
applicationRelease.setAppHashValue(md5OfApp); applicationReleaseDTO.setAppHashValue(md5OfApp);
} catch (IOException e) { } catch (IOException e) {
String msg = "IO Exception while saving the release artifacts in the server for the application UUID " String msg = "IO Exception while saving the release artifacts in the server for the application UUID "
+ applicationRelease.getUuid(); + applicationReleaseDTO.getUuid();
log.error(msg); log.error(msg);
throw new ApplicationStorageManagementException( msg, e); throw new ApplicationStorageManagementException( msg, e);
} catch (ParsingException e) { } catch (ParsingException e) {
String msg = String msg = "Error occurred while parsing the artifact file. Application release UUID is "
"Error occurred while parsing the artifact file. ApplicationEntity release UUID is " + applicationRelease + applicationReleaseDTO.getUuid();
.getUuid();
log.error(msg); log.error(msg);
throw new ApplicationStorageManagementException(msg, e); throw new ApplicationStorageManagementException(msg, e);
} }
return applicationRelease; return applicationReleaseDTO;
} }
@Override @Override
public ApplicationReleaseEntity updateReleaseArtifacts(ApplicationReleaseEntity applicationRelease, String appType, public ApplicationReleaseDTO updateReleaseArtifacts(ApplicationReleaseDTO applicationRelease, String appType,
String deviceType, InputStream binaryFile) throws ApplicationStorageManagementException, String deviceType, InputStream binaryFile) throws ApplicationStorageManagementException,
RequestValidatingException { RequestValidatingException {
@ -258,9 +249,9 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
deleteApplicationReleaseArtifacts(applicationRelease.getInstallerName()); deleteApplicationReleaseArtifacts(applicationRelease.getInstallerName());
applicationRelease = uploadReleaseArtifact(applicationRelease, appType, deviceType, binaryFile); applicationRelease = uploadReleaseArtifact(applicationRelease, appType, deviceType, binaryFile);
} catch (ApplicationStorageManagementException e) { } catch (ApplicationStorageManagementException e) {
throw new ApplicationStorageManagementException("ApplicationEntity Artifact doesn't contains in the System", e); throw new ApplicationStorageManagementException("ApplicationDTO Artifact doesn't contains in the System", e);
} catch (ResourceManagementException e) { } catch (ResourceManagementException e) {
throw new ApplicationStorageManagementException("ApplicationEntity Artifact Updating failed", e); throw new ApplicationStorageManagementException("ApplicationDTO Artifact Updating failed", e);
} }
return applicationRelease; return applicationRelease;
} }

@ -21,7 +21,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.application.mgt.common.AppOperation; import org.wso2.carbon.device.application.mgt.common.AppOperation;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.ApplicationInstallResponse; import org.wso2.carbon.device.application.mgt.common.ApplicationInstallResponse;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException;
import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager;
@ -70,7 +70,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
log.debug("Install application: " + applicationUUID + " to " + deviceList.size() + "devices."); log.debug("Install application: " + applicationUUID + " to " + deviceList.size() + "devices.");
} }
ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager(); ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager();
ApplicationEntity application = applicationManager.getApplicationByRelease(applicationUUID); ApplicationDTO application = applicationManager.getApplicationByRelease(applicationUUID);
return installApplication(application, deviceList); return installApplication(application, deviceList);
} }
@ -82,7 +82,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
log.debug("Install application: " + applicationUUID + " to " + userList.size() + " users."); log.debug("Install application: " + applicationUUID + " to " + userList.size() + " users.");
} }
ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager(); ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager();
ApplicationEntity application = applicationManager.getApplicationByRelease(applicationUUID); ApplicationDTO application = applicationManager.getApplicationByRelease(applicationUUID);
List<DeviceIdentifier> deviceList = new ArrayList<>(); List<DeviceIdentifier> deviceList = new ArrayList<>();
for (String user : userList) { for (String user : userList) {
try { try {
@ -123,7 +123,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
log.debug("Install application: " + applicationUUID + " to " + roleList.size() + " roles."); log.debug("Install application: " + applicationUUID + " to " + roleList.size() + " roles.");
} }
ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager(); ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager();
ApplicationEntity application = applicationManager.getApplicationByRelease(applicationUUID); ApplicationDTO application = applicationManager.getApplicationByRelease(applicationUUID);
List<DeviceIdentifier> deviceList = new ArrayList<>(); List<DeviceIdentifier> deviceList = new ArrayList<>();
for (String role : roleList) { for (String role : roleList) {
try { try {
@ -164,7 +164,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
log.debug("Install application: " + applicationUUID + " to " + deviceGroupList.size() + " groups."); log.debug("Install application: " + applicationUUID + " to " + deviceGroupList.size() + " groups.");
} }
ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager(); ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager();
ApplicationEntity application = applicationManager.getApplicationByRelease(applicationUUID); ApplicationDTO application = applicationManager.getApplicationByRelease(applicationUUID);
GroupManagementProviderService groupManagementProviderService = HelperUtil.getGroupManagementProviderService(); GroupManagementProviderService groupManagementProviderService = HelperUtil.getGroupManagementProviderService();
List<DeviceGroup> groupList = new ArrayList<>(); List<DeviceGroup> groupList = new ArrayList<>();
List<DeviceIdentifier> deviceList = new ArrayList<>(); List<DeviceIdentifier> deviceList = new ArrayList<>();
@ -207,7 +207,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
return null; return null;
} }
private ApplicationInstallResponse installApplication(ApplicationEntity application, private ApplicationInstallResponse installApplication(ApplicationDTO application,
List<DeviceIdentifier> deviceIdentifierList) throws ApplicationManagementException { List<DeviceIdentifier> deviceIdentifierList) throws ApplicationManagementException {
DeviceManagementProviderService deviceManagementProviderService = HelperUtil DeviceManagementProviderService deviceManagementProviderService = HelperUtil
.getDeviceManagementProviderService(); .getDeviceManagementProviderService();
@ -259,7 +259,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
return response; return response;
} }
private Operation generateOperationPayloadByDeviceType(String deviceType, ApplicationEntity application) { private Operation generateOperationPayloadByDeviceType(String deviceType, ApplicationDTO application) {
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
operation.setCode(INSTALL_APPLICATION); operation.setCode(INSTALL_APPLICATION);
operation.setType(Operation.Type.PROFILE); operation.setType(Operation.Type.PROFILE);

@ -120,14 +120,14 @@ public class ApplicationManagementServiceComponent {
protected void setDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) { protected void setDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Setting ApplicationEntity Management OSGI Manager"); log.debug("Setting ApplicationDTO Management OSGI Manager");
} }
DataHolder.getInstance().setDeviceManagementService(deviceManagementProviderService); DataHolder.getInstance().setDeviceManagementService(deviceManagementProviderService);
} }
protected void unsetDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) { protected void unsetDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Removing ApplicationEntity Management OSGI Manager"); log.debug("Removing ApplicationDTO Management OSGI Manager");
} }
DataHolder.getInstance().setDeviceManagementService(null); DataHolder.getInstance().setDeviceManagementService(null);
} }

@ -29,7 +29,7 @@ import javax.ws.rs.core.Response;
/** /**
* Holds util methods required for ApplicationEntity-Mgt API component. * Holds util methods required for ApplicationDTO-Mgt API component.
*/ */
public class APIUtil { public class APIUtil {
@ -49,7 +49,7 @@ public class APIUtil {
applicationManager = applicationManager =
(ApplicationManager) ctx.getOSGiService(ApplicationManager.class, null); (ApplicationManager) ctx.getOSGiService(ApplicationManager.class, null);
if (applicationManager == null) { if (applicationManager == null) {
String msg = "ApplicationEntity Manager service has not initialized."; String msg = "ApplicationDTO Manager service has not initialized.";
log.error(msg); log.error(msg);
throw new IllegalStateException(msg); throw new IllegalStateException(msg);
} }
@ -60,7 +60,7 @@ public class APIUtil {
} }
/** /**
* To get the ApplicationEntity Storage Manager from the osgi context. * To get the ApplicationDTO Storage Manager from the osgi context.
* @return ApplicationStoreManager instance in the current osgi context. * @return ApplicationStoreManager instance in the current osgi context.
*/ */
public static ApplicationStorageManager getApplicationStorageManager() { public static ApplicationStorageManager getApplicationStorageManager() {
@ -71,7 +71,7 @@ public class APIUtil {
applicationStorageManager = (ApplicationStorageManager) ctx applicationStorageManager = (ApplicationStorageManager) ctx
.getOSGiService(ApplicationStorageManager.class, null); .getOSGiService(ApplicationStorageManager.class, null);
if (applicationStorageManager == null) { if (applicationStorageManager == null) {
String msg = "ApplicationEntity Storage Manager service has not initialized."; String msg = "ApplicationDTO Storage Manager service has not initialized.";
log.error(msg); log.error(msg);
throw new IllegalStateException(msg); throw new IllegalStateException(msg);
} }

@ -19,7 +19,7 @@
<ApplicationManagementConfiguration> <ApplicationManagementConfiguration>
<!-- ApplicationEntity Mgt DB schema --> <!-- ApplicationDTO Mgt DB schema -->
<DatasourceName>jdbc/APPM_DS</DatasourceName> <DatasourceName>jdbc/APPM_DS</DatasourceName>
<Extensions> <Extensions>

@ -34,10 +34,8 @@ import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.application.mgt.common.*; import org.wso2.carbon.device.application.mgt.common.*;
import org.wso2.carbon.device.application.mgt.common.ErrorResponse; import org.wso2.carbon.device.application.mgt.common.ErrorResponse;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationReleaseEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO;
import org.wso2.carbon.device.application.mgt.common.response.Application;
import org.wso2.carbon.device.application.mgt.common.wrapper.ApplicationReleaseWrapper;
import org.wso2.carbon.device.application.mgt.common.wrapper.ApplicationWrapper; import org.wso2.carbon.device.application.mgt.common.wrapper.ApplicationWrapper;
import java.util.List; import java.util.List;
@ -60,7 +58,7 @@ import javax.ws.rs.core.Response;
@SwaggerDefinition( @SwaggerDefinition(
info = @Info( info = @Info(
version = "1.0.0", version = "1.0.0",
title = "ApplicationEntity Management Service", title = "ApplicationDTO Management Service",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = "name", value = "ApplicationManagementService"), @ExtensionProperty(name = "name", value = "ApplicationManagementService"),
@ -69,20 +67,20 @@ import javax.ws.rs.core.Response;
} }
), ),
tags = { tags = {
@Tag(name = "application_management, device_management", description = "ApplicationEntity Management related " @Tag(name = "application_management, device_management", description = "ApplicationDTO Management related "
+ "APIs") + "APIs")
} }
) )
@Scopes( @Scopes(
scopes = { scopes = {
@Scope( @Scope(
name = "Get ApplicationEntity Details", name = "Get ApplicationDTO Details",
description = "Get application details", description = "Get application details",
key = "perm:app:publisher:view", key = "perm:app:publisher:view",
permissions = {"/device-mgt/application/view"} permissions = {"/device-mgt/application/view"}
), ),
@Scope( @Scope(
name = "Update an ApplicationEntity", name = "Update an ApplicationDTO",
description = "Update an application", description = "Update an application",
key = "perm:app:publisher:update", key = "perm:app:publisher:update",
permissions = {"/device-mgt/application/update"} permissions = {"/device-mgt/application/update"}
@ -90,7 +88,7 @@ import javax.ws.rs.core.Response;
} }
) )
@Path("/publisher/applications") @Path("/publisher/applications")
@Api(value = "ApplicationEntity Management", description = "This API carries all application management related operations " + @Api(value = "ApplicationDTO Management", description = "This API carries all application management related operations " +
"such as get all the applications, add application, etc.") "such as get all the applications, add application, etc.")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public interface ApplicationManagementAPI { public interface ApplicationManagementAPI {
@ -106,7 +104,7 @@ public interface ApplicationManagementAPI {
httpMethod = "GET", httpMethod = "GET",
value = "get all applications", value = "get all applications",
notes = "This will get all applications", notes = "This will get all applications",
tags = "ApplicationEntity Management", tags = "ApplicationDTO Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:app:publisher:view") @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:view")
@ -143,7 +141,7 @@ public interface ApplicationManagementAPI {
@QueryParam("type") String appType, @QueryParam("type") String appType,
@ApiParam( @ApiParam(
name = "category", name = "category",
value = "CategoryEntity of the application") value = "CategoryDTO of the application")
@QueryParam("category") String appCategory, @QueryParam("category") String appCategory,
@ApiParam( @ApiParam(
name = "exact-match", name = "exact-match",
@ -180,7 +178,7 @@ public interface ApplicationManagementAPI {
httpMethod = "GET", httpMethod = "GET",
value = "get the application of requesting application id and state", value = "get the application of requesting application id and state",
notes = "This will get the application identified by the application id and state, if exists", notes = "This will get the application identified by the application id and state, if exists",
tags = "ApplicationEntity Management", tags = "ApplicationDTO Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:app:publisher:view") @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:view")
@ -192,10 +190,10 @@ public interface ApplicationManagementAPI {
@ApiResponse( @ApiResponse(
code = 200, code = 200,
message = "OK. \n Successfully retrieved relevant application.", message = "OK. \n Successfully retrieved relevant application.",
response = ApplicationEntity.class), response = ApplicationDTO.class),
@ApiResponse( @ApiResponse(
code = 404, code = 404,
message = "ApplicationEntity not found"), message = "ApplicationDTO not found"),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
message = "Internal Server Error. \n Error occurred while getting relevant application.", message = "Internal Server Error. \n Error occurred while getting relevant application.",
@ -224,7 +222,7 @@ public interface ApplicationManagementAPI {
httpMethod = "PUT", httpMethod = "PUT",
value = "Edit an application", value = "Edit an application",
notes = "This will edit the new application", notes = "This will edit the new application",
tags = "ApplicationEntity Management", tags = "ApplicationDTO Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update") @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
@ -236,11 +234,11 @@ public interface ApplicationManagementAPI {
@ApiResponse( @ApiResponse(
code = 200, code = 200,
message = "OK. \n Successfully edited the application.", message = "OK. \n Successfully edited the application.",
response = ApplicationEntity.class), response = ApplicationDTO.class),
@ApiResponse( @ApiResponse(
code = 400, code = 400,
message = "Bad Request. \n " + message = "Bad Request. \n " +
"ApplicationEntity updating payload contains unacceptable or vulnerable data"), "ApplicationDTO updating payload contains unacceptable or vulnerable data"),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
message = "Internal Server Error. \n Error occurred while editing the application.", message = "Internal Server Error. \n Error occurred while editing the application.",
@ -256,7 +254,7 @@ public interface ApplicationManagementAPI {
name = "application", name = "application",
value = "The application that need to be edited.", value = "The application that need to be edited.",
required = true) required = true)
@Valid ApplicationEntity application @Valid ApplicationDTO application
); );
@POST @POST
@ -268,7 +266,7 @@ public interface ApplicationManagementAPI {
httpMethod = "POST", httpMethod = "POST",
value = "Create an application", value = "Create an application",
notes = "This will create a new application", notes = "This will create a new application",
tags = "ApplicationEntity Management", tags = "ApplicationDTO Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update") @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
@ -280,11 +278,11 @@ public interface ApplicationManagementAPI {
@ApiResponse( @ApiResponse(
code = 201, code = 201,
message = "OK. \n Successfully created an application.", message = "OK. \n Successfully created an application.",
response = ApplicationEntity.class), response = ApplicationDTO.class),
@ApiResponse( @ApiResponse(
code = 400, code = 400,
message = "Bad Request. \n " + message = "Bad Request. \n " +
"ApplicationEntity creating payload contains unacceptable or vulnerable data"), "ApplicationDTO creating payload contains unacceptable or vulnerable data"),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
message = "Internal Server Error. \n Error occurred while creating the application.", message = "Internal Server Error. \n Error occurred while creating the application.",
@ -338,7 +336,7 @@ public interface ApplicationManagementAPI {
// httpMethod = "POST", // httpMethod = "POST",
// value = "Create an application", // value = "Create an application",
// notes = "This will create a new application", // notes = "This will create a new application",
// tags = "ApplicationEntity Management", // tags = "ApplicationDTO Management",
// extensions = { // extensions = {
// @Extension(properties = { // @Extension(properties = {
// @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update") // @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
@ -354,7 +352,7 @@ public interface ApplicationManagementAPI {
// @ApiResponse( // @ApiResponse(
// code = 400, // code = 400,
// message = "Bad Request. \n " + // message = "Bad Request. \n " +
// "ApplicationEntity creating payload contains unacceptable or vulnerable data"), // "ApplicationDTO creating payload contains unacceptable or vulnerable data"),
// @ApiResponse( // @ApiResponse(
// code = 500, // code = 500,
// message = "Internal Server Error. \n Error occurred while creating the application.", // message = "Internal Server Error. \n Error occurred while creating the application.",
@ -368,7 +366,7 @@ public interface ApplicationManagementAPI {
// name = "applicationRelease", // name = "applicationRelease",
// value = "The application release that need to be created.", // value = "The application release that need to be created.",
// required = true) // required = true)
// @Multipart("applicationRelease") ApplicationReleaseEntity applicationRelease, // @Multipart("applicationRelease") ApplicationReleaseDTO applicationRelease,
// @ApiParam( // @ApiParam(
// name = "binaryFile", // name = "binaryFile",
// value = "Binary file of uploading application", // value = "Binary file of uploading application",
@ -410,7 +408,7 @@ public interface ApplicationManagementAPI {
httpMethod = "DELETE", httpMethod = "DELETE",
value = "Delete the application with the given UUID", value = "Delete the application with the given UUID",
notes = "This will delete the application with the given UUID", notes = "This will delete the application with the given UUID",
tags = "ApplicationEntity Management", tags = "ApplicationDTO Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update") @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
@ -431,7 +429,7 @@ public interface ApplicationManagementAPI {
Response deleteApplication( Response deleteApplication(
@ApiParam( @ApiParam(
name = "UUID", name = "UUID",
value = "Unique identifier of the ApplicationEntity", value = "Unique identifier of the ApplicationDTO",
required = true) required = true)
@PathParam("appid") int applicationId @PathParam("appid") int applicationId
); );
@ -446,7 +444,7 @@ public interface ApplicationManagementAPI {
httpMethod = "POST", httpMethod = "POST",
value = "Upload artifacts", value = "Upload artifacts",
notes = "This will create a new application", notes = "This will create a new application",
tags = "ApplicationEntity Management", tags = "ApplicationDTO Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update") @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
@ -522,7 +520,7 @@ public interface ApplicationManagementAPI {
httpMethod = "POST", httpMethod = "POST",
value = "Upload artifacts", value = "Upload artifacts",
notes = "This will create a new application", notes = "This will create a new application",
tags = "ApplicationEntity Management", tags = "ApplicationDTO Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update") @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
@ -537,7 +535,7 @@ public interface ApplicationManagementAPI {
@ApiResponse( @ApiResponse(
code = 400, code = 400,
message = "Bad Request. \n " + message = "Bad Request. \n " +
"ApplicationEntity artifact updating payload contains unacceptable or vulnerable data"), "ApplicationDTO artifact updating payload contains unacceptable or vulnerable data"),
@ApiResponse( @ApiResponse(
code = 404, code = 404,
message = "NOT FOUND. \n Couldn't found application/application release to update applocation release artifact."), message = "NOT FOUND. \n Couldn't found application/application release to update applocation release artifact."),
@ -568,7 +566,7 @@ public interface ApplicationManagementAPI {
httpMethod = "PUT", httpMethod = "PUT",
value = "Update an application release", value = "Update an application release",
notes = "This will update a new application release", notes = "This will update a new application release",
tags = "ApplicationEntity Management", tags = "ApplicationDTO Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update") @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
@ -580,11 +578,11 @@ public interface ApplicationManagementAPI {
@ApiResponse( @ApiResponse(
code = 201, code = 201,
message = "OK. \n Successfully created an application release.", message = "OK. \n Successfully created an application release.",
response = ApplicationReleaseEntity.class), response = ApplicationReleaseDTO.class),
@ApiResponse( @ApiResponse(
code = 400, code = 400,
message = "Bad Request. \n " + message = "Bad Request. \n " +
"ApplicationEntity release updating payload contains unacceptable or vulnerable data"), "ApplicationDTO release updating payload contains unacceptable or vulnerable data"),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
message = "Internal Server Error. \n Error occurred while releasing the application.", message = "Internal Server Error. \n Error occurred while releasing the application.",
@ -593,11 +591,11 @@ public interface ApplicationManagementAPI {
Response updateApplicationRelease( Response updateApplicationRelease(
@ApiParam(name = "deviceType", value = "Supported device type of the application", required = true) @ApiParam(name = "deviceType", value = "Supported device type of the application", required = true)
@PathParam("deviceType") String deviceType, @PathParam("deviceType") String deviceType,
@ApiParam(name = "appId", value = "Identifier of the ApplicationEntity", required = true) @ApiParam(name = "appId", value = "Identifier of the ApplicationDTO", required = true)
@PathParam("appId") int applicationId, @PathParam("appId") int applicationId,
@ApiParam(name = "UUID", value = "Unique identifier of the ApplicationEntity Release", required = true) @ApiParam(name = "UUID", value = "Unique identifier of the ApplicationDTO Release", required = true)
@PathParam("uuid") String applicationUUID, @PathParam("uuid") String applicationUUID,
@Multipart(value = "applicationRelease", required = false, type = "application/json") ApplicationReleaseEntity applicationRelease, @Multipart(value = "applicationRelease", required = false, type = "application/json") ApplicationReleaseDTO applicationRelease,
@Multipart(value = "binaryFile", required = false) Attachment binaryFile, @Multipart(value = "binaryFile", required = false) Attachment binaryFile,
@Multipart(value = "icon", required = false) Attachment iconFile, @Multipart(value = "icon", required = false) Attachment iconFile,
@Multipart(value = "banner", required = false) Attachment bannerFile, @Multipart(value = "banner", required = false) Attachment bannerFile,
@ -660,7 +658,7 @@ public interface ApplicationManagementAPI {
@ApiResponse( @ApiResponse(
code = 201, code = 201,
message = "OK. \n Successfully add a lifecycle state.", message = "OK. \n Successfully add a lifecycle state.",
response = ApplicationEntity.class), response = ApplicationDTO.class),
@ApiResponse( @ApiResponse(
code = 400, code = 400,
message = "Bad Request. \n " + message = "Bad Request. \n " +
@ -677,12 +675,12 @@ public interface ApplicationManagementAPI {
Response addLifecycleState( Response addLifecycleState(
@ApiParam( @ApiParam(
name = "appId", name = "appId",
value = "Identifier of the ApplicationEntity", value = "Identifier of the ApplicationDTO",
required = true) required = true)
@PathParam("appId") int applicationId, @PathParam("appId") int applicationId,
@ApiParam( @ApiParam(
name = "uuid", name = "uuid",
value = "UUID of the ApplicationEntity Release", value = "UUID of the ApplicationDTO Release",
required = true) required = true)
@PathParam("uuid") String applicationUuid, @PathParam("uuid") String applicationUuid,
@ApiParam( @ApiParam(

@ -23,9 +23,9 @@ import org.apache.commons.logging.LogFactory;
import org.apache.cxf.jaxrs.ext.multipart.Attachment; import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart; import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import org.wso2.carbon.device.application.mgt.common.*; import org.wso2.carbon.device.application.mgt.common.*;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationReleaseEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO;
import org.wso2.carbon.device.application.mgt.common.entity.LifecycleStateEntity; import org.wso2.carbon.device.application.mgt.common.dto.LifecycleStateDTO;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationStorageManagementException; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationStorageManagementException;
import org.wso2.carbon.device.application.mgt.common.exception.RequestValidatingException; import org.wso2.carbon.device.application.mgt.common.exception.RequestValidatingException;
import org.wso2.carbon.device.application.mgt.common.response.Application; import org.wso2.carbon.device.application.mgt.common.response.Application;
@ -62,7 +62,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
/** /**
* Implementation of ApplicationEntity Management related APIs. * Implementation of Application Management related APIs.
*/ */
@Produces({"application/json"}) @Produces({"application/json"})
@Path("/applications") @Path("/applications")
@ -114,10 +114,10 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
@DefaultValue("PUBLISHED") @QueryParam("state") String state) { @DefaultValue("PUBLISHED") @QueryParam("state") String state) {
ApplicationManager applicationManager = APIUtil.getApplicationManager(); ApplicationManager applicationManager = APIUtil.getApplicationManager();
try { try {
ApplicationEntity application = applicationManager.getApplicationById(appId, state); ApplicationDTO application = applicationManager.getApplicationById(appId, state);
return Response.status(Response.Status.OK).entity(application).build(); return Response.status(Response.Status.OK).entity(application).build();
} catch (NotFoundException e) { } catch (NotFoundException e) {
String msg = "ApplicationEntity with application id: " + appId + " not found"; String msg = "ApplicationDTO with application id: " + appId + " not found";
log.error(msg, e); log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} catch (ApplicationManagementException e) { } catch (ApplicationManagementException e) {
@ -151,17 +151,21 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
} }
try { try {
applicationManager applicationManager.validateAppCreatingRequest(applicationWrapper);
.validateAppCreatingRequest(applicationWrapper, binaryFile, iconFile, bannerFile, attachmentList); applicationManager.validateReleaseCreatingRequest(applicationWrapper.getApplicationReleaseWrappers().get(0),
applicationWrapper.getType());
applicationManager.isValidAttachmentSet(binaryFile, iconFile, bannerFile, attachmentList,
applicationWrapper.getType());
// Created new application entry // Created new application entry
Application createdApplication = applicationManager.createApplication(applicationWrapper, Application application = applicationManager.createApplication(applicationWrapper,
constructApplicationArtifact(binaryFile, iconFile, bannerFile, attachmentList)); constructApplicationArtifact(binaryFile, iconFile, bannerFile, attachmentList));
if (createdApplication != null) { if (application != null) {
return Response.status(Response.Status.CREATED).entity(createdApplication).build(); return Response.status(Response.Status.CREATED).entity(application).build();
} else { } else {
String msg = "ApplicationEntity creation is failed"; String msg = "ApplicationDTO creation is failed";
log.error(msg); log.error(msg);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} }
} catch (ApplicationManagementException e) { } catch (ApplicationManagementException e) {
String msg = "Error occurred while creating the application"; String msg = "Error occurred while creating the application";
@ -181,7 +185,7 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
// @PathParam("deviceType") String deviceType, // @PathParam("deviceType") String deviceType,
// @PathParam("appType") String appType, // @PathParam("appType") String appType,
// @PathParam("appId") int appId, // @PathParam("appId") int appId,
// @Multipart("applicationRelease") ApplicationReleaseEntity applicationRelease, // @Multipart("applicationRelease") ApplicationReleaseDTO applicationRelease,
// @Multipart("binaryFile") Attachment binaryFile, // @Multipart("binaryFile") Attachment binaryFile,
// @Multipart("icon") Attachment iconFile, // @Multipart("icon") Attachment iconFile,
// @Multipart("banner") Attachment bannerFile, // @Multipart("banner") Attachment bannerFile,
@ -233,11 +237,11 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
// applicationRelease.setUuid(UUID.randomUUID().toString()); // applicationRelease.setUuid(UUID.randomUUID().toString());
// //
// // Created new application release entry // // Created new application release entry
// ApplicationReleaseEntity release = applicationManager.createRelease(appId, applicationRelease); // ApplicationReleaseDTO release = applicationManager.createRelease(appId, applicationRelease);
// if (release != null) { // if (release != null) {
// return Response.status(Response.Status.CREATED).entity(release).build(); // return Response.status(Response.Status.CREATED).entity(release).build();
// } else { // } else {
// log.error("ApplicationEntity Creation Failed"); // log.error("ApplicationDTO Creation Failed");
// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); // return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
// } // }
// } catch (ApplicationManagementException e) { // } catch (ApplicationManagementException e) {
@ -337,7 +341,7 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
+ applicationReleaseUuid).build(); + applicationReleaseUuid).build();
} }
if (!ApplicationType.ENTERPRISE.toString().equals(appType)) { if (!ApplicationType.ENTERPRISE.toString().equals(appType)) {
return Response.status(Response.Status.BAD_REQUEST).entity("If ApplicationEntity type is " + appType return Response.status(Response.Status.BAD_REQUEST).entity("If ApplicationDTO type is " + appType
+ ", therefore you don't have application release artifact to update for application release UUID: " + ", therefore you don't have application release artifact to update for application release UUID: "
+ applicationReleaseUuid).build(); + applicationReleaseUuid).build();
} }
@ -370,7 +374,7 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
@Path("/{appId}") @Path("/{appId}")
public Response updateApplication( public Response updateApplication(
@PathParam("appId") int applicationId, @PathParam("appId") int applicationId,
@Valid ApplicationEntity application) { @Valid ApplicationDTO application) {
ApplicationManager applicationManager = APIUtil.getApplicationManager(); ApplicationManager applicationManager = APIUtil.getApplicationManager();
try { try {
application = applicationManager.updateApplication(applicationId, application); application = applicationManager.updateApplication(applicationId, application);
@ -395,7 +399,7 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
@PathParam("deviceType") String deviceType, @PathParam("deviceType") String deviceType,
@PathParam("appId") int applicationId, @PathParam("appId") int applicationId,
@PathParam("uuid") String applicationUUID, @PathParam("uuid") String applicationUUID,
@Multipart("applicationRelease") ApplicationReleaseEntity applicationRelease, @Multipart("applicationRelease") ApplicationReleaseDTO applicationRelease,
@Multipart("binaryFile") Attachment binaryFile, @Multipart("binaryFile") Attachment binaryFile,
@Multipart("icon") Attachment iconFile, @Multipart("icon") Attachment iconFile,
@Multipart("banner") Attachment bannerFile, @Multipart("banner") Attachment bannerFile,
@ -434,12 +438,12 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
.updateRelease(applicationId, applicationUUID, deviceType, applicationRelease, binaryFileStram, .updateRelease(applicationId, applicationUUID, deviceType, applicationRelease, binaryFileStram,
iconFileStream, bannerFileStream, attachments); iconFileStream, bannerFileStream, attachments);
if (!status){ if (!status){
log.error("ApplicationEntity release updating is failed. Please contact the administrator. ApplicationEntity id: " log.error("ApplicationDTO release updating is failed. Please contact the administrator. ApplicationDTO id: "
+ applicationId + ", ApplicationEntity release UUID: " + applicationUUID + ", Supported device type: " + applicationId + ", ApplicationDTO release UUID: " + applicationUUID + ", Supported device type: "
+ deviceType); + deviceType);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(applicationRelease).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(applicationRelease).build();
} }
return Response.status(Response.Status.OK).entity("ApplicationEntity release is successfully updated.").build(); return Response.status(Response.Status.OK).entity("ApplicationDTO release is successfully updated.").build();
} catch(BadRequestException e){ } catch(BadRequestException e){
String msg = "Invalid request to update application release for application release UUID " + applicationUUID; String msg = "Invalid request to update application release for application release UUID " + applicationUUID;
log.error(msg, e); log.error(msg, e);
@ -536,7 +540,7 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
public Response getLifecycleState( public Response getLifecycleState(
@PathParam("appId") int applicationId, @PathParam("appId") int applicationId,
@PathParam("uuid") String applicationUuid) { @PathParam("uuid") String applicationUuid) {
LifecycleStateEntity lifecycleState; LifecycleStateDTO lifecycleState;
ApplicationManager applicationManager = APIUtil.getApplicationManager(); ApplicationManager applicationManager = APIUtil.getApplicationManager();
try { try {
lifecycleState = applicationManager.getLifecycleState(applicationId, applicationUuid); lifecycleState = applicationManager.getLifecycleState(applicationId, applicationUuid);
@ -567,7 +571,7 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
log.error(msg); log.error(msg);
return Response.status(Response.Status.BAD_REQUEST).build(); return Response.status(Response.Status.BAD_REQUEST).build();
} }
LifecycleStateEntity state = new LifecycleStateEntity(); LifecycleStateDTO state = new LifecycleStateDTO();
state.setCurrentState(action); state.setCurrentState(action);
applicationManager.changeLifecycleState(applicationId, applicationUuid, state); applicationManager.changeLifecycleState(applicationId, applicationUuid, state);
} catch (NotFoundException e) { } catch (NotFoundException e) {

@ -30,7 +30,7 @@
<PermissionConfiguration> <PermissionConfiguration>
<APIVersion></APIVersion> <APIVersion></APIVersion>
<!-- ApplicationEntity related permissions --> <!-- ApplicationDTO related permissions -->
<Permission> <Permission>
<name>Get Application Details</name> <name>Get Application Details</name>
<path>/device-mgt/application/get</path> <path>/device-mgt/application/get</path>

@ -1841,7 +1841,7 @@ c29.2568 87.7715 113.371 149.942 212.114 149.942z" />
d="M512 411.429v-413.257h-512v413.257h512zM138.972 257.828h175.543v87.7715h-175.543v-87.7715zM318.172 213.942h-175.543v-65.8281h175.543v65.8281zM142.629 42.0576h175.543v65.8281h-175.543v-65.8281zM43.8857 345.6v-87.7715h54.8574v87.7715h-54.8574z d="M512 411.429v-413.257h-512v413.257h512zM138.972 257.828h175.543v87.7715h-175.543v-87.7715zM318.172 213.942h-175.543v-65.8281h175.543v65.8281zM142.629 42.0576h175.543v65.8281h-175.543v-65.8281zM43.8857 345.6v-87.7715h54.8574v87.7715h-54.8574z
M362.058 257.828h106.057v87.7715h-106.057v-87.7715zM95.0859 148.114v65.8281h-54.8574v-65.8281h54.8574zM362.058 148.114h106.057v65.8281h-106.057v-65.8281zM43.8857 104.229v-65.8281h54.8574v65.8281h-54.8574zM468.114 104.229h-106.057v-65.8281h106.057v65.8281 M362.058 257.828h106.057v87.7715h-106.057v-87.7715zM95.0859 148.114v65.8281h-54.8574v-65.8281h54.8574zM362.058 148.114h106.057v65.8281h-106.057v-65.8281zM43.8857 104.229v-65.8281h54.8574v65.8281h-54.8574zM468.114 104.229h-106.057v-65.8281h106.057v65.8281
z" /> z" />
<glyph glyph-name="tagEntity" unicode="&#xe67a;" <glyph glyph-name="tagDTO" unicode="&#xe67a;"
d="M336.724 352.915l175.542 -179.201l-171.886 -182.856l-193.828 182.856l-32.916 128l32.916 36.5723c-7.31543 3.65625 -10.9717 3.65625 -14.6299 3.65625c-10.9707 -3.65625 -25.5986 -10.9717 -32.9131 -18.2861 d="M336.724 352.915l175.542 -179.201l-171.886 -182.856l-193.828 182.856l-32.916 128l32.916 36.5723c-7.31543 3.65625 -10.9717 3.65625 -14.6299 3.65625c-10.9707 -3.65625 -25.5986 -10.9717 -32.9131 -18.2861
c-10.9707 -14.627 -10.9707 -29.2568 -10.9707 -47.542c0 -18.2861 3.65625 -36.5723 7.3125 -54.8574c0 0 21.9443 -80.458 -40.2275 -87.7705c-62.1719 0 -54.8574 87.7705 -54.8574 87.7705v25.6006v7.31445c0 14.627 3.65625 29.2568 10.9707 43.8857 c-10.9707 -14.627 -10.9707 -29.2568 -10.9707 -47.542c0 -18.2861 3.65625 -36.5723 7.3125 -54.8574c0 0 21.9443 -80.458 -40.2275 -87.7705c-62.1719 0 -54.8574 87.7705 -54.8574 87.7705v25.6006v7.31445c0 14.627 3.65625 29.2568 10.9707 43.8857
c21.9443 62.1699 91.4287 84.1143 128 73.1436c10.9717 0 21.9443 -3.65918 29.2568 -7.31543l25.6006 25.6006zM62.4375 250.514c-3.29199 27.4287 5.85059 73.5088 9.87305 79.7275c-32.1807 -25.6006 -42.7881 -61.4424 -46.4443 -72.4131 c21.9443 62.1699 91.4287 84.1143 128 73.1436c10.9717 0 21.9443 -3.65918 29.2568 -7.31543l25.6006 25.6006zM62.4375 250.514c-3.29199 27.4287 5.85059 73.5088 9.87305 79.7275c-32.1807 -25.6006 -42.7881 -61.4424 -46.4443 -72.4131

Before

Width:  |  Height:  |  Size: 443 KiB

After

Width:  |  Height:  |  Size: 443 KiB

@ -31,7 +31,7 @@ import io.swagger.annotations.Tag;
import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.application.mgt.common.ErrorResponse; import org.wso2.carbon.device.application.mgt.common.ErrorResponse;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.ApplicationList; import org.wso2.carbon.device.application.mgt.common.ApplicationList;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
@ -49,7 +49,7 @@ import javax.ws.rs.core.Response;
@SwaggerDefinition( @SwaggerDefinition(
info = @Info( info = @Info(
version = "1.0.0", version = "1.0.0",
title = "ApplicationEntity Storage Management Service", title = "ApplicationDTO Storage Management Service",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = "name", value = "ApplicationStorageManagementService"), @ExtensionProperty(name = "name", value = "ApplicationStorageManagementService"),
@ -58,14 +58,14 @@ import javax.ws.rs.core.Response;
} }
), ),
tags = { tags = {
@Tag(name = "application_management, device_management", description = "ApplicationEntity Storage Management " @Tag(name = "application_management, device_management", description = "ApplicationDTO Storage Management "
+ "related APIs") + "related APIs")
} }
) )
@Scopes( @Scopes(
scopes = { scopes = {
@Scope( @Scope(
name = "Get ApplicationEntity Details", name = "Get ApplicationDTO Details",
description = "Get application details", description = "Get application details",
key = "perm:app:store:view", key = "perm:app:store:view",
permissions = {"/device-mgt/application/get"} permissions = {"/device-mgt/application/get"}
@ -73,7 +73,7 @@ import javax.ws.rs.core.Response;
} }
) )
@Path("/store/applications") @Path("/store/applications")
@Api(value = "ApplicationEntity Management", description = "This API carries all app store management related operations " + @Api(value = "ApplicationDTO Management", description = "This API carries all app store management related operations " +
"such as get all the applications etc.") "such as get all the applications etc.")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public interface ApplicationManagementAPI { public interface ApplicationManagementAPI {
@ -89,7 +89,7 @@ public interface ApplicationManagementAPI {
httpMethod = "GET", httpMethod = "GET",
value = "get all applications", value = "get all applications",
notes = "This will get all applications", notes = "This will get all applications",
tags = "ApplicationEntity Management", tags = "ApplicationDTO Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:application:get") @ExtensionProperty(name = SCOPE, value = "perm:application:get")
@ -121,7 +121,7 @@ public interface ApplicationManagementAPI {
@QueryParam("type") String appType, @QueryParam("type") String appType,
@ApiParam( @ApiParam(
name = "category", name = "category",
value = "CategoryEntity of the application") value = "CategoryDTO of the application")
@QueryParam("category") String appCategory, @QueryParam("category") String appCategory,
@ApiParam( @ApiParam(
name = "exact-match", name = "exact-match",
@ -152,7 +152,7 @@ public interface ApplicationManagementAPI {
httpMethod = "GET", httpMethod = "GET",
value = "get the application of requesting application type", value = "get the application of requesting application type",
notes = "This will get the application identified by the application type and name, if exists", notes = "This will get the application identified by the application type and name, if exists",
tags = "ApplicationEntity Management", tags = "ApplicationDTO Management",
extensions = { extensions = {
@Extension(properties = { @Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:application:get") @ExtensionProperty(name = SCOPE, value = "perm:application:get")
@ -164,10 +164,10 @@ public interface ApplicationManagementAPI {
@ApiResponse( @ApiResponse(
code = 200, code = 200,
message = "OK. \n Successfully retrieved relevant application.", message = "OK. \n Successfully retrieved relevant application.",
response = ApplicationEntity.class), response = ApplicationDTO.class),
@ApiResponse( @ApiResponse(
code = 404, code = 404,
message = "ApplicationEntity not found"), message = "ApplicationDTO not found"),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
message = "Internal Server Error. \n Error occurred while getting relevant application.", message = "Internal Server Error. \n Error occurred while getting relevant application.",

@ -28,7 +28,7 @@ import io.swagger.annotations.Info;
import io.swagger.annotations.SwaggerDefinition; import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Tag; import io.swagger.annotations.Tag;
import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.ApplicationInstallResponse; import org.wso2.carbon.device.application.mgt.common.ApplicationInstallResponse;
import org.wso2.carbon.device.application.mgt.common.EnterpriseInstallationDetails; import org.wso2.carbon.device.application.mgt.common.EnterpriseInstallationDetails;
import org.wso2.carbon.device.application.mgt.common.InstallationDetails; import org.wso2.carbon.device.application.mgt.common.InstallationDetails;
@ -65,13 +65,13 @@ import javax.ws.rs.core.Response;
@Scopes( @Scopes(
scopes = { scopes = {
@org.wso2.carbon.apimgt.annotations.api.Scope( @org.wso2.carbon.apimgt.annotations.api.Scope(
name = "Install an ApplicationEntity", name = "Install an ApplicationDTO",
description = "Install an application", description = "Install an application",
key = "perm:subscription:install", key = "perm:subscription:install",
permissions = {"/device-mgt/subscription/install"} permissions = {"/device-mgt/subscription/install"}
), ),
@org.wso2.carbon.apimgt.annotations.api.Scope( @org.wso2.carbon.apimgt.annotations.api.Scope(
name = "Install an ApplicationEntity", name = "Install an ApplicationDTO",
description = "Install an application", description = "Install an application",
key = "perm:application-mgt:login", key = "perm:application-mgt:login",
permissions = {"/device-mgt/application-mgt/login"} permissions = {"/device-mgt/application-mgt/login"}
@ -117,7 +117,7 @@ public interface SubscriptionManagementAPI {
), ),
@ApiResponse( @ApiResponse(
code = 404, code = 404,
message = "Not Found. \n ApplicationEntity cannot be found to install." message = "Not Found. \n ApplicationDTO cannot be found to install."
), ),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
@ -162,7 +162,7 @@ public interface SubscriptionManagementAPI {
), ),
@ApiResponse( @ApiResponse(
code = 404, code = 404,
message = "Not Found. \n ApplicationEntity cannot be found to install." message = "Not Found. \n ApplicationDTO cannot be found to install."
), ),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
@ -198,7 +198,7 @@ public interface SubscriptionManagementAPI {
@ApiResponse( @ApiResponse(
code = 200, code = 200,
message = "OK. \n Successfully uninstalled the application.", message = "OK. \n Successfully uninstalled the application.",
response = ApplicationEntity.class response = ApplicationDTO.class
), ),
@ApiResponse( @ApiResponse(
code = 304, code = 304,
@ -206,7 +206,7 @@ public interface SubscriptionManagementAPI {
), ),
@ApiResponse( @ApiResponse(
code = 404, code = 404,
message = "Not Found. \n ApplicationEntity cannot be found to uninstall." message = "Not Found. \n ApplicationDTO cannot be found to uninstall."
), ),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
@ -242,7 +242,7 @@ public interface SubscriptionManagementAPI {
@ApiResponse( @ApiResponse(
code = 200, code = 200,
message = "OK. \n Successfully uninstalled the application.", message = "OK. \n Successfully uninstalled the application.",
response = ApplicationEntity.class response = ApplicationDTO.class
), ),
@ApiResponse( @ApiResponse(
code = 304, code = 304,
@ -250,7 +250,7 @@ public interface SubscriptionManagementAPI {
), ),
@ApiResponse( @ApiResponse(
code = 404, code = 404,
message = "Not Found. \n ApplicationEntity cannot be found to uninstall." message = "Not Found. \n ApplicationDTO cannot be found to uninstall."
), ),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
@ -287,7 +287,7 @@ public interface SubscriptionManagementAPI {
@ApiResponse( @ApiResponse(
code = 200, code = 200,
message = "OK. \n Successfully installed the application.", message = "OK. \n Successfully installed the application.",
response = ApplicationEntity.class response = ApplicationDTO.class
), ),
@ApiResponse( @ApiResponse(
code = 304, code = 304,
@ -302,7 +302,7 @@ public interface SubscriptionManagementAPI {
Response getApplication( Response getApplication(
@ApiParam( @ApiParam(
name = "applicationUUID", name = "applicationUUID",
value = "ApplicationEntity ID" value = "ApplicationDTO ID"
) )
@QueryParam("applicationUUID") String applicationUUID, @QueryParam("applicationUUID") String applicationUUID,
@ApiParam( @ApiParam(

@ -21,7 +21,7 @@ package org.wso2.carbon.device.application.mgt.store.api.services.impl;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.application.mgt.common.AppLifecycleState; import org.wso2.carbon.device.application.mgt.common.AppLifecycleState;
import org.wso2.carbon.device.application.mgt.common.entity.ApplicationEntity; import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.ApplicationList; import org.wso2.carbon.device.application.mgt.common.ApplicationList;
import org.wso2.carbon.device.application.mgt.common.Filter; import org.wso2.carbon.device.application.mgt.common.Filter;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException;
@ -97,7 +97,7 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
@PathParam("uuid") String uuid) { @PathParam("uuid") String uuid) {
ApplicationManager applicationManager = APIUtil.getApplicationManager(); ApplicationManager applicationManager = APIUtil.getApplicationManager();
try { try {
ApplicationEntity application = applicationManager ApplicationDTO application = applicationManager
.getApplicationByUuid(uuid, AppLifecycleState.PUBLISHED.toString()); .getApplicationByUuid(uuid, AppLifecycleState.PUBLISHED.toString());
return Response.status(Response.Status.OK).entity(application).build(); return Response.status(Response.Status.OK).entity(application).build();
} catch (NotFoundException e) { } catch (NotFoundException e) {

@ -48,7 +48,7 @@ public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{
@Override @Override
@POST @POST
@Path("/install-application") @Path("/install-application")
public Response installApplication(@ApiParam(name = "installationDetails", value = "ApplicationEntity ID and list of" + public Response installApplication(@ApiParam(name = "installationDetails", value = "ApplicationDTO ID and list of" +
"devices", required = true) @Valid InstallationDetails installationDetails) { "devices", required = true) @Valid InstallationDetails installationDetails) {
SubscriptionManager subscriptionManager = APIUtil.getSubscriptionManager(); SubscriptionManager subscriptionManager = APIUtil.getSubscriptionManager();
String applicationUUID = installationDetails.getApplicationUUID(); String applicationUUID = installationDetails.getApplicationUUID();
@ -81,7 +81,7 @@ public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{
ApplicationInstallResponse response; ApplicationInstallResponse response;
if (applicationUUID.isEmpty()) { if (applicationUUID.isEmpty()) {
msg = "ApplicationEntity UUID is empty in the incoming request. Therefore unable to proceed with the " msg = "ApplicationDTO UUID is empty in the incoming request. Therefore unable to proceed with the "
+ "installation."; + "installation.";
log.error(msg); log.error(msg);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
@ -128,7 +128,7 @@ public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{
} }
@Override @Override
public Response getApplication(@ApiParam(name = "applicationUUID", value = "ApplicationEntity ID") String public Response getApplication(@ApiParam(name = "applicationUUID", value = "ApplicationDTO ID") String
applicationUUID, @ApiParam(name = "deviceId", value = "The device ID") applicationUUID, @ApiParam(name = "deviceId", value = "The device ID")
String deviceId) { String deviceId) {
return null; return null;

@ -30,7 +30,7 @@
<PermissionConfiguration> <PermissionConfiguration>
<APIVersion></APIVersion> <APIVersion></APIVersion>
<!-- ApplicationEntity related permissions --> <!-- ApplicationDTO related permissions -->
<Permission> <Permission>
<name>Get Application</name> <name>Get Application</name>
<path>/device-mgt/application/get</path> <path>/device-mgt/application/get</path>

@ -1841,7 +1841,7 @@ c29.2568 87.7715 113.371 149.942 212.114 149.942z" />
d="M512 411.429v-413.257h-512v413.257h512zM138.972 257.828h175.543v87.7715h-175.543v-87.7715zM318.172 213.942h-175.543v-65.8281h175.543v65.8281zM142.629 42.0576h175.543v65.8281h-175.543v-65.8281zM43.8857 345.6v-87.7715h54.8574v87.7715h-54.8574z d="M512 411.429v-413.257h-512v413.257h512zM138.972 257.828h175.543v87.7715h-175.543v-87.7715zM318.172 213.942h-175.543v-65.8281h175.543v65.8281zM142.629 42.0576h175.543v65.8281h-175.543v-65.8281zM43.8857 345.6v-87.7715h54.8574v87.7715h-54.8574z
M362.058 257.828h106.057v87.7715h-106.057v-87.7715zM95.0859 148.114v65.8281h-54.8574v-65.8281h54.8574zM362.058 148.114h106.057v65.8281h-106.057v-65.8281zM43.8857 104.229v-65.8281h54.8574v65.8281h-54.8574zM468.114 104.229h-106.057v-65.8281h106.057v65.8281 M362.058 257.828h106.057v87.7715h-106.057v-87.7715zM95.0859 148.114v65.8281h-54.8574v-65.8281h54.8574zM362.058 148.114h106.057v65.8281h-106.057v-65.8281zM43.8857 104.229v-65.8281h54.8574v65.8281h-54.8574zM468.114 104.229h-106.057v-65.8281h106.057v65.8281
z" /> z" />
<glyph glyph-name="tagEntity" unicode="&#xe67a;" <glyph glyph-name="tagDTO" unicode="&#xe67a;"
d="M336.724 352.915l175.542 -179.201l-171.886 -182.856l-193.828 182.856l-32.916 128l32.916 36.5723c-7.31543 3.65625 -10.9717 3.65625 -14.6299 3.65625c-10.9707 -3.65625 -25.5986 -10.9717 -32.9131 -18.2861 d="M336.724 352.915l175.542 -179.201l-171.886 -182.856l-193.828 182.856l-32.916 128l32.916 36.5723c-7.31543 3.65625 -10.9717 3.65625 -14.6299 3.65625c-10.9707 -3.65625 -25.5986 -10.9717 -32.9131 -18.2861
c-10.9707 -14.627 -10.9707 -29.2568 -10.9707 -47.542c0 -18.2861 3.65625 -36.5723 7.3125 -54.8574c0 0 21.9443 -80.458 -40.2275 -87.7705c-62.1719 0 -54.8574 87.7705 -54.8574 87.7705v25.6006v7.31445c0 14.627 3.65625 29.2568 10.9707 43.8857 c-10.9707 -14.627 -10.9707 -29.2568 -10.9707 -47.542c0 -18.2861 3.65625 -36.5723 7.3125 -54.8574c0 0 21.9443 -80.458 -40.2275 -87.7705c-62.1719 0 -54.8574 87.7705 -54.8574 87.7705v25.6006v7.31445c0 14.627 3.65625 29.2568 10.9707 43.8857
c21.9443 62.1699 91.4287 84.1143 128 73.1436c10.9717 0 21.9443 -3.65918 29.2568 -7.31543l25.6006 25.6006zM62.4375 250.514c-3.29199 27.4287 5.85059 73.5088 9.87305 79.7275c-32.1807 -25.6006 -42.7881 -61.4424 -46.4443 -72.4131 c21.9443 62.1699 91.4287 84.1143 128 73.1436c10.9717 0 21.9443 -3.65918 29.2568 -7.31543l25.6006 25.6006zM62.4375 250.514c-3.29199 27.4287 5.85059 73.5088 9.87305 79.7275c-32.1807 -25.6006 -42.7881 -61.4424 -46.4443 -72.4131

Before

Width:  |  Height:  |  Size: 443 KiB

After

Width:  |  Height:  |  Size: 443 KiB

Loading…
Cancel
Save