Merge branch 'application-mgt-new' of https://gitlab.com/tcdlpds/carbon-device-mgt into application-mgt-new

This commit is contained in:
Jayasanka 2019-04-18 11:08:06 +05:30
commit 42a91ac923
979 changed files with 7434 additions and 198385 deletions

6
.gitignore vendored
View File

@ -29,7 +29,7 @@ components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/r
components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package-lock.json
components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/npm-debug.log
components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/dist/
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/node_modules/
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/public/dist/
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/package-lock.json
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/node_modules/
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/dist/
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/package-lock.json

View File

@ -0,0 +1,95 @@
/* 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.
*/
package org.wso2.carbon.device.application.mgt.api.services;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.Extension;
import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Info;
import io.swagger.annotations.SwaggerDefinition;
import org.wso2.carbon.device.application.mgt.common.ApplicationList;
import org.wso2.carbon.device.application.mgt.common.ErrorResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
/**
* APIs to handle application management related tasks.
*/
@SwaggerDefinition(
info = @Info(
version = "1.0.0",
title = "ApplicationDTO Management Common Service",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name", value = "ApplicationManagementArtifactDownloadService"),
@ExtensionProperty(name = "context", value = "/api/application-mgt/v1.0/artifact"),
})
}
)
)
@Path("/artifact")
@Api(value = "ApplicationDTO Management Artifact Downloading Service", description = "This API carries all application management artifact downloading services")
@Produces(MediaType.APPLICATION_JSON)
public interface ArtifactDownloadAPI {
@GET
@Path("/download-artifact/{md5sum}/{fileName}")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
@ApiOperation(
produces = MediaType.APPLICATION_OCTET_STREAM,
httpMethod = "GET",
value = "get application management UI configuration",
notes = "This will get all UI configuration of application management"
)
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n Successfully got UI config.",
response = ApplicationList.class),
@ApiResponse(
code = 404,
message = "Not Found. There doesn't have an defined UI config." +
"query."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Error occurred while getting the UI config.",
response = ErrorResponse.class)
})
Response getArtifact(
@ApiParam(
name = "md5sum",
value = "md5sum of the application release installer",
required = true)
@PathParam("md5sum") String md5sum,
@ApiParam(
name = "fileName",
value = "Name of the artifact",
required = true)
@PathParam("fileName") String fileName);
}

View File

@ -40,19 +40,19 @@ import javax.ws.rs.core.Response;
@SwaggerDefinition(
info = @Info(
version = "1.0.0",
title = "Application Management Common Service",
title = "ApplicationDTO Management Common Service",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name", value = "ApplicationManagementCommonService"),
@ExtensionProperty(name = "context", value = "/api/application-mgt/v1.0/app-mgt"),
@ExtensionProperty(name = "context", value = "/api/application-mgt/v1.0/configt"),
})
}
)
)
@Path("/app-mgt")
@Api(value = "Application Management Common Service", description = "This API carries all application management common services")
@Path("/config")
@Api(value = "ApplicationDTO Management Common Service", description = "This API carries all application management common services")
@Produces(MediaType.APPLICATION_JSON)
public interface AppMgtAPI {
public interface ConfigRetrieveAPI {
@GET
@Path("/ui-config")

View File

@ -0,0 +1,63 @@
/* 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.
*/
package org.wso2.carbon.device.application.mgt.api.services.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.application.mgt.api.services.ArtifactDownloadAPI;
import org.wso2.carbon.device.application.mgt.common.config.UIConfiguration;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException;
import org.wso2.carbon.device.application.mgt.common.services.AppmDataHandler;
import org.wso2.carbon.device.application.mgt.core.util.APIUtil;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
/**
* Implementation of ApplicationDTO Management related APIs.
*/
@Produces({"application/json"})
@Path("/artifact")
public class ArtifactDownloadAPIImpl implements ArtifactDownloadAPI {
private static Log log = LogFactory.getLog(ArtifactDownloadAPIImpl.class);
@GET
@Override
@Produces(MediaType.APPLICATION_OCTET_STREAM)
@Path("/download-artifact/{md5sum}/{fileName}")
public Response getArtifact(
@PathParam("md5sum") String md5sum,
@PathParam("fileName") String fileName) {
AppmDataHandler dataHandler = APIUtil.getDataHandler();
try {
UIConfiguration uiConfiguration = dataHandler.getUIConfiguration();
return Response.status(Response.Status.OK).entity(uiConfiguration).build();
}catch (ApplicationManagementException e) {
String msg = "Error occurred while getting the application list for publisher ";
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
}
}
}

View File

@ -19,9 +19,9 @@ package org.wso2.carbon.device.application.mgt.api.services.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.application.mgt.api.services.AppMgtAPI;
import org.wso2.carbon.device.application.mgt.api.services.ConfigRetrieveAPI;
import org.wso2.carbon.device.application.mgt.common.config.UIConfiguration;
import org.wso2.carbon.device.application.mgt.common.services.ConfigManager;
import org.wso2.carbon.device.application.mgt.common.services.AppmDataHandler;
import org.wso2.carbon.device.application.mgt.core.util.APIUtil;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException;
@ -32,22 +32,22 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
/**
* Implementation of Application Management related APIs.
* Implementation of ApplicationDTO Management related APIs.
*/
@Produces({"application/json"})
@Path("/app-mgt")
public class AppMgtAPIImpl implements AppMgtAPI {
@Path("/config")
public class ConfigRetrieveAPIImpl implements ConfigRetrieveAPI {
private static Log log = LogFactory.getLog(AppMgtAPIImpl.class);
private static Log log = LogFactory.getLog(ConfigRetrieveAPIImpl.class);
@GET
@Override
@Consumes("application/json")
@Path("/ui-config")
public Response getUiConfig() {
ConfigManager configManager = APIUtil.getConfigManager();
AppmDataHandler dataHandler = APIUtil.getDataHandler();
try {
UIConfiguration uiConfiguration = configManager.getUIConfiguration();
UIConfiguration uiConfiguration = dataHandler.getUIConfiguration();
return Response.status(Response.Status.OK).entity(uiConfiguration).build();
}catch (ApplicationManagementException e) {

View File

@ -25,7 +25,8 @@
<jaxrs:server id="applicationMgtCommonService" address="/">
<jaxrs:serviceBeans>
<ref bean="applicationMgtCommonServiceBean"/>
<ref bean="applicationMgtConfigService"/>
<ref bean="applicationMgtArtifactService"/>
<ref bean="swaggerResource"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
@ -52,7 +53,8 @@
<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.services.impl.AppMgtAPIImpl"/>
<bean id="applicationMgtConfigService" class="org.wso2.carbon.device.application.mgt.api.services.impl.ConfigRetrieveAPIImpl"/>
<bean id="applicationMgtArtifactService" class="org.wso2.carbon.device.application.mgt.api.services.impl.ArtifactDownloadAPIImpl"/>
<bean id="jsonProvider" class="org.wso2.carbon.device.application.mgt.addons.JSONMessageHandler"/>
<bean id="multipartProvider" class="org.wso2.carbon.device.application.mgt.addons.MultipartCustomProvider"/>

View File

@ -42,7 +42,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
@ -52,11 +51,12 @@
<Bundle-Description>Application Management Common Bundle</Bundle-Description>
<Import-Package>
org.wso2.carbon.device.mgt.common.*;version="${carbon.device.mgt.version}",
org.wso2.carbon.device.mgt.core.dto;version="${carbon.device.mgt.version}",
com.google.gson,
io.swagger.annotations.*;resolution:=optional,
com.fasterxml.jackson.annotation,
javax.validation.constraints,
javax.xml.bind.annotation.*
javax.xml.bind.annotation.*,
</Import-Package>
<Export-Package>
org.wso2.carbon.device.application.mgt.common.*
@ -113,6 +113,17 @@
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
</dependency>
</dependencies>
</project>

View File

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

View File

@ -0,0 +1,92 @@
package org.wso2.carbon.device.application.mgt.common;/* 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.
*/
import java.io.InputStream;
import java.util.Map;
public class ApplicationArtifact {
private String installerName;
private InputStream installerStream;
private String bannerName;
private InputStream bannerStream;
private String iconName;
private InputStream iconStream;
private Map<String , InputStream> screenshots;
public String getInstallerName() {
return installerName;
}
public void setInstallerName(String installerName) {
this.installerName = installerName;
}
public InputStream getInstallerStream() {
return installerStream;
}
public void setInstallerStream(InputStream installerStream) {
this.installerStream = installerStream;
}
public String getBannerName() {
return bannerName;
}
public void setBannerName(String bannerName) {
this.bannerName = bannerName;
}
public InputStream getBannerStream() {
return bannerStream;
}
public void setBannerStream(InputStream bannerStream) {
this.bannerStream = bannerStream;
}
public String getIconName() {
return iconName;
}
public void setIconName(String iconName) {
this.iconName = iconName;
}
public InputStream getIconStream() {
return iconStream;
}
public void setIconStream(InputStream iconStream) {
this.iconStream = iconStream;
}
public Map<String, InputStream> getScreenshots() {
return screenshots;
}
public void setScreenshots(Map<String, InputStream> screenshots) {
this.screenshots = screenshots;
}
}

View File

@ -0,0 +1,45 @@
package org.wso2.carbon.device.application.mgt.common;/* 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 ApplicationInstaller {
/***
* Package name of the Installer
*/
private String packageName;
/***
* Version of the Installer.
*/
private String version;
public String getPackageName() {
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
}

View File

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

View File

@ -0,0 +1,42 @@
package org.wso2.carbon.device.application.mgt.common;/* 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.
*/
import java.util.List;
public class ApplicationReleaseArtifactPaths {
private String installerPath;
private String iconPath;
private String bannerPath;
private List<String> screenshotPaths;
public String getInstallerPath() { return installerPath; }
public void setInstallerPath(String installerPath) { this.installerPath = installerPath; }
public String getIconPath() { return iconPath; }
public void setIconPath(String iconPath) { this.iconPath = iconPath; }
public String getBannerPath() { return bannerPath; }
public void setBannerPath(String bannerPath) { this.bannerPath = bannerPath; }
public List<String> getScreenshotPaths() { return screenshotPaths; }
public void setScreenshotPaths(List<String> screenshotPaths) { this.screenshotPaths = screenshotPaths; }
}

View File

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

View File

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

View File

@ -63,6 +63,11 @@ public class Filter {
*/
private String currentAppReleaseState;
/***
* Supported device type for the application. i.e Android, iOS, Windows etc
*/
private int deviceTypeId;
public int getLimit() {
return limit;
}
@ -119,11 +124,13 @@ public class Filter {
this.appCategory = appCategory;
}
public String getCurrentAppReleaseState() {
return currentAppReleaseState;
}
public String getCurrentAppReleaseState() { return currentAppReleaseState; }
public void setCurrentAppReleaseState(String currentAppReleaseState) {
this.currentAppReleaseState = currentAppReleaseState;
}
public int getDeviceTypeId() { return deviceTypeId; }
public void setDeviceTypeId(int deviceTypeId) { this.deviceTypeId = deviceTypeId; }
}

View File

@ -19,7 +19,7 @@
package org.wso2.carbon.device.application.mgt.common;
/**
* Represents an user of {@link Application}.
* Represents an user.
*/
public class User {

View File

@ -16,7 +16,7 @@
* under the License.
*
*/
package org.wso2.carbon.device.application.mgt.common;
package org.wso2.carbon.device.application.mgt.common.dto;
import io.swagger.annotations.ApiModel;
@ -24,8 +24,8 @@ import io.swagger.annotations.ApiModelProperty;
import java.util.List;
@ApiModel(value = "Application", description = "Application represents the an Application in Application Store")
public class Application {
@ApiModel(value = "ApplicationDTO", description = "ApplicationDTO represents an Application details.")
public class ApplicationDTO {
@ApiModelProperty(name = "id",
value = "The ID given to the application when it is stored in the APPM database")
@ -36,6 +36,11 @@ public class Application {
required = true)
private String name;
@ApiModelProperty(name = "description",
value = "Description of the application",
required = true)
private String description;
@ApiModelProperty(name = "appCategory",
value = "Category of the application",
required = true,
@ -64,32 +69,36 @@ public class Application {
value = "List of application tags")
private List<String> tags;
@ApiModelProperty(name = "user",
value = "Application creating user")
private User user;
@ApiModelProperty(name = "unrestrictedRoles",
value = "List of roles that users should have to access the application")
private List<String> unrestrictedRoles;
@ApiModelProperty(name = "isRestricted",
value = "If unrestricted roles are defined then isRestricted value is true otherwise it is false")
private boolean isRestricted;
@ApiModelProperty(name = "deviceTypeId",
value = "Id of the Related device type of the application",
example = "1, 2, 3")
private int deviceTypeId;
@ApiModelProperty(name = "deviceType",
@ApiModelProperty(name = "deviceTypeName",
value = "Related device type of the application",
required = true,
example = "IoS, Android, Arduino, RaspberryPi etc")
private String deviceType;
private String deviceTypeName;
@ApiModelProperty(name = "appRating",
value = "Rating of the aplication")
private int appRating;
@ApiModelProperty(name = "status",
value = "Application status",
required = true,
example = "REMOVED, ACTIVE")
private String status;
@ApiModelProperty(name = "applicationReleases",
value = "List of application releases",
required = true)
private List<ApplicationRelease> applicationReleases;
private List<ApplicationReleaseDTO> applicationReleases;
public int getId() {
return id;
@ -119,14 +128,6 @@ public class Application {
this.tags = tags;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String getType() {
return type;
}
@ -151,19 +152,11 @@ public class Application {
this.paymentCurrency = paymentCurrency;
}
public boolean getIsRestricted() {
return isRestricted;
}
public void setIsRestricted(boolean isRestricted) {
this.isRestricted = isRestricted;
}
public List<ApplicationRelease> getApplicationReleases() {
public List<ApplicationReleaseDTO> getApplicationReleases() {
return applicationReleases;
}
public void setApplicationReleases(List<ApplicationRelease> applicationReleases) {
public void setApplicationReleases(List<ApplicationReleaseDTO> applicationReleases) {
this.applicationReleases = applicationReleases;
}
@ -175,13 +168,11 @@ public class Application {
this.unrestrictedRoles = unrestrictedRoles;
}
public String getDeviceType() {
return deviceType;
public String getDeviceTypeName() {
return deviceTypeName;
}
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}
public void setDeviceTypeName(String deviceTypeName) { this.deviceTypeName = deviceTypeName; }
public int getDeviceTypeId() {
return deviceTypeId;
@ -190,4 +181,16 @@ public class Application {
public void setDeviceTypeId(int deviceTypeId) {
this.deviceTypeId = deviceTypeId;
}
public String getStatus() { return status; }
public void setStatus(String status) { this.status = status; }
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
public int getAppRating() { return appRating; }
public void setAppRating(int appRating) { this.appRating = appRating; }
}

View File

@ -16,18 +16,24 @@
* under the License.
*
*/
package org.wso2.carbon.device.application.mgt.common;
package org.wso2.carbon.device.application.mgt.common.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
@ApiModel(value = "ApplicationRelease", description = "This class holds the details when releasing an Application to application store")
public class ApplicationRelease {
@ApiModel(value = "ApplicationReleaseDTO", description = "This class holds the details when releasing an ApplicationDTO to application store")
@JsonIgnoreProperties({"appHashValue"})
public class ApplicationReleaseDTO {
@ApiModelProperty(name = "id",
value = "ID of the application release")
private int id;
@ApiModelProperty(name = "description",
value = "Description of the application release")
private String description;
@ApiModelProperty(name = "version",
value = "Version of the application release")
private String version;
@ -36,29 +42,29 @@ public class ApplicationRelease {
value = "UUID of the application release")
private String uuid;
@ApiModelProperty(name = "appStoredLoc",
value = "Application storing location")
private String appStoredLoc;
@ApiModelProperty(name = "installerName",
value = "ApplicationDTO storing location")
private String installerName;
@ApiModelProperty(name = "bannerLoc",
@ApiModelProperty(name = "bannerName",
value = "Banner file storing location")
private String bannerLoc;
private String bannerName;
@ApiModelProperty(name = "screenshotLoc1",
value = "Screenshot storing location")
private String screenshotLoc1;
@ApiModelProperty(name = "screenshotLoc2",
value = "Screenshot storing location")
private String screenshotLoc2;
@ApiModelProperty(name = "screenshotLoc3",
value = "Screenshot storing location")
private String screenshotLoc3;
@ApiModelProperty(name = "iconLoc",
@ApiModelProperty(name = "iconName",
value = "icon file storing location")
private String iconLoc;
private String iconName;
@ApiModelProperty(name = "screenshotName1",
value = "Screenshot storing location")
private String screenshotName1;
@ApiModelProperty(name = "screenshotName2",
value = "Screenshot storing location")
private String screenshotName2;
@ApiModelProperty(name = "screenshotName3",
value = "Screenshot storing location")
private String screenshotName3;
@ApiModelProperty(name = "releaseType",
value = "Release type of the application release",
@ -78,7 +84,7 @@ public class ApplicationRelease {
@ApiModelProperty(name = "isSharedWithAllTenants",
value = "If application release is shared with all tenants it is eqal to 1 otherwise 0",
required = true)
private int isSharedWithAllTenants;
private boolean isSharedWithAllTenants;
@ApiModelProperty(name = "metaData",
value = "Meta data of the application release",
@ -97,14 +103,21 @@ public class ApplicationRelease {
value = "URL which is used for WEB-CLIP")
private String url;
@ApiModelProperty(name = "lifecycleState",
value = "Latest Lifecycle state of the application release")
private LifecycleState lifecycleState;
@ApiModelProperty(name = "supportedOsVersions",
value = "ApplicationDTO release supported OS versions")
private String supportedOsVersions;
@ApiModelProperty(name = "currentState",
value = "Current state of the application release")
private String currentState;
@ApiModelProperty(name = "packageName",
value = "Application bundle identifier")
value = "ApplicationDTO bundle identifier")
private String packageName;
public ApplicationReleaseDTO() {
}
public int getRatedUsers() {
return ratedUsers;
}
@ -149,7 +162,7 @@ public class ApplicationRelease {
this.appHashValue = appHashValue;
}
public void setIsSharedWithAllTenants(int isSharedWithAllTenants) {
public void setIsSharedWithAllTenants(boolean isSharedWithAllTenants) {
this.isSharedWithAllTenants = isSharedWithAllTenants;
}
@ -177,60 +190,58 @@ public class ApplicationRelease {
return appHashValue;
}
public int getIsSharedWithAllTenants() {
return isSharedWithAllTenants;
}
public boolean getIsSharedWithAllTenants() { return isSharedWithAllTenants; }
public String getMetaData() {
return metaData;
}
public String getAppStoredLoc() {
return appStoredLoc;
public String getInstallerName() {
return installerName;
}
public void setAppStoredLoc(String appStoredLoc) {
this.appStoredLoc = appStoredLoc;
public void setInstallerName(String installerName) {
this.installerName = installerName;
}
public String getBannerLoc() {
return bannerLoc;
public String getBannerName() {
return bannerName;
}
public void setBannerLoc(String bannerLoc) {
this.bannerLoc = bannerLoc;
public void setBannerName(String bannerName) {
this.bannerName = bannerName;
}
public String getScreenshotLoc1() {
return screenshotLoc1;
public String getScreenshotName1() {
return screenshotName1;
}
public void setScreenshotLoc1(String screenshotLoc1) {
this.screenshotLoc1 = screenshotLoc1;
public void setScreenshotName1(String screenshotName1) {
this.screenshotName1 = screenshotName1;
}
public String getScreenshotLoc2() {
return screenshotLoc2;
public String getScreenshotName2() {
return screenshotName2;
}
public void setScreenshotLoc2(String screenshotLoc2) {
this.screenshotLoc2 = screenshotLoc2;
public void setScreenshotName2(String screenshotName2) {
this.screenshotName2 = screenshotName2;
}
public String getScreenshotLoc3() {
return screenshotLoc3;
public String getScreenshotName3() {
return screenshotName3;
}
public void setScreenshotLoc3(String screenshotLoc3) {
this.screenshotLoc3 = screenshotLoc3;
public void setScreenshotName3(String screenshotName3) {
this.screenshotName3 = screenshotName3;
}
public String getIconLoc() {
return iconLoc;
public String getIconName() {
return iconName;
}
public void setIconLoc(String iconLoc) {
this.iconLoc = iconLoc;
public void setIconName(String iconName) {
this.iconName = iconName;
}
public String getUrl() {
@ -241,14 +252,6 @@ public class ApplicationRelease {
this.url = url;
}
public LifecycleState getLifecycleState() {
return lifecycleState;
}
public void setLifecycleState(LifecycleState lifecycleState) {
this.lifecycleState = lifecycleState;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
@ -256,4 +259,16 @@ public class ApplicationRelease {
public String getPackageName() {
return packageName;
}
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
public String getSupportedOsVersions() { return supportedOsVersions; }
public void setSupportedOsVersions(String supportedOsVersions) { this.supportedOsVersions = supportedOsVersions; }
public String getCurrentState() { return currentState; }
public void setCurrentState(String currentState) { this.currentState = currentState; }
}

View File

@ -0,0 +1,38 @@
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,
* 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 CategoryDTO {
int id;
String categoryName;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
}

View File

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

View File

@ -0,0 +1,39 @@
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,
* 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 TagDTO {
int id;
String tagName;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTagName() {
return tagName;
}
public void setTagName(String tagName) {
this.tagName = tagName;
}
}

View File

@ -0,0 +1,131 @@
package org.wso2.carbon.device.application.mgt.common.response;/* 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.
*/
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
public class Application {
@ApiModelProperty(name = "id",
value = "ID of the application",
required = true)
private int id;
@ApiModelProperty(name = "name",
value = "Name of the application",
required = true)
private String name;
@ApiModelProperty(name = "description",
value = "Description of the application",
required = true)
private String description;
@ApiModelProperty(name = "appCategory",
value = "CategoryDTO of the application",
required = true,
example = "Educational, Gaming, Travel, Entertainment etc")
private String appCategory;
@ApiModelProperty(name = "type",
value = "Type of the application",
required = true,
example = "ENTERPRISE, PUBLIC, WEB, WEB_CLIP etc")
private String type;
@ApiModelProperty(name = "subType",
value = "Subscription type of the application",
required = true,
example = "PAID, FREE")
private String subType;
@ApiModelProperty(name = "paymentCurrency",
value = "Payment currency of the application",
required = true,
example = "$")
private String paymentCurrency;
@ApiModelProperty(name = "tags",
value = "List of application tags")
private List<String> tags;
@ApiModelProperty(name = "unrestrictedRoles",
value = "List of roles that users should have to access the application")
private List<String> unrestrictedRoles;
@ApiModelProperty(name = "deviceType",
value = "Related device type of the application",
required = true,
example = "IoS, Android, Arduino, RaspberryPi etc")
private String deviceType;
@ApiModelProperty(name = "applicationReleases",
value = "List of application releases",
required = true)
private List<ApplicationRelease> applicationReleases;
public int getId() { return id; }
public void setId(int id) { this.id = id; }
public String getName() {
return name;
}
public void setName(String name) { this.name = name; }
public String getAppCategory() {
return appCategory;
}
public void setAppCategory(String appCategory) {
this.appCategory = appCategory;
}
public List<String> getTags() { return tags; }
public void setTags(List<String> tags) { this.tags = tags; }
public String getType() { return type; }
public void setType(String type) { this.type = type; }
public String getSubType() { return subType; }
public void setSubType(String subType) { this.subType = subType; }
public String getPaymentCurrency() { return paymentCurrency; }
public void setPaymentCurrency(String paymentCurrency) { this.paymentCurrency = paymentCurrency; }
public List<ApplicationRelease> getApplicationReleases() { return applicationReleases; }
public void setApplicationReleases(List<ApplicationRelease> applicationReleases) {
this.applicationReleases = applicationReleases; }
public List<String> getUnrestrictedRoles() { return unrestrictedRoles; }
public void setUnrestrictedRoles(List<String> unrestrictedRoles) { this.unrestrictedRoles = unrestrictedRoles; }
public String getDeviceType() { return deviceType; }
public void setDeviceType(String deviceType) { this.deviceType = deviceType; }
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
}

View File

@ -0,0 +1,175 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.wso2.carbon.device.application.mgt.common.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "ApplicationReleaseDTO", description = "This class holds the details when releasing an ApplicationDTO to application store")
public class ApplicationRelease {
@ApiModelProperty(name = "description",
value = "Description of the application release")
private String description;
@ApiModelProperty(name = "version",
value = "Version of the application release")
private String version;
@ApiModelProperty(name = "uuid",
value = "UUID of the application release")
private String uuid;
@ApiModelProperty(name = "installerPath",
value = "ApplicationDTO storing location")
private String installerPath;
@ApiModelProperty(name = "bannerPath",
value = "Banner file storing location")
private String bannerPath;
@ApiModelProperty(name = "iconPath",
value = "icon file storing location")
private String iconPath;
@ApiModelProperty(name = "screenshotPath1",
value = "Screenshot storing location")
private String screenshotPath1;
@ApiModelProperty(name = "screenshotPath2",
value = "Screenshot storing location")
private String screenshotPath2;
@ApiModelProperty(name = "screenshotPath3",
value = "Screenshot storing location")
private String screenshotPath3;
@ApiModelProperty(name = "releaseType",
value = "Release type of the application release",
required = true,
example = "alpha, beta etc")
private String releaseType;
@ApiModelProperty(name = "price",
value = "Price of the application release",
required = true)
private Double price;
@ApiModelProperty(name = "isSharedWithAllTenants",
value = "If application release is shared with all tenants it is eqal to 1 otherwise 0",
required = true)
private boolean isSharedWithAllTenants;
@ApiModelProperty(name = "metaData",
value = "Meta data of the application release",
required = true)
private String metaData;
@ApiModelProperty(name = "url",
value = "URL which is used for WEB-CLIP")
private String url;
@ApiModelProperty(name = "supportedOsVersions",
value = "ApplicationDTO release supported OS versions")
private String supportedOsVersions;
public String getReleaseType() {
return releaseType;
}
public void setReleaseType(String releaseType) {
this.releaseType = releaseType;
}
public void setIsSharedWithAllTenants(boolean isSharedWithAllTenants) {
this.isSharedWithAllTenants = isSharedWithAllTenants;
}
public void setMetaData(String metaData) {
this.metaData = metaData;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public boolean getIsSharedWithAllTenants() {
return isSharedWithAllTenants;
}
public String getMetaData() {
return metaData;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
public String getVersion() { return version; }
public void setVersion(String version) { this.version = version; }
public String getUuid() { return uuid; }
public void setUuid(String uuid) { this.uuid = uuid; }
public String getInstallerPath() { return installerPath; }
public void setInstallerPath(String installerPath) { this.installerPath = installerPath; }
public String getBannerPath() { return bannerPath; }
public void setBannerPath(String bannerPath) { this.bannerPath = bannerPath; }
public String getIconPath() { return iconPath; }
public void setIconPath(String iconPath) { this.iconPath = iconPath; }
public String getScreenshotPath1() { return screenshotPath1; }
public void setScreenshotPath1(String screenshotPath1) { this.screenshotPath1 = screenshotPath1; }
public String getScreenshotPath2() { return screenshotPath2; }
public void setScreenshotPath2(String screenshotPath2) { this.screenshotPath2 = screenshotPath2; }
public String getScreenshotPath3() { return screenshotPath3; }
public void setScreenshotPath3(String screenshotPath3) { this.screenshotPath3 = screenshotPath3; }
public boolean isSharedWithAllTenants() { return isSharedWithAllTenants; }
public void setSharedWithAllTenants(boolean sharedWithAllTenants) { isSharedWithAllTenants = sharedWithAllTenants; }
public String getSupportedOsVersions() { return supportedOsVersions; }
public void setSupportedOsVersions(String supportedOsVersions) { this.supportedOsVersions = supportedOsVersions; }
}

View File

@ -18,15 +18,18 @@
*/
package org.wso2.carbon.device.application.mgt.common.services;
import org.wso2.carbon.device.application.mgt.common.Application;
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.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.ApplicationList;
import org.wso2.carbon.device.application.mgt.common.ApplicationRelease;
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.LifecycleState;
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.RequestValidatingException;
import org.wso2.carbon.device.application.mgt.common.exception.ResourceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
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 java.io.InputStream;
import java.util.List;
@ -39,27 +42,28 @@ public interface ApplicationManager {
/**
* Creates an application.
*
* @param application Application that need to be created.
* @param applicationWrapper Application that need to be created.
* @return Created application
* @throws ApplicationManagementException Application Management Exception
* @throws ApplicationManagementException ApplicationDTO Management Exception
*/
Application createApplication(Application application)
Application createApplication(ApplicationWrapper applicationWrapper, ApplicationArtifact applicationArtifact)
throws ApplicationManagementException, RequestValidatingException;
/**
* Updates an already existing application.
*
* @param application Application that need to be updated.
* @param applicationId ID of the application
* @return Updated Application
* @throws ApplicationManagementException Application Management Exception
* @throws ApplicationManagementException ApplicationDTO Management Exception
*/
Application updateApplication(Application application) throws ApplicationManagementException;
ApplicationDTO updateApplication(int applicationId, ApplicationDTO application) throws ApplicationManagementException;
/**
* Delete an application identified by the unique ID.
*
* @param applicationId ID for tha application
* @throws ApplicationManagementException Application Management Exception
* @throws ApplicationManagementException ApplicationDTO Management Exception
*/
List<String> deleteApplication(int applicationId) throws ApplicationManagementException;
@ -68,154 +72,151 @@ public interface ApplicationManager {
*
* @param applicationId ID of tha application
* @param releaseUuid UUID of tha application release
* @param handleConnections Whether it is necessary handle DB connections.
* @throws ApplicationManagementException Application Management Exception
* @throws ApplicationManagementException ApplicationDTO Management Exception
*/
String deleteApplicationRelease(int applicationId, String releaseUuid, boolean handleConnections) throws
ApplicationManagementException;
String deleteApplicationRelease(int applicationId, String releaseUuid) throws ApplicationManagementException;
/**
* To get the applications based on the search filter.
*
* @param filter Search filter
* @return Applications that matches the given filter criteria.
* @throws ApplicationManagementException Application Management Exception
* @throws ApplicationManagementException ApplicationDTO Management Exception
*/
ApplicationList getApplications(Filter filter) throws ApplicationManagementException;
ApplicationList getApplications(Filter filter, String deviceTypeName) throws ApplicationManagementException;
/**
* To get the applications based on the search filter.
* To get the ApplicationDTO for given Id.
*
* @param appId id of the application
* @return Application release which is published and release of the Application(appId).
* @throws ApplicationManagementException Application Management Exception
* @param id id of the ApplicationDTO
* @param state state of the ApplicationDTO
* @return the ApplicationDTO identified by the ID
* @throws ApplicationManagementException ApplicationDTO Management Exception.
*/
String getUuidOfLatestRelease(int appId) throws ApplicationManagementException;
ApplicationDTO getApplicationById(int id, String state) throws ApplicationManagementException;
/**
* To get the Application for given Id.
* To get the ApplicationDTO for given application relase UUID.
*
* @param id id of the Application
* @param state state of the Application
* @return the Application identified by the ID
* @throws ApplicationManagementException Application Management Exception.
* @param uuid UUID of the ApplicationDTO
* @param state state of the ApplicationDTO
* @return the ApplicationDTO identified by the ID
* @throws ApplicationManagementException ApplicationDTO Management Exception.
*/
Application getApplicationById(int id, String state) throws ApplicationManagementException;
/**
* To get the Application for given application relase UUID.
*
* @param uuid UUID of the Application
* @param state state of the Application
* @return the Application identified by the ID
* @throws ApplicationManagementException Application Management Exception.
*/
Application getApplicationByUuid(String uuid, String state) throws ApplicationManagementException;
ApplicationDTO getApplicationByUuid(String uuid, String state) throws ApplicationManagementException;
/**
* To get an application associated with the release.
*
* @param appReleaseUUID UUID of the app release
* @return {@link Application} associated with the release
* @throws ApplicationManagementException If unable to retrieve {@link Application} associated with the given UUID
* @return {@link ApplicationDTO} associated with the release
* @throws ApplicationManagementException If unable to retrieve {@link ApplicationDTO} associated with the given UUID
*/
Application getApplicationByRelease(String appReleaseUUID) throws ApplicationManagementException;
ApplicationDTO getApplicationByRelease(String appReleaseUUID) throws ApplicationManagementException;
/**
* To get Application with the given UUID.
* To get all the releases of a particular ApplicationDTO.
*
* @param appId ID of the Application
* @return the boolean value, whether application exist or not
* @throws ApplicationManagementException Application Management Exception.
* @param applicationId ID of the ApplicationDTO .
* @param releaseUuid UUID of the ApplicationDTO Release.
* @return the LifecycleStateDTO of the ApplicationDTO releases related with the particular ApplicationDTO.
* @throws ApplicationManagementException ApplicationDTO Management Exception.
*/
boolean verifyApplicationExistenceById(int appId) throws ApplicationManagementException;
LifecycleStateDTO getLifecycleState(int applicationId, String releaseUuid) throws ApplicationManagementException;
/**
* To get Application with the given UUID.
* To get all the releases of a particular ApplicationDTO.
*
* @return the boolean value, whether user has assigned unrestricted roles to access the application
* * @throws ApplicationManagementException Application Management Exception.
*/
Boolean isUserAllowable(List<String> unrestrictedRoles, String userName) throws ApplicationManagementException;
/**
* To get all the releases of a particular Application.
*
* @param applicationId ID of the Application .
* @param releaseUuid UUID of the Application Release.
* @return the LifecycleState of the Application releases related with the particular Application.
* @throws ApplicationManagementException Application Management Exception.
*/
LifecycleState getLifecycleState(int applicationId, String releaseUuid) throws ApplicationManagementException;
/**
* To get all the releases of a particular Application.
*
* @param applicationId ID of the Application.
* @param releaseUuid UUID of the Application Release.
* @param applicationId ID of the ApplicationDTO.
* @param releaseUuid UUID of the ApplicationDTO Release.
* @param state Lifecycle state to change the app
* @throws ApplicationManagementException Application Management Exception.
* @throws ApplicationManagementException ApplicationDTO Management Exception.
*/
void changeLifecycleState(int applicationId, String releaseUuid, LifecycleState state)
void changeLifecycleState(int applicationId, String releaseUuid, LifecycleStateDTO state)
throws ApplicationManagementException;
/**
* Get the application if application is an accessible one.
*
* @param applicationId ID of the Application.
* @throws ApplicationManagementException Application Management Exception.
*/
Application getApplicationIfAccessible(int applicationId) throws ApplicationManagementException;
/**
* To update release images such as icons, banner and screenshots.
*
* @param appId ID of the Application
* @param uuid uuid of the Application
* @param appId ID of the ApplicationDTO
* @param uuid uuid of the ApplicationDTO
* @param iconFileStream icon file of the release
* @param bannerFileStream bannerFileStream of the release.
* @param attachments screenshot attachments of the release
* @return Updated Application Release.
* @throws ApplicationManagementException Application Management Exception.
* @throws ApplicationManagementException ApplicationDTO Management Exception.
*/
ApplicationRelease updateApplicationImageArtifact(int appId, String uuid, InputStream iconFileStream, InputStream
bannerFileStream, List<InputStream> attachments)
throws ApplicationManagementException, ResourceManagementException;
void updateApplicationImageArtifact(int appId, String uuid, InputStream iconFileStream, InputStream
bannerFileStream, List<InputStream> attachments) throws ApplicationManagementException;
/**
* To update release images.
*
* @param appId ID of the Application
* @param uuid uuid of the Application
* @param appId ID of the ApplicationDTO
* @param deviceType Applicable device type of the application
* @param uuid uuid of the ApplicationDTO
* @param binaryFile binaryFile of the release.
* @return Updated Application Release.
* @throws ApplicationManagementException Application Management Exception.
* @throws ApplicationManagementException ApplicationDTO Management Exception.
*/
ApplicationRelease updateApplicationArtifact(int appId, String uuid, InputStream binaryFile)
throws ApplicationManagementException, ResourceManagementException, RequestValidatingException, DeviceManagementException;
/**
* To verify whether application release is acceptable to update or not.
*
* @param appId ID of the Application
* @param appReleaseUuid UUID of the ApplicationRelease
* @return Updated Application Release.
* @throws ApplicationManagementException Application Management Exception.
*/
boolean isAcceptableAppReleaseUpdate(int appId, String appReleaseUuid)
void updateApplicationArtifact(int appId, String deviceType, String uuid, InputStream binaryFile)
throws ApplicationManagementException;
/**
* To create an application release for an Application.
* To create an application release for an ApplicationDTO.
*
* @param applicationId ID of the Application
* @param applicationId ID of the ApplicationDTO
* @param applicationRelease ApplicatonRelease that need to be be created.
* @return the unique id of the application release, if the application release succeeded else -1
*/
ApplicationRelease createRelease(int applicationId, ApplicationRelease applicationRelease)
ApplicationReleaseDTO createRelease(int applicationId, ApplicationReleaseDTO applicationRelease)
throws ApplicationManagementException;
}
/***
*
* @param applicationId ID of the application
* @param releaseUuid UUID of the application release
* @param deviceType Supported device type of the application
* @param applicationRelease {@link ApplicationReleaseDTO}
* @param binaryFileStram {@link InputStream} of the binary file
* @param iconFileStream {@link InputStream} of the icon
* @param bannerFileStream {@link InputStream} of the banner
* @param attachments {@link List} of {@link InputStream} of attachments
* @return If the application release is updated correctly True returns, otherwise retuen False
*/
boolean updateRelease(int applicationId, String releaseUuid, String deviceType, ApplicationReleaseDTO applicationRelease,
InputStream binaryFileStram, InputStream iconFileStream, InputStream bannerFileStream,
List<InputStream> attachments) throws ApplicationManagementException;
/***
* 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 addAplicationCategories(List<String> categories) throws ApplicationManagementException;
}

View File

@ -19,8 +19,8 @@
package org.wso2.carbon.device.application.mgt.common.services;
import org.wso2.carbon.device.application.mgt.common.ApplicationRelease;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException;
import org.wso2.carbon.device.application.mgt.common.ApplicationInstaller;
import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO;
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.ResourceManagementException;
@ -29,22 +29,22 @@ import java.io.InputStream;
import java.util.List;
/**
* This manages all the storage related requirements of Application.
* This manages all the storage related requirements of ApplicationDTO.
*/
public interface ApplicationStorageManager {
/**
* To upload image artifacts related with an Application.
* To upload image artifacts related with an ApplicationDTO.
*
* @param applicationRelease ApplicationRelease Object
* @param applicationRelease ApplicationReleaseDTO Object
* @param iconFile Icon File input stream
* @param bannerFile Banner File input stream
* @throws ResourceManagementException Resource Management Exception.
*/
ApplicationRelease uploadImageArtifacts(ApplicationRelease applicationRelease,
ApplicationReleaseDTO uploadImageArtifacts(ApplicationReleaseDTO applicationRelease,
InputStream iconFile, InputStream bannerFile, List<InputStream> screenshots) throws ResourceManagementException;
/**
* To upload image artifacts related with an Application.
* To upload image artifacts related with an ApplicationDTO.
*
* @param applicationRelease Release of the application
* @param iconFile Icon File input stream
@ -52,36 +52,39 @@ public interface ApplicationStorageManager {
* @param screenshots Input Streams of screenshots
* @throws ResourceManagementException Resource Management Exception.
*/
ApplicationRelease updateImageArtifacts(ApplicationRelease applicationRelease, InputStream iconFile,
InputStream bannerFile, List<InputStream> screenshots)
throws ResourceManagementException, ApplicationManagementException;
ApplicationReleaseDTO updateImageArtifacts(ApplicationReleaseDTO applicationRelease, InputStream iconFile,
InputStream bannerFile, List<InputStream> screenshots) throws ResourceManagementException;
ApplicationInstaller getAppInstallerData(InputStream binaryFile, String deviceType)
throws ApplicationStorageManagementException;
/**
* To upload release artifacts for an Application.
* To upload release artifacts for an ApplicationDTO.
*
* @param applicationRelease Application Release Object.
* @param appType Application Type.
* @param applicationRelease ApplicationDTO Release Object.
* @param appType ApplicationDTO Type.
* @param deviceType Compatible device tipe of the application.
* @param binaryFile Binary File for the release.
* @throws ResourceManagementException Resource Management Exception.
*/
ApplicationRelease uploadReleaseArtifact(ApplicationRelease applicationRelease, String appType, String deviceType,
InputStream binaryFile) throws ResourceManagementException, RequestValidatingException;
ApplicationReleaseDTO uploadReleaseArtifact(ApplicationReleaseDTO applicationRelease, String appType, String deviceType,
InputStream binaryFile) throws ResourceManagementException;
/**
* To upload release artifacts for an Application.
* To upload release artifacts for an ApplicationDTO.
*
* @param applicationRelease applicationRelease Application release of a particular application.
* @param applicationRelease applicationRelease ApplicationDTO release of a particular application.
* @param appType Type of the application.
* @param deviceType Compatible device tipe of the application.
* @param binaryFile Binary File for the release.
* @throws ApplicationStorageManagementException Resource Management Exception.
*/
ApplicationRelease updateReleaseArtifacts(ApplicationRelease applicationRelease, String appType, String deviceType,
ApplicationReleaseDTO updateReleaseArtifacts(ApplicationReleaseDTO applicationRelease, String appType, String deviceType,
InputStream binaryFile) throws ApplicationStorageManagementException, RequestValidatingException;
/**
* To delete the artifacts related with particular Application Release.
* To delete the artifacts related with particular ApplicationDTO Release.
*
* @param directoryPath Hash value of the application artifact.
* @throws ApplicationStorageManagementException Not Found Exception.
@ -89,11 +92,20 @@ public interface ApplicationStorageManager {
void deleteApplicationReleaseArtifacts(String directoryPath) throws ApplicationStorageManagementException;
/**
* To delete all release artifacts related with particular Application Release.
* To delete all release artifacts related with particular ApplicationDTO Release.
*
* @param directoryPaths Hash values of the Application.
* @throws ApplicationStorageManagementException Application Storage Management Exception
* @param directoryPaths Hash values of the ApplicationDTO.
* @throws ApplicationStorageManagementException ApplicationDTO Storage Management Exception
*/
void deleteAllApplicationReleaseArtifacts(List<String> directoryPaths) throws ApplicationStorageManagementException;
}
/***
* Get the InputStream of the file which is located in filePath
* @param path file path
* @return {@link InputStream}
* @throws ApplicationStorageManagementException throws if an error occurs when accessing the file.
*/
InputStream getFileSttream (String path) throws ApplicationStorageManagementException;
}

View File

@ -20,12 +20,16 @@ package org.wso2.carbon.device.application.mgt.common.services;
import org.wso2.carbon.device.application.mgt.common.config.UIConfiguration;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException;
public interface ConfigManager {
import java.io.InputStream;
public interface AppmDataHandler {
/**
* Get all review with pagination
* Get UI configuration which is defined in the app-manager.xml
*
* @return {@link UIConfiguration} UI configuration
* @throws ApplicationManagementException Exceptions of the Application managementt.
* @throws ApplicationManagementException Exceptions of the ApplicationDTO management.
*/
UIConfiguration getUIConfiguration() throws ApplicationManagementException;
InputStream getArtifactStream(String md5sum, String artifactName) throws ApplicationManagementException;
}

View File

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

View File

@ -0,0 +1,107 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.wso2.carbon.device.application.mgt.common.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "ApplicationReleaseDTO", description = "This class holds the details when releasing an ApplicationDTO to application store")
public class ApplicationReleaseWrapper {
@ApiModelProperty(name = "description",
value = "Description of the application release")
private String description;
@ApiModelProperty(name = "releaseType",
value = "Release type of the application release",
required = true,
example = "alpha, beta etc")
private String releaseType;
@ApiModelProperty(name = "price",
value = "Price of the application release",
required = true)
private Double price;
@ApiModelProperty(name = "isSharedWithAllTenants",
value = "If application release is shared with all tenants it is eqal to 1 otherwise 0",
required = true)
private boolean isSharedWithAllTenants;
@ApiModelProperty(name = "metaData",
value = "Meta data of the application release",
required = true)
private String metaData;
@ApiModelProperty(name = "url",
value = "URL which is used for WEB-CLIP")
private String url;
@ApiModelProperty(name = "supportedOsVersions",
value = "ApplicationDTO release supported OS versions")
private String supportedOsVersions;
public String getReleaseType() {
return releaseType;
}
public void setReleaseType(String releaseType) {
this.releaseType = releaseType;
}
public void setIsSharedWithAllTenants(boolean isSharedWithAllTenants) {
this.isSharedWithAllTenants = isSharedWithAllTenants;
}
public void setMetaData(String metaData) {
this.metaData = metaData;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public boolean getIsSharedWithAllTenants() {
return isSharedWithAllTenants;
}
public String getMetaData() {
return metaData;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
public String getSupportedOsVersions() { return supportedOsVersions; }
public void setSupportedOsVersions(String supportedOsVersions) { this.supportedOsVersions = supportedOsVersions; }
}

View File

@ -0,0 +1,130 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.wso2.carbon.device.application.mgt.common.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
@ApiModel(value = "ApplicationWrapper", description = "ApplicationWrapper represents the an ApplicationDTO in ApplicationDTO Store")
public class ApplicationWrapper {
@ApiModelProperty(name = "name",
value = "Name of the application",
required = true)
private String name;
@ApiModelProperty(name = "description",
value = "Description of the application",
required = true)
private String description;
@ApiModelProperty(name = "appCategory",
value = "CategoryDTO of the application",
required = true,
example = "Educational, Gaming, Travel, Entertainment etc")
private String appCategory;
@ApiModelProperty(name = "type",
value = "Type of the application",
required = true,
example = "ENTERPRISE, PUBLIC, WEB, WEB_CLIP etc")
private String type;
@ApiModelProperty(name = "subType",
value = "Subscription type of the application",
required = true,
example = "PAID, FREE")
private String subType;
@ApiModelProperty(name = "paymentCurrency",
value = "Payment currency of the application",
required = true,
example = "$")
private String paymentCurrency;
@ApiModelProperty(name = "tags",
value = "List of application tags")
private List<String> tags;
@ApiModelProperty(name = "unrestrictedRoles",
value = "List of roles that users should have to access the application")
private List<String> unrestrictedRoles;
@ApiModelProperty(name = "deviceType",
value = "Related device type of the application",
required = true,
example = "IoS, Android, Arduino, RaspberryPi etc")
private String deviceType;
@ApiModelProperty(name = "applicationReleaseWrappers",
value = "List of application releases",
required = true)
private List<ApplicationReleaseWrapper> applicationReleaseWrappers;
public String getName() {
return name;
}
public void setName(String name) { this.name = name; }
public String getAppCategory() {
return appCategory;
}
public void setAppCategory(String appCategory) {
this.appCategory = appCategory;
}
public List<String> getTags() { return tags; }
public void setTags(List<String> tags) { this.tags = tags; }
public String getType() { return type; }
public void setType(String type) { this.type = type; }
public String getSubType() { return subType; }
public void setSubType(String subType) { this.subType = subType; }
public String getPaymentCurrency() { return paymentCurrency; }
public void setPaymentCurrency(String paymentCurrency) { this.paymentCurrency = paymentCurrency; }
public List<ApplicationReleaseWrapper> getApplicationReleaseWrappers() { return applicationReleaseWrappers; }
public void setApplicationReleaseWrappers(List<ApplicationReleaseWrapper> applicationReleaseWrappers) {
this.applicationReleaseWrappers = applicationReleaseWrappers; }
public List<String> getUnrestrictedRoles() { return unrestrictedRoles; }
public void setUnrestrictedRoles(List<String> unrestrictedRoles) { this.unrestrictedRoles = unrestrictedRoles; }
public String getDeviceType() { return deviceType; }
public void setDeviceType(String deviceType) { this.deviceType = deviceType; }
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
}

View File

@ -71,7 +71,6 @@
org.wso2.carbon.user.api.*,
org.wso2.carbon.ndatasource.core,
org.wso2.carbon,
javax.annotation,
org.xml.sax,
org.xml.sax.helpers,
org.apache.commons.io,
@ -197,6 +196,17 @@
<artifactId>commons-validator</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>3.2.7</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -44,6 +44,10 @@ public class Configuration {
private UIConfiguration uiConfiguration;
private List<String> appCategories;
private String artifactDownloadEndpoint;
@XmlElement(name = "DatasourceName", required = true)
public String getDatasourceName() {
return datasourceName;
@ -74,8 +78,7 @@ public class Configuration {
return lifecycleStates;
}
public void setLifecycleStates(
List<LifecycleState> lifecycleStates) {
public void setLifecycleStates(List<LifecycleState> lifecycleStates) {
this.lifecycleStates = lifecycleStates;
}
@ -87,5 +90,24 @@ public class Configuration {
public void setUiConfiguration(UIConfiguration uiConfiguration) {
this.uiConfiguration = uiConfiguration;
}
@XmlElement(name = "ArtifactDownloadEndpoint", required = true)
public String getArtifactDownloadEndpoint() {
return artifactDownloadEndpoint;
}
public void setArtifactDownloadEndpoint(String artifactDownloadEndpoint) {
this.artifactDownloadEndpoint = artifactDownloadEndpoint;
}
@XmlElementWrapper(name = "AppCategories")
@XmlElement(name = "Category")
public List<String> getAppCategories() {
return appCategories;
}
public void setAppCategories(List<String> appCategories) {
this.appCategories = appCategories;
}
}

View File

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

View File

@ -18,25 +18,26 @@
*/
package org.wso2.carbon.device.application.mgt.core.dao;
import org.wso2.carbon.device.application.mgt.common.ApplicationRelease;
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.Rating;
import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException;
import java.util.List;
/**
* This is responsible for Application Release related DAO operations.
* This is responsible for ApplicationDTO Release related DAO operations.
*/
public interface ApplicationReleaseDAO {
/**
* To create an Application release.
* To create an ApplicationDTO release.
*
* @param applicationRelease Application Release that need to be created.
* @param applicationRelease ApplicationDTO Release that need to be created.
* @return Unique ID of the relevant release.
* @throws ApplicationManagementDAOException Application Management DAO Exception.
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/
ApplicationRelease createRelease(ApplicationRelease applicationRelease, int appId, int tenantId) throws
ApplicationReleaseDTO createRelease(ApplicationReleaseDTO applicationRelease, int appId, int tenantId) throws
ApplicationManagementDAOException;
/**
@ -47,54 +48,54 @@ public interface ApplicationReleaseDAO {
* @param releaseType type of the release
* @param tenantId tenantId of the application
* @return ApplicationRelease for the particular version of the given application
* @throws ApplicationManagementDAOException Application Management DAO Exception.
* @return ApplicationReleaseDTO for the particular version of the given application
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/
ApplicationRelease getRelease(String applicationName,String applicationType, String versionName,
ApplicationReleaseDTO getRelease(String applicationName,String applicationType, String versionName,
String releaseType, int tenantId) throws
ApplicationManagementDAOException;
/**
* To get all the releases of a particular application.
*
* @param applicationId Id of the Application
* @param applicationId Id of the application
* @param tenantId tenant id of the application
* @return list of the application releases
* @throws ApplicationManagementDAOException Application Management DAO Exception.
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/
List<ApplicationRelease> getReleases(int applicationId, int tenantId) throws
List<ApplicationReleaseDTO> getReleases(int applicationId, int tenantId) throws
ApplicationManagementDAOException;
/**
* To get the release by state.
*
* @param appId Id of the Application
* @param appId Id of the ApplicationDTO
* @param tenantId tenant id of the application
* @param state state of the application
* @return list of the application releases
* @throws ApplicationManagementDAOException Application Management DAO Exception.
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/
List<ApplicationRelease> getReleaseByState(int appId, int tenantId, String state)
List<ApplicationReleaseDTO> getReleaseByState(int appId, int tenantId, String state)
throws ApplicationManagementDAOException;
/**
* To update an Application release.
* To update an ApplicationDTO release.
*
* @param applicationRelease ApplicationRelease that need to be updated.
* @param applicationRelease ApplicationReleaseDTO that need to be updated.
* @param applicationId Id of the application.
* @param tenantId Id of the tenant
* @return the updated Application Release
* @throws ApplicationManagementDAOException Application Management DAO Exception
* @return the updated ApplicationDTO Release
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception
*/
ApplicationRelease updateRelease(int applicationId, ApplicationRelease applicationRelease, int tenantId) throws
ApplicationReleaseDTO updateRelease(int applicationId, ApplicationReleaseDTO applicationRelease, int tenantId) throws
ApplicationManagementDAOException;
/**
* To update an Application release.
* @param uuid UUID of the ApplicationRelease that need to be updated.
* To update an ApplicationDTO release.
* @param uuid UUID of the ApplicationReleaseDTO that need to be updated.
* @param rating given stars for the application.
* @param ratedUsers number of users who has rated for the application release.
* @throws ApplicationManagementDAOException Application Management DAO Exception
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception
*/
void updateRatingValue(String uuid, double rating, int ratedUsers) throws ApplicationManagementDAOException;
@ -103,7 +104,7 @@ public interface ApplicationReleaseDAO {
*
* @param uuid UUID of the application Release.
* @param tenantId Tenant Id
* @throws ApplicationManagementDAOException Application Management DAO Exception.
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/
Rating getRating(String uuid, int tenantId) throws ApplicationManagementDAOException;
@ -111,9 +112,9 @@ public interface ApplicationReleaseDAO {
/**
* To delete a particular release.
*
* @param id ID of the Application which the release need to be deleted.
* @param version Version of the Application Release
* @throws ApplicationManagementDAOException Application Management DAO Exception.
* @param id ID of the ApplicationDTO which the release need to be deleted.
* @param version Version of the ApplicationDTO Release
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/
void deleteRelease(int id, String version) throws ApplicationManagementDAOException;
@ -123,9 +124,9 @@ public interface ApplicationReleaseDAO {
* @param applicationId ID of the application.
* @param releaseUuid UUID of the application release.
* @param tenantId Tenant Id
* @throws ApplicationManagementDAOException Application Management DAO Exception.
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/
ApplicationRelease getReleaseByIds(int applicationId, String releaseUuid, int tenantId) throws
ApplicationReleaseDTO getReleaseByIds(int applicationId, String releaseUuid, int tenantId) throws
ApplicationManagementDAOException;
/**
@ -134,7 +135,7 @@ public interface ApplicationReleaseDAO {
* @param appId ID of the application.
* @param uuid UUID of the application release.
* @param tenantId Tenant Id
* @throws ApplicationManagementDAOException Application Management DAO Exception.
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/
boolean verifyReleaseExistence(int appId, String uuid, int tenantId) throws ApplicationManagementDAOException;
@ -144,7 +145,7 @@ public interface ApplicationReleaseDAO {
* @param appId ID of the application.
* @param hashVal Hash value of the application release.
* @param tenantId Tenant Id
* @throws ApplicationManagementDAOException Application Management DAO Exception.
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/
boolean verifyReleaseExistenceByHash(int appId, String hashVal, int tenantId)
throws ApplicationManagementDAOException;
@ -167,4 +168,15 @@ public interface ApplicationReleaseDAO {
*/
boolean verifyReleaseExistenceByUuid(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 isActiveReleaseExisitForPackageName(String packageName, int tenantId) throws ApplicationManagementDAOException;
}

View File

@ -18,7 +18,7 @@
*/
package org.wso2.carbon.device.application.mgt.core.dao;
import org.wso2.carbon.device.application.mgt.common.LifecycleState;
import org.wso2.carbon.device.application.mgt.common.dto.LifecycleStateDTO;
import org.wso2.carbon.device.application.mgt.core.exception.LifeCycleManagementDAOException;
import java.util.List;
@ -35,7 +35,7 @@ public interface LifecycleStateDAO {
* @return Latest Lifecycle State for the given application release
* @throws LifeCycleManagementDAOException Lifecycle Management DAO Exception.
*/
LifecycleState 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.
@ -45,7 +45,7 @@ public interface LifecycleStateDAO {
* @return Latest Lifecycle State for the given application release
* @throws LifeCycleManagementDAOException Lifecycle Management DAO Exception.
*/
LifecycleState 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.
@ -54,25 +54,35 @@ public interface LifecycleStateDAO {
* @return Lifecycle States for the given application release
* @throws LifeCycleManagementDAOException Lifecycle Management DAO Exception.
*/
List<LifecycleState> getLifecycleStates(int appReleaseId) throws LifeCycleManagementDAOException;
List<LifecycleStateDTO> getLifecycleStates(int appReleaseId) throws LifeCycleManagementDAOException;
/**
* To add new lifecycle states for the given application release.
* @param uuid Id of the application release.
* @param appId Id of the application.
* @param state LifecycleState.
* @param state LifecycleStateDTO.
* @param tenantId Tenant id
*
* @throws LifeCycleManagementDAOException Lifecycle Management DAO Exception.
*/
void addLifecycleState(LifecycleState state, int appId, String uuid, int tenantId)
void addLifecycleState(LifecycleStateDTO state, int appId, String uuid, int tenantId)
throws LifeCycleManagementDAOException;
/**
* To delete a specific lifecycle state for application release.
* @param identifier Id of the LifecycleState.
* @param identifier Id of the LifecycleStateDTO.
*
* @throws LifeCycleManagementDAOException Lifecycle Management DAO Exception.
*/
void deleteLifecycleState(int identifier) throws LifeCycleManagementDAOException;
}
/***
*
* @param appId ID of the application
* @param uuid UUID of the application release
* @return Username of the application release creator
* @throws LifeCycleManagementDAOException {@link LifeCycleManagementDAOException}
*/
String getAppReleaseCreatedUsername(int appId, String uuid, int tenantId) throws LifeCycleManagementDAOException;
}

View File

@ -18,7 +18,8 @@
*/
package org.wso2.carbon.device.application.mgt.core.dao;
import org.wso2.carbon.device.application.mgt.common.Application;
import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
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.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup;
@ -37,8 +38,8 @@ public interface SubscriptionDAO {
* @param tenantId id of the tenant
* @param subscribedBy username of the user who subscribe the application
* @param deviceList List of {@link Device} which the application is installed on
* @param appId id of the {@link Application} which installs
* @param releaseId id of the {@link org.wso2.carbon.device.application.mgt.common.ApplicationRelease}
* @param appId id of the {@link ApplicationDTO} which installs
* @param releaseId id of the {@link ApplicationReleaseDTO}
* @throws ApplicationManagementDAOException If unable to add a mapping between device and application
*/
void subscribeDeviceToApplication(int tenantId, String subscribedBy, List<Device> deviceList, int appId,
@ -51,8 +52,8 @@ public interface SubscriptionDAO {
* @param tenantId id of the tenant
* @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 appId id of the {@link Application} which installs
* @param releaseId id of the {@link org.wso2.carbon.device.application.mgt.common.ApplicationRelease}
* @param appId id of the {@link ApplicationDTO} which installs
* @param releaseId id of the {@link ApplicationReleaseDTO}
* @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)
@ -65,8 +66,8 @@ public interface SubscriptionDAO {
* @param tenantId id of the tenant
* @param subscribedBy username of the user who subscribe the application
* @param roleList list of roles which belongs devices are subscribed to the application
* @param appId id of the {@link Application} which installs
* @param releaseId id of the {@link org.wso2.carbon.device.application.mgt.common.ApplicationRelease}
* @param appId id of the {@link ApplicationDTO} which installs
* @param releaseId id of the {@link ApplicationReleaseDTO}
* @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)
@ -79,8 +80,8 @@ public interface SubscriptionDAO {
* @param tenantId id of the tenant
* @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 appId id of the {@link Application} which installs
* @param releaseId id of the {@link org.wso2.carbon.device.application.mgt.common.ApplicationRelease}
* @param appId id of the {@link ApplicationDTO} which installs
* @param releaseId id of the {@link ApplicationReleaseDTO}
* @throws ApplicationManagementDAOException If unable to add a mapping between device and application
*/
void subscribeGroupToApplication(int tenantId, String subscribedBy, List<DeviceGroup> groupList, int appId,

View File

@ -22,10 +22,10 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.json.JSONException;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.application.mgt.common.*;
import org.wso2.carbon.device.application.mgt.common.Application;
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.dto.ApplicationReleaseDTO;
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.ApplicationStorageManager;
@ -47,6 +47,66 @@ public class Util {
private static final Log log = LogFactory.getLog(Util.class);
// /**
// * To create application object from the result set retrieved from the Database.
// *
// * @param rs ResultSet
// * @return List of Applications that is retrieved from the Database.
// * @throws SQLException SQL Exception
// * @throws JSONException JSONException.
// */
// public static List<ApplicationDTO> loadApplications(ResultSet rs) throws SQLException, JSONException {
//
// List<ApplicationDTO> applications = new ArrayList<>();
// ApplicationDTO application = null;
// int applicationId = -1;
// boolean hasNext = rs.next();
//
// while (hasNext) {
// if (applicationId != rs.getInt("APP_ID")) {
// if (application != null) {
// applications.add(application);
// }
// applicationId = rs.getInt("APP_ID");
// application = new ApplicationDTO();
// application.setTags(new ArrayList<>());
// application.setUnrestrictedRoles(new ArrayList<>());
// application.setId(applicationId);
// application.setName(rs.getString("APP_NAME"));
// application.setType(rs.getString("APP_TYPE"));
// application.setAppCategory(rs.getString("APP_CATEGORY"));
// application.setSubType(rs.getString("SUB_TYPE"));
// application.setPaymentCurrency(rs.getString("CURRENCY"));
// application.setIsRestricted(rs.getBoolean("RESTRICTED"));
// application.setStatus(rs.getString("STATUS"));
// String tag = rs.getString("APP_TAG");
// String unrestrictedRole = rs.getString("ROLE");
// if (tag != null) {
// application.getTags().add(tag);
// }
// if (unrestrictedRole != null) {
// application.getUnrestrictedRoles().add(unrestrictedRole);
// }
// } else {
// String tag = rs.getString("APP_TAG");
// String unrestrictedRole = rs.getString("ROLE");
// if (application != null) {
// if (tag != null && !application.getTags().contains(tag)) {
// application.getTags().add(tag);
// }
// if (unrestrictedRole != null && !application.getUnrestrictedRoles().contains(unrestrictedRole)) {
// application.getUnrestrictedRoles().add(unrestrictedRole);
// }
// }
// }
// hasNext = rs.next();
// if (!hasNext) {
// applications.add(application);
// }
// }
// return applications;
// }
/**
* To create application object from the result set retrieved from the Database.
*
@ -55,10 +115,10 @@ public class Util {
* @throws SQLException SQL Exception
* @throws JSONException JSONException.
*/
public static List<Application> loadApplications(ResultSet rs) throws SQLException, JSONException {
public static List<ApplicationDTO> loadApplications(ResultSet rs) throws SQLException, JSONException {
List<Application> applications = new ArrayList<>();
Application application = null;
List<ApplicationDTO> applications = new ArrayList<>();
ApplicationDTO application = null;
int applicationId = -1;
boolean hasNext = rs.next();
@ -67,35 +127,37 @@ public class Util {
if (application != null) {
applications.add(application);
}
application = new ApplicationDTO();
application.setApplicationReleases(new ArrayList<>());
applicationId = rs.getInt("APP_ID");
application = new Application();
application.setTags(new ArrayList<>());
application.setUnrestrictedRoles(new ArrayList<>());
application.setId(applicationId);
application.setName(rs.getString("APP_NAME"));
application.setDescription(rs.getString("APP_DESCRIPTION"));
application.setType(rs.getString("APP_TYPE"));
application.setAppCategory(rs.getString("APP_CATEGORY"));
application.setSubType(rs.getString("SUB_TYPE"));
application.setPaymentCurrency(rs.getString("CURRENCY"));
application.setIsRestricted(rs.getBoolean("RESTRICTED"));
String tag = rs.getString("APP_TAG");
String unrestrictedRole = rs.getString("ROLE");
if (tag != null) {
application.getTags().add(tag);
}
if (unrestrictedRole != null) {
application.getUnrestrictedRoles().add(unrestrictedRole);
}
application.setSubType(rs.getString("APP_SUB_TYPE"));
application.setPaymentCurrency(rs.getString("APP_CURRENCY"));
application.setStatus(rs.getString("APP_STATUS"));
application.setAppRating(rs.getInt("APP_RATING"));
application.setDeviceTypeId(rs.getInt("APP_DEVICE_TYPE_ID"));
} else {
String tag = rs.getString("APP_TAG");
String unrestrictedRole = rs.getString("ROLE");
if (application != null) {
if (tag != null && !application.getTags().contains(tag)) {
application.getTags().add(tag);
}
if (unrestrictedRole != null && !application.getUnrestrictedRoles().contains(unrestrictedRole)) {
application.getUnrestrictedRoles().add(unrestrictedRole);
}
ApplicationReleaseDTO appRelease = new ApplicationReleaseDTO();
appRelease.setDescription(rs.getString("RELEASE_DESCRIPTION"));
appRelease.setUuid(rs.getString("RELEASE_UUID"));
appRelease.setReleaseType(rs.getString("RELEASE_TYPE"));
appRelease.setVersion(rs.getString("RELEASE_VERSION"));
appRelease.setInstallerName(rs.getString("AP_RELEASE_STORED_LOC"));
appRelease.setBannerName(rs.getString("RELEASE_BANNER_LOC"));
appRelease.setScreenshotName1("RELEASE_SC1");
appRelease.setScreenshotName2("RELEASE_SC2");
appRelease.setScreenshotName3("RELEASE_SC3");
appRelease.setPrice(rs.getDouble(" RELEASE_PRICE"));
appRelease.setMetaData(rs.getString("RELEASE_META_INFO"));
appRelease.setSupportedOsVersions(rs.getString("RELEASE_SUP_OS_VERSIONS"));
appRelease.setRating(rs.getDouble("RELEASE_RATING"));
appRelease.setCurrentState(rs.getString("RELEASE_CURRENT_STATE"));
appRelease.setRatedUsers(rs.getInt("RATED_USER_COUNT"));
if (application != null && application.getApplicationReleases() != null) {
application.getApplicationReleases().add(appRelease);
}
}
hasNext = rs.next();
@ -111,19 +173,19 @@ public class Util {
* To create application object from the result set retrieved from the Database.
*
* @param rs ResultSet
* @return Application that is retrieved from the Database.
* @return ApplicationDTO that is retrieved from the Database.
* @throws SQLException SQL Exception
* @throws JSONException JSONException.
*/
public static Application loadApplication(ResultSet rs) throws SQLException, JSONException {
public static ApplicationDTO loadApplication(ResultSet rs) throws SQLException, JSONException {
Application application = null;
ApplicationDTO application = null;
int applicatioId;
int iteration = 0;
if (rs != null) {
while (rs.next()) {
if (iteration == 0) {
application = new Application();
application = new ApplicationDTO();
application.setTags(new ArrayList<>());
application.setUnrestrictedRoles(new ArrayList<>());
applicatioId = rs.getInt("APP_ID");
@ -133,7 +195,7 @@ public class Util {
application.setAppCategory(rs.getString("APP_CATEGORY"));
application.setSubType(rs.getString("SUB_TYPE"));
application.setPaymentCurrency(rs.getString("CURRENCY"));
application.setIsRestricted(rs.getBoolean("RESTRICTED"));
// application.setIsRestricted(rs.getBoolean("RESTRICTED"));
application.setDeviceTypeId(rs.getInt("DEVICE_TYPE_ID"));
}
@ -153,28 +215,28 @@ public class Util {
}
/**
* Populates {@link ApplicationRelease} 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
* @return {@link ApplicationRelease} object populated with the data
* @throws SQLException If unable to populate {@link ApplicationRelease} object with the data
* @return {@link ApplicationReleaseDTO} object populated with the data
* @throws SQLException If unable to populate {@link ApplicationReleaseDTO} object with the data
*/
public static ApplicationRelease loadApplicationRelease(ResultSet resultSet) throws SQLException {
ApplicationRelease applicationRelease = new ApplicationRelease();
public static ApplicationReleaseDTO loadApplicationRelease(ResultSet resultSet) throws SQLException {
ApplicationReleaseDTO applicationRelease = new ApplicationReleaseDTO();
applicationRelease.setId(resultSet.getInt("RELEASE_ID"));
applicationRelease.setVersion(resultSet.getString("RELEASE_VERSION"));
applicationRelease.setUuid(resultSet.getString("UUID"));
applicationRelease.setReleaseType(resultSet.getString("RELEASE_TYPE"));
applicationRelease.setPackageName(resultSet.getString("PACKAGE_NAME"));
applicationRelease.setPrice(resultSet.getDouble("APP_PRICE"));
applicationRelease.setAppStoredLoc(resultSet.getString("STORED_LOCATION"));
applicationRelease.setBannerLoc(resultSet.getString("BANNER_LOCATION"));
applicationRelease.setIconLoc(resultSet.getString("ICON_LOCATION"));
applicationRelease.setScreenshotLoc1(resultSet.getString("SCREEN_SHOT_1"));
applicationRelease.setScreenshotLoc2(resultSet.getString("SCREEN_SHOT_2"));
applicationRelease.setScreenshotLoc3(resultSet.getString("SCREEN_SHOT_3"));
applicationRelease.setInstallerName(resultSet.getString("STORED_LOCATION"));
applicationRelease.setBannerName(resultSet.getString("BANNER_LOCATION"));
applicationRelease.setIconName(resultSet.getString("ICON_LOCATION"));
applicationRelease.setScreenshotName1(resultSet.getString("SCREEN_SHOT_1"));
applicationRelease.setScreenshotName2(resultSet.getString("SCREEN_SHOT_2"));
applicationRelease.setScreenshotName3(resultSet.getString("SCREEN_SHOT_3"));
applicationRelease.setAppHashValue(resultSet.getString("HASH_VALUE"));
applicationRelease.setIsSharedWithAllTenants(resultSet.getInt("SHARED"));
applicationRelease.setIsSharedWithAllTenants(resultSet.getBoolean("SHARED"));
applicationRelease.setMetaData(resultSet.getString("APP_META_INFO"));
applicationRelease.setRating(resultSet.getDouble("RATING"));
return applicationRelease;
@ -212,7 +274,7 @@ public class Util {
commentManagementConfig.getPaginationConfiguration().getCommentListPageSize());
} else {
throw new ReviewManagementException(
"Application 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;
@ -230,7 +292,7 @@ public class Util {
applicationManager =
(ApplicationManager) ctx.getOSGiService(ApplicationManager.class, null);
if (applicationManager == null) {
String msg = "Application Manager service has not initialized.";
String msg = "ApplicationDTO Manager service has not initialized.";
log.error(msg);
throw new IllegalStateException(msg);
}
@ -241,7 +303,7 @@ public class Util {
}
/**
* To get the Application Storage Manager from the osgi context.
* To get the ApplicationDTO Storage Manager from the osgi context.
* @return ApplicationStoreManager instance in the current osgi context.
*/
public static ApplicationStorageManager getApplicationStorageManager() {
@ -252,7 +314,7 @@ public class Util {
applicationStorageManager = (ApplicationStorageManager) ctx
.getOSGiService(ApplicationStorageManager.class, null);
if (applicationStorageManager == null) {
String msg = "Application Storage Manager service has not initialized.";
String msg = "ApplicationDTO Storage Manager service has not initialized.";
log.error(msg);
throw new IllegalStateException(msg);
}

View File

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

View File

@ -22,12 +22,13 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.json.JSONException;
import org.wso2.carbon.device.application.mgt.common.AppLifecycleState;
import org.wso2.carbon.device.application.mgt.common.Application;
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.ApplicationRelease;
import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO;
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.Pagination;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException;
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.core.dao.ApplicationDAO;
import org.wso2.carbon.device.application.mgt.core.dao.common.Util;
@ -41,6 +42,7 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.StringJoiner;
/**
* This handles ApplicationDAO related operations.
@ -50,12 +52,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
private static final Log log = LogFactory.getLog(GenericApplicationDAOImpl.class);
@Override
public int createApplication(Application application, int deviceId) throws ApplicationManagementDAOException {
public int createApplication(ApplicationDTO application, int tenantId) throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to create an application");
log.debug("Application Details : ");
log.debug("App Name : " + application.getName() + " App Type : "
+ application.getType() + " User Name : " + application.getUser().getUserName());
log.debug("ApplicationDTO Details : ");
log.debug("App Name : " + application.getName() + " App Type : " + application.getType());
}
Connection conn;
PreparedStatement stmt = null;
@ -63,16 +64,19 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
int applicationId = -1;
try {
conn = this.getDBConnection();
stmt = conn.prepareStatement("INSERT INTO AP_APP (NAME, TYPE, APP_CATEGORY, SUB_TYPE, RESTRICTED, "
+ "TENANT_ID, DEVICE_TYPE_ID) VALUES (?, ?, ?, ?, ?, ?, ?)",
Statement.RETURN_GENERATED_KEYS);
stmt = conn.prepareStatement("INSERT INTO AP_APP "
+ "(NAME, "
+ "DESCRIPTION, "
+ "TYPE, "
+ "SUB_TYPE, "
+ "TENANT_ID, "
+ "DEVICE_TYPE_ID) VALUES (?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS);
stmt.setString(1, application.getName());
stmt.setString(2, application.getType());
stmt.setString(3, application.getAppCategory());
stmt.setString(2, application.getDescription());
stmt.setString(3, application.getType());
stmt.setString(4, application.getSubType());
stmt.setBoolean(5, application.getIsRestricted());
stmt.setInt(6, application.getUser().getTenantId());
stmt.setInt(7, deviceId);
stmt.setInt(5, tenantId);
stmt.setInt(6, application.getDeviceTypeId());
stmt.executeUpdate();
rs = stmt.getGeneratedKeys();
@ -80,7 +84,6 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
applicationId = rs.getInt(1);
}
return applicationId;
} catch (DBConnectionException e) {
throw new ApplicationManagementDAOException(
"Error occurred while obtaining the DB connection when application creation", e);
@ -121,6 +124,117 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
}
// @Override
// public ApplicationList getApplications(Filter filter, int tenantId) throws ApplicationManagementDAOException {
// if (log.isDebugEnabled()) {
// log.debug("Getting application data from the database");
// log.debug(String.format("Filter: limit=%s, offset=%s", filter.getLimit(), filter.getOffset()));
// }
// int paramIndex = 1;
// Connection conn;
// PreparedStatement stmt = null;
// ResultSet rs = null;
// ApplicationList applicationList = new ApplicationList();
// Pagination pagination = new Pagination();
// String sql = "SELECT "
// + "AP_APP.ID AS APP_ID,"
// + " AP_APP.NAME AS APP_NAME,"
// + " AP_APP.TYPE AS APP_TYPE,"
// + " AP_APP.APP_CATEGORY AS APP_CATEGORY,"
// + " AP_APP.SUB_TYPE AS SUB_TYPE,"
// + " AP_APP.CURRENCY AS CURRENCY, "
// + "AP_APP.RESTRICTED AS RESTRICTED,"
// + " AP_APP_TAG.TAG AS APP_TAG,"
// + " AP_UNRESTRICTED_ROLE.ROLE AS ROLE "
// + "FROM ((AP_APP LEFT JOIN AP_APP_TAG ON AP_APP.ID = AP_APP_TAG.AP_APP_ID) "
// + "LEFT JOIN AP_UNRESTRICTED_ROLE ON AP_APP.ID = AP_UNRESTRICTED_ROLE.AP_APP_ID) "
// + "WHERE AP_APP.TENANT_ID = ?";
//
//
// if (filter == null) {
// throw new ApplicationManagementDAOException("Filter need to be instantiated");
// }
// if (filter.getAppType() != null && !filter.getAppType().isEmpty()) {
// sql += " AND AP_APP.TYPE ";
// sql += "= ?";
// }
// if (filter.getAppCategory() != null && !filter.getAppCategory().isEmpty()) {
// sql += " AND AP_APP.APP_CATEGORY ";
// sql += "= ?";
// }
// if (filter.getAppName() != null && !filter.getAppName().isEmpty()) {
// sql += " AND LOWER (AP_APP.NAME) ";
// if (filter.isFullMatch()) {
// sql += "= ?";
// } else {
// sql += "LIKE ?";
// }
// }
// if (filter.getDeviceTypeName() != null ) {
// sql += " AND AP_APP.DEVICE_TYPE_ID ";
// sql += "= ?";
// }
//
// String defaultSortOrder = "ASC";
// if (filter.getSortBy() != null && !filter.getSortBy().isEmpty()) {
// defaultSortOrder = filter.getSortBy();
// }
// sql += " ORDER BY APP_ID " + defaultSortOrder +" LIMIT ? OFFSET ? ";
//
// pagination.setLimit(filter.getLimit());
// pagination.setOffset(filter.getOffset());
//
// try {
// conn = this.getDBConnection();
// stmt = conn.prepareStatement(sql);
// stmt.setInt(paramIndex++, tenantId);
//
// if (filter.getAppType() != null && !filter.getAppType().isEmpty()) {
// stmt.setString(paramIndex++, filter.getAppType());
// }
// if (filter.getAppCategory() != null && !filter.getAppCategory().isEmpty()) {
// stmt.setString(paramIndex++, filter.getAppCategory());
// }
// if (filter.getAppName() != null && !filter.getAppName().isEmpty()) {
// if (filter.isFullMatch()) {
// stmt.setString(paramIndex++, filter.getAppName().toLowerCase());
// } else {
// stmt.setString(paramIndex++, "%" + filter.getAppName().toLowerCase() + "%");
// }
// }
// if (filter.getDeviceTypeName() != null ) {
// stmt.setInt(paramIndex++, filter.getDeviceTypeName().getId());
// }
//
//
// if (filter.getLimit() == 0) {
// stmt.setInt(paramIndex++, 100);
// } else {
// stmt.setInt(paramIndex++, filter.getLimit());
// }
// stmt.setInt(paramIndex, filter.getOffset());
// rs = stmt.executeQuery();
// applicationList.setApplications(Util.loadApplications(rs));
// applicationList.setPagination(pagination);
// applicationList.getPagination().setSize(filter.getOffset());
// applicationList.getPagination().setCount(applicationList.getApplications().size());
//
// } catch (SQLException e) {
// throw new ApplicationManagementDAOException("Error occurred while getting application list for the tenant"
// + " " + tenantId + ". While executing " + sql, e);
// } catch (DBConnectionException e) {
// throw new ApplicationManagementDAOException("Error occurred while obtaining the DB connection while "
// + "getting application list for the tenant " + tenantId,
// e);
// } catch (JSONException e) {
// throw new ApplicationManagementDAOException("Error occurred while parsing JSON ", e);
// } finally {
// Util.cleanupResources(stmt, rs);
// }
// return applicationList;
// }
@Override
public ApplicationList getApplications(Filter filter, int tenantId) throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
@ -133,28 +247,48 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
ResultSet rs = null;
ApplicationList applicationList = new ApplicationList();
Pagination pagination = new Pagination();
String sql = "SELECT AP_APP.ID AS APP_ID, AP_APP.NAME AS APP_NAME, AP_APP.TYPE AS APP_TYPE, AP_APP.APP_CATEGORY"
+ " AS APP_CATEGORY, AP_APP.SUB_TYPE AS SUB_TYPE, AP_APP.CURRENCY AS CURRENCY, "
+ "AP_APP.RESTRICTED AS RESTRICTED, AP_APP_TAG.TAG AS APP_TAG, AP_UNRESTRICTED_ROLE.ROLE "
+ "AS ROLE FROM ((AP_APP LEFT JOIN AP_APP_TAG ON AP_APP.ID = AP_APP_TAG.AP_APP_ID) "
+ "LEFT JOIN AP_UNRESTRICTED_ROLE ON AP_APP.ID = AP_UNRESTRICTED_ROLE.AP_APP_ID) "
+ "WHERE AP_APP.TENANT_ID = ? AND AP_APP.STATUS != ?";
String sql = "SELECT "
+ "AP_APP.ID AS APP_ID, "
+ "AP_APP.NAME AS APP_NAME, "
+ "AP_APP.DESCRIPTION AS APP_DESCRIPTION, "
+ "AP_APP.TYPE AS APP_TYPE, "
+ "AP_APP.STATUS AS APP_STATUS, "
+ "AP_APP.SUB_TYPE AS APP_SUB_TYPE, "
+ "AP_APP.CURRENCY AS APP_CURRENCY, "
+ "AP_APP.RATING AS APP_RATING, "
+ "AP_APP.DEVICE_TYPE_ID AS APP_DEVICE_TYPE_ID, "
+ "AP_APP_RELEASE.DESCRIPTION AS RELEASE_DESCRIPTION, "
+ "AP_APP_RELEASE.VERSION AS RELEASE_VERSION, "
+ "AP_APP_RELEASE.UUID AS RELEASE_UUID, "
+ "AP_APP_RELEASE.RELEASE_TYPE AS RELEASE_TYPE, "
+ "AP_APP_RELEASE.INSTALLER_LOCATION AS AP_RELEASE_STORED_LOC, "
+ "AP_APP_RELEASE.BANNER_LOCATION AS AP_RELEASE_BANNER_LOC, "
+ "AP_APP_RELEASE.SC_1_LOCATION AS AP_RELEASE_SC1, "
+ "AP_APP_RELEASE.SC_2_LOCATION AS AP_RELEASE_SC2, "
+ "AP_APP_RELEASE.SC_3_LOCATION AS AP_RELEASE_SC3, "
+ "AP_APP_RELEASE.APP_PRICE AS RELEASE_PRICE, "
+ "AP_APP_RELEASE.APP_META_INFO AS RELEASE_META_INFO, "
+ "AP_APP_RELEASE.SUPPORTED_OS_VERSIONS AS RELEASE_SUP_OS_VERSIONS, "
+ "AP_APP_RELEASE.RATING AS RELEASE_RATING, "
+ "AP_APP_RELEASE.CURRENT_STATE AS RELEASE_CURRENT_STATE, "
+ "AP_APP_RELEASE.RATED_USERS AS RATED_USER_COUNT "
+ "FROM AP_APP "
+ "INNER JOIN AP_APP_RELEASE ON "
+ "AP_APP.ID = AP_APP_RELEASE.AP_APP_ID AND "
+ "AP_APP.TENANT_ID = ? AND "
+ "AP_APP.TENANT_ID = AP_APP_RELEASE.TENANT_ID";
if (filter == null) {
throw new ApplicationManagementDAOException("Filter need to be instantiated");
}
if (filter.getAppType() != null && !filter.getAppType().isEmpty()) {
sql += " AND AP_APP.TYPE ";
sql += "= ?";
}
if (filter.getAppCategory() != null && !filter.getAppCategory().isEmpty()) {
sql += " AND AP_APP.APP_CATEGORY ";
sql += "= ?";
}
if (filter.getAppName() != null && !filter.getAppName().isEmpty()) {
sql += " AND LOWER (AP_APP.NAME) ";
if (filter.isFullMatch()) {
@ -163,6 +297,10 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
sql += "LIKE ?";
}
}
if (filter.getDeviceTypeId() > 0 ) {
sql += " AND AP_APP.DEVICE_TYPE_ID ";
sql += "= ?";
}
String defaultSortOrder = "ASC";
if (filter.getSortBy() != null && !filter.getSortBy().isEmpty()) {
@ -177,7 +315,6 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
conn = this.getDBConnection();
stmt = conn.prepareStatement(sql);
stmt.setInt(paramIndex++, tenantId);
stmt.setString(paramIndex++, AppLifecycleState.REMOVED.toString());
if (filter.getAppType() != null && !filter.getAppType().isEmpty()) {
stmt.setString(paramIndex++, filter.getAppType());
@ -192,6 +329,10 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
stmt.setString(paramIndex++, "%" + filter.getAppName().toLowerCase() + "%");
}
}
if (filter.getDeviceTypeId() > 0 ) {
stmt.setInt(paramIndex++, filter.getDeviceTypeId());
}
if (filter.getLimit() == 0) {
stmt.setInt(paramIndex++, 100);
@ -207,11 +348,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (SQLException e) {
throw new ApplicationManagementDAOException("Error occurred while getting application list for the tenant"
+ " " + tenantId + ". While executing " + sql, e);
+ " " + tenantId + ". While executing " + sql, e);
} catch (DBConnectionException e) {
throw new ApplicationManagementDAOException("Error occurred while obtaining the DB connection while "
+ "getting application list for the tenant " + tenantId,
e);
+ "getting application list for the tenant " + tenantId,
e);
} catch (JSONException e) {
throw new ApplicationManagementDAOException("Error occurred while parsing JSON ", e);
} finally {
@ -301,7 +442,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
@Override
public Application getApplication(String appName, String appType, int tenantId) throws
public ApplicationDTO getApplication(String appName, String appType, int tenantId) throws
ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Getting application with the type(" + appType + " and Name " + appName +
@ -346,7 +487,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
@Override
public Application getApplicationById(String id, int tenantId) throws
public ApplicationDTO getApplicationById(String id, int tenantId) throws
ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Getting application with the id:" + id);
@ -388,7 +529,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
@Override
public Application getApplicationByUUID(String releaseUuid, int tenantId) throws
public ApplicationDTO getApplicationByUUID(String releaseUuid, int tenantId) throws
ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Getting application with the release UUID: " + releaseUuid + " from the database");
@ -435,7 +576,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
@Override
public Application getApplicationById(int applicationId, int tenantId) throws
public ApplicationDTO getApplicationById(int applicationId, int tenantId) throws
ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Getting application with the id (" + applicationId + ") from the database");
@ -514,14 +655,14 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
@Override
public Application editApplication(Application application, int tenantId) throws ApplicationManagementException {
public ApplicationDTO editApplication(ApplicationDTO application, int tenantId) throws ApplicationManagementDAOException {
int paramIndex = 1;
Connection conn;
PreparedStatement stmt = null;
Application existingApplication = this.getApplicationById(application.getId(), tenantId);
ApplicationDTO existingApplication = this.getApplicationById(application.getId(), tenantId);
if (existingApplication == null) {
throw new ApplicationManagementException("There doesn't have an application for updating");
throw new ApplicationManagementDAOException("There doesn't have an application for updating");
}
try {
conn = this.getDBConnection();
@ -537,9 +678,9 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
existingApplication.getAppCategory())) {
sql += "APP_CATEGORY = ?, ";
}
if (application.getIsRestricted() != existingApplication.getIsRestricted()) {
sql += "RESTRICTED = ? ";
}
// if (application.getIsRestricted() != existingApplication.getIsRestricted()) {
// sql += "RESTRICTED = ? ";
// }
if (!application.getSubType().equals(existingApplication.getSubType())) {
sql += "SUB_TYPE = ? ";
}
@ -557,9 +698,9 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
existingApplication.getAppCategory())) {
stmt.setString(paramIndex++, application.getAppCategory());
}
if (application.getIsRestricted() != existingApplication.getIsRestricted()) {
stmt.setBoolean(paramIndex++, application.getIsRestricted());
}
// if (application.getIsRestricted() != existingApplication.getIsRestricted()) {
// stmt.setBoolean(paramIndex++, application.getIsRestricted());
// }
if (!application.getSubType().equals(existingApplication.getSubType())) {
stmt.setString(paramIndex++, application.getSubType());
}
@ -597,21 +738,22 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
@Override
public void addTags(List<String> tags, int applicationId, int tenantId) throws ApplicationManagementDAOException {
public void addTags(List<String> tags, int tenantId) throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to add tags");
}
Connection conn;
PreparedStatement stmt = null;
String sql = "INSERT INTO AP_APP_TAG (TAG, TENANT_ID, AP_APP_ID) VALUES (?, ?, ?)";
String sql = "INSERT INTO AP_APP_TAG "
+ "(TAG,"
+ " TENANT_ID) "
+ "VALUES (?, ?)";
try {
conn = this.getDBConnection();
conn.setAutoCommit(false);
stmt = conn.prepareStatement(sql);
for (String tag : tags) {
stmt.setString(1, tag);
stmt.setInt(2, tenantId);
stmt.setInt(3, applicationId);
stmt.addBatch();
}
stmt.executeBatch();
@ -626,6 +768,211 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
}
@Override
public List<TagDTO> getAllTags(int tenantId) throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to get all tags");
}
Connection conn;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
List<TagDTO> tagEntities = new ArrayList<>();
String sql = "SELECT "
+ "AP_APP_TAG.ID AS ID, "
+ "AP_APP_TAG.TAG AS TAG "
+ "FROM AP_APP_TAG "
+ "WHERE TENANT_ID = ?";
conn = this.getDBConnection();
stmt = conn.prepareStatement(sql);
stmt.setInt(1, tenantId);
rs = stmt.executeQuery();
while(rs.next()){
TagDTO tagDTO = new TagDTO();
tagDTO.setId(rs.getInt("ID"));
tagDTO.setTagName(rs.getString("TAG"));
tagEntities.add(tagDTO);
}
return tagEntities;
} catch (DBConnectionException e) {
throw new ApplicationManagementDAOException(
"Error occurred while obtaining the DB connection when adding tags", e);
} catch (SQLException e) {
throw new ApplicationManagementDAOException("Error occurred while adding tags", e);
} finally {
Util.cleanupResources(stmt, rs);
}
}
@Override
public List<CategoryDTO> getAllCategories(int tenantId) throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to get all tags");
}
Connection conn;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
List<CategoryDTO> categories = new ArrayList<>();
String sql = "SELECT "
+ "AP_APP_CATEGORY.ID AS ID, "
+ "AP_APP_CATEGORY.CATEGORY AS CATEGORY "
+ "FROM AP_APP_CATEGORY "
+ "WHERE TENANT_ID = ?";
conn = this.getDBConnection();
stmt = conn.prepareStatement(sql);
stmt.setInt(1, tenantId);
rs = stmt.executeQuery();
while(rs.next()){
CategoryDTO category = new CategoryDTO();
category.setId(rs.getInt("ID"));
category.setCategoryName(rs.getString("CATEGORY"));
categories.add(category);
}
return categories;
} catch (DBConnectionException e) {
throw new ApplicationManagementDAOException(
"Error occurred while obtaining the DB connection when getting categories", e);
} catch (SQLException e) {
throw new ApplicationManagementDAOException("Error occurred while getting categories", e);
} finally {
Util.cleanupResources(stmt, rs);
}
}
@Override
public void addCategories(List<String> categories, int tenantId) throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to add tags");
}
Connection conn;
PreparedStatement stmt = null;
String sql = "INSERT INTO AP_APP_CATEGORY "
+ "(CATEGORY,"
+ " TENANT_ID) "
+ "VALUES (?, ?)";
try {
conn = this.getDBConnection();
stmt = conn.prepareStatement(sql);
for (String category : categories) {
stmt.setString(1, category);
stmt.setInt(2, tenantId);
stmt.addBatch();
}
stmt.executeBatch();
} catch (DBConnectionException e) {
throw new ApplicationManagementDAOException(
"Error occurred while obtaining the DB connection when adding categories.", e);
} catch (SQLException e) {
throw new ApplicationManagementDAOException("Error occurred while adding categories.", e);
} finally {
Util.cleanupResources(stmt, null);
}
}
@Override
public void addCategoryMapping (List<Integer> categoryIds, int applicationId, int tenantId) throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to add categories");
}
Connection conn;
PreparedStatement stmt = null;
String sql = "INSERT INTO AP_APP_CATEGORY_MAPPING "
+ "(AP_APP_CATEGORY_ID, "
+ "AP_APP_ID, "
+ " TENANT_ID) "
+ "VALUES (?, ?, ?)";
try {
conn = this.getDBConnection();
stmt = conn.prepareStatement(sql);
for (Integer categoryId : categoryIds) {
stmt.setInt(1, categoryId);
stmt.setInt(2, applicationId);
stmt.setInt(3, tenantId);
stmt.addBatch();
}
stmt.executeBatch();
} catch (DBConnectionException e) {
throw new ApplicationManagementDAOException(
"Error occurred while obtaining the DB connection when adding data into category mapping.", e);
} catch (SQLException e) {
throw new ApplicationManagementDAOException("Error occurred while adding data into category mapping.", e);
} finally {
Util.cleanupResources(stmt, null);
}
}
@Override
public List<Integer> getTagIdsForTagNames(List<String> tagNames, int tenantId)
throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to get tag ids for given tag names");
}
try {
Connection conn = this.getDBConnection();
int index = 1;
List<Integer> tagIds = new ArrayList<>();
StringJoiner joiner = new StringJoiner(",",
"SELECT AP_APP_TAG.ID AS ID FROM AP_APP_TAG WHERE AP_APP_TAG.TAG IN (", ") AND TENANT_ID = ?");
tagNames.stream().map(ignored -> "?").forEach(joiner::add);
String query = joiner.toString();
try (PreparedStatement ps = conn.prepareStatement(query)) {
for (String tagName : tagNames) {
ps.setObject(index++, tagName);
}
ps.setInt(index, tenantId);
try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) {
tagIds.add(rs.getInt("ID"));
}
}
}
return tagIds;
} catch (DBConnectionException e) {
throw new ApplicationManagementDAOException(
"Error occurred while obtaining the DB connection when adding tags", e);
} catch (SQLException e) {
throw new ApplicationManagementDAOException("Error occurred while adding tags", e);
}
}
public void addTagMapping (List<Integer> tagIds, int applicationId, int tenantId) throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Request received in DAO Layer to add tags");
}
Connection conn;
PreparedStatement stmt = null;
String sql = "INSERT INTO AP_APP_TAG_MAPPING "
+ "(AP_APP_TAG_ID, "
+ "AP_APP_ID, "
+ " TENANT_ID) "
+ "VALUES (?, ?, ?)";
try {
conn = this.getDBConnection();
stmt = conn.prepareStatement(sql);
for (Integer tagId : tagIds) {
stmt.setInt(1, tagId);
stmt.setInt(2, applicationId);
stmt.setInt(3, tenantId);
stmt.addBatch();
}
stmt.executeBatch();
} catch (DBConnectionException e) {
throw new ApplicationManagementDAOException(
"Error occurred while obtaining the DB connection when adding tags", e);
} catch (SQLException e) {
throw new ApplicationManagementDAOException("Error occurred while adding tags", e);
} finally {
Util.cleanupResources(stmt, null);
}
}
@Override
public void deleteTags(List<String> tags, int applicationId, int tenantId) throws ApplicationManagementDAOException {
Connection conn;
@ -644,9 +991,6 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
stmt.addBatch();
}
stmt.executeBatch();
} catch (DBConnectionException e) {
throw new ApplicationManagementDAOException("Error occurred while obtaining the DB connection.", e);
} catch (SQLException e) {
@ -658,7 +1002,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
@Override
public Application getApplicationByRelease(String appReleaseUUID, int tenantId)
public ApplicationDTO getApplicationByRelease(String appReleaseUUID, int tenantId)
throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
log.debug("Getting application with the UUID (" + appReleaseUUID + ") from the database");
@ -689,10 +1033,10 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
log.debug("Successfully retrieved details of the application with the UUID " + appReleaseUUID);
}
Application application = null;
ApplicationDTO application = null;
while (rs.next()) {
ApplicationRelease appRelease = Util.loadApplicationRelease(rs);
application = new Application();
ApplicationReleaseDTO appRelease = Util.loadApplicationRelease(rs);
application = new ApplicationDTO();
application.setId(rs.getInt("APP_ID"));
application.setName(rs.getString("APP_NAME"));
@ -700,7 +1044,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
application.setAppCategory(rs.getString("APP_CATEGORY"));
application.setSubType(rs.getString("SUB_TYPE"));
application.setPaymentCurrency(rs.getString("CURRENCY"));
application.setIsRestricted(rs.getBoolean("RESTRICTED"));
// application.setIsRestricted(rs.getBoolean("RESTRICTED"));
String unrestrictedRole = rs.getString("ROLE").toLowerCase();
List<String> unrestrictedRoleList = new ArrayList<>();
@ -708,7 +1052,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
application.setUnrestrictedRoles(unrestrictedRoleList);
List<ApplicationRelease> applicationReleaseList = new ArrayList<>();
List<ApplicationReleaseDTO> applicationReleaseList = new ArrayList<>();
applicationReleaseList.add(appRelease);
application.setApplicationReleases(applicationReleaseList);

View File

@ -21,7 +21,9 @@ package org.wso2.carbon.device.application.mgt.core.dao.impl.application.release
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.application.mgt.common.ApplicationRelease;
import org.wso2.carbon.device.application.mgt.common.AppLifecycleState;
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.Rating;
import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException;
import org.wso2.carbon.device.application.mgt.core.dao.ApplicationReleaseDAO;
@ -37,52 +39,71 @@ import java.util.ArrayList;
import java.util.List;
/**
* GenericApplicationReleaseDAOImpl holds the implementation of ApplicationRelease related DAO operations.
* GenericApplicationReleaseDAOImpl holds the implementation of ApplicationReleaseDTO related DAO operations.
*/
public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements ApplicationReleaseDAO {
private static final Log log = LogFactory.getLog(GenericApplicationReleaseDAOImpl.class);
/**
* To insert the Application Release Details.
* To insert the ApplicationDTO Release Details.
*
* @param appId Id of the application
* @param applicationRelease Application 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
* @throws ApplicationManagementDAOException Application Management DAO Exception.
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/
@Override public ApplicationRelease createRelease(ApplicationRelease applicationRelease, int appId, int tenantId)
@Override public ApplicationReleaseDTO createRelease(ApplicationReleaseDTO applicationRelease, int appId, int tenantId)
throws ApplicationManagementDAOException {
Connection connection;
PreparedStatement statement = null;
ResultSet resultSet = null;
String sql = "INSERT INTO AP_APP_RELEASE (VERSION,TENANT_ID,UUID,RELEASE_TYPE, PACKAGE_NAME, APP_PRICE, "
+ "STORED_LOCATION, ICON_LOCATION, BANNER_LOCATION, SC_1_LOCATION,SC_2_LOCATION,SC_3_LOCATION,"
+ "APP_HASH_VALUE, SHARED_WITH_ALL_TENANTS, APP_META_INFO,AP_APP_ID) "
+ "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);";
String sql = "INSERT INTO AP_APP_RELEASE "
+ "(DESCRIPTION,"
+ "VERSION,"
+ "TENANT_ID,"
+ "UUID,"
+ "RELEASE_TYPE,"
+ "PACKAGE_NAME,"
+ "APP_PRICE, "
+ "INSTALLER_LOCATION,"
+ "ICON_LOCATION,"
+ "BANNER_LOCATION,"
+ "SC_1_LOCATION,"
+ "SC_2_LOCATION,"
+ "SC_3_LOCATION,"
+ "APP_HASH_VALUE,"
+ "SHARED_WITH_ALL_TENANTS,"
+ "APP_META_INFO,"
+ "SUPPORTED_OS_VERSIONS,"
+ "CURRENT_STATE,"
+ "AP_APP_ID) "
+ "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);";
int index = 0;
String generatedColumns[] = { "ID" };
try {
connection = this.getDBConnection();
statement = connection.prepareStatement(sql, generatedColumns);
statement.setString(++index, applicationRelease.getVersion());
statement.setInt(++index, tenantId);
statement.setString(++index, applicationRelease.getUuid());
statement.setString(++index, String.valueOf(applicationRelease.getReleaseType()));
statement.setString(++index, String.valueOf(applicationRelease.getPackageName()));
statement.setDouble(++index, applicationRelease.getPrice());
statement.setString(++index, applicationRelease.getAppStoredLoc());
statement.setString(++index, applicationRelease.getIconLoc());
statement.setString(++index, applicationRelease.getBannerLoc());
statement.setString(++index, applicationRelease.getScreenshotLoc1());
statement.setString(++index, applicationRelease.getScreenshotLoc2());
statement.setString(++index, applicationRelease.getScreenshotLoc3());
statement.setString(++index, applicationRelease.getAppHashValue());
statement.setInt(++index, applicationRelease.getIsSharedWithAllTenants());
statement.setString(++index, applicationRelease.getMetaData());
statement.setInt(++index, appId);
statement.setString(1, applicationRelease.getDescription());
statement.setString(2, applicationRelease.getVersion());
statement.setInt(3, tenantId);
statement.setString(4, applicationRelease.getUuid());
statement.setString(5, String.valueOf(applicationRelease.getReleaseType()));
statement.setString(6, String.valueOf(applicationRelease.getPackageName()));
statement.setDouble(7, applicationRelease.getPrice());
statement.setString(8, applicationRelease.getInstallerName());
statement.setString(9, applicationRelease.getIconName());
statement.setString(10, applicationRelease.getBannerName());
statement.setString(11, applicationRelease.getScreenshotName1());
statement.setString(12, applicationRelease.getScreenshotName2());
statement.setString(13, applicationRelease.getScreenshotName3());
statement.setString(14, applicationRelease.getAppHashValue());
statement.setBoolean(15, applicationRelease.getIsSharedWithAllTenants());
statement.setString(16, applicationRelease.getMetaData());
statement.setString(17, applicationRelease.getSupportedOsVersions());
statement.setString(18, applicationRelease.getCurrentState());
statement.setInt(19, appId);
statement.executeUpdate();
resultSet = statement.getGeneratedKeys();
if (resultSet.next()) {
@ -108,9 +129,9 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
* @param versionName version name of the application.
* @param releaseType type of the application release.
* @param tenantId Tenant Id
* @throws ApplicationManagementDAOException Application Management DAO Exception.
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/
@Override public ApplicationRelease getRelease(String applicationName, String applicationType, String versionName,
@Override public ApplicationReleaseDTO getRelease(String applicationName, String applicationType, String versionName,
String releaseType, int tenantId) throws ApplicationManagementDAOException {
//todo no usage
Connection connection;
@ -158,9 +179,9 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
* @param applicationId ID of the application.
* @param releaseUuid UUID of the application release.
* @param tenantId Tenant Id
* @throws ApplicationManagementDAOException Application Management DAO Exception.
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/
@Override public ApplicationRelease getReleaseByIds(int applicationId, String releaseUuid, int tenantId)
@Override public ApplicationReleaseDTO getReleaseByIds(int applicationId, String releaseUuid, int tenantId)
throws ApplicationManagementDAOException {
Connection connection;
@ -206,14 +227,14 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
*
* @param applicationId Id of the application.
* @param tenantId Tenant Id
* @throws ApplicationManagementDAOException Application Management DAO Exception.
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/
@Override public List<ApplicationRelease> getReleases(int applicationId, int tenantId)
@Override public List<ApplicationReleaseDTO> getReleases(int applicationId, int tenantId)
throws ApplicationManagementDAOException {
Connection connection;
PreparedStatement statement = null;
ResultSet resultSet = null;
List<ApplicationRelease> 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 "
+ "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, "
@ -229,7 +250,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
resultSet = statement.executeQuery();
while (resultSet.next()) {
ApplicationRelease applicationRelease = Util.loadApplicationRelease(resultSet);
ApplicationReleaseDTO applicationRelease = Util.loadApplicationRelease(resultSet);
applicationReleases.add(applicationRelease);
}
return applicationReleases;
@ -247,12 +268,12 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
//todo this has to be removed
@Override
public List<ApplicationRelease> getReleaseByState(int appId, int tenantId, String state) throws
public List<ApplicationReleaseDTO> getReleaseByState(int appId, int tenantId, String state) throws
ApplicationManagementDAOException {
Connection connection;
PreparedStatement statement = null;
ResultSet resultSet = null;
List<ApplicationRelease> 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 "
+ "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 "
@ -272,7 +293,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
resultSet = statement.executeQuery();
while (resultSet.next()) {
ApplicationRelease appRelease = Util.loadApplicationRelease(resultSet);
ApplicationReleaseDTO appRelease = Util.loadApplicationRelease(resultSet);
applicationReleases.add(appRelease);
}
return applicationReleases;
@ -293,7 +314,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
*
* @param uuid UUID of the application Release.
* @param rating given stars for the application release.
* @throws ApplicationManagementDAOException Application Management DAO Exception.
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/
@Override public void updateRatingValue(String uuid, double rating, int ratedUsers)
throws ApplicationManagementDAOException {
@ -322,7 +343,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
* To retrieve rating of an application release.
*
* @param uuid UUID of the application Release.
* @throws ApplicationManagementDAOException Application Management DAO Exception.
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/
@Override public Rating getRating(String uuid, int tenantId) throws ApplicationManagementDAOException {
Connection connection;
@ -357,10 +378,11 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
/**
* To insert the application release properties.
*
* @param applicationRelease Application Release the properties of which that need to be inserted.
* @throws ApplicationManagementDAOException Application Management DAO Exception.
* @param applicationRelease ApplicationDTO Release the properties of which that need to be inserted.
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/
@Override public ApplicationRelease updateRelease(int applicationId, ApplicationRelease applicationRelease, int tenantId)
@Override
public ApplicationReleaseDTO updateRelease(int applicationId, ApplicationReleaseDTO applicationRelease, int tenantId)
throws ApplicationManagementDAOException {
Connection connection;
PreparedStatement statement = null;
@ -377,19 +399,21 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
statement.setString(3, applicationRelease.getReleaseType());
statement.setString(4, applicationRelease.getPackageName());
statement.setDouble(5, applicationRelease.getPrice());
statement.setString(6, applicationRelease.getAppStoredLoc());
statement.setString(7, applicationRelease.getBannerLoc());
statement.setString(8, applicationRelease.getIconLoc());
statement.setString(9, applicationRelease.getScreenshotLoc1());
statement.setString(10, applicationRelease.getScreenshotLoc2());
statement.setString(11, applicationRelease.getScreenshotLoc3());
statement.setString(6, applicationRelease.getInstallerName());
statement.setString(7, applicationRelease.getBannerName());
statement.setString(8, applicationRelease.getIconName());
statement.setString(9, applicationRelease.getScreenshotName1());
statement.setString(10, applicationRelease.getScreenshotName2());
statement.setString(11, applicationRelease.getScreenshotName3());
statement.setString(12, applicationRelease.getAppHashValue());
statement.setInt(13, applicationRelease.getIsSharedWithAllTenants());
statement.setBoolean(13, applicationRelease.getIsSharedWithAllTenants());
statement.setString(14, applicationRelease.getMetaData());
statement.setInt(15, applicationId);
statement.setInt(16, tenantId);
statement.setInt(17, applicationRelease.getId());
statement.executeUpdate();
if (statement.executeUpdate() == 0) {
return null;
}
} catch (DBConnectionException e) {
throw new ApplicationManagementDAOException(
"Database connection exception while trying to update the application release", e);
@ -407,7 +431,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
*
* @param id Id of the application Release.
* @param version version name of the application release.
* @throws ApplicationManagementDAOException Application Management DAO Exception.
* @throws ApplicationManagementDAOException ApplicationDTO Management DAO Exception.
*/
@Override public void deleteRelease(int id, String version) throws ApplicationManagementDAOException {
Connection connection;
@ -454,7 +478,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
if (log.isDebugEnabled()) {
log.debug("Successfully retrieved basic details of the application release with the application ID "
+ appId + " Application release hash value: " + hashVal);
+ appId + " ApplicationDTO release hash value: " + hashVal);
}
return rs.next();
} catch (SQLException e) {
@ -528,7 +552,7 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
if (log.isDebugEnabled()) {
log.debug("Successfully retrieved basic details of the application release with the application ID "
+ appId + " Application release uuid: " + uuid);
+ appId + " ApplicationDTO release uuid: " + uuid);
}
return rs.next();
} catch (SQLException e) {
@ -575,4 +599,90 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements
Util.cleanupResources(stmt, rs);
}
}
@Override
public ApplicationReleaseArtifactPaths getReleaseArtifactPaths(String uuid, int tenantId) throws ApplicationManagementDAOException{
if (log.isDebugEnabled()) {
log.debug("Getting application release artifact stored location paths for: " + uuid);
}
Connection conn;
PreparedStatement stmt = null;
ResultSet rs = null;
ApplicationReleaseArtifactPaths applicationReleaseArtifactPaths = null;
try {
conn = this.getDBConnection();
String sql = "SELECT AR.INSTALLER_LOCATION AS INSTALLER,"
+ "AR.ICON_LOCATION AS ICON,"
+ "AR.BANNER_LOCATION AS BANNER,"
+ "AR.SC_1_LOCATION AS SC1,"
+ "AR.SC_2_LOCATION AS SC2,"
+ "AR.SC_3_LOCATION AS SC3 "
+ "FROM AP_APP_RELEASE AS AR "
+ "WHERE AR.UUID = ? AND AR.TENANT_ID = ?;";
stmt = conn.prepareStatement(sql);
stmt.setString(1, uuid);
stmt.setInt(2, tenantId);
rs = stmt.executeQuery();
if (log.isDebugEnabled()) {
log.debug(
"Successfully retrieved application release artifact details of the application release with the application UUID: "
+ uuid);
}
if (rs.getFetchSize() == 0 || rs.getFetchSize() >1){
return null;
}
while(rs.next()){
applicationReleaseArtifactPaths = new ApplicationReleaseArtifactPaths();
List<String> scs = new ArrayList<>();
applicationReleaseArtifactPaths.setInstallerPath(rs.getString("INSTALLER"));
applicationReleaseArtifactPaths.setIconPath(rs.getString("ICON"));
applicationReleaseArtifactPaths.setBannerPath(rs.getString("BANNER"));
scs.add(rs.getString("SC1"));
scs.add(rs.getString("SC2"));
scs.add(rs.getString("SC3"));
applicationReleaseArtifactPaths.setScreenshotPaths(scs);
}
return applicationReleaseArtifactPaths;
} catch (SQLException e) {
throw new ApplicationManagementDAOException(
"Error occurred when executing query to get application release artifact paths for App release uuid: "
+ uuid, e);
} catch (DBConnectionException e) {
throw new ApplicationManagementDAOException("Error occurred while obtaining the DB connection.", e);
} finally {
Util.cleanupResources(stmt, rs);
}
}
@Override
public boolean isActiveReleaseExisitForPackageName(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.CURRENT_STATE != ? AND AR.TENANT_ID = ? LIMIT 1";
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setString(1, packageName);
stmt.setString(2, AppLifecycleState.REMOVED.toString());
stmt.setInt(3, 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);
}
}
}

View File

@ -18,7 +18,8 @@
*/
package org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate;
import org.wso2.carbon.device.application.mgt.common.LifecycleState;
import org.wso2.carbon.device.application.mgt.common.AppLifecycleState;
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.core.dao.LifecycleStateDAO;
import org.wso2.carbon.device.application.mgt.core.dao.common.Util;
@ -40,7 +41,7 @@ import java.util.List;
public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements LifecycleStateDAO {
@Override
public LifecycleState getLatestLifeCycleStateByReleaseID(int applicationReleaseId) throws LifeCycleManagementDAOException {
public LifecycleStateDTO getLatestLifeCycleStateByReleaseID(int applicationReleaseId) throws LifeCycleManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
@ -64,7 +65,7 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
}
}
public LifecycleState getLatestLifeCycleState(int appId, String uuid) throws LifeCycleManagementDAOException{
public LifecycleStateDTO getLatestLifeCycleState(int appId, String uuid) throws LifeCycleManagementDAOException{
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
@ -87,13 +88,42 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
} finally {
Util.cleanupResources(stmt, rs);
}
}
public String getAppReleaseCreatedUsername(int appId, String uuid, int tenantId) throws LifeCycleManagementDAOException{
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
conn = this.getDBConnection();
String sql = "SELECT UPDATED_BY FROM AP_APP_LIFECYCLE_STATE WHERE AP_APP_ID=? AND "
+ "AP_APP_RELEASE_ID=(SELECT ID FROM AP_APP_RELEASE WHERE UUID=?) AND CURRENT_STATE = ? AND TENANT_ID = ?;";
stmt = conn.prepareStatement(sql);
stmt.setInt(1, appId);
stmt.setString(2, uuid);
stmt.setString(3, AppLifecycleState.CREATED.toString());
stmt.setInt(4, tenantId);
rs = stmt.executeQuery();
if (rs.next()) {
return rs.getString("UPDATED_BY");
}
return null;
} catch (SQLException e) {
throw new LifeCycleManagementDAOException("Error occurred while getting application List", e);
} catch (DBConnectionException e) {
throw new LifeCycleManagementDAOException("Error occurred while obtaining the DB connection to get latest"
+ " lifecycle state for a specific application", e);
} finally {
Util.cleanupResources(stmt, rs);
}
}
@Override
public List<LifecycleState> getLifecycleStates(int appReleaseId) throws LifeCycleManagementDAOException {
List<LifecycleState> lifecycleStates = new ArrayList<>();
public List<LifecycleStateDTO> getLifecycleStates(int appReleaseId) throws LifeCycleManagementDAOException {
List<LifecycleStateDTO> lifecycleStates = new ArrayList<>();
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
@ -105,7 +135,7 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
stmt.setInt(1,appReleaseId);
rs = stmt.executeQuery();
while (rs.next()) {
LifecycleState lifecycleState = new LifecycleState();
LifecycleStateDTO lifecycleState = new LifecycleStateDTO();
lifecycleState.setId(rs.getInt("ID"));
lifecycleState.setCurrentState(rs.getString("CURRENT_STATE"));
lifecycleState.setPreviousState(rs.getString("PREVIOUS_STATE"));
@ -125,14 +155,20 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
}
@Override
public void addLifecycleState(LifecycleState 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;
PreparedStatement stmt = null;
try {
conn = this.getDBConnection();
String sql = "INSERT INTO AP_APP_LIFECYCLE_STATE (CURRENT_STATE, PREVIOUS_STATE, TENANT_ID, UPDATED_BY, "
+ "UPDATED_AT, AP_APP_RELEASE_ID, AP_APP_ID) VALUES (?,?, ?, ?, ?, "
+ "(SELECT ID FROM AP_APP_RELEASE WHERE UUID=?),?);";
String sql = "INSERT INTO AP_APP_LIFECYCLE_STATE "
+ "(CURRENT_STATE, "
+ "PREVIOUS_STATE, "
+ "TENANT_ID, "
+ "UPDATED_BY, "
+ "UPDATED_AT, "
+ "AP_APP_RELEASE_ID, "
+ "AP_APP_ID) "
+ "VALUES (?,?, ?, ?, ?, (SELECT ID FROM AP_APP_RELEASE WHERE UUID=?),?);";
Calendar calendar = Calendar.getInstance();
Timestamp timestamp = new Timestamp(calendar.getTime().getTime());
@ -177,11 +213,11 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif
}
}
private LifecycleState constructLifecycle(ResultSet rs) throws LifeCycleManagementDAOException {
LifecycleState lifecycleState = null;
private LifecycleStateDTO constructLifecycle(ResultSet rs) throws LifeCycleManagementDAOException {
LifecycleStateDTO lifecycleState = null;
try {
if (rs !=null && rs.next()) {
lifecycleState = new LifecycleState();
lifecycleState = new LifecycleStateDTO();
lifecycleState.setId(rs.getInt("ID"));
lifecycleState.setCurrentState(rs.getString("CURRENT_STATE"));
lifecycleState.setPreviousState(rs.getString("PREVIOUS_STATE"));

View File

@ -89,7 +89,7 @@ public class GenericVisibilityDAOImpl extends AbstractDAOImpl implements Visibil
rs = stmt.executeQuery();
while (rs.next()){
unrestrictedRoles.add(rs.getString("ROLE").toLowerCase());
unrestrictedRoles.add(rs.getString("ROLE"));
}
return unrestrictedRoles;

View File

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

View File

@ -30,16 +30,16 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.validator.routines.UrlValidator;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.application.mgt.common.ApplicationRelease;
import org.wso2.carbon.device.application.mgt.common.ApplicationInstaller;
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.DeviceType;
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.RequestValidatingException;
import org.wso2.carbon.device.application.mgt.common.exception.ResourceManagementException;
import org.wso2.carbon.device.application.mgt.common.services.ApplicationStorageManager;
import org.wso2.carbon.device.application.mgt.core.exception.ParsingException;
import org.wso2.carbon.device.application.mgt.core.util.ArtifactsParser;
import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil;
import org.wso2.carbon.device.application.mgt.core.util.Constants;
import org.wso2.carbon.device.application.mgt.core.util.StorageManagementUtil;
import org.xml.sax.SAXException;
@ -78,44 +78,45 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
}
@Override
public ApplicationRelease uploadImageArtifacts(ApplicationRelease applicationRelease, InputStream iconFileStream,
public ApplicationReleaseDTO uploadImageArtifacts(ApplicationReleaseDTO applicationRelease, InputStream iconFileStream,
InputStream bannerFileStream, List<InputStream> screenShotStreams)
throws ResourceManagementException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
String artifactDirectoryPath;
String iconStoredLocation;
String bannerStoredLocation;
String scStoredLocation;
String scStoredLocation = null;
try {
// todo handle WEB CLIP and save data in different folder (uuid)
artifactDirectoryPath = storagePath + applicationRelease.getAppHashValue();
StorageManagementUtil.createArtifactDirectory(artifactDirectoryPath);
iconStoredLocation = artifactDirectoryPath + File.separator + Constants.IMAGE_ARTIFACTS[0];
bannerStoredLocation = artifactDirectoryPath + File.separator + Constants.IMAGE_ARTIFACTS[1];
iconStoredLocation = artifactDirectoryPath + File.separator + applicationRelease.getIconName();
bannerStoredLocation = artifactDirectoryPath + File.separator + applicationRelease.getBannerName();
if (iconFileStream != null) {
saveFile(iconFileStream, iconStoredLocation);
applicationRelease.setIconLoc(iconStoredLocation);
}
if (bannerFileStream != null) {
saveFile(bannerFileStream, bannerStoredLocation);
applicationRelease.setBannerLoc(bannerStoredLocation);
}
if (!screenShotStreams.isEmpty()) {
if (screenShotStreams.size() > screenShotMaxCount) {
throw new ApplicationStorageManagementException("Maximum limit for the screen-shot exceeds");
String msg = "Maximum limit for the screen-shot exceeds. You can't upload more than three "
+ "screenshot for an application release";
log.error(msg);
throw new ApplicationStorageManagementException(msg);
}
int count = 1;
for (InputStream screenshotStream : screenShotStreams) {
scStoredLocation = artifactDirectoryPath + File.separator + Constants.IMAGE_ARTIFACTS[2] + count;
if (count == 1) {
applicationRelease.setScreenshotLoc1(scStoredLocation);
scStoredLocation = artifactDirectoryPath + File.separator + applicationRelease.getScreenshotName1();
}
if (count == 2) {
applicationRelease.setScreenshotLoc2(scStoredLocation);
scStoredLocation = artifactDirectoryPath + File.separator + applicationRelease.getScreenshotName2();
}
if (count == 3) {
applicationRelease.setScreenshotLoc3(scStoredLocation);
scStoredLocation = artifactDirectoryPath + File.separator + applicationRelease.getScreenshotName3();
}
saveFile(screenshotStream, scStoredLocation);
count++;
@ -126,14 +127,15 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
throw new ApplicationStorageManagementException("IO Exception while saving the screens hots for " +
"the application " + applicationRelease.getUuid(), e);
} catch (ApplicationStorageManagementException e) {
throw new ApplicationStorageManagementException("Application 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() +
" for the tenant id " + tenantId, e);
}
}
@Override
public ApplicationRelease updateImageArtifacts(ApplicationRelease applicationRelease, InputStream
public ApplicationReleaseDTO updateImageArtifacts(ApplicationReleaseDTO applicationRelease, InputStream
iconFileStream, InputStream bannerFileStream, List<InputStream> screenShotStreams)
throws ResourceManagementException {
@ -141,10 +143,10 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
try {
if (iconFileStream != null) {
deleteApplicationReleaseArtifacts(applicationRelease.getIconLoc());
deleteApplicationReleaseArtifacts(applicationRelease.getIconName());
}
if (bannerFileStream != null) {
deleteApplicationReleaseArtifacts(applicationRelease.getBannerLoc());
deleteApplicationReleaseArtifacts(applicationRelease.getBannerName());
}
if (!screenShotStreams.isEmpty()) {
if (screenShotStreams.size() > screenShotMaxCount) {
@ -153,144 +155,98 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
int count = 1;
while (count < screenShotStreams.size()) {
if (count == 1) {
deleteApplicationReleaseArtifacts(applicationRelease.getScreenshotLoc1());
deleteApplicationReleaseArtifacts(applicationRelease.getScreenshotName1());
}
if (count == 2) {
deleteApplicationReleaseArtifacts(applicationRelease.getScreenshotLoc2());
deleteApplicationReleaseArtifacts(applicationRelease.getScreenshotName2());
}
if (count == 3) {
deleteApplicationReleaseArtifacts(applicationRelease.getScreenshotLoc3());
deleteApplicationReleaseArtifacts(applicationRelease.getScreenshotName3());
}
count++;
}
}
applicationRelease = uploadImageArtifacts(applicationRelease, iconFileStream, bannerFileStream,
screenShotStreams);
return applicationRelease;
} catch (ApplicationStorageManagementException e) {
throw new ApplicationStorageManagementException("Application 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() +
" for the tenant " + tenantId, e);
}
}
@Override
public ApplicationRelease uploadReleaseArtifact(ApplicationRelease applicationRelease, String appType,
String deviceType, InputStream binaryFile) throws ResourceManagementException, RequestValidatingException {
public ApplicationInstaller getAppInstallerData(InputStream binaryFile, String deviceType)
throws ApplicationStorageManagementException {
ApplicationInstaller applicationInstaller = new ApplicationInstaller();
try {
if (ApplicationType.WEB_CLIP.toString().equals(appType)) {
applicationRelease.setVersion(Constants.DEFAULT_VERSION);
UrlValidator urlValidator = new UrlValidator();
if (applicationRelease.getUrl() == null || !urlValidator.isValid(applicationRelease.getUrl())) {
throw new RequestValidatingException("Request payload doesn't contains Web Clip URL " +
"with application release object or Web " +
"Clip URL is invalid");
}
applicationRelease.setAppStoredLoc(applicationRelease.getUrl());
applicationRelease.setAppHashValue(null);
return applicationRelease;
}
String artifactDirectoryPath;
String md5OfApp;
InputStream[] cloneInputStream = cloneInputStream(binaryFile);
md5OfApp = getMD5(binaryFile);
if (md5OfApp == null) {
throw new ApplicationStorageManagementException(
"Error occurred while md5sum value retrieving process: " +
"application UUID " + applicationRelease.getUuid());
}
if (DeviceType.ANDROID.toString().equalsIgnoreCase(deviceType)) {
ApkMeta apkMeta = ArtifactsParser.readAndroidManifestFile(cloneInputStream[2]);
applicationRelease.setVersion(apkMeta.getVersionName());
applicationRelease.setPackageName(apkMeta.getPackageName());
} else if (DeviceType.IOS.toString().equalsIgnoreCase(deviceType)) {
if (DeviceTypes.ANDROID.toString().equalsIgnoreCase(deviceType)) {
ApkMeta apkMeta = ArtifactsParser.readAndroidManifestFile(binaryFile);
applicationInstaller.setVersion(apkMeta.getVersionName());
applicationInstaller.setPackageName(apkMeta.getPackageName());
} else if (DeviceTypes.IOS.toString().equalsIgnoreCase(deviceType)) {
NSDictionary plistInfo = ArtifactsParser.readiOSManifestFile(binaryFile);
applicationRelease
applicationInstaller
.setVersion(plistInfo.objectForKey(ArtifactsParser.IPA_BUNDLE_VERSION_KEY).toString());
applicationRelease
applicationInstaller
.setPackageName(plistInfo.objectForKey(ArtifactsParser.IPA_BUNDLE_IDENTIFIER_KEY).toString());
} else {
throw new ApplicationStorageManagementException("Application Type doesn't match with supporting " +
"application types " + applicationRelease.getUuid());
}
artifactDirectoryPath = storagePath + md5OfApp;
StorageManagementUtil.createArtifactDirectory(artifactDirectoryPath);
if (log.isDebugEnabled()) {
log.debug("Artifact Directory Path for saving the application release related artifacts related with "
+ "application UUID " + applicationRelease.getUuid() + " is " + artifactDirectoryPath);
}
String artifactPath = artifactDirectoryPath + File.separator + Constants.RELEASE_ARTIFACT +".apk";
saveFile(cloneInputStream[1], artifactPath);
applicationRelease.setAppStoredLoc(artifactPath);
applicationRelease.setAppHashValue(md5OfApp);
} catch (IOException e) {
throw new ApplicationStorageManagementException(
"IO Exception while saving the release artifacts in the server for the application UUID "
+ applicationRelease.getUuid(), e);
} catch (ParsingException e) {
throw new ApplicationStorageManagementException(
"Error occurred while parsing the artifact file. Application release UUID is " + applicationRelease
.getUuid(), e);
}
return applicationRelease;
}
public InputStream[] cloneInputStream(InputStream inputStream) throws ApplicationStorageManagementException {
ByteArrayOutputStream byteArrayOutputStream = null;
try {
byteArrayOutputStream = new ByteArrayOutputStream();
byte[] buffer = new byte[BUFFER_SIZE];
int len;
while ((len = inputStream.read(buffer)) > -1 ) {
byteArrayOutputStream.write(buffer, 0, len);
}
byteArrayOutputStream.flush();
InputStream stream1 = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
InputStream stream2 = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
InputStream stream3 = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
return new InputStream[]{stream1, stream2, stream3};
} catch (IOException e) {
throw new ApplicationStorageManagementException("Error occurred while cloning input stream ", e);
} finally {
if (byteArrayOutputStream != null) {
try {
byteArrayOutputStream.close();
} catch (IOException e) {
}
String msg = "Application Type doesn't match with supporting application types " + deviceType;
log.error(msg);
throw new ApplicationStorageManagementException(msg);
}
} catch (ParsingException e){
String msg = "Application Type doesn't match with supporting application types " + deviceType;
log.error(msg);
throw new ApplicationStorageManagementException(msg);
}
return applicationInstaller;
}
@Override
public ApplicationRelease updateReleaseArtifacts(ApplicationRelease applicationRelease, String appType,
String deviceType, InputStream binaryFile) throws ApplicationStorageManagementException,
RequestValidatingException {
public ApplicationReleaseDTO uploadReleaseArtifact(ApplicationReleaseDTO applicationReleaseDTO, String appType,
String deviceType, InputStream binaryFile) throws ResourceManagementException {
try {
deleteApplicationReleaseArtifacts(applicationRelease.getAppStoredLoc());
applicationRelease = uploadReleaseArtifact(applicationRelease, appType, deviceType, binaryFile);
} catch (ApplicationStorageManagementException e) {
throw new ApplicationStorageManagementException("Application Artifact doesn't contains in the System", e);
} catch (ResourceManagementException e) {
throw new ApplicationStorageManagementException("Application Artifact Updating failed", e);
String artifactDirectoryPath;
String md5OfApp;
String artifactPath;
byte [] content = IOUtils.toByteArray(binaryFile);
md5OfApp = getMD5(new ByteArrayInputStream(content));
if (md5OfApp == null) {
String msg = "Error occurred while md5sum value retrieving process: application UUID "
+ applicationReleaseDTO.getUuid();
log.error(msg);
throw new ApplicationStorageManagementException(msg);
}
artifactDirectoryPath = storagePath + md5OfApp;
StorageManagementUtil.createArtifactDirectory(artifactDirectoryPath);
artifactPath = artifactDirectoryPath + File.separator + applicationReleaseDTO.getInstallerName();
saveFile(new ByteArrayInputStream(content), artifactPath);
applicationReleaseDTO.setAppHashValue(md5OfApp);
} catch (IOException e) {
String msg = "IO Exception while saving the release artifacts in the server for the application UUID "
+ applicationReleaseDTO.getUuid();
log.error(msg);
throw new ApplicationStorageManagementException( msg, e);
}
return applicationRelease;
return applicationReleaseDTO;
}
@Override
public ApplicationReleaseDTO updateReleaseArtifacts(ApplicationReleaseDTO applicationRelease,
String appType, String deviceType, InputStream binaryFile) throws ApplicationStorageManagementException {
try {
deleteApplicationReleaseArtifacts(applicationRelease.getInstallerName());
applicationRelease = uploadReleaseArtifact(applicationRelease, appType, deviceType, binaryFile);
} catch (ApplicationStorageManagementException e) {
throw new ApplicationStorageManagementException("ApplicationDTO Artifact doesn't contains in the System", e);
} catch (ResourceManagementException e) {
throw new ApplicationStorageManagementException("ApplicationDTO Artifact Updating failed", e);
}
return applicationRelease;
}
@Override
public void deleteApplicationReleaseArtifacts(String directoryPath) throws ApplicationStorageManagementException {
@ -309,17 +265,28 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
}
}
@Override public void deleteAllApplicationReleaseArtifacts(List<String> directoryPaths)
@Override
public void deleteAllApplicationReleaseArtifacts(List<String> directoryPaths)
throws ApplicationStorageManagementException {
for (String directoryBasePath : directoryPaths) {
deleteApplicationReleaseArtifacts(directoryBasePath);
deleteApplicationReleaseArtifacts(storagePath + directoryBasePath);
}
}
public InputStream getFileSttream (String path) throws ApplicationStorageManagementException {
String filePath = storagePath + path;
try {
return StorageManagementUtil.getInputStream(filePath);
} catch (IOException e) {
String msg = "Error occured when accessing the file in file path: " + filePath;
throw new ApplicationStorageManagementException(msg, e);
}
}
private String getMD5(InputStream binaryFile) throws ApplicationStorageManagementException {
String md5;
try {
md5 = DigestUtils.md5Hex(IOUtils.toByteArray(binaryFile));
md5 = DigestUtils.md5Hex(binaryFile);
} catch (IOException e) {
throw new ApplicationStorageManagementException
("IO Exception while trying to get the md5sum value of application");

View File

@ -0,0 +1,103 @@
/* Copyright (c) 2018, 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.
*/
package org.wso2.carbon.device.application.mgt.core.impl;
import org.apache.commons.lang.StringUtils;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.application.mgt.common.ApplicationReleaseArtifactPaths;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationStorageManagementException;
import org.wso2.carbon.device.application.mgt.common.services.ApplicationStorageManager;
import org.wso2.carbon.device.application.mgt.common.services.AppmDataHandler;
import org.wso2.carbon.device.application.mgt.common.config.UIConfiguration;
import org.wso2.carbon.device.application.mgt.core.dao.ApplicationReleaseDAO;
import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory;
import org.wso2.carbon.device.application.mgt.core.dao.common.Util;
import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException;
import java.io.InputStream;
public class AppmDataHandlerImpl implements AppmDataHandler {
private UIConfiguration uiConfiguration;
public AppmDataHandlerImpl(UIConfiguration config) {
this.uiConfiguration = config;
}
@Override
public UIConfiguration getUIConfiguration() throws ApplicationManagementException {
return this.uiConfiguration;
}
@Override
// throws ApplicationManagementException
public InputStream getArtifactStream(String uuid, String artifactName) {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
ApplicationStorageManager applicationStorageManager = Util.getApplicationStorageManager();
ApplicationReleaseDAO applicationReleaseDAO = ApplicationManagementDAOFactory.getApplicationReleaseDAO();
String artifactPath = null;
if (StringUtils.isEmpty(uuid) || StringUtils.isEmpty(artifactName)) {
// todo throw
}
ApplicationReleaseArtifactPaths applicationReleaseArtifactPaths = null;
try {
applicationReleaseArtifactPaths = applicationReleaseDAO
.getReleaseArtifactPaths(uuid, tenantId);
} catch (ApplicationManagementDAOException e) {
// todo throw
// throw new ApplicationManagementException();
// e.printStackTrace();
}
String installerFileName = applicationReleaseArtifactPaths.getInstallerPath();
String iconFileName = applicationReleaseArtifactPaths.getIconPath();
String bannerFileName = applicationReleaseArtifactPaths.getBannerPath();
if (StringUtils.isEmpty(installerFileName) && artifactName.equals(installerFileName)) {
artifactPath = applicationReleaseArtifactPaths.getInstallerPath();
}
if (StringUtils.isEmpty(iconFileName) && artifactName.equals(iconFileName)) {
artifactPath = applicationReleaseArtifactPaths.getIconPath();
}
if (StringUtils.isEmpty(bannerFileName) && artifactName.equals(bannerFileName)) {
artifactPath = applicationReleaseArtifactPaths.getBannerPath();
}
for (String screenshotPath : applicationReleaseArtifactPaths.getScreenshotPaths()) {
if (screenshotPath != null && screenshotPath.contains(artifactName)) {
artifactPath = screenshotPath;
}
}
if (artifactPath != null) {
try {
return applicationStorageManager.getFileSttream(artifactPath);
} catch (ApplicationStorageManagementException e) {
// todo throw
// throw new ApplicationManagementException();
// e.printStackTrace();
}
}
return null;
}
}

View File

@ -1,35 +0,0 @@
/* Copyright (c) 2018, 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.
*/
package org.wso2.carbon.device.application.mgt.core.impl;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException;
import org.wso2.carbon.device.application.mgt.common.services.ConfigManager;
import org.wso2.carbon.device.application.mgt.common.config.UIConfiguration;
public class ConfigManagerImpl implements ConfigManager {
private UIConfiguration uiConfiguration;
public ConfigManagerImpl(UIConfiguration config) {
this.uiConfiguration = config;
}
@Override public UIConfiguration getUIConfiguration() throws ApplicationManagementException {
return this.uiConfiguration;
}
}

View File

@ -74,7 +74,7 @@ public class MAMDeviceConnectorImpl implements DeviceConnector{
for (String username: userList) {
List<Device> devices = getDeviceManagementService().getDevicesOfUser(username);
List<DeviceIdentifier> deviceIdentifiers = convertDeviceToDeviceIdentifier(devices);
// getDeviceManagementService().addOperation(appOperation.getApplication().getDeviceType(),
// getDeviceManagementService().addOperation(appOperation.getApplication().getDeviceTypeName(),
// operationEKA, devices);
subscriptionDAO.subscribeDeviceToApplication(appOperation.getTenantId(), appOperation.getSubscribedBy(),
devices, appOperation.getApplication().getId(), appOperation.getAppReleaseId(),

View File

@ -21,7 +21,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.application.mgt.common.AppOperation;
import org.wso2.carbon.device.application.mgt.common.Application;
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.exception.ApplicationManagementException;
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.");
}
ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager();
Application application = applicationManager.getApplicationByRelease(applicationUUID);
ApplicationDTO application = applicationManager.getApplicationByRelease(applicationUUID);
return installApplication(application, deviceList);
}
@ -82,7 +82,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
log.debug("Install application: " + applicationUUID + " to " + userList.size() + " users.");
}
ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager();
Application application = applicationManager.getApplicationByRelease(applicationUUID);
ApplicationDTO application = applicationManager.getApplicationByRelease(applicationUUID);
List<DeviceIdentifier> deviceList = new ArrayList<>();
for (String user : userList) {
try {
@ -123,7 +123,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
log.debug("Install application: " + applicationUUID + " to " + roleList.size() + " roles.");
}
ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager();
Application application = applicationManager.getApplicationByRelease(applicationUUID);
ApplicationDTO application = applicationManager.getApplicationByRelease(applicationUUID);
List<DeviceIdentifier> deviceList = new ArrayList<>();
for (String role : roleList) {
try {
@ -164,7 +164,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
log.debug("Install application: " + applicationUUID + " to " + deviceGroupList.size() + " groups.");
}
ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager();
Application application = applicationManager.getApplicationByRelease(applicationUUID);
ApplicationDTO application = applicationManager.getApplicationByRelease(applicationUUID);
GroupManagementProviderService groupManagementProviderService = HelperUtil.getGroupManagementProviderService();
List<DeviceGroup> groupList = new ArrayList<>();
List<DeviceIdentifier> deviceList = new ArrayList<>();
@ -207,7 +207,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
return null;
}
private ApplicationInstallResponse installApplication(Application application,
private ApplicationInstallResponse installApplication(ApplicationDTO application,
List<DeviceIdentifier> deviceIdentifierList) throws ApplicationManagementException {
DeviceManagementProviderService deviceManagementProviderService = HelperUtil
.getDeviceManagementProviderService();
@ -259,14 +259,14 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
return response;
}
private Operation generateOperationPayloadByDeviceType(String deviceType, Application application) {
private Operation generateOperationPayloadByDeviceType(String deviceType, ApplicationDTO application) {
ProfileOperation operation = new ProfileOperation();
operation.setCode(INSTALL_APPLICATION);
operation.setType(Operation.Type.PROFILE);
//todo: generate operation payload correctly for all types of devices.
operation.setPayLoad(
"{'type':'enterprise', 'url':'" + application.getApplicationReleases().get(0).getAppStoredLoc()
"{'type':'enterprise', 'url':'" + application.getApplicationReleases().get(0).getInstallerName()
+ "', 'app':'" + application.getApplicationReleases().get(0).getUuid() + "'}");
return operation;
}

View File

@ -24,14 +24,14 @@ import org.osgi.framework.BundleContext;
import org.osgi.service.component.ComponentContext;
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.ConfigManager;
import org.wso2.carbon.device.application.mgt.common.services.AppmDataHandler;
import org.wso2.carbon.device.application.mgt.common.services.ReviewManager;
import org.wso2.carbon.device.application.mgt.common.services.SubscriptionManager;
import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager;
import org.wso2.carbon.device.application.mgt.common.config.UIConfiguration;
import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory;
import org.wso2.carbon.device.application.mgt.core.impl.ConfigManagerImpl;
import org.wso2.carbon.device.application.mgt.core.lifecycle.LifecycleStateManger;
import org.wso2.carbon.device.application.mgt.core.impl.AppmDataHandlerImpl;
import org.wso2.carbon.device.application.mgt.core.lifecycle.LifecycleStateManager;
import org.wso2.carbon.device.application.mgt.core.lifecycle.config.LifecycleState;
import org.wso2.carbon.device.application.mgt.core.util.ApplicationManagementUtil;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
@ -75,16 +75,17 @@ public class ApplicationManagementServiceComponent {
try {
String dataSourceName = ConfigurationManager.getInstance().getConfiguration().getDatasourceName();
ApplicationManagementDAOFactory.init(dataSourceName);
// ApplicationManagementDAOFactory.initDatabases();
List<LifecycleState> lifecycleStates = ConfigurationManager.getInstance().
getConfiguration().getLifecycleStates();
LifecycleStateManger lifecycleStateManger = ApplicationManagementUtil.getLifecycleStateMangerInstance();
lifecycleStateManger.init(lifecycleStates);
DataHolder.getInstance().setLifecycleStateManger(lifecycleStateManger);
bundleContext.registerService(LifecycleStateManger.class.getName(), lifecycleStateManger, null);
LifecycleStateManager lifecycleStateManager = ApplicationManagementUtil.getLifecycleStateMangerInstance();
lifecycleStateManager.init(lifecycleStates);
DataHolder.getInstance().setLifecycleStateManger(lifecycleStateManager);
bundleContext.registerService(LifecycleStateManager.class.getName(), lifecycleStateManager, null);
ApplicationManager applicationManager = ApplicationManagementUtil.getApplicationManagerInstance();
applicationManager
.addAplicationCategories(ConfigurationManager.getInstance().getConfiguration().getAppCategories());
DataHolder.getInstance().setApplicationManager(applicationManager);
bundleContext.registerService(ApplicationManager.class.getName(), applicationManager, null);
@ -103,9 +104,9 @@ public class ApplicationManagementServiceComponent {
UIConfiguration uiConfiguration = ConfigurationManager.getInstance().
getConfiguration().getUiConfiguration();
ConfigManager configManager = new ConfigManagerImpl(uiConfiguration);
AppmDataHandler configManager = new AppmDataHandlerImpl(uiConfiguration);
DataHolder.getInstance().setConfigManager(configManager);
bundleContext.registerService(ConfigManager.class.getName(), configManager, null);
bundleContext.registerService(AppmDataHandler.class.getName(), configManager, null);
log.info("ApplicationManagement core bundle has been successfully initialized");
} catch (Throwable e) {
@ -119,14 +120,14 @@ public class ApplicationManagementServiceComponent {
protected void setDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) {
if (log.isDebugEnabled()) {
log.debug("Setting Application Management OSGI Manager");
log.debug("Setting ApplicationDTO Management OSGI Manager");
}
DataHolder.getInstance().setDeviceManagementService(deviceManagementProviderService);
}
protected void unsetDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) {
if (log.isDebugEnabled()) {
log.debug("Removing Application Management OSGI Manager");
log.debug("Removing ApplicationDTO Management OSGI Manager");
}
DataHolder.getInstance().setDeviceManagementService(null);
}

View File

@ -20,10 +20,10 @@ package org.wso2.carbon.device.application.mgt.core.internal;
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.ConfigManager;
import org.wso2.carbon.device.application.mgt.common.services.AppmDataHandler;
import org.wso2.carbon.device.application.mgt.common.services.ReviewManager;
import org.wso2.carbon.device.application.mgt.common.services.SubscriptionManager;
import org.wso2.carbon.device.application.mgt.core.lifecycle.LifecycleStateManger;
import org.wso2.carbon.device.application.mgt.core.lifecycle.LifecycleStateManager;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.user.core.service.RealmService;
@ -44,9 +44,9 @@ public class DataHolder {
private ApplicationStorageManager applicationStorageManager;
private LifecycleStateManger lifecycleStateManger;
private LifecycleStateManager lifecycleStateManager;
private ConfigManager configManager;
private AppmDataHandler configManager;
private static final DataHolder applicationMgtDataHolder = new DataHolder();
@ -106,19 +106,19 @@ public class DataHolder {
return applicationStorageManager;
}
public LifecycleStateManger getLifecycleStateManager() {
return lifecycleStateManger;
public LifecycleStateManager getLifecycleStateManager() {
return lifecycleStateManager;
}
public void setLifecycleStateManger(LifecycleStateManger lifecycleStateManger) {
this.lifecycleStateManger = lifecycleStateManger;
public void setLifecycleStateManger(LifecycleStateManager lifecycleStateManager) {
this.lifecycleStateManager = lifecycleStateManager;
}
public ConfigManager getConfigManager() {
public AppmDataHandler getConfigManager() {
return configManager;
}
public void setConfigManager(ConfigManager configManager) {
public void setConfigManager(AppmDataHandler configManager) {
this.configManager = configManager;
}
}

View File

@ -0,0 +1,195 @@
/* 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.
*/
package org.wso2.carbon.device.application.mgt.core.lifecycle;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.application.mgt.common.exception.LifecycleManagementException;
import org.wso2.carbon.device.application.mgt.core.internal.DataHolder;
import org.wso2.carbon.device.application.mgt.core.lifecycle.config.LifecycleState;
import org.wso2.carbon.device.mgt.common.permission.mgt.PermissionManagementException;
import org.wso2.carbon.device.mgt.core.permission.mgt.PermissionUtils;
import org.wso2.carbon.device.mgt.core.search.mgt.Constants;
import org.wso2.carbon.user.api.UserRealm;
import org.wso2.carbon.user.api.UserStoreException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* This class represents the activities related to lifecycle management
*/
public class LifecycleStateManager {
private Map<String, State> lifecycleStates;
private static Log log = LogFactory.getLog(LifecycleStateManager.class);
public void init(List<LifecycleState> states) throws LifecycleManagementException {
lifecycleStates = new HashMap<>();
for (LifecycleState s : states) {
if (s.getProceedingStates() != null) {
s.getProceedingStates().replaceAll(String::toUpperCase);
}
lifecycleStates.put(s.getName().toUpperCase(), new State(s.getName().toUpperCase(),
s.getProceedingStates(), s.getPermission(), s.isAppUpdatable(), s.isAppInstallable(),
s.isInitialState(), s.isEndState()));
try {
PermissionUtils.putPermission(s.getPermission());
} catch (PermissionManagementException e) {
String msg = "Error when adding permission " + s.getPermission() + " related to the state: "
+ s.getName();
log.error(msg, e);
throw new LifecycleManagementException(msg, e);
}
}
}
public Set<String> getNextLifecycleStates(String currentLifecycleState) {
return lifecycleStates.get(currentLifecycleState.toUpperCase()).getProceedingStates();
}
public boolean isValidStateChange(String currentState, String nextState, String username, int tenantId) throws
LifecycleManagementException {
UserRealm userRealm;
String permission = getPermissionForStateChange(nextState);
if (permission != null) {
try {
userRealm = DataHolder.getInstance().getRealmService().getTenantUserRealm(tenantId);
if (userRealm != null && userRealm.getAuthorizationManager() != null &&
userRealm.getAuthorizationManager().isUserAuthorized(username,
PermissionUtils.getAbsolutePermissionPath(permission),
Constants.UI_EXECUTE)) {
if (currentState.equalsIgnoreCase(nextState)) {
return true;
}
State state = getMatchingState(currentState);
if (state != null) {
return getMatchingNextState(state.getProceedingStates(), nextState);
}
return false;
}
return false;
} catch (UserStoreException e) {
throw new LifecycleManagementException(
"UserStoreException exception from changing the state from : " + currentState + " to: "
+ nextState + " with username : " + username + " and tenant Id : " + tenantId, e);
}
} else {
throw new LifecycleManagementException(
"Required permissions cannot be found for the state : " + nextState);
}
}
private State getMatchingState(String currentState) {
for (Map.Entry<String, State> stringStateEntry : lifecycleStates.entrySet()) {
if (stringStateEntry.getKey().equalsIgnoreCase(currentState)) {
return lifecycleStates.get(stringStateEntry.getKey());
}
}
return null;
}
private boolean getMatchingNextState(Set<String> proceedingStates, String nextState) {
for (String state : proceedingStates) {
if (state.equalsIgnoreCase(nextState)) {
return true;
}
}
return false;
}
private String getPermissionForStateChange(String nextState) {
Iterator it = lifecycleStates.entrySet().iterator();
State nextLifecycleState;
while (it.hasNext()) {
Map.Entry pair = (Map.Entry) it.next();
if (pair.getKey().toString().equalsIgnoreCase(nextState)) {
nextLifecycleState = lifecycleStates.get(nextState);
return nextLifecycleState.getPermission();
}
it.remove();
}
return null;
}
public boolean isUpdatable(String state) throws LifecycleManagementException {
State currentState = getMatchingState(state);
if (currentState != null) {
return currentState.isAppUpdatable();
} else {
String msg = "Couldn't find a lifecycle state that matches with " + state + " state.";
log.error(msg);
throw new LifecycleManagementException(msg);
}
}
public boolean isInstallable(String state) throws LifecycleManagementException {
State currentState = getMatchingState(state);
if (currentState != null) {
return currentState.isAppInstallable();
} else {
String msg = "Couldn't find a lifecycle state that matches with " + state + " state.";
log.error(msg);
throw new LifecycleManagementException(msg);
}
}
public String getInitialState() throws LifecycleManagementException {
String initialState = null;
for (Map.Entry<String, State> stringStateEntry : lifecycleStates.entrySet()) {
if (stringStateEntry.getValue().isInitialState()) {
initialState = stringStateEntry.getKey();
break;
}
}
if (initialState == null){
String msg = "Haven't defined the initial state in the application-manager.xml. Please add initial state "
+ "to the <LifecycleStates> section in the app-manager.xml";
log.error(msg);
throw new LifecycleManagementException(msg);
}
return initialState;
}
public String getEntState() throws LifecycleManagementException {
String endState = null;
for (Map.Entry<String, State> stringStateEntry : lifecycleStates.entrySet()) {
if (stringStateEntry.getValue().isEndState()) {
endState = stringStateEntry.getKey();
break;
}
}
if (endState == null){
String msg = "Haven't defined the end state in the application-manager.xml. Please add end state "
+ "to the <LifecycleStates> section in the app-manager.xml";
log.error(msg);
throw new LifecycleManagementException(msg);
}
return endState;
}
public void setLifecycleStates(Map<String, State> lifecycleStates) {
this.lifecycleStates = lifecycleStates;
}
}

View File

@ -1,66 +0,0 @@
package org.wso2.carbon.device.application.mgt.core.lifecycle;
import org.wso2.carbon.device.application.mgt.core.lifecycle.config.LifecycleState;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* This class represents the activities related to lifecycle management
*/
public class LifecycleStateManger {
private Map<String, State> lifecycleStates;
public void init(List<LifecycleState> states){
lifecycleStates = new HashMap<>();
for (LifecycleState s : states) {
if (s.getProceedingStates() != null) {
s.getProceedingStates().replaceAll(String::toUpperCase);
}
lifecycleStates.put(s.getName().toUpperCase(), new State(s.getName().toUpperCase(), s.getProceedingStates()));
}
}
public Set<String> getNextLifecycleStates(String currentLifecycleState) {
return lifecycleStates.get(currentLifecycleState.toUpperCase()).getProceedingStates();
}
public boolean isValidStateChange(String currentState, String nextState) {
if (currentState.equalsIgnoreCase(nextState)) {
return true;
}
State state = getMatchingState(currentState);
if (state != null) {
return getMatchingNextState(state.getProceedingStates(), nextState);
}
return false;
}
private State getMatchingState(String currentState) {
Iterator it = lifecycleStates.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pair = (Map.Entry)it.next();
if(pair.getKey().toString().equalsIgnoreCase(currentState)) {
return lifecycleStates.get(pair.getKey().toString());
}
it.remove();
}
return null;
}
private boolean getMatchingNextState(Set<String> proceedingStates, String nextState) {
for (String state: proceedingStates) {
if (state.equalsIgnoreCase(nextState)) {
return true;
}
}
return false;
}
}

View File

@ -11,9 +11,20 @@ public class State {
private Set<String> proceedingStates;
private String stateName;
private String permission;
private boolean isAppUpdatable;
private boolean isAppInstallable;
private boolean isInitialState;
private boolean isEndState;
public State(String stateName, List<String> states) {
public State(String stateName, List<String> states, String permission, boolean isAppUpdatable,
boolean isAppInstallable, boolean isInitialState, boolean isEndState) {
this.stateName = stateName;
this.permission = permission;
this.isAppUpdatable=isAppUpdatable;
this.isAppInstallable=isAppInstallable;
this.isInitialState=isInitialState;
this.isEndState=isEndState;
if (states != null && !states.isEmpty()) {
proceedingStates = new HashSet<>(states);
}
@ -27,4 +38,14 @@ public class State {
return proceedingStates;
}
public String getPermission(){ return permission;}
public boolean isAppUpdatable(){ return isAppUpdatable;}
public boolean isAppInstallable(){ return isAppInstallable;}
public boolean isInitialState(){ return isInitialState;}
public boolean isEndState(){ return isEndState;}
}

View File

@ -3,16 +3,22 @@ package org.wso2.carbon.device.application.mgt.core.lifecycle.config;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
/**
* This class represents the lifecycle state config
*/
@XmlRootElement(name = "LifecycleState")
public class LifecycleState {
private String name;
private String permission;
private List<String> proceedingStates;
private boolean isAppInstallable;
private boolean isAppUpdatable;
private boolean isInitialState;
private boolean isEndState;
@XmlAttribute(name = "name")
public String getName() {
@ -32,4 +38,50 @@ public class LifecycleState {
public void setProceedingStates(List<String> proceedingStates) {
this.proceedingStates = proceedingStates;
}
@XmlElement(name = "Permission")
public String getPermission() {
return permission;
}
public void setPermission(String permission) {
this.permission = permission;
}
@XmlElement(name = "IsAppInstallable")
public boolean isAppInstallable() {
return isAppInstallable;
}
public void setAppInstallable(boolean isAppInstallable) {
this.isAppInstallable = isAppInstallable;
}
@XmlElement(name = "IsAppUpdatable")
public boolean isAppUpdatable() {
return isAppUpdatable;
}
public void setAppUpdatable(boolean isAppUpdatable) {
this.isAppUpdatable = isAppUpdatable;
}
@XmlElement(name = "IsInitialState")
public boolean isInitialState() {
return isInitialState;
}
public void setInitialState(boolean isInitialState) {
this.isInitialState = isInitialState;
}
@XmlElement(name = "IsEndState")
public boolean isEndState() {
return isEndState;
}
public void setEndState(boolean isEndState) {
this.isEndState = isEndState;
}
}

View File

@ -21,6 +21,7 @@ package org.wso2.carbon.device.application.mgt.core.util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.application.mgt.common.Filter;
import org.wso2.carbon.device.application.mgt.common.services.*;
import org.wso2.carbon.device.application.mgt.common.ErrorResponse;
@ -28,7 +29,7 @@ import javax.ws.rs.core.Response;
/**
* Holds util methods required for Application-Mgt API component.
* Holds util methods required for ApplicationDTO-Mgt API component.
*/
public class APIUtil {
@ -38,7 +39,7 @@ public class APIUtil {
private static ApplicationStorageManager applicationStorageManager;
private static SubscriptionManager subscriptionManager;
private static ReviewManager reviewManager;
private static ConfigManager configManager;
private static AppmDataHandler appmDataHandler;
public static ApplicationManager getApplicationManager() {
if (applicationManager == null) {
@ -48,7 +49,7 @@ public class APIUtil {
applicationManager =
(ApplicationManager) ctx.getOSGiService(ApplicationManager.class, null);
if (applicationManager == null) {
String msg = "Application Manager service has not initialized.";
String msg = "ApplicationDTO Manager service has not initialized.";
log.error(msg);
throw new IllegalStateException(msg);
}
@ -59,7 +60,7 @@ public class APIUtil {
}
/**
* To get the Application Storage Manager from the osgi context.
* To get the ApplicationDTO Storage Manager from the osgi context.
* @return ApplicationStoreManager instance in the current osgi context.
*/
public static ApplicationStorageManager getApplicationStorageManager() {
@ -70,7 +71,7 @@ public class APIUtil {
applicationStorageManager = (ApplicationStorageManager) ctx
.getOSGiService(ApplicationStorageManager.class, null);
if (applicationStorageManager == null) {
String msg = "Application Storage Manager service has not initialized.";
String msg = "ApplicationDTO Storage Manager service has not initialized.";
log.error(msg);
throw new IllegalStateException(msg);
}
@ -141,17 +142,17 @@ public class APIUtil {
}
/**
* To get the Config Manager from the osgi context.
* @return ConfigManager instance in the current osgi context.
* To get the DataHandler from the osgi context.
* @return AppmDataHandler instance in the current osgi context.
*/
public static ConfigManager getConfigManager() {
if (configManager == null) {
public static AppmDataHandler getDataHandler() {
if (appmDataHandler == null) {
synchronized (APIUtil.class) {
if (configManager == null) {
if (appmDataHandler == null) {
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
configManager =
(ConfigManager) ctx.getOSGiService(ConfigManager.class, null);
if (configManager == null) {
appmDataHandler =
(AppmDataHandler) ctx.getOSGiService(AppmDataHandler.class, null);
if (appmDataHandler == null) {
String msg = "Config Manager service has not initialized.";
log.error(msg);
throw new IllegalStateException(msg);
@ -160,7 +161,29 @@ public class APIUtil {
}
}
return configManager;
return appmDataHandler;
}
public static Filter constructFilter( String appName, String appType, String appCategory,
boolean isFullMatch, String releaseState, int offset, int limit, String sortBy) {
Filter filter = new Filter();
filter.setOffset(offset);
filter.setLimit(limit);
filter.setSortBy(sortBy);
filter.setFullMatch(isFullMatch);
if (appName != null && !appName.isEmpty()) {
filter.setAppName(appName);
}
if (appType != null && !appType.isEmpty()) {
filter.setAppType(appType);
}
if (appCategory != null && !appCategory.isEmpty()) {
filter.setAppCategory(appCategory);
}
if (releaseState != null && !releaseState.isEmpty()) {
filter.setCurrentAppReleaseState(releaseState);
}
return filter;
}
}

View File

@ -27,7 +27,7 @@ import org.wso2.carbon.device.application.mgt.common.services.ReviewManager;
import org.wso2.carbon.device.application.mgt.common.services.SubscriptionManager;
import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager;
import org.wso2.carbon.device.application.mgt.core.config.Extension;
import org.wso2.carbon.device.application.mgt.core.lifecycle.LifecycleStateManger;
import org.wso2.carbon.device.application.mgt.core.lifecycle.LifecycleStateManager;
import java.lang.reflect.Constructor;
@ -64,10 +64,10 @@ public class ApplicationManagementUtil {
return getInstance(extension, ApplicationStorageManager.class);
}
public static LifecycleStateManger getLifecycleStateMangerInstance() throws InvalidConfigurationException {
public static LifecycleStateManager getLifecycleStateMangerInstance() throws InvalidConfigurationException {
ConfigurationManager configurationManager = ConfigurationManager.getInstance();
Extension extension = configurationManager.getExtension(Extension.Name.LifecycleStateManager);
return getInstance(extension, LifecycleStateManger.class);
return getInstance(extension, LifecycleStateManager.class);
}
private static <T> T getInstance(Extension extension, Class<T> cls) throws InvalidConfigurationException {

View File

@ -37,6 +37,8 @@ public class Constants {
public static final String CF_BUNDLE_VERSION = "CFBundleVersion";
public static final String APP_EXTENSION = ".app";
public static final String FORWARD_SLASH = "/";
/**
* Database types supported by Application Management.
*/
@ -51,12 +53,6 @@ public class Constants {
public static final String DB_TYPE_POSTGRESQL = "PostgreSQL";
}
/**
* Lifecycle states of the application life-cycle.
*/
public static final String[] LIFE_CYCLES = {"CREATED", "IN REVIEW", "APPROVED", "REJECTED", "PUBLISHED",
"UNPUBLISHED", "RETIRED"};
/**
* Name of the image artifacts that are saved in the file system.

View File

@ -20,11 +20,14 @@ package org.wso2.carbon.device.application.mgt.core.util;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.application.mgt.common.ImageArtifact;
import org.wso2.carbon.device.application.mgt.common.exception.ResourceManagementException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@ -35,6 +38,9 @@ import java.nio.file.Files;
* This is a util class that handles Storage Management related tasks.
*/
public class StorageManagementUtil {
private static Log log = LogFactory.getLog(StorageManagementUtil.class);
/**
* This method is responsible for creating artifact parent directories in the given path.
*
@ -99,4 +105,19 @@ public class StorageManagementUtil {
return imageArtifact;
}
/***
* Get the fine input stream
* @param filePath File path
* @return {@link InputStream}
* @throws IOException throws if error occured when reading file or if couldn't find a file in the filePath
*/
public static InputStream getInputStream (String filePath) throws IOException {
try (InputStream inputStream = new FileInputStream(filePath)){
return inputStream;
} catch (FileNotFoundException e) {
String msg = "Couldn't file the file in file path: " + filePath;
log.error(msg);
throw new IOException(msg);
}
}
}

View File

@ -0,0 +1,25 @@
package org.wso2.carbon.device.application.mgt.core;
import org.wso2.carbon.device.application.mgt.core.lifecycle.LifecycleStateManager;
import org.wso2.carbon.device.application.mgt.core.lifecycle.State;
import org.wso2.carbon.device.application.mgt.core.lifecycle.config.LifecycleState;
import java.util.HashMap;
import java.util.List;
public class LifeCycleStateManagerTest extends LifecycleStateManager {
public void initializeLifeCycleDetails(List<LifecycleState> states) {
HashMap<String, State> lifecycleStates = new HashMap<>();
for (LifecycleState s : states) {
if (s.getProceedingStates() != null) {
s.getProceedingStates().replaceAll(String::toUpperCase);
}
lifecycleStates.put(s.getName().toUpperCase(), new State(s.getName().toUpperCase(),
s.getProceedingStates(), s.getPermission(), s.isAppUpdatable(), s.isAppInstallable(),
s.isInitialState(), s.isEndState()));
}
setLifecycleStates(lifecycleStates);
}
}

View File

@ -3,9 +3,10 @@ package org.wso2.carbon.device.application.mgt.core;
import org.junit.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.carbon.device.application.mgt.common.exception.LifecycleManagementException;
import org.wso2.carbon.device.application.mgt.core.config.Configuration;
import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager;
import org.wso2.carbon.device.application.mgt.core.lifecycle.LifecycleStateManger;
import org.wso2.carbon.device.application.mgt.core.lifecycle.LifecycleStateManager;
import org.wso2.carbon.device.application.mgt.core.lifecycle.config.LifecycleState;
import java.util.List;
@ -14,45 +15,70 @@ import java.util.Set;
public class LifecycleManagementTest {
private List<LifecycleState> lifecycleStates;
private LifecycleStateManger lifecycleStateManger;
private LifecycleStateManager lifecycleStateManager;
private final String CURRENT_STATE = "Approved";
private final String NEXT_STATE = "Published";
private final String BOGUS_STATE = "Removed";
private final String UPDATABLE_STATE = "Created";
private final String NON_UPDATABLE_STATE = "Removed";
private final String INSTALLABLE_STATE = "Published";
private final String UNINSTALlABLE_STATE = "Removed";
@BeforeClass
public void init() {
public void init() throws LifecycleManagementException {
ConfigurationManager configurationManager = ConfigurationManager.getInstance();
Configuration configuration = configurationManager.getConfiguration();
lifecycleStates = configuration.getLifecycleStates();
lifecycleStateManger = new LifecycleStateManger();
lifecycleStateManger.init(lifecycleStates);
lifecycleStateManager = new LifeCycleStateManagerTest();
((LifeCycleStateManagerTest) lifecycleStateManager).initializeLifeCycleDetails(lifecycleStates);
}
@Test
public void checkValidNextLifecycleState() {
Set<String> proceedingStates = lifecycleStateManger.getNextLifecycleStates(CURRENT_STATE);
Set<String> proceedingStates = lifecycleStateManager.getNextLifecycleStates(CURRENT_STATE);
Assert.assertTrue("Invalid proceeding state of: " + CURRENT_STATE,
proceedingStates.contains(NEXT_STATE.toUpperCase()));
proceedingStates.contains(NEXT_STATE.toUpperCase()));
}
@Test
public void checkInvalidNextLifecycleState() {
Set<String> proceedingStates = lifecycleStateManger.getNextLifecycleStates(CURRENT_STATE);
Set<String> proceedingStates = lifecycleStateManager.getNextLifecycleStates(CURRENT_STATE);
Assert.assertFalse("Invalid proceeding state of: " + CURRENT_STATE,
proceedingStates.contains(BOGUS_STATE.toUpperCase()));
proceedingStates.contains(BOGUS_STATE.toUpperCase()));
}
@Test
public void checkValidStateChange() {
Assert.assertTrue("Invalid state transition from: " + CURRENT_STATE + " to: " + NEXT_STATE,
lifecycleStateManger.isValidStateChange(CURRENT_STATE, NEXT_STATE));
}
@Test
public void checkInvalidStateChange() {
Assert.assertFalse("Invalid state transition from: " + CURRENT_STATE + " to: " + BOGUS_STATE,
lifecycleStateManger.isValidStateChange(CURRENT_STATE, BOGUS_STATE));
}
// @Test
// public void CheckUpdatableState() {
// boolean isUpdatable = lifecycleStateManager.isUpdatable(UPDATABLE_STATE);
// System.out.println(isUpdatable);
// Assert.assertTrue("Updatable state: " + UPDATABLE_STATE, isUpdatable);
// }
//
// @Test
// public void CheckNonUpdatableState() {
// boolean isUpdatable = lifecycleStateManager.isUpdatable(NON_UPDATABLE_STATE);
// Assert.assertFalse("Non Updatable state: " + NON_UPDATABLE_STATE, isUpdatable);
// }
//
// @Test
// public void CheckInstallableState() {
// boolean isInstallable = lifecycleStateManager.isInstallable(INSTALLABLE_STATE);
// Assert.assertTrue("Installable state: " + INSTALLABLE_STATE, isInstallable);
// }
//
// @Test
// public void CheckUnInstallableState() {
// boolean isInstallable = lifecycleStateManager.isInstallable(UNINSTALlABLE_STATE);
// Assert.assertFalse("UnInstallable state: " + UNINSTALlABLE_STATE, isInstallable);
// }
//
// @Test
// public void check() {
// Set<String> proceedingStates = lifecycleStateManager.getNextLifecycleStates(CURRENT_STATE);
// Assert.assertFalse("Invalid proceeding state of: " + CURRENT_STATE,
// proceedingStates.contains(BOGUS_STATE.toUpperCase()));
// }
}

View File

@ -16,10 +16,9 @@
~ specific language governing permissions and limitations
~ under the License.
-->
<ApplicationManagementConfiguration>
<!-- Application Mgt DB schema -->
<!-- ApplicationDTO Mgt DB schema -->
<DatasourceName>jdbc/APPM_DS</DatasourceName>
<Extensions>
@ -30,54 +29,143 @@
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.ReviewManagerImpl</ClassName>
</Extension>
<Extension name="LifecycleStateManager">
<ClassName>org.wso2.carbon.device.application.mgt.core.lifecycle.LifecycleStateManger</ClassName>
<ClassName>org.wso2.carbon.device.application.mgt.core.lifecycle.LifecycleStateManager</ClassName>
</Extension>
<Extension name="SubscriptionManager">
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.SubscriptionManagerImpl</ClassName>
</Extension>
<Extension name="ApplicationStorageManager">
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.ApplicationStorageManagerImpl</ClassName>
<Parameters>
<Parameter name="StoragePath">repository/resources/apps/</Parameter>
<Parameter name="MaxScreenShotCount">6</Parameter>
</Parameters>
</Extension>
</Extensions>
<!-- This is for publisher lifecycle -->
<!-- The current lifecycle as follows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Created] -> [In-Review] -> [Approved] -> [Published] -> [Unpublished] -> [Removed]
^ | ^
| | |
| |-> [Deprecated] - - - - - - - -|
| |
|-> [Rejected] - - - - - - - - - - - - - - - - - - - - - - - - |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If there is a requirement to introduce a new state to the lifecycle, please refer above
diagram and add relevant state to the below configuration appropriately.
-->
<!-- a lifecyclestate can have following properties
<LifecycleState name="In-Review">
<IsAppInstallable>false</IsAppInstallable>
<IsAppUpdatable>true</IsAppUpdatable>
<IsInitialState>false</IsInitialState>
<IsEndState>false</IsEndState>
<Permission>
/device-mgt/applications/life-cycle/in-review
</Permission>
<ProceedingStates>
<State>Rejected</State>
<State>Approved</State>
</ProceedingStates>
</LifecycleState>
-->
<LifecycleStates>
<LifecycleState name="Created">
<IsAppUpdatable>true</IsAppUpdatable>
<IsInitialState>true</IsInitialState>
<Permission>/device-mgt/applications/life-cycle/create</Permission>
<ProceedingStates>
<State>In-Review</State>
</ProceedingStates>
</LifecycleState>
<LifecycleState name="In-Review">
<Permission>/device-mgt/applications/life-cycle/in-review</Permission>
<ProceedingStates>
<State>Rejected</State>
<State>Approved</State>
</ProceedingStates>
</LifecycleState>
<LifecycleState name="Approved">
<Permission>/device-mgt/applications/life-cycle/approve</Permission>
<ProceedingStates>
<State>Published</State>
<State>Created</State>
</ProceedingStates>
</LifecycleState>
<LifecycleState name="Rejected">
<Permission>/device-mgt/applications/life-cycle/reject</Permission>
<ProceedingStates>
<State>In-Review</State>
<State>Created</State>
<State>Removed</State>
</ProceedingStates>
</LifecycleState>
<LifecycleState name="Published">
<IsAppInstallable>true</IsAppInstallable>
<Permission>/device-mgt/applications/life-cycle/publish</Permission>
<ProceedingStates>
<State>Unpublished</State>
<State>Deprecated</State>
</ProceedingStates>
</LifecycleState>
<LifecycleState name="Unpublished">
<Permission>/device-mgt/applications/life-cycle/unpublish</Permission>
<ProceedingStates>
<State>Published</State>
<State>In-Review</State>
<State>Removed</State>
</ProceedingStates>
</LifecycleState>
<LifecycleState name="Deprecated">
<Permission>/device-mgt/applications/life-cycle/deprecate</Permission>
<ProceedingStates>
<State>Removed</State>
<State>In-Review</State>
</ProceedingStates>
</LifecycleState>
<LifecycleState name="Removed">
<IsEndState>true</IsEndState>
<Permission>/device-mgt/applications/life-cycle/remove</Permission>
</LifecycleState>
</LifecycleStates>
<UIConfigs>
<EnableOAuth>true</EnableOAuth>
<EnableSSO>false</EnableSSO>
<EnableSSO>false</EnableSSO>
<AppRegistration>
<Tags>
<Tag>application_management</Tag>
<Tag>device_management</Tag>
<Tag>subscription_management</Tag>
<Tag>review_management</Tag>
</Tags>
<AllowToAllDomains>true</AllowToAllDomains>
</AppRegistration>
<Scopes>
<Scope>perm:app:review:view</Scope>
<Scope>perm:app:review:update</Scope>
<Scope>perm:app:publisher:view</Scope>
<Scope>perm:app:publisher:update</Scope>
</Scopes>
<SSOConfiguration>
<Issuer>app-mgt</Issuer>
</SSOConfiguration>
<LoginResponse>
<SuccessCallback>/application-mgt</SuccessCallback>
<FailureCallback>
<BadRequest>/pages/error/client-errors/400</BadRequest>
<Unauthorized>/pages/error/client-errors/401</Unauthorized>
<Forbidden>/pages/error/client-errors/403</Forbidden>
<NotFound>/pages/error/client-errors/404</NotFound>
<MethodNotAllowed>/pages/error/client-errors/405</MethodNotAllowed>
<NotAcceptable>/pages/error/client-errors/406</NotAcceptable>
<UnsupportedMediaType>/pages/error/client-errors/415</UnsupportedMediaType>
<InternalServerError>/pages/error/server-errors/500</InternalServerError>
<DefaultPage>/pages/error/default</DefaultPage>
</FailureCallback>
</LoginResponse>
</UIConfigs>
</ApplicationManagementConfiguration>

View File

@ -34,6 +34,9 @@ import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
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.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO;
import org.wso2.carbon.device.application.mgt.common.wrapper.ApplicationWrapper;
import java.util.List;
import javax.validation.Valid;
@ -55,7 +58,7 @@ import javax.ws.rs.core.Response;
@SwaggerDefinition(
info = @Info(
version = "1.0.0",
title = "Application Management Service",
title = "ApplicationDTO Management Service",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name", value = "ApplicationManagementService"),
@ -64,20 +67,20 @@ import javax.ws.rs.core.Response;
}
),
tags = {
@Tag(name = "application_management, device_management", description = "Application Management related "
@Tag(name = "application_management, device_management", description = "ApplicationDTO Management related "
+ "APIs")
}
)
@Scopes(
scopes = {
@Scope(
name = "Get Application Details",
name = "Get ApplicationDTO Details",
description = "Get application details",
key = "perm:app:publisher:view",
permissions = {"/device-mgt/application/view"}
),
@Scope(
name = "Update an Application",
name = "Update an ApplicationDTO",
description = "Update an application",
key = "perm:app:publisher:update",
permissions = {"/device-mgt/application/update"}
@ -85,7 +88,7 @@ import javax.ws.rs.core.Response;
}
)
@Path("/publisher/applications")
@Api(value = "Application 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.")
@Produces(MediaType.APPLICATION_JSON)
public interface ApplicationManagementAPI {
@ -101,7 +104,7 @@ public interface ApplicationManagementAPI {
httpMethod = "GET",
value = "get all applications",
notes = "This will get all applications",
tags = "Application Management",
tags = "ApplicationDTO Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:app:publisher:view")
@ -124,6 +127,10 @@ public interface ApplicationManagementAPI {
response = ErrorResponse.class)
})
Response getApplications(
@ApiParam(
name = "deviceType",
value = "Supporting device Type of the application")
@QueryParam("device-type") String deviceType,
@ApiParam(
name = "name",
value = "Name of the application")
@ -134,7 +141,7 @@ public interface ApplicationManagementAPI {
@QueryParam("type") String appType,
@ApiParam(
name = "category",
value = "Category of the application")
value = "CategoryDTO of the application")
@QueryParam("category") String appCategory,
@ApiParam(
name = "exact-match",
@ -171,7 +178,7 @@ public interface ApplicationManagementAPI {
httpMethod = "GET",
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",
tags = "Application Management",
tags = "ApplicationDTO Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:app:publisher:view")
@ -183,10 +190,10 @@ public interface ApplicationManagementAPI {
@ApiResponse(
code = 200,
message = "OK. \n Successfully retrieved relevant application.",
response = Application.class),
response = ApplicationDTO.class),
@ApiResponse(
code = 404,
message = "Application not found"),
message = "ApplicationDTO not found"),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Error occurred while getting relevant application.",
@ -206,6 +213,7 @@ public interface ApplicationManagementAPI {
);
@PUT
@Path("/{appId}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(
@ -214,7 +222,7 @@ public interface ApplicationManagementAPI {
httpMethod = "PUT",
value = "Edit an application",
notes = "This will edit the new application",
tags = "Application Management",
tags = "ApplicationDTO Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
@ -226,22 +234,27 @@ public interface ApplicationManagementAPI {
@ApiResponse(
code = 200,
message = "OK. \n Successfully edited the application.",
response = Application.class),
response = ApplicationDTO.class),
@ApiResponse(
code = 400,
message = "Bad Request. \n " +
"Application updating payload contains unacceptable or vulnerable data"),
"ApplicationDTO updating payload contains unacceptable or vulnerable data"),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Error occurred while editing the application.",
response = ErrorResponse.class)
})
Response updateApplication(
@ApiParam(
name = "appId",
value = "application Id",
required = true)
@PathParam("appId") int appId,
@ApiParam(
name = "application",
value = "The application that need to be edited.",
required = true)
@Valid Application application
@Valid ApplicationDTO application
);
@POST
@ -253,7 +266,7 @@ public interface ApplicationManagementAPI {
httpMethod = "POST",
value = "Create an application",
notes = "This will create a new application",
tags = "Application Management",
tags = "ApplicationDTO Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
@ -265,11 +278,11 @@ public interface ApplicationManagementAPI {
@ApiResponse(
code = 201,
message = "OK. \n Successfully created an application.",
response = Application.class),
response = ApplicationDTO.class),
@ApiResponse(
code = 400,
message = "Bad Request. \n " +
"Application creating payload contains unacceptable or vulnerable data"),
"ApplicationDTO creating payload contains unacceptable or vulnerable data"),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Error occurred while creating the application.",
@ -280,7 +293,7 @@ public interface ApplicationManagementAPI {
name = "application",
value = "The application that need to be created.",
required = true)
@Multipart("application") Application application,
@Multipart("application") ApplicationWrapper application,
@ApiParam(
name = "binaryFile",
value = "Binary file of uploading application",
@ -313,78 +326,78 @@ public interface ApplicationManagementAPI {
@Multipart(value = "screenshot3") Attachment screenshot3
);
@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes("multipart/mixed")
@Path("/{deviceType}/{appType}/{appId}")
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Create an application",
notes = "This will create a new application",
tags = "Application Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
})
}
)
@ApiResponses(
value = {
@ApiResponse(
code = 201,
message = "OK. \n Successfully created an application.",
response = Application.class),
@ApiResponse(
code = 400,
message = "Bad Request. \n " +
"Application creating payload contains unacceptable or vulnerable data"),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Error occurred while creating the application.",
response = ErrorResponse.class)
})
Response createRelease(
@PathParam("deviceType") String deviceType,
@PathParam("appId") String appType,
@PathParam("appId") int appId,
@ApiParam(
name = "applicationRelease",
value = "The application release that need to be created.",
required = true)
@Multipart("applicationRelease") ApplicationRelease applicationRelease,
@ApiParam(
name = "binaryFile",
value = "Binary file of uploading application",
required = true)
@Multipart(value = "binaryFile") Attachment binaryFile,
@ApiParam(
name = "icon",
value = "Icon of the uploading application",
required = true)
@Multipart(value = "icon") Attachment iconFile,
@ApiParam(
name = "banner",
value = "Banner of the uploading application",
required = true)
@Multipart(value = "banner") Attachment bannerFile,
@ApiParam(
name = "screenshot1",
value = "Screen Shots of the uploading application",
required = true)
@Multipart(value = "screenshot1") Attachment screenshot1,
@ApiParam(
name = "screenshot2",
value = "Screen Shots of the uploading application",
required = false)
@Multipart(value = "screenshot2") Attachment screenshot2,
@ApiParam(
name = "screenshot3",
value = "Screen Shots of the uploading application",
required = false)
@Multipart(value = "screenshot3") Attachment screenshot3
);
// @POST
// @Produces(MediaType.APPLICATION_JSON)
// @Consumes("multipart/mixed")
// @Path("/{deviceType}/{appType}/{appId}")
// @ApiOperation(
// consumes = MediaType.APPLICATION_JSON,
// produces = MediaType.APPLICATION_JSON,
// httpMethod = "POST",
// value = "Create an application",
// notes = "This will create a new application",
// tags = "ApplicationDTO Management",
// extensions = {
// @Extension(properties = {
// @ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
// })
// }
// )
// @ApiResponses(
// value = {
// @ApiResponse(
// code = 201,
// message = "OK. \n Successfully created an application.",
// response = Application.class),
// @ApiResponse(
// code = 400,
// message = "Bad Request. \n " +
// "ApplicationDTO creating payload contains unacceptable or vulnerable data"),
// @ApiResponse(
// code = 500,
// message = "Internal Server Error. \n Error occurred while creating the application.",
// response = ErrorResponse.class)
// })
// Response createRelease(
// @PathParam("deviceType") String deviceType,
// @PathParam("appId") String appType,
// @PathParam("appId") int appId,
// @ApiParam(
// name = "applicationRelease",
// value = "The application release that need to be created.",
// required = true)
// @Multipart("applicationRelease") ApplicationReleaseDTO applicationRelease,
// @ApiParam(
// name = "binaryFile",
// value = "Binary file of uploading application",
// required = true)
// @Multipart(value = "binaryFile") Attachment binaryFile,
// @ApiParam(
// name = "icon",
// value = "Icon of the uploading application",
// required = true)
// @Multipart(value = "icon") Attachment iconFile,
// @ApiParam(
// name = "banner",
// value = "Banner of the uploading application",
// required = true)
// @Multipart(value = "banner") Attachment bannerFile,
// @ApiParam(
// name = "screenshot1",
// value = "Screen Shots of the uploading application",
// required = true)
// @Multipart(value = "screenshot1") Attachment screenshot1,
// @ApiParam(
// name = "screenshot2",
// value = "Screen Shots of the uploading application",
// required = false)
// @Multipart(value = "screenshot2") Attachment screenshot2,
// @ApiParam(
// name = "screenshot3",
// value = "Screen Shots of the uploading application",
// required = false)
// @Multipart(value = "screenshot3") Attachment screenshot3
// );
@DELETE
@Consumes("application/json")
@ -395,7 +408,7 @@ public interface ApplicationManagementAPI {
httpMethod = "DELETE",
value = "Delete the application with the given UUID",
notes = "This will delete the application with the given UUID",
tags = "Application Management",
tags = "ApplicationDTO Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
@ -416,7 +429,7 @@ public interface ApplicationManagementAPI {
Response deleteApplication(
@ApiParam(
name = "UUID",
value = "Unique identifier of the Application",
value = "Unique identifier of the ApplicationDTO",
required = true)
@PathParam("appid") int applicationId
);
@ -431,7 +444,7 @@ public interface ApplicationManagementAPI {
httpMethod = "POST",
value = "Upload artifacts",
notes = "This will create a new application",
tags = "Application Management",
tags = "ApplicationDTO Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
@ -443,6 +456,10 @@ public interface ApplicationManagementAPI {
@ApiResponse(
code = 200,
message = "OK. \n Successfully updated artifacts."),
@ApiResponse(
code = 400,
message = "Bad Request. \n Requesting to update image artifacts with invalid application "
+ "or application release data."),
@ApiResponse(
code = 403,
message = "FORBIDDEN. \n Can't Update the application release in PUBLISHED or DEPRECATED "
@ -503,7 +520,7 @@ public interface ApplicationManagementAPI {
httpMethod = "POST",
value = "Upload artifacts",
notes = "This will create a new application",
tags = "Application Management",
tags = "ApplicationDTO Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
@ -518,7 +535,10 @@ public interface ApplicationManagementAPI {
@ApiResponse(
code = 400,
message = "Bad Request. \n " +
"Application artifact updating payload contains unacceptable or vulnerable data"),
"ApplicationDTO artifact updating payload contains unacceptable or vulnerable data"),
@ApiResponse(
code = 404,
message = "NOT FOUND. \n Couldn't found application/application release to update applocation release artifact."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Error occurred while getting the application list.",
@ -537,7 +557,7 @@ public interface ApplicationManagementAPI {
);
@PUT
@Path("/{appId}/{uuid}")
@Path("/{deviceType}/{appId}/{uuid}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.MULTIPART_FORM_DATA)
@ApiOperation(
@ -546,7 +566,7 @@ public interface ApplicationManagementAPI {
httpMethod = "PUT",
value = "Update an application release",
notes = "This will update a new application release",
tags = "Application Management",
tags = "ApplicationDTO Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = SCOPE, value = "perm:app:publisher:update")
@ -558,24 +578,33 @@ public interface ApplicationManagementAPI {
@ApiResponse(
code = 201,
message = "OK. \n Successfully created an application release.",
response = ApplicationRelease.class),
response = ApplicationReleaseDTO.class),
@ApiResponse(
code = 400,
message = "Bad Request. \n " +
"Application release updating payload contains unacceptable or vulnerable data"),
"ApplicationDTO release updating payload contains unacceptable or vulnerable data"),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Error occurred while releasing the application.",
response = ErrorResponse.class)
})
Response updateApplicationRelease(
@ApiParam(name = "appId", value = "Identifier of the Application", required = true) @PathParam("appId") int applicationId,
@ApiParam(name = "UUID", value = "Unique identifier of the Application Release", required = true) @PathParam("uuid") String applicationUUID,
@Multipart(value = "applicationRelease", required = false, type = "application/json") ApplicationRelease applicationRelease,
@ApiParam(name = "deviceType", value = "Supported device type of the application", required = true)
@PathParam("deviceType") String deviceType,
@ApiParam(name = "appId", value = "Identifier of the ApplicationDTO", required = true)
@PathParam("appId") int applicationId,
@ApiParam(name = "UUID", value = "Unique identifier of the ApplicationDTO Release", required = true)
@PathParam("uuid") String applicationUUID,
@Multipart(value = "applicationRelease", required = false, type = "application/json") ApplicationReleaseDTO applicationRelease,
@Multipart(value = "binaryFile", required = false) Attachment binaryFile,
@Multipart(value = "icon", required = false) Attachment iconFile,
@Multipart(value = "banner", required = false) Attachment bannerFile,
@Multipart(value = "screenshot", required = false) List<Attachment> attachmentList);
@ApiParam(name = "screenshot1", value = "Screen Shots of the uploading application", required = true)
@Multipart(value = "screenshot1") Attachment screenshot1,
@ApiParam(name = "screenshot2", value = "Screen Shots of the uploading application")
@Multipart(value = "screenshot2") Attachment screenshot2,
@ApiParam(name = "screenshot3", value = "Screen Shots of the uploading application")
@Multipart(value = "screenshot3") Attachment screenshot3);
@GET
@Path("/lifecycle/{appId}/{uuid}")
@ -629,7 +658,7 @@ public interface ApplicationManagementAPI {
@ApiResponse(
code = 201,
message = "OK. \n Successfully add a lifecycle state.",
response = Application.class),
response = ApplicationDTO.class),
@ApiResponse(
code = 400,
message = "Bad Request. \n " +
@ -646,12 +675,12 @@ public interface ApplicationManagementAPI {
Response addLifecycleState(
@ApiParam(
name = "appId",
value = "Identifier of the Application",
value = "Identifier of the ApplicationDTO",
required = true)
@PathParam("appId") int applicationId,
@ApiParam(
name = "uuid",
value = "UUID of the Application Release",
value = "UUID of the ApplicationDTO Release",
required = true)
@PathParam("uuid") String applicationUuid,
@ApiParam(

View File

@ -23,22 +23,30 @@ import org.apache.commons.logging.LogFactory;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import org.wso2.carbon.device.application.mgt.common.*;
import org.wso2.carbon.device.application.mgt.common.dto.ApplicationDTO;
import org.wso2.carbon.device.application.mgt.common.dto.ApplicationReleaseDTO;
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.RequestValidatingException;
import org.wso2.carbon.device.application.mgt.common.response.Application;
import org.wso2.carbon.device.application.mgt.common.wrapper.ApplicationWrapper;
import org.wso2.carbon.device.application.mgt.core.exception.BadRequestException;
import org.wso2.carbon.device.application.mgt.core.exception.ForbiddenException;
import org.wso2.carbon.device.application.mgt.core.exception.ValidationException;
import org.wso2.carbon.device.application.mgt.core.util.APIUtil;
import org.wso2.carbon.device.application.mgt.publisher.api.services.ApplicationManagementAPI;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException;
import org.wso2.carbon.device.application.mgt.common.exception.ResourceManagementException;
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.core.exception.NotFoundException;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import java.util.Map;
import javax.activation.DataHandler;
import javax.validation.Valid;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@ -66,6 +74,7 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
@Override
@Consumes("application/json")
public Response getApplications(
@QueryParam("device-type") String deviceType,
@QueryParam("name") String appName,
@QueryParam("type") String appType,
@QueryParam("category") String appCategory,
@ -77,30 +86,20 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
ApplicationManager applicationManager = APIUtil.getApplicationManager();
try {
Filter filter = new Filter();
filter.setOffset(offset);
filter.setLimit(limit);
filter.setSortBy(sortBy);
filter.setFullMatch(isFullMatch);
if (appName != null && !appName.isEmpty()) {
filter.setAppName(appName);
}
if (appType != null && !appType.isEmpty()) {
filter.setAppType(appType);
}
if (appCategory != null && !appCategory.isEmpty()) {
filter.setAppCategory(appCategory);
}
if (releaseState != null && !releaseState.isEmpty()) {
filter.setCurrentAppReleaseState(releaseState);
}
ApplicationList applications = applicationManager.getApplications(filter);
Filter filter = APIUtil
.constructFilter(appName, appType, appCategory, isFullMatch, releaseState, offset,
limit, sortBy);
ApplicationList applications = applicationManager.getApplications(filter, deviceType);
if (applications.getApplications().isEmpty()) {
return Response.status(Response.Status.NOT_FOUND)
.entity("Couldn't find any application for requested query.").build();
.entity("Couldn't find any application for the requested query.").build();
}
return Response.status(Response.Status.OK).entity(applications).build();
} catch (ApplicationManagementException e) {
} catch(BadRequestException e){
String msg = "Couldn't found a device type for " + deviceType;
log.error(msg, e);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
}catch (ApplicationManagementException e) {
String msg = "Error occurred while getting the application list for publisher ";
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
@ -115,10 +114,10 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
@DefaultValue("PUBLISHED") @QueryParam("state") String state) {
ApplicationManager applicationManager = APIUtil.getApplicationManager();
try {
Application application = applicationManager.getApplicationById(appId, state);
ApplicationDTO application = applicationManager.getApplicationById(appId, state);
return Response.status(Response.Status.OK).entity(application).build();
} catch (NotFoundException e) {
String msg = "Application with application id: " + appId + " not found";
String msg = "ApplicationDTO with application id: " + appId + " not found";
log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} catch (ApplicationManagementException e) {
@ -131,7 +130,7 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
@POST
@Consumes("multipart/mixed")
public Response createApplication(
@Multipart("application") Application application,
@Multipart("application") ApplicationWrapper applicationWrapper,
@Multipart("binaryFile") Attachment binaryFile,
@Multipart("icon") Attachment iconFile,
@Multipart("banner") Attachment bannerFile,
@ -139,14 +138,11 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
@Multipart("screenshot2") Attachment screenshot2,
@Multipart("screenshot3") Attachment screenshot3) {
ApplicationManager applicationManager = APIUtil.getApplicationManager();
ApplicationStorageManager applicationStorageManager = APIUtil.getApplicationStorageManager();
InputStream iconFileStream;
InputStream bannerFileStream;
List<InputStream> attachments = new ArrayList<>();
List<ApplicationRelease> applicationReleases = new ArrayList<>();
ApplicationRelease applicationRelease;
List<Attachment> attachmentList = new ArrayList<>();
attachmentList.add(screenshot1);
if (screenshot1 != null) {
attachmentList.add(screenshot1);
}
if (screenshot2 != null) {
attachmentList.add(screenshot2);
}
@ -155,155 +151,25 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
}
try {
if (!isValidAppCreatingRequest(iconFile, bannerFile, attachmentList, application)) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
// The application executable artifacts such as apks are uploaded.
if (!ApplicationType.ENTERPRISE.toString().equals(application.getType())) {
applicationRelease = application.getApplicationReleases().get(0);
applicationRelease = applicationStorageManager
.uploadReleaseArtifact(applicationRelease, application.getType(), application.getDeviceType(),
null);
} else {
if (binaryFile == null){
String msg = "Binary file is not found for the application release. Application name: " + application.getName()
+ " Application type: " + application.getType();
return Response.status(Response.Status.BAD_REQUEST).entity(new ApplicationManagementException(msg))
.build();
}
applicationRelease = application.getApplicationReleases().get(0);
applicationRelease = applicationStorageManager
.uploadReleaseArtifact(applicationRelease, application.getType(), application.getDeviceType(),
binaryFile.getDataHandler().getInputStream());
if (applicationRelease.getAppStoredLoc() == null || applicationRelease.getAppHashValue() == null) {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
}
iconFileStream = iconFile.getDataHandler().getInputStream();
bannerFileStream = bannerFile.getDataHandler().getInputStream();
for (Attachment screenshot : attachmentList) {
attachments.add(screenshot.getDataHandler().getInputStream());
}
// Upload images
applicationRelease = applicationStorageManager
.uploadImageArtifacts(applicationRelease, iconFileStream, bannerFileStream, attachments);
applicationRelease.setUuid(UUID.randomUUID().toString());
applicationReleases.add(applicationRelease);
application.setApplicationReleases(applicationReleases);
applicationManager.validateAppCreatingRequest(applicationWrapper);
applicationManager.validateReleaseCreatingRequest(applicationWrapper.getApplicationReleaseWrappers().get(0),
applicationWrapper.getType());
applicationManager.isValidAttachmentSet(binaryFile, iconFile, bannerFile, attachmentList,
applicationWrapper.getType());
// Created new application entry
Application createdApplication = applicationManager.createApplication(application);
if (createdApplication != null) {
return Response.status(Response.Status.CREATED).entity(createdApplication).build();
Application application = applicationManager.createApplication(applicationWrapper,
constructApplicationArtifact(binaryFile, iconFile, bannerFile, attachmentList));
if (application != null) {
return Response.status(Response.Status.CREATED).entity(application).build();
} else {
String msg = "Application creation is failed";
String msg = "ApplicationDTO creation is failed";
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) {
String msg = "Error occurred while creating the application";
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
} catch (ResourceManagementException e) {
String msg =
"Error occurred while uploading the releases artifacts of the application " + application.getName();
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
} catch (IOException e) {
String msg =
"Error while uploading binary file and resources for the application release of the application "
+ application.getName();
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
} catch (RequestValidatingException e) {
String msg = "Error occurred while handling the application creating request";
log.error(msg, e);
return Response.status(Response.Status.BAD_REQUEST).build();
}
}
@POST
@Consumes("multipart/mixed")
@Path("/{deviceType}/{appType}/{appId}")
public Response createRelease(
@PathParam("deviceType") String deviceType,
@PathParam("appId") String appType,
@PathParam("appId") int appId,
@Multipart("applicationRelease") ApplicationRelease applicationRelease,
@Multipart("binaryFile") Attachment binaryFile,
@Multipart("icon") Attachment iconFile,
@Multipart("banner") Attachment bannerFile,
@Multipart("screenshot1") Attachment screenshot1,
@Multipart("screenshot2") Attachment screenshot2,
@Multipart("screenshot3") Attachment screenshot3) {
ApplicationManager applicationManager = APIUtil.getApplicationManager();
ApplicationStorageManager applicationStorageManager = APIUtil.getApplicationStorageManager();
InputStream iconFileStream;
InputStream bannerFileStream;
List<InputStream> attachments = new ArrayList<>();
List<Attachment> attachmentList = new ArrayList<>();
attachmentList.add(screenshot1);
if (screenshot2 != null) {
attachmentList.add(screenshot2);
}
if (screenshot3 != null) {
attachmentList.add(screenshot3);
}
try {
if (!isValidReleaseCreatingRequest(binaryFile, iconFile, bannerFile, attachmentList, appType)) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
// The application executable artifacts such as apks are uploaded.
if (!ApplicationType.ENTERPRISE.toString().equals(appType)) {
applicationRelease = applicationStorageManager
.uploadReleaseArtifact(applicationRelease, appType, deviceType, null);
} else {
applicationRelease = applicationStorageManager
.uploadReleaseArtifact(applicationRelease, appType, deviceType,
binaryFile.getDataHandler().getInputStream());
if (applicationRelease.getAppStoredLoc() == null || applicationRelease.getAppHashValue() == null) {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
}
iconFileStream = iconFile.getDataHandler().getInputStream();
bannerFileStream = bannerFile.getDataHandler().getInputStream();
for (Attachment screenshot : attachmentList) {
attachments.add(screenshot.getDataHandler().getInputStream());
}
// Upload images
applicationRelease = applicationStorageManager
.uploadImageArtifacts(applicationRelease, iconFileStream, bannerFileStream, attachments);
applicationRelease.setUuid(UUID.randomUUID().toString());
// Created new application release entry
ApplicationRelease release = applicationManager.createRelease(appId, applicationRelease);
if (release != null) {
return Response.status(Response.Status.CREATED).entity(release).build();
} else {
log.error("Application Creation Failed");
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
} catch (ApplicationManagementException e) {
String msg = "Error occurred while creating the application";
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (ResourceManagementException e) {
String msg = "Error occurred while uploading the releases artifacts of the application ID: " + appId;
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (IOException e) {
String msg = "Error while uploading binary file and resources for the application release of the "
+ "application ID: " + appId;
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (RequestValidatingException e) {
String msg = "Error occurred while handling the application creating request";
@ -312,17 +178,105 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
}
}
// @POST
// @Consumes("multipart/mixed")
// @Path("/{deviceType}/{appType}/{appId}")
// public Response createRelease(
// @PathParam("deviceType") String deviceType,
// @PathParam("appType") String appType,
// @PathParam("appId") int appId,
// @Multipart("applicationRelease") ApplicationReleaseDTO applicationRelease,
// @Multipart("binaryFile") Attachment binaryFile,
// @Multipart("icon") Attachment iconFile,
// @Multipart("banner") Attachment bannerFile,
// @Multipart("screenshot1") Attachment screenshot1,
// @Multipart("screenshot2") Attachment screenshot2,
// @Multipart("screenshot3") Attachment screenshot3) {
// ApplicationManager applicationManager = APIUtil.getApplicationManager();
// ApplicationStorageManager applicationStorageManager = APIUtil.getApplicationStorageManager();
// InputStream iconFileStream;
// InputStream bannerFileStream;
// List<InputStream> attachments = new ArrayList<>();
// List<Attachment> attachmentList = new ArrayList<>();
// attachmentList.add(screenshot1);
// if (screenshot2 != null) {
// attachmentList.add(screenshot2);
// }
// if (screenshot3 != null) {
// attachmentList.add(screenshot3);
// }
//
// try {
// applicationManager
// .validateReleaseCreatingRequest(applicationRelease, appType, binaryFile, iconFile, bannerFile,
// attachmentList);
//
// // The application executable artifacts such as apks are uploaded.
// if (!ApplicationType.ENTERPRISE.toString().equals(appType)) {
// applicationRelease = applicationStorageManager
// .uploadReleaseArtifact(applicationRelease, appType, deviceType, null);
// } else {
// applicationRelease = applicationStorageManager
// .uploadReleaseArtifact(applicationRelease, appType, deviceType,
// binaryFile.getDataHandler().getInputStream());
// if (applicationRelease.getInstallerName() == null || applicationRelease.getAppHashValue() == null) {
// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
// }
// }
//
// iconFileStream = iconFile.getDataHandler().getInputStream();
// bannerFileStream = bannerFile.getDataHandler().getInputStream();
//
// for (Attachment screenshot : attachmentList) {
// attachments.add(screenshot.getDataHandler().getInputStream());
// }
//
// // Upload images
// applicationRelease = applicationStorageManager
// .uploadImageArtifacts(applicationRelease, iconFileStream, bannerFileStream, attachments);
// applicationRelease.setUuid(UUID.randomUUID().toString());
//
// // Created new application release entry
// ApplicationReleaseDTO release = applicationManager.createRelease(appId, applicationRelease);
// if (release != null) {
// return Response.status(Response.Status.CREATED).entity(release).build();
// } else {
// log.error("ApplicationDTO Creation Failed");
// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
// }
// } catch (ApplicationManagementException e) {
// String msg = "Error occurred while creating the application";
// log.error(msg, e);
// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
// } catch (ResourceManagementException e) {
// String msg = "Error occurred while uploading the releases artifacts of the application ID: " + appId;
// log.error(msg, e);
// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
// } catch (IOException e) {
// String msg = "Error while uploading binary file and resources for the application release of the "
// + "application ID: " + appId;
// log.error(msg, e);
// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
// } catch (RequestValidatingException e) {
// String msg = "Error occurred while handling the application creating request";
// log.error(msg, e);
// return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
// }
// }
@Override
@PUT
@Consumes("multipart/mixed")
@Produces(MediaType.APPLICATION_JSON)
@Path("/image-artifacts/{appId}/{uuid}")
public Response updateApplicationImageArtifacts(
@PathParam("appId") int appId, @PathParam("uuid") String applicationUuid,
@Multipart("icon") Attachment iconFile, @Multipart("banner") Attachment bannerFile,
@Multipart("screenshot1") Attachment screenshot1, @Multipart("screenshot2") Attachment screenshot2,
@PathParam("appId") int appId,
@PathParam("uuid") String applicationReleaseUuid,
@Multipart("icon") Attachment iconFile,
@Multipart("banner") Attachment bannerFile,
@Multipart("screenshot1") Attachment screenshot1,
@Multipart("screenshot2") Attachment screenshot2,
@Multipart("screenshot3") Attachment screenshot3) {
try {
InputStream iconFileStream = null;
InputStream bannerFileStream = null;
@ -334,7 +288,6 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
if (bannerFile != null) {
bannerFileStream = bannerFile.getDataHandler().getInputStream();
}
attachments.add(screenshot1.getDataHandler().getInputStream());
if (screenshot2 != null) {
attachments.add(screenshot2.getDataHandler().getInputStream());
@ -343,27 +296,30 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
attachments.add(screenshot3.getDataHandler().getInputStream());
}
ApplicationManager applicationManager = APIUtil.getApplicationManager();
applicationManager.updateApplicationImageArtifact(appId, applicationUuid, iconFileStream, bannerFileStream,
attachments);
applicationManager
.updateApplicationImageArtifact(appId, applicationReleaseUuid, iconFileStream, bannerFileStream,
attachments);
return Response.status(Response.Status.OK)
.entity("Successfully uploaded artifacts for the application " + applicationUuid).build();
.entity("Successfully uploaded artifacts for the application " + applicationReleaseUuid).build();
} catch (NotFoundException e) {
log.error(e.getMessage(), e);
return APIUtil.getResponse(e, Response.Status.NOT_FOUND);
return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).build();
} catch (ValidationException e) {
log.error(e.getMessage(), e);
return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
} catch (ForbiddenException e) {
log.error(e.getMessage(), e);
return Response.status(Response.Status.FORBIDDEN).entity(e.getMessage()).build();
} catch (ApplicationManagementException e) {
String msg = "Error occurred while updating the application.";
String msg = "Error occurred while updating the application image artifacts for app id: " + appId
+ " application release uuid: " + applicationReleaseUuid;
log.error(msg, e);
return APIUtil.getResponse(e, Response.Status.INTERNAL_SERVER_ERROR);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (IOException e) {
String msg = "Exception while trying to read icon, banner files for the application " + applicationUuid;
String msg =
"Exception while trying to read icon, banner files for the application " + applicationReleaseUuid;
log.error(msg);
return APIUtil
.getResponse(new ApplicationManagementException(msg, e), Response.Status.INTERNAL_SERVER_ERROR);
} catch (ResourceManagementException e) {
log.error("Error occurred while uploading the image artifacts of the application with the uuid "
+ applicationUuid, e);
return APIUtil.getResponse(e, Response.Status.INTERNAL_SERVER_ERROR);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
}
}
@ -375,127 +331,142 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
@PathParam("deviceType") String deviceType,
@PathParam("appType") String appType,
@PathParam("appId") int applicationId,
@PathParam("uuid") String applicationUuid,
@PathParam("uuid") String applicationReleaseUuid,
@Multipart("binaryFile") Attachment binaryFile) {
try {
if (binaryFile == null) {
return APIUtil.getResponse("Uploading artifacts for the application is failed " + applicationUuid,
Response.Status.BAD_REQUEST);
return Response.status(Response.Status.BAD_REQUEST)
.entity("binary file is NULL, hence invalid request to update application release artifact for application release UUID: "
+ applicationReleaseUuid).build();
}
APIUtil.getApplicationManager().updateApplicationArtifact(applicationId, applicationUuid,
if (!ApplicationType.ENTERPRISE.toString().equals(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: "
+ applicationReleaseUuid).build();
}
APIUtil.getApplicationManager().updateApplicationArtifact(applicationId, deviceType, applicationReleaseUuid,
binaryFile.getDataHandler().getInputStream());
return Response.status(Response.Status.OK)
.entity("Successfully uploaded artifacts for the application release. UUID is " + applicationUuid)
.build();
.entity("Successfully uploaded artifacts for the application release. UUID is "
+ applicationReleaseUuid).build();
} catch (IOException e) {
String msg = "Error occurred while trying to read icon, banner files for the application release"
+ applicationUuid;
+ applicationReleaseUuid;
log.error(msg);
return APIUtil.getResponse(new ApplicationManagementException(msg, e), Response.Status.BAD_REQUEST);
} catch (ResourceManagementException e) {
log.error("Error occurred while uploading the image artifacts of the application with the uuid "
+ applicationUuid, e);
return APIUtil.getResponse(e, Response.Status.INTERNAL_SERVER_ERROR);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
} catch (NotFoundException e) {
log.error(e.getMessage(), e);
return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).build();
} catch (ValidationException e) {
log.error(e.getMessage(), e);
return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
} catch (ApplicationManagementException e) {
log.error("Error occurred while updating the image artifacts of the application with the uuid "
+ applicationUuid, e);
return APIUtil.getResponse(e, Response.Status.INTERNAL_SERVER_ERROR);
} catch (RequestValidatingException e) {
log.error(
"Error occured while handling the application artifact updating request. application release UUID: "
+ applicationUuid);
return APIUtil.getResponse(e, Response.Status.BAD_REQUEST);
} catch (DeviceManagementException e) {
log.error("Error occurred while updating the image artifacts of the application with the uuid "
+ applicationUuid, e);
return APIUtil.getResponse(e, Response.Status.INTERNAL_SERVER_ERROR);
+ applicationReleaseUuid, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
}
}
@PUT
@Consumes("application/json")
public Response updateApplication(@Valid Application application) {
@Path("/{appId}")
public Response updateApplication(
@PathParam("appId") int applicationId,
@Valid ApplicationDTO application) {
ApplicationManager applicationManager = APIUtil.getApplicationManager();
try {
application = applicationManager.updateApplication(application);
application = applicationManager.updateApplication(applicationId, application);
} catch (NotFoundException e) {
return APIUtil.getResponse(e, Response.Status.NOT_FOUND);
log.error(e.getMessage());
return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).build();
} catch (ForbiddenException e) {
log.error(e.getMessage());
return Response.status(Response.Status.FORBIDDEN).entity(e.getMessage()).build();
} catch (ApplicationManagementException e) {
String msg = "Error occurred while modifying the application";
log.error(msg, e);
return APIUtil.getResponse(e, Response.Status.BAD_REQUEST);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
}
return Response.status(Response.Status.OK).entity(application).build();
}
@Override
@PUT
@Path("/{appId}/{uuid}")
@Path("/{deviceType}/{appId}/{uuid}")
public Response updateApplicationRelease(
@PathParam("deviceType") String deviceType,
@PathParam("appId") int applicationId,
@PathParam("uuid") String applicationUUID,
@Multipart("applicationRelease") ApplicationRelease applicationRelease,
@Multipart("applicationRelease") ApplicationReleaseDTO applicationRelease,
@Multipart("binaryFile") Attachment binaryFile,
@Multipart("icon") Attachment iconFile,
@Multipart("banner") Attachment bannerFile,
@Multipart("screenshot") List<Attachment> attachmentList) {
@Multipart("screenshot1") Attachment screenshot1,
@Multipart("screenshot2") Attachment screenshot2,
@Multipart("screenshot3") Attachment screenshot3) {
ApplicationManager applicationManager = APIUtil.getApplicationManager();
ApplicationStorageManager applicationStorageManager = APIUtil.getApplicationStorageManager();
InputStream iconFileStream = null;
InputStream bannerFileStream = null;
InputStream iconFileStream;
InputStream bannerFileStream;
InputStream binaryFileStram;
List<InputStream> attachments = new ArrayList<>();
List<Attachment> attachmentList = new ArrayList<>();
if (screenshot1 != null){
attachmentList.add(screenshot1);
}
if (screenshot2 != null) {
attachmentList.add(screenshot2);
}
if (screenshot3 != null) {
attachmentList.add(screenshot3);
}
if (iconFile == null || bannerFile == null || binaryFile == null || attachmentList.isEmpty()){
String msg = "Invalid data is received for application release updating. application id: " + applicationId
+ " and application release UUID: " + applicationUUID;
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
}
try {
Application application = applicationManager.getApplicationIfAccessible(applicationId);
if (!applicationManager.isAcceptableAppReleaseUpdate(application.getId(), applicationRelease.getUuid())) {
String msg = "Application release is in the " + applicationRelease.getLifecycleState().getCurrentState()
+ " state. Hence updating is not acceptable when application in this state";
log.error(msg);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
binaryFileStram = binaryFile.getDataHandler().getInputStream();
iconFileStream = iconFile.getDataHandler().getInputStream();
bannerFileStream = bannerFile.getDataHandler().getInputStream();
for (Attachment screenshot : attachmentList) {
attachments.add(screenshot.getDataHandler().getInputStream());
}
if (binaryFile != null) {
applicationRelease = applicationStorageManager
.updateReleaseArtifacts(applicationRelease, application.getType(), application.getDeviceType(),
binaryFile.getDataHandler().getInputStream());
boolean status = applicationManager
.updateRelease(applicationId, applicationUUID, deviceType, applicationRelease, binaryFileStram,
iconFileStream, bannerFileStream, attachments);
if (!status){
log.error("ApplicationDTO release updating is failed. Please contact the administrator. ApplicationDTO id: "
+ applicationId + ", ApplicationDTO release UUID: " + applicationUUID + ", Supported device type: "
+ deviceType);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(applicationRelease).build();
}
if (iconFile != null) {
iconFileStream = iconFile.getDataHandler().getInputStream();
}
if (bannerFile != null) {
bannerFileStream = bannerFile.getDataHandler().getInputStream();
}
if (!attachmentList.isEmpty()) {
for (Attachment screenshot : attachmentList) {
attachments.add(screenshot.getDataHandler().getInputStream());
}
}
// applicationRelease = applicationStorageManager
// .updateImageArtifacts(applicationRelease, iconFileStream, bannerFileStream, attachments);
// applicationRelease = applicationManager.updateRelease(applicationId, applicationRelease);
return Response.status(Response.Status.OK).entity(applicationRelease).build();
} catch (ApplicationManagementException e) {
log.error("Error while updating the application release of the application with UUID " + applicationUUID);
return APIUtil.getResponse(e, Response.Status.INTERNAL_SERVER_ERROR);
return Response.status(Response.Status.OK).entity("ApplicationDTO release is successfully updated.").build();
} catch(BadRequestException e){
String msg = "Invalid request to update application release for application release UUID " + applicationUUID;
log.error(msg, e);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
} catch (NotFoundException e) {
String msg = "Couldn't found application or application release for application id: " + applicationId
+ " and application release UUID " + applicationUUID;
log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} catch (ForbiddenException e) {
String msg = "You don't have require permission to update the application release which has UUID "
+ applicationUUID;
log.error(msg, e);
return Response.status(Response.Status.FORBIDDEN).entity(msg).build();
}
catch (ApplicationManagementException e) {
String msg = "Error while updating the application release of the application with UUID " + applicationUUID;
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (IOException e) {
log.error("Error while updating the release artifacts of the application with UUID " + applicationUUID);
return APIUtil.getResponse(new ApplicationManagementException(
"Error while updating the release artifacts of the application with UUID " + applicationUUID),
Response.Status.INTERNAL_SERVER_ERROR);
} catch (ResourceManagementException e) {
log.error("Error occurred while updating the releases artifacts of the application with the uuid "
+ applicationUUID + " for the release " + applicationRelease.getVersion(), e);
return APIUtil.getResponse(e, Response.Status.INTERNAL_SERVER_ERROR);
} catch (RequestValidatingException e) {
log.error(
"Error occured while handling the application release updating request. application release UUID: "
+ applicationUUID);
return APIUtil.getResponse(e, Response.Status.BAD_REQUEST);
String msg = "Error while updating the release artifacts of the application with UUID " + applicationUUID;
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
}
}
@ -510,14 +481,23 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
applicationStorageManager.deleteAllApplicationReleaseArtifacts(storedLocations);
String responseMsg = "Successfully deleted the application and application releases: " + applicationId;
return Response.status(Response.Status.OK).entity(responseMsg).build();
} catch (NotFoundException e) {
String msg =
"Couldn't found application for application id: " + applicationId + " to delete the application";
log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} catch (ForbiddenException e) {
String msg = "You don't have require permission to delete the application which has ID " + applicationId;
log.error(msg, e);
return Response.status(Response.Status.FORBIDDEN).entity(msg).build();
} catch (ApplicationManagementException e) {
String msg = "Error occurred while deleting the application: " + applicationId;
log.error(msg, e);
return APIUtil.getResponse(e, Response.Status.INTERNAL_SERVER_ERROR);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (ApplicationStorageManagementException e) {
String msg = "Error occurred while deleting the application storage: " + applicationId;
log.error(msg, e);
return APIUtil.getResponse(e, Response.Status.INTERNAL_SERVER_ERROR);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
}
}
@ -529,18 +509,29 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
ApplicationManager applicationManager = APIUtil.getApplicationManager();
ApplicationStorageManager applicationStorageManager = APIUtil.getApplicationStorageManager();
try {
String storedLocation = applicationManager.deleteApplicationRelease(applicationId, releaseUuid, true);
String storedLocation = applicationManager.deleteApplicationRelease(applicationId, releaseUuid);
applicationStorageManager.deleteApplicationReleaseArtifacts(storedLocation);
String responseMsg = "Successfully deleted the application release of: " + applicationId + "";
return Response.status(Response.Status.OK).entity(responseMsg).build();
} catch (ApplicationManagementException e) {
} catch (NotFoundException e) {
String msg = "Couldn't found application release which is having application id: " + applicationId
+ " and application release UUID:" + releaseUuid;
log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} catch (ForbiddenException e) {
String msg =
"You don't have require permission to delete the application release which has UUID " + releaseUuid
+ " and application ID " + applicationId;
log.error(msg, e);
return Response.status(Response.Status.FORBIDDEN).entity(msg).build();
}catch (ApplicationManagementException e) {
String msg = "Error occurred while deleting the application: " + applicationId;
log.error(msg, e);
return APIUtil.getResponse(e, Response.Status.INTERNAL_SERVER_ERROR);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (ApplicationStorageManagementException e) {
String msg = "Error occurred while deleting the application storage: " + applicationId;
log.error(msg, e);
return APIUtil.getResponse(e, Response.Status.INTERNAL_SERVER_ERROR);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
}
}
@ -549,15 +540,16 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
public Response getLifecycleState(
@PathParam("appId") int applicationId,
@PathParam("uuid") String applicationUuid) {
LifecycleState lifecycleState;
LifecycleStateDTO lifecycleState;
ApplicationManager applicationManager = APIUtil.getApplicationManager();
try {
lifecycleState = applicationManager.getLifecycleState(applicationId, applicationUuid);
} catch (NotFoundException e) {
String msg = "Couldn't found application lifecycle details for appid: " + applicationId
+ " and app release UUID: " + applicationUuid;
log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).build();
if (lifecycleState == null) {
String msg = "Couldn't found application lifecycle details for appid: " + applicationId
+ " and app release UUID: " + applicationUuid;
log.error(msg);
return Response.status(Response.Status.NOT_FOUND).build();
}
} catch (ApplicationManagementException e) {
String msg = "Error occurred while getting lifecycle state.";
log.error(msg, e);
@ -579,7 +571,7 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
log.error(msg);
return Response.status(Response.Status.BAD_REQUEST).build();
}
LifecycleState state = new LifecycleState();
LifecycleStateDTO state = new LifecycleStateDTO();
state.setCurrentState(action);
applicationManager.changeLifecycleState(applicationId, applicationUuid, state);
} catch (NotFoundException e) {
@ -595,60 +587,106 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
return Response.status(Response.Status.CREATED).entity("Lifecycle state added successfully.").build();
}
private boolean isValidAppCreatingRequest(Attachment iconFile, Attachment bannerFile,
List<Attachment> attachmentList, Application application) {
/***
*
* @param binaryFile binary file of the application release
* @param iconFile icon file of the application release
* @param bannerFile banner file of the application release
* @param attachmentList list of screenshot of the application release
* @return {@link ApplicationArtifact}
* @throws ApplicationManagementException if an error occurs when reading the attached data.
*/
private ApplicationArtifact constructApplicationArtifact(Attachment binaryFile, Attachment iconFile,
Attachment bannerFile, List<Attachment> attachmentList) throws ApplicationManagementException {
try {
ApplicationArtifact applicationArtifact = new ApplicationArtifact();
DataHandler dataHandler;
if (binaryFile != null) {
dataHandler = binaryFile.getDataHandler();
InputStream installerStream = dataHandler.getInputStream();
String installerFileName = dataHandler.getName();
if (installerStream == null) {
String msg = "Stream of the application release installer is null. Hence can't proceed. Please "
+ "verify the installer file.";
log.error(msg);
throw new BadRequestException(msg);
}
if (installerFileName == null) {
String msg = "Installer file name retrieving is failed.. Hence can't proceed. Please verify the "
+ "installer file.";
log.error(msg);
throw new BadRequestException(msg);
}
applicationArtifact.setInstallerName(installerFileName);
applicationArtifact.setInstallerStream(installerStream);
}
// if (application.getApplicationReleases().size() > 1) {
// log.error("Invalid application creating request. Application creating request must have single application "
// + "release. Application name:" + application.getName() + " and type: " + application.getType());
// return false;
// }
dataHandler = iconFile.getDataHandler();
String iconFileName = dataHandler.getName();
InputStream iconStream = dataHandler.getInputStream();
if (iconFile == null) {
log.error("Icon file is not found for the application release. Application name: " + application.getName()
+ " and type: " + application.getType());
return false;
if (iconStream == null) {
String msg = "Stream of the application release icon is null. Hence can't proceed. Please "
+ "verify the uploaded icon file.";
log.error(msg);
throw new BadRequestException(msg);
}
if (iconFileName == null) {
String msg =
"Icon file name retrieving is failed.. Hence can't proceed. Please verify the " + "icon file.";
log.error(msg);
throw new BadRequestException(msg);
}
applicationArtifact.setIconName(iconFileName);
applicationArtifact.setIconStream(iconStream);
dataHandler = bannerFile.getDataHandler();
String bannerFileName = dataHandler.getName();
InputStream bannerStream = dataHandler.getInputStream();
if (bannerStream == null) {
String msg = "Stream of the application release banner is null. Hence can't proceed. Please "
+ "verify the uploaded banner file.";
log.error(msg);
throw new BadRequestException(msg);
}
if (bannerFileName == null) {
String msg = "Banner file name retrieving is failed.. Hence can't proceed. Please verify the "
+ "banner file.";
log.error(msg);
throw new BadRequestException(msg);
}
applicationArtifact.setBannerName(bannerFileName);
applicationArtifact.setBannerStream(bannerStream);
Map<String, InputStream> scrrenshotData = new HashMap<>();
for (Attachment sc : attachmentList) {
dataHandler = sc.getDataHandler();
String screenshotrFileName = dataHandler.getName();
InputStream screenshotStream = dataHandler.getInputStream();
if (screenshotStream == null) {
String msg =
"Stream of one of the application release screenshot is null. Hence can't proceed. Please "
+ "verify the uploaded screenshots.";
log.error(msg);
throw new BadRequestException(msg);
}
if (screenshotrFileName == null) {
String msg =
"Screenshot file name retrieving is failed for one screenshot. Hence can't proceed. Please verify the "
+ "screenshots.";
log.error(msg);
throw new BadRequestException(msg);
}
scrrenshotData.put(screenshotrFileName, screenshotStream);
}
applicationArtifact.setScreenshots(scrrenshotData);
return applicationArtifact;
} catch (IOException e) {
String msg = "Error occurred when reading attachment data.";
log.error(msg, e);
throw new ApplicationManagementException(msg);
}
if (bannerFile == null) {
log.error("Banner file is not found for the application release. Application name: " + application.getName()
+ " and application type: " + application.getType());
return false;
}
if (attachmentList == null || attachmentList.isEmpty()) {
log.error(
"Screenshots are not found for the application release. Application name: " + application.getName()
+ " Application type: " + application.getType());
return false;
}
return true;
}
private boolean isValidReleaseCreatingRequest(Attachment binaryFile, Attachment iconFile, Attachment bannerFile,
List<Attachment> attachmentList, String appType) {
if (iconFile == null) {
log.error("Icon file is not found with the application release creating request.");
return false;
}
if (bannerFile == null) {
log.error("Banner file is not found with the application release creating request.");
return false;
}
if (attachmentList == null || attachmentList.isEmpty()) {
log.error("Screenshots are not found with the application release creating request.");
return false;
}
if (binaryFile == null && ApplicationType.ENTERPRISE.toString().equals(appType)) {
log.error("Binary file is not found with the application release creating request. Application type: "
+ appType);
return false;
}
return true;
}
}

View File

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

View File

@ -10,6 +10,7 @@
},
"license": "Apache License 2.0",
"dependencies": {
"acorn": "^6.1.1",
"antd": "^3.15.0",
"react": "^16.8.4",
"react-dom": "^16.8.4",

View File

@ -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
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" />
<glyph glyph-name="tag" 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
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

Before

Width:  |  Height:  |  Size: 443 KiB

After

Width:  |  Height:  |  Size: 443 KiB

View File

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

View File

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

View File

@ -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.LogFactory;
import org.wso2.carbon.device.application.mgt.common.AppLifecycleState;
import org.wso2.carbon.device.application.mgt.common.Application;
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.Filter;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException;
@ -77,7 +77,7 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
if (appCategory != null && !appCategory.isEmpty()) {
filter.setAppCategory(appCategory);
}
ApplicationList applications = applicationManager.getApplications(filter);
ApplicationList applications = applicationManager.getApplications(filter, null);
if (applications.getApplications().isEmpty()) {
return Response.status(Response.Status.NOT_FOUND)
.entity("Couldn't find any application for requested query.").build();
@ -97,7 +97,7 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
@PathParam("uuid") String uuid) {
ApplicationManager applicationManager = APIUtil.getApplicationManager();
try {
Application application = applicationManager
ApplicationDTO application = applicationManager
.getApplicationByUuid(uuid, AppLifecycleState.PUBLISHED.toString());
return Response.status(Response.Status.OK).entity(application).build();
} catch (NotFoundException e) {

View File

@ -48,7 +48,7 @@ public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{
@Override
@POST
@Path("/install-application")
public Response installApplication(@ApiParam(name = "installationDetails", value = "Application ID and list of" +
public Response installApplication(@ApiParam(name = "installationDetails", value = "ApplicationDTO ID and list of" +
"devices", required = true) @Valid InstallationDetails installationDetails) {
SubscriptionManager subscriptionManager = APIUtil.getSubscriptionManager();
String applicationUUID = installationDetails.getApplicationUUID();
@ -81,7 +81,7 @@ public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{
ApplicationInstallResponse response;
if (applicationUUID.isEmpty()) {
msg = "Application 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.";
log.error(msg);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
@ -128,7 +128,7 @@ public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{
}
@Override
public Response getApplication(@ApiParam(name = "applicationUUID", value = "Application ID") String
public Response getApplication(@ApiParam(name = "applicationUUID", value = "ApplicationDTO ID") String
applicationUUID, @ApiParam(name = "deviceId", value = "The device ID")
String deviceId) {
return null;

View File

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

View File

@ -28,12 +28,31 @@
</parent>
<artifactId>org.wso2.carbon.device.application.mgt.store.ui</artifactId>
<version>3.2.2-SNAPSHOT</version>
<packaging>war</packaging>
<name>WSO2 Carbon - Application Management Store UI Component</name>
<url>http://wso2.org</url>
<description>This Component contains Application Management store UI</description>
<dependencies>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<packagingExcludes>WEB-INF/lib/*cxf*.jar</packagingExcludes>
<warName>store</warName>
<webResources>
<resource>
<directory>${npm.output.directory}/dist</directory>
</resource>
<resource>
<directory>${npm.output.directory}/public</directory>
<targetPath>public</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
@ -46,10 +65,11 @@
</goals>
<phase>initialize</phase>
<configuration>
<workingDirectory>${basedir}/src/main/resources/store</workingDirectory>
<workingDirectory>react-app</workingDirectory>
<executable>${npm.executable}</executable>
<arguments>
<argument>install</argument>
<argument>--silent</argument>
</arguments>
</configuration>
</execution>
@ -60,7 +80,7 @@
</goals>
<phase>compile</phase>
<configuration>
<workingDirectory>${basedir}/src/main/resources/store</workingDirectory>
<workingDirectory>react-app</workingDirectory>
<executable>${npm.executable}</executable>
<arguments>
<argument>run</argument>
@ -73,7 +93,6 @@
<workingDirectory>${npm.working.dir}</workingDirectory>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
@ -94,6 +113,8 @@
<maven.test.skip>false</maven.test.skip>
<npm.executable>npm</npm.executable>
<npm.build.command>build_prod</npm.build.command>
<npm.working.dir>./src/main/</npm.working.dir>
<npm.working.dir>./react-app</npm.working.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<npm.output.directory>react-app</npm.output.directory>
</properties>
</project>

View File

@ -0,0 +1,11 @@
module.exports = function (api) {
api.cache(true);
const presets = [ "@babel/preset-env",
"@babel/preset-react" ];
const plugins = ["@babel/plugin-proposal-class-properties"];
return {
presets,
plugins
};
};

View File

@ -0,0 +1,71 @@
{
"name": "store",
"version": "1.0.0",
"description": "WSO2 IoT Server App Publisher",
"main": "App.js",
"proxy": "http://localhost:3001",
"repository": {
"type": "git",
"url": "git://github.com/wso2/carbon-devicemgt"
},
"license": "Apache License 2.0",
"dependencies": {
"acorn": "^6.1.1",
"antd": "^3.15.0",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-router-config": "^5.0.0",
"react-router-dom": "latest",
"react-scripts": "2.1.8"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"babel-loader": "^8.0.0",
"body-parser": "^1.18.3",
"chai": "^4.1.2",
"css-loader": "^0.28.11",
"express": "^4.16.4",
"express-pino-logger": "^4.0.0",
"file-loader": "^2.0.0",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"img-loader": "^3.0.1",
"less": "^3.9.0",
"less-loader": "^4.1.0",
"mini-css-extract-plugin": "^0.5.0",
"mocha": "^5.2.0",
"mock-local-storage": "^1.0.5",
"node-env-run": "^3.0.2",
"node-sass": "^4.11.0",
"nodemon": "^1.18.9",
"npm-run-all": "^4.1.5",
"pino-colada": "^1.4.4",
"postcss-loader": "^3.0.0",
"react": "^15.6.2",
"react-dom": "^15.6.2",
"react-intl": "^2.4.0",
"redux": "^4.0.1",
"sass-loader": "^6.0.7",
"style-loader": "^0.18.2",
"url-loader": "^1.1.2",
"webpack": "^4.27.1",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.10"
},
"scripts": {
"start": "webpack-dev-server --mode development --open",
"dev": "webpack --mode development",
"build": "webpack --mode production",
"watch": "webpack --watch --mode development",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"build_prod": "NODE_ENV=production NODE_OPTIONS=--max_old_space_size=4096 webpack -p --display errors-only --hide-modules",
"build_dev": "NODE_ENV=development webpack -d --watch ",
"server": "node-env-run server --exec nodemon | pino-colada",
"dev2": "run-p server start"
}
}

View File

@ -1,6 +1,6 @@
{
"short_name": "App Store",
"name": "WSO2 IoT App Store",
"short_name": "App Publisher",
"name": "WSO2 IoT App Publisher",
"icons": [
{
"src": "images/favicon.png",

View File

@ -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
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" />
<glyph glyph-name="tag" 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
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

Before

Width:  |  Height:  |  Size: 443 KiB

After

Width:  |  Height:  |  Size: 443 KiB

View File

@ -0,0 +1,798 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 232 81" style="enable-background:new 0 0 232 81;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
.st1{clip-path:url(#SVGID_2_);fill:#308BD6;}
.st2{clip-path:url(#SVGID_2_);fill:#318CD6;}
.st3{clip-path:url(#SVGID_2_);fill:#328DD7;}
.st4{clip-path:url(#SVGID_2_);fill:#338ED7;}
.st5{clip-path:url(#SVGID_2_);fill:#348FD8;}
.st6{clip-path:url(#SVGID_2_);fill:#3590D8;}
.st7{clip-path:url(#SVGID_2_);fill:#3691D9;}
.st8{clip-path:url(#SVGID_2_);fill:#3792D9;}
.st9{clip-path:url(#SVGID_2_);fill:#3893DA;}
.st10{clip-path:url(#SVGID_2_);fill:#3994DA;}
.st11{clip-path:url(#SVGID_2_);fill:#3A95DA;}
.st12{clip-path:url(#SVGID_2_);fill:#3B96DB;}
.st13{clip-path:url(#SVGID_2_);fill:#3C97DB;}
.st14{clip-path:url(#SVGID_2_);fill:#3D98DC;}
.st15{clip-path:url(#SVGID_2_);fill:#3E99DC;}
.st16{clip-path:url(#SVGID_2_);fill:#3F9ADD;}
.st17{clip-path:url(#SVGID_2_);fill:#409BDD;}
.st18{clip-path:url(#SVGID_2_);fill:#419CDE;}
.st19{clip-path:url(#SVGID_2_);fill:#429DDE;}
.st20{clip-path:url(#SVGID_2_);fill:#439EDE;}
.st21{clip-path:url(#SVGID_2_);fill:#449FDF;}
.st22{clip-path:url(#SVGID_2_);fill:#45A0DF;}
.st23{clip-path:url(#SVGID_2_);fill:#46A1E0;}
.st24{clip-path:url(#SVGID_2_);fill:#47A2E0;}
.st25{clip-path:url(#SVGID_2_);fill:#48A4E1;}
.st26{clip-path:url(#SVGID_2_);fill:#49A5E1;}
.st27{clip-path:url(#SVGID_2_);fill:#4AA6E2;}
.st28{clip-path:url(#SVGID_2_);fill:#4BA7E2;}
.st29{clip-path:url(#SVGID_2_);fill:#4CA8E3;}
.st30{clip-path:url(#SVGID_2_);fill:#4DA9E3;}
.st31{clip-path:url(#SVGID_2_);fill:#4EAAE3;}
.st32{clip-path:url(#SVGID_2_);fill:#4FABE4;}
.st33{clip-path:url(#SVGID_2_);fill:#50ACE4;}
.st34{clip-path:url(#SVGID_2_);fill:#51ADE5;}
.st35{clip-path:url(#SVGID_2_);fill:#52AEE5;}
.st36{clip-path:url(#SVGID_2_);fill:#53AFE6;}
.st37{clip-path:url(#SVGID_2_);fill:#54B0E6;}
.st38{clip-path:url(#SVGID_2_);fill:#55B1E7;}
.st39{clip-path:url(#SVGID_2_);fill:#56B2E7;}
.st40{clip-path:url(#SVGID_2_);fill:#57B3E7;}
.st41{clip-path:url(#SVGID_2_);fill:#58B4E8;}
.st42{clip-path:url(#SVGID_2_);fill:#59B5E8;}
.st43{clip-path:url(#SVGID_2_);fill:#5AB6E9;}
.st44{clip-path:url(#SVGID_2_);fill:#5BB7E9;}
.st45{clip-path:url(#SVGID_2_);fill:#5CB8EA;}
.st46{clip-path:url(#SVGID_2_);fill:#5DB9EA;}
.st47{clip-path:url(#SVGID_2_);fill:#5EBAEB;}
.st48{clip-path:url(#SVGID_2_);fill:#5FBBEB;}
.st49{clip-path:url(#SVGID_4_);fill:#2E5E87;}
.st50{clip-path:url(#SVGID_4_);fill:#2E5F88;}
.st51{clip-path:url(#SVGID_4_);fill:#2F5F89;}
.st52{clip-path:url(#SVGID_4_);fill:#2F608A;}
.st53{clip-path:url(#SVGID_4_);fill:#30618B;}
.st54{clip-path:url(#SVGID_4_);fill:#30628C;}
.st55{clip-path:url(#SVGID_4_);fill:#31628D;}
.st56{clip-path:url(#SVGID_4_);fill:#31638E;}
.st57{clip-path:url(#SVGID_4_);fill:#31648F;}
.st58{clip-path:url(#SVGID_4_);fill:#326590;}
.st59{clip-path:url(#SVGID_4_);fill:#326591;}
.st60{clip-path:url(#SVGID_4_);fill:#336692;}
.st61{clip-path:url(#SVGID_4_);fill:#336793;}
.st62{clip-path:url(#SVGID_4_);fill:#346894;}
.st63{clip-path:url(#SVGID_4_);fill:#346895;}
.st64{clip-path:url(#SVGID_4_);fill:#356996;}
.st65{clip-path:url(#SVGID_4_);fill:#356A97;}
.st66{clip-path:url(#SVGID_4_);fill:#356B98;}
.st67{clip-path:url(#SVGID_4_);fill:#366B99;}
.st68{clip-path:url(#SVGID_4_);fill:#366C9A;}
.st69{clip-path:url(#SVGID_4_);fill:#376D9B;}
.st70{clip-path:url(#SVGID_4_);fill:#376E9C;}
.st71{clip-path:url(#SVGID_4_);fill:#386E9D;}
.st72{clip-path:url(#SVGID_4_);fill:#386F9E;}
.st73{clip-path:url(#SVGID_4_);fill:#38709F;}
.st74{clip-path:url(#SVGID_4_);fill:#3971A0;}
.st75{clip-path:url(#SVGID_4_);fill:#3971A1;}
.st76{clip-path:url(#SVGID_4_);fill:#3A72A2;}
.st77{clip-path:url(#SVGID_4_);fill:#3A73A3;}
.st78{clip-path:url(#SVGID_4_);fill:#3B74A4;}
.st79{clip-path:url(#SVGID_4_);fill:#3B74A5;}
.st80{clip-path:url(#SVGID_4_);fill:#3C75A7;}
.st81{clip-path:url(#SVGID_4_);fill:#3C76A8;}
.st82{clip-path:url(#SVGID_4_);fill:#3C76A9;}
.st83{clip-path:url(#SVGID_4_);fill:#3D77AA;}
.st84{clip-path:url(#SVGID_4_);fill:#3D78AB;}
.st85{clip-path:url(#SVGID_4_);fill:#3E79AC;}
.st86{clip-path:url(#SVGID_4_);fill:#3E79AD;}
.st87{clip-path:url(#SVGID_4_);fill:#3F7AAE;}
.st88{clip-path:url(#SVGID_4_);fill:#3F7BAF;}
.st89{clip-path:url(#SVGID_4_);fill:#3F7CB0;}
.st90{clip-path:url(#SVGID_4_);fill:#407CB1;}
.st91{clip-path:url(#SVGID_4_);fill:#407DB2;}
.st92{clip-path:url(#SVGID_4_);fill:#417EB3;}
.st93{clip-path:url(#SVGID_4_);fill:#417FB4;}
.st94{clip-path:url(#SVGID_4_);fill:#427FB5;}
.st95{clip-path:url(#SVGID_4_);fill:#4280B6;}
.st96{clip-path:url(#SVGID_4_);fill:#4281B7;}
.st97{clip-path:url(#SVGID_4_);fill:#4382B8;}
.st98{clip-path:url(#SVGID_4_);fill:#4382B9;}
.st99{clip-path:url(#SVGID_4_);fill:#4483BA;}
.st100{clip-path:url(#SVGID_4_);fill:#4484BB;}
.st101{clip-path:url(#SVGID_4_);fill:#4585BC;}
.st102{clip-path:url(#SVGID_4_);fill:#4585BD;}
.st103{clip-path:url(#SVGID_4_);fill:#4686BE;}
.st104{clip-path:url(#SVGID_4_);fill:#4687BF;}
.st105{clip-path:url(#SVGID_4_);fill:#4688C0;}
.st106{clip-path:url(#SVGID_4_);fill:#4788C1;}
.st107{clip-path:url(#SVGID_4_);fill:#4789C2;}
.st108{clip-path:url(#SVGID_4_);fill:#488AC3;}
.st109{clip-path:url(#SVGID_4_);fill:#488BC4;}
.st110{clip-path:url(#SVGID_4_);fill:#498BC5;}
.st111{clip-path:url(#SVGID_4_);fill:#498CC6;}
.st112{clip-path:url(#SVGID_6_);fill:#4CE8C6;}
.st113{clip-path:url(#SVGID_6_);fill:#4BE8C7;}
.st114{clip-path:url(#SVGID_6_);fill:#4AE7C7;}
.st115{clip-path:url(#SVGID_6_);fill:#49E7C8;}
.st116{clip-path:url(#SVGID_6_);fill:#48E6C8;}
.st117{clip-path:url(#SVGID_6_);fill:#47E6C9;}
.st118{clip-path:url(#SVGID_6_);fill:#46E6C9;}
.st119{clip-path:url(#SVGID_6_);fill:#45E5CA;}
.st120{clip-path:url(#SVGID_6_);fill:#44E5CB;}
.st121{clip-path:url(#SVGID_6_);fill:#43E4CB;}
.st122{clip-path:url(#SVGID_6_);fill:#42E4CC;}
.st123{clip-path:url(#SVGID_6_);fill:#41E4CC;}
.st124{clip-path:url(#SVGID_6_);fill:#40E3CD;}
.st125{clip-path:url(#SVGID_6_);fill:#3FE3CE;}
.st126{clip-path:url(#SVGID_6_);fill:#3EE2CE;}
.st127{clip-path:url(#SVGID_6_);fill:#3DE2CF;}
.st128{clip-path:url(#SVGID_6_);fill:#3CE2CF;}
.st129{clip-path:url(#SVGID_6_);fill:#3BE1D0;}
.st130{clip-path:url(#SVGID_6_);fill:#3AE1D0;}
.st131{clip-path:url(#SVGID_6_);fill:#39E0D1;}
.st132{clip-path:url(#SVGID_6_);fill:#38E0D2;}
.st133{clip-path:url(#SVGID_6_);fill:#37E0D2;}
.st134{clip-path:url(#SVGID_6_);fill:#36DFD3;}
.st135{clip-path:url(#SVGID_6_);fill:#35DFD3;}
.st136{clip-path:url(#SVGID_6_);fill:#34DED4;}
.st137{clip-path:url(#SVGID_6_);fill:#33DED5;}
.st138{clip-path:url(#SVGID_6_);fill:#31DED5;}
.st139{clip-path:url(#SVGID_6_);fill:#30DDD6;}
.st140{clip-path:url(#SVGID_6_);fill:#2FDDD6;}
.st141{clip-path:url(#SVGID_6_);fill:#2EDCD7;}
.st142{clip-path:url(#SVGID_6_);fill:#2DDCD7;}
.st143{clip-path:url(#SVGID_6_);fill:#2CDCD8;}
.st144{clip-path:url(#SVGID_6_);fill:#2BDBD9;}
.st145{clip-path:url(#SVGID_6_);fill:#2ADBD9;}
.st146{clip-path:url(#SVGID_6_);fill:#29DADA;}
.st147{clip-path:url(#SVGID_6_);fill:#28DADA;}
.st148{clip-path:url(#SVGID_6_);fill:#27DADB;}
.st149{clip-path:url(#SVGID_6_);fill:#26D9DB;}
.st150{clip-path:url(#SVGID_6_);fill:#25D9DC;}
.st151{clip-path:url(#SVGID_6_);fill:#24D8DD;}
.st152{clip-path:url(#SVGID_6_);fill:#23D8DD;}
.st153{clip-path:url(#SVGID_6_);fill:#22D8DE;}
.st154{clip-path:url(#SVGID_6_);fill:#21D7DE;}
.st155{clip-path:url(#SVGID_6_);fill:#20D7DF;}
.st156{clip-path:url(#SVGID_6_);fill:#1FD6E0;}
.st157{clip-path:url(#SVGID_6_);fill:#1ED6E0;}
.st158{clip-path:url(#SVGID_6_);fill:#1DD6E1;}
.st159{clip-path:url(#SVGID_6_);fill:#1CD5E1;}
.st160{clip-path:url(#SVGID_6_);fill:#1BD5E2;}
.st161{clip-path:url(#SVGID_6_);fill:#1AD4E2;}
.st162{clip-path:url(#SVGID_6_);fill:#19D4E3;}
.st163{opacity:0.4;}
.st164{clip-path:url(#SVGID_8_);fill:#4CE8C6;}
.st165{clip-path:url(#SVGID_8_);fill:#4BE8C7;}
.st166{clip-path:url(#SVGID_8_);fill:#4AE7C7;}
.st167{clip-path:url(#SVGID_8_);fill:#49E7C8;}
.st168{clip-path:url(#SVGID_8_);fill:#48E6C8;}
.st169{clip-path:url(#SVGID_8_);fill:#47E6C9;}
.st170{clip-path:url(#SVGID_8_);fill:#46E6C9;}
.st171{clip-path:url(#SVGID_8_);fill:#45E5CA;}
.st172{clip-path:url(#SVGID_8_);fill:#44E5CB;}
.st173{clip-path:url(#SVGID_8_);fill:#43E4CB;}
.st174{clip-path:url(#SVGID_8_);fill:#42E4CC;}
.st175{clip-path:url(#SVGID_8_);fill:#41E4CC;}
.st176{clip-path:url(#SVGID_8_);fill:#40E3CD;}
.st177{clip-path:url(#SVGID_8_);fill:#3FE3CE;}
.st178{clip-path:url(#SVGID_8_);fill:#3EE2CE;}
.st179{clip-path:url(#SVGID_8_);fill:#3DE2CF;}
.st180{clip-path:url(#SVGID_8_);fill:#3CE2CF;}
.st181{clip-path:url(#SVGID_8_);fill:#3BE1D0;}
.st182{clip-path:url(#SVGID_8_);fill:#3AE1D0;}
.st183{clip-path:url(#SVGID_8_);fill:#39E0D1;}
.st184{clip-path:url(#SVGID_8_);fill:#38E0D2;}
.st185{clip-path:url(#SVGID_8_);fill:#37E0D2;}
.st186{clip-path:url(#SVGID_8_);fill:#36DFD3;}
.st187{clip-path:url(#SVGID_8_);fill:#35DFD3;}
.st188{clip-path:url(#SVGID_8_);fill:#34DED4;}
.st189{clip-path:url(#SVGID_8_);fill:#33DED5;}
.st190{clip-path:url(#SVGID_8_);fill:#31DED5;}
.st191{clip-path:url(#SVGID_8_);fill:#30DDD6;}
.st192{clip-path:url(#SVGID_8_);fill:#2FDDD6;}
.st193{clip-path:url(#SVGID_8_);fill:#2EDCD7;}
.st194{clip-path:url(#SVGID_8_);fill:#2DDCD7;}
.st195{clip-path:url(#SVGID_8_);fill:#2CDCD8;}
.st196{clip-path:url(#SVGID_8_);fill:#2BDBD9;}
.st197{clip-path:url(#SVGID_8_);fill:#2ADBD9;}
.st198{clip-path:url(#SVGID_8_);fill:#29DADA;}
.st199{clip-path:url(#SVGID_8_);fill:#28DADA;}
.st200{clip-path:url(#SVGID_8_);fill:#27DADB;}
.st201{clip-path:url(#SVGID_8_);fill:#26D9DB;}
.st202{clip-path:url(#SVGID_8_);fill:#25D9DC;}
.st203{clip-path:url(#SVGID_8_);fill:#24D8DD;}
.st204{clip-path:url(#SVGID_8_);fill:#23D8DD;}
.st205{clip-path:url(#SVGID_8_);fill:#22D8DE;}
.st206{clip-path:url(#SVGID_8_);fill:#21D7DE;}
.st207{clip-path:url(#SVGID_8_);fill:#20D7DF;}
.st208{clip-path:url(#SVGID_8_);fill:#1FD6E0;}
.st209{clip-path:url(#SVGID_8_);fill:#1ED6E0;}
.st210{clip-path:url(#SVGID_8_);fill:#1DD6E1;}
.st211{clip-path:url(#SVGID_8_);fill:#1CD5E1;}
.st212{clip-path:url(#SVGID_8_);fill:#1BD5E2;}
.st213{clip-path:url(#SVGID_8_);fill:#1AD4E2;}
.st214{clip-path:url(#SVGID_8_);fill:#19D4E3;}
.st215{opacity:0.5;}
.st216{clip-path:url(#SVGID_10_);fill:#316490;}
.st217{clip-path:url(#SVGID_10_);fill:#316591;}
.st218{clip-path:url(#SVGID_10_);fill:#326692;}
.st219{clip-path:url(#SVGID_10_);fill:#326693;}
.st220{clip-path:url(#SVGID_10_);fill:#336794;}
.st221{clip-path:url(#SVGID_10_);fill:#336895;}
.st222{clip-path:url(#SVGID_10_);fill:#346996;}
.st223{clip-path:url(#SVGID_10_);fill:#346997;}
.st224{clip-path:url(#SVGID_10_);fill:#356A98;}
.st225{clip-path:url(#SVGID_10_);fill:#356B99;}
.st226{clip-path:url(#SVGID_10_);fill:#366C9A;}
.st227{clip-path:url(#SVGID_10_);fill:#366C9B;}
.st228{clip-path:url(#SVGID_10_);fill:#366D9C;}
.st229{clip-path:url(#SVGID_10_);fill:#376E9D;}
.st230{clip-path:url(#SVGID_10_);fill:#376F9E;}
.st231{clip-path:url(#SVGID_10_);fill:#386F9F;}
.st232{clip-path:url(#SVGID_10_);fill:#3870A0;}
.st233{clip-path:url(#SVGID_10_);fill:#3971A1;}
.st234{clip-path:url(#SVGID_10_);fill:#3972A2;}
.st235{clip-path:url(#SVGID_10_);fill:#3A72A3;}
.st236{clip-path:url(#SVGID_10_);fill:#3A73A4;}
.st237{clip-path:url(#SVGID_10_);fill:#3B74A5;}
.st238{clip-path:url(#SVGID_10_);fill:#3B75A6;}
.st239{clip-path:url(#SVGID_10_);fill:#3B75A7;}
.st240{clip-path:url(#SVGID_10_);fill:#3C76A8;}
.st241{clip-path:url(#SVGID_10_);fill:#3C77A9;}
.st242{clip-path:url(#SVGID_10_);fill:#3D78AA;}
.st243{clip-path:url(#SVGID_10_);fill:#3D78AC;}
.st244{clip-path:url(#SVGID_10_);fill:#3E79AD;}
.st245{clip-path:url(#SVGID_10_);fill:#3E7AAE;}
.st246{clip-path:url(#SVGID_10_);fill:#3F7BAF;}
.st247{clip-path:url(#SVGID_10_);fill:#3F7BB0;}
.st248{clip-path:url(#SVGID_10_);fill:#3F7CB1;}
.st249{clip-path:url(#SVGID_10_);fill:#407DB2;}
.st250{clip-path:url(#SVGID_10_);fill:#407EB3;}
.st251{clip-path:url(#SVGID_10_);fill:#417EB4;}
.st252{clip-path:url(#SVGID_10_);fill:#417FB5;}
.st253{clip-path:url(#SVGID_10_);fill:#4280B6;}
.st254{clip-path:url(#SVGID_10_);fill:#4281B7;}
.st255{clip-path:url(#SVGID_10_);fill:#4381B8;}
.st256{clip-path:url(#SVGID_10_);fill:#4382B9;}
.st257{clip-path:url(#SVGID_10_);fill:#4483BA;}
.st258{clip-path:url(#SVGID_10_);fill:#4484BB;}
.st259{clip-path:url(#SVGID_10_);fill:#4484BC;}
.st260{clip-path:url(#SVGID_10_);fill:#4585BD;}
.st261{clip-path:url(#SVGID_10_);fill:#4586BE;}
.st262{clip-path:url(#SVGID_10_);fill:#4687BF;}
.st263{clip-path:url(#SVGID_10_);fill:#4687C0;}
.st264{clip-path:url(#SVGID_10_);fill:#4788C1;}
.st265{clip-path:url(#SVGID_10_);fill:#4789C2;}
.st266{clip-path:url(#SVGID_10_);fill:#488AC3;}
.st267{clip-path:url(#SVGID_10_);fill:#488AC4;}
.st268{clip-path:url(#SVGID_10_);fill:#498BC5;}
.st269{clip-path:url(#SVGID_10_);fill:#498CC6;}
.st270{clip-path:url(#SVGID_12_);fill:#5FBBEB;}
.st271{clip-path:url(#SVGID_12_);fill:#5EBAEB;}
.st272{clip-path:url(#SVGID_12_);fill:#5DB9EA;}
.st273{clip-path:url(#SVGID_12_);fill:#5CB8EA;}
.st274{clip-path:url(#SVGID_12_);fill:#5BB7E9;}
.st275{clip-path:url(#SVGID_12_);fill:#5AB6E9;}
.st276{clip-path:url(#SVGID_12_);fill:#59B5E8;}
.st277{clip-path:url(#SVGID_12_);fill:#58B4E8;}
.st278{clip-path:url(#SVGID_12_);fill:#57B3E7;}
.st279{clip-path:url(#SVGID_12_);fill:#56B2E7;}
.st280{clip-path:url(#SVGID_12_);fill:#55B1E7;}
.st281{clip-path:url(#SVGID_12_);fill:#54B0E6;}
.st282{clip-path:url(#SVGID_12_);fill:#53AFE6;}
.st283{clip-path:url(#SVGID_12_);fill:#52AEE5;}
.st284{clip-path:url(#SVGID_12_);fill:#51ADE5;}
.st285{clip-path:url(#SVGID_12_);fill:#50ACE4;}
.st286{clip-path:url(#SVGID_12_);fill:#4FABE4;}
.st287{clip-path:url(#SVGID_12_);fill:#4EAAE3;}
.st288{clip-path:url(#SVGID_12_);fill:#4DA9E3;}
.st289{clip-path:url(#SVGID_12_);fill:#4CA8E3;}
.st290{clip-path:url(#SVGID_12_);fill:#4BA7E2;}
.st291{clip-path:url(#SVGID_12_);fill:#4AA6E2;}
.st292{clip-path:url(#SVGID_12_);fill:#49A5E1;}
.st293{clip-path:url(#SVGID_12_);fill:#48A4E1;}
.st294{clip-path:url(#SVGID_12_);fill:#47A2E0;}
.st295{clip-path:url(#SVGID_12_);fill:#46A1E0;}
.st296{clip-path:url(#SVGID_12_);fill:#45A0DF;}
.st297{clip-path:url(#SVGID_12_);fill:#449FDF;}
.st298{clip-path:url(#SVGID_12_);fill:#439EDE;}
.st299{clip-path:url(#SVGID_12_);fill:#429DDE;}
.st300{clip-path:url(#SVGID_12_);fill:#419CDE;}
.st301{clip-path:url(#SVGID_12_);fill:#409BDD;}
.st302{clip-path:url(#SVGID_12_);fill:#3F9ADD;}
.st303{clip-path:url(#SVGID_12_);fill:#3E99DC;}
.st304{clip-path:url(#SVGID_12_);fill:#3D98DC;}
.st305{clip-path:url(#SVGID_12_);fill:#3C97DB;}
.st306{clip-path:url(#SVGID_12_);fill:#3B96DB;}
.st307{clip-path:url(#SVGID_12_);fill:#3A95DA;}
.st308{clip-path:url(#SVGID_12_);fill:#3994DA;}
.st309{clip-path:url(#SVGID_12_);fill:#3893DA;}
.st310{clip-path:url(#SVGID_12_);fill:#3792D9;}
.st311{clip-path:url(#SVGID_12_);fill:#3691D9;}
.st312{clip-path:url(#SVGID_12_);fill:#3590D8;}
.st313{clip-path:url(#SVGID_12_);fill:#348FD8;}
.st314{clip-path:url(#SVGID_12_);fill:#338ED7;}
.st315{clip-path:url(#SVGID_12_);fill:#328DD7;}
.st316{clip-path:url(#SVGID_12_);fill:#318CD6;}
.st317{clip-path:url(#SVGID_12_);fill:#308BD6;}
.st318{fill:#316490;}
</style>
<path class="st0" d="M224,81H8c-4.4,0-8-3.6-8-8V8c0-4.4,3.6-8,8-8h216c4.4,0,8,3.6,8,8v65C232,77.4,228.4,81,224,81z"/>
<g>
<g>
<g>
<g>
<g>
<defs>
<polygon id="SVGID_1_" points="15.2,15 15.2,62.9 59.2,56 59.2,8.1 "/>
</defs>
<clipPath id="SVGID_2_">
<use xlink:href="#SVGID_1_" style="overflow:visible;"/>
</clipPath>
<polygon class="st1" points="56.7,62.9 59.2,56 59.2,62.9 "/>
<polygon class="st1" points="55.7,62.9 59.2,53.1 59.2,56 56.7,62.9 "/>
<polygon class="st2" points="54.6,62.9 59.2,50.3 59.2,53.1 55.7,62.9 "/>
<polygon class="st3" points="53.6,62.9 59.2,47.4 59.2,50.3 54.6,62.9 "/>
<polygon class="st4" points="52.6,62.9 59.2,44.6 59.2,47.4 53.6,62.9 "/>
<polygon class="st5" points="51.5,62.9 59.2,41.7 59.2,44.6 52.6,62.9 "/>
<polygon class="st6" points="50.5,62.9 59.2,38.9 59.2,41.7 51.5,62.9 "/>
<polygon class="st7" points="49.4,62.9 59.2,36 59.2,38.9 50.5,62.9 "/>
<polygon class="st8" points="48.4,62.9 59.2,33.1 59.2,36 49.4,62.9 "/>
<polygon class="st9" points="47.4,62.9 59.2,30.3 59.2,33.1 48.4,62.9 "/>
<polygon class="st10" points="46.3,62.9 59.2,27.4 59.2,30.3 47.4,62.9 "/>
<polygon class="st11" points="45.3,62.9 59.2,24.6 59.2,27.4 46.3,62.9 "/>
<polygon class="st12" points="44.2,62.9 59.2,21.7 59.2,24.6 45.3,62.9 "/>
<polygon class="st13" points="43.2,62.9 59.2,18.9 59.2,21.7 44.2,62.9 "/>
<polygon class="st14" points="42.2,62.9 59.2,16 59.2,18.9 43.2,62.9 "/>
<polygon class="st15" points="41.1,62.9 59.2,13.2 59.2,16 42.2,62.9 "/>
<polygon class="st16" points="40.1,62.9 59.2,10.3 59.2,13.2 41.1,62.9 "/>
<polygon class="st17" points="39,62.9 59,8.1 59.2,8.1 59.2,10.3 40.1,62.9 "/>
<polygon class="st18" points="38,62.9 57.9,8.1 59,8.1 39,62.9 "/>
<polygon class="st19" points="37,62.9 56.9,8.1 57.9,8.1 38,62.9 "/>
<polygon class="st20" points="35.9,62.9 55.9,8.1 56.9,8.1 37,62.9 "/>
<polygon class="st21" points="34.9,62.9 54.8,8.1 55.9,8.1 35.9,62.9 "/>
<polygon class="st22" points="33.8,62.9 53.8,8.1 54.8,8.1 34.9,62.9 "/>
<polygon class="st23" points="32.8,62.9 52.7,8.1 53.8,8.1 33.8,62.9 "/>
<polygon class="st24" points="31.8,62.9 51.7,8.1 52.7,8.1 32.8,62.9 "/>
<polygon class="st25" points="30.7,62.9 50.7,8.1 51.7,8.1 31.8,62.9 "/>
<polygon class="st26" points="29.7,62.9 49.6,8.1 50.7,8.1 30.7,62.9 "/>
<polygon class="st27" points="28.7,62.9 48.6,8.1 49.6,8.1 29.7,62.9 "/>
<polygon class="st28" points="27.6,62.9 47.5,8.1 48.6,8.1 28.7,62.9 "/>
<polygon class="st29" points="26.6,62.9 46.5,8.1 47.5,8.1 27.6,62.9 "/>
<polygon class="st30" points="25.5,62.9 45.5,8.1 46.5,8.1 26.6,62.9 "/>
<polygon class="st31" points="24.5,62.9 44.4,8.1 45.5,8.1 25.5,62.9 "/>
<polygon class="st32" points="23.5,62.9 43.4,8.1 44.4,8.1 24.5,62.9 "/>
<polygon class="st33" points="22.4,62.9 42.3,8.1 43.4,8.1 23.5,62.9 "/>
<polygon class="st34" points="21.4,62.9 41.3,8.1 42.3,8.1 22.4,62.9 "/>
<polygon class="st35" points="20.3,62.9 40.3,8.1 41.3,8.1 21.4,62.9 "/>
<polygon class="st36" points="19.3,62.9 39.2,8.1 40.3,8.1 20.3,62.9 "/>
<polygon class="st37" points="18.3,62.9 38.2,8.1 39.2,8.1 19.3,62.9 "/>
<polygon class="st38" points="17.2,62.9 37.1,8.1 38.2,8.1 18.3,62.9 "/>
<polygon class="st39" points="16.2,62.9 36.1,8.1 37.1,8.1 17.2,62.9 "/>
<polygon class="st40" points="15.2,62.7 35.1,8.1 36.1,8.1 16.2,62.9 15.2,62.9 "/>
<polygon class="st41" points="15.2,59.9 34,8.1 35.1,8.1 15.2,62.7 "/>
<polygon class="st42" points="15.2,57 33,8.1 34,8.1 15.2,59.9 "/>
<polygon class="st43" points="15.2,54.2 32,8.1 33,8.1 15.2,57 "/>
<polygon class="st44" points="15.2,51.3 30.9,8.1 32,8.1 15.2,54.2 "/>
<polygon class="st45" points="15.2,48.5 29.9,8.1 30.9,8.1 15.2,51.3 "/>
<polygon class="st46" points="15.2,45.6 28.8,8.1 29.9,8.1 15.2,48.5 "/>
<polygon class="st47" points="15.2,42.7 27.8,8.1 28.8,8.1 15.2,45.6 "/>
<polygon class="st48" points="15.2,39.9 26.8,8.1 27.8,8.1 15.2,42.7 "/>
<polygon class="st48" points="26.8,8.1 15.2,39.9 15.2,8.1 "/>
</g>
</g>
</g>
<g>
<g>
<g>
<defs>
<polygon id="SVGID_3_" points="83,68.7 83,20.8 59.2,8.1 59.2,56 "/>
</defs>
<clipPath id="SVGID_4_">
<use xlink:href="#SVGID_3_" style="overflow:visible;"/>
</clipPath>
<polygon class="st49" points="83,20.8 78.4,8.1 83,8.1 "/>
<polygon class="st49" points="83,22 77.9,8.1 78.4,8.1 83,20.8 "/>
<polygon class="st50" points="83,23.1 77.5,8.1 77.9,8.1 83,22 "/>
<polygon class="st51" points="83,24.3 77.1,8.1 77.5,8.1 83,23.1 "/>
<polygon class="st52" points="83,25.4 76.7,8.1 77.1,8.1 83,24.3 "/>
<polygon class="st53" points="83,26.6 76.3,8.1 76.7,8.1 83,25.4 "/>
<polygon class="st54" points="83,27.7 75.9,8.1 76.3,8.1 83,26.6 "/>
<polygon class="st55" points="83,28.8 75.4,8.1 75.9,8.1 83,27.7 "/>
<polygon class="st56" points="83,30 75,8.1 75.4,8.1 83,28.8 "/>
<polygon class="st57" points="83,31.1 74.6,8.1 75,8.1 83,30 "/>
<polygon class="st58" points="83,32.3 74.2,8.1 74.6,8.1 83,31.1 "/>
<polygon class="st59" points="83,33.4 73.8,8.1 74.2,8.1 83,32.3 "/>
<polygon class="st60" points="83,34.6 73.4,8.1 73.8,8.1 83,33.4 "/>
<polygon class="st61" points="83,35.7 72.9,8.1 73.4,8.1 83,34.6 "/>
<polygon class="st62" points="83,36.9 72.5,8.1 72.9,8.1 83,35.7 "/>
<polygon class="st63" points="83,38 72.1,8.1 72.5,8.1 83,36.9 "/>
<polygon class="st64" points="83,39.1 71.7,8.1 72.1,8.1 83,38 "/>
<polygon class="st65" points="83,40.3 71.3,8.1 71.7,8.1 83,39.1 "/>
<polygon class="st66" points="83,41.4 70.9,8.1 71.3,8.1 83,40.3 "/>
<polygon class="st67" points="83,42.6 70.4,8.1 70.9,8.1 83,41.4 "/>
<polygon class="st68" points="83,43.7 70,8.1 70.4,8.1 83,42.6 "/>
<polygon class="st69" points="83,44.9 69.6,8.1 70,8.1 83,43.7 "/>
<polygon class="st70" points="83,46 69.2,8.1 69.6,8.1 83,44.9 "/>
<polygon class="st71" points="83,47.2 68.8,8.1 69.2,8.1 83,46 "/>
<polygon class="st72" points="83,48.3 68.4,8.1 68.8,8.1 83,47.2 "/>
<polygon class="st73" points="83,49.5 67.9,8.1 68.4,8.1 83,48.3 "/>
<polygon class="st74" points="83,50.6 67.5,8.1 67.9,8.1 83,49.5 "/>
<polygon class="st75" points="83,51.7 67.1,8.1 67.5,8.1 83,50.6 "/>
<polygon class="st76" points="83,52.9 66.7,8.1 67.1,8.1 83,51.7 "/>
<polygon class="st77" points="83,54 66.3,8.1 66.7,8.1 83,52.9 "/>
<polygon class="st78" points="83,55.2 65.9,8.1 66.3,8.1 83,54 "/>
<polygon class="st79" points="83,56.3 65.4,8.1 65.9,8.1 83,55.2 "/>
<polygon class="st80" points="83,57.5 65,8.1 65.4,8.1 83,56.3 "/>
<polygon class="st81" points="83,58.6 64.6,8.1 65,8.1 83,57.5 "/>
<polygon class="st82" points="83,59.8 64.2,8.1 64.6,8.1 83,58.6 "/>
<polygon class="st83" points="83,60.9 63.8,8.1 64.2,8.1 83,59.8 "/>
<polygon class="st84" points="83,62 63.3,8.1 63.8,8.1 83,60.9 "/>
<polygon class="st85" points="83,63.2 62.9,8.1 63.3,8.1 83,62 "/>
<polygon class="st86" points="83,64.3 62.5,8.1 62.9,8.1 83,63.2 "/>
<polygon class="st87" points="83,65.5 62.1,8.1 62.5,8.1 83,64.3 "/>
<polygon class="st88" points="83,66.6 61.7,8.1 62.1,8.1 83,65.5 "/>
<polygon class="st89" points="83,67.8 61.3,8.1 61.7,8.1 83,66.6 "/>
<polygon class="st90" points="82.9,68.7 60.8,8.1 61.3,8.1 83,67.8 83,68.7 "/>
<polygon class="st91" points="82.5,68.7 60.4,8.1 60.8,8.1 82.9,68.7 "/>
<polygon class="st92" points="82.1,68.7 60,8.1 60.4,8.1 82.5,68.7 "/>
<polygon class="st93" points="81.6,68.7 59.6,8.1 60,8.1 82.1,68.7 "/>
<polygon class="st94" points="81.2,68.7 59.2,8.1 59.2,8.1 59.6,8.1 81.6,68.7 "/>
<polygon class="st95" points="80.8,68.7 59.2,9.3 59.2,8.1 81.2,68.7 "/>
<polygon class="st96" points="80.4,68.7 59.2,10.4 59.2,9.3 80.8,68.7 "/>
<polygon class="st97" points="80,68.7 59.2,11.6 59.2,10.4 80.4,68.7 "/>
<polygon class="st98" points="79.6,68.7 59.2,12.7 59.2,11.6 80,68.7 "/>
<polygon class="st99" points="79.1,68.7 59.2,13.8 59.2,12.7 79.6,68.7 "/>
<polygon class="st100" points="78.7,68.7 59.2,15 59.2,13.8 79.1,68.7 "/>
<polygon class="st101" points="78.3,68.7 59.2,16.1 59.2,15 78.7,68.7 "/>
<polygon class="st102" points="77.9,68.7 59.2,17.3 59.2,16.1 78.3,68.7 "/>
<polygon class="st103" points="77.5,68.7 59.2,18.4 59.2,17.3 77.9,68.7 "/>
<polygon class="st104" points="77.1,68.7 59.2,19.6 59.2,18.4 77.5,68.7 "/>
<polygon class="st105" points="76.6,68.7 59.2,20.7 59.2,19.6 77.1,68.7 "/>
<polygon class="st106" points="76.2,68.7 59.2,21.9 59.2,20.7 76.6,68.7 "/>
<polygon class="st107" points="75.8,68.7 59.2,23 59.2,21.9 76.2,68.7 "/>
<polygon class="st108" points="75.4,68.7 59.2,24.1 59.2,23 75.8,68.7 "/>
<polygon class="st109" points="75,68.7 59.2,25.3 59.2,24.1 75.4,68.7 "/>
<polygon class="st110" points="74.6,68.7 59.2,26.4 59.2,25.3 75,68.7 "/>
<polygon class="st111" points="74.1,68.7 59.2,27.6 59.2,26.4 74.6,68.7 "/>
<polygon class="st111" points="59.2,27.6 74.1,68.7 59.2,68.7 "/>
</g>
</g>
</g>
<g>
<g>
<g>
<defs>
<polygon id="SVGID_5_" points="39,75.5 83,68.7 59.2,56 15.2,62.9 "/>
</defs>
<clipPath id="SVGID_6_">
<use xlink:href="#SVGID_5_" style="overflow:visible;"/>
</clipPath>
<path class="st112" d="M83,75.5v-6.9V75.5z"/>
<rect x="82.1" y="56" class="st112" width="0.9" height="19.5"/>
<rect x="81.2" y="56" class="st113" width="0.9" height="19.5"/>
<rect x="80.3" y="56" class="st114" width="0.9" height="19.5"/>
<rect x="79.4" y="56" class="st115" width="0.9" height="19.5"/>
<rect x="78.5" y="56" class="st116" width="0.9" height="19.5"/>
<rect x="77.6" y="56" class="st117" width="0.9" height="19.5"/>
<rect x="76.7" y="56" class="st118" width="0.9" height="19.5"/>
<rect x="75.8" y="56" class="st119" width="0.9" height="19.5"/>
<rect x="74.9" y="56" class="st120" width="0.9" height="19.5"/>
<rect x="74" y="56" class="st121" width="0.9" height="19.5"/>
<rect x="73.1" y="56" class="st122" width="0.9" height="19.5"/>
<rect x="72.2" y="56" class="st123" width="0.9" height="19.5"/>
<rect x="71.3" y="56" class="st124" width="0.9" height="19.5"/>
<rect x="70.4" y="56" class="st125" width="0.9" height="19.5"/>
<rect x="69.5" y="56" class="st126" width="0.9" height="19.5"/>
<rect x="68.6" y="56" class="st127" width="0.9" height="19.5"/>
<rect x="67.7" y="56" class="st128" width="0.9" height="19.5"/>
<rect x="66.8" y="56" class="st129" width="0.9" height="19.5"/>
<rect x="65.9" y="56" class="st130" width="0.9" height="19.5"/>
<rect x="65" y="56" class="st131" width="0.9" height="19.5"/>
<rect x="64.1" y="56" class="st132" width="0.9" height="19.5"/>
<rect x="63.2" y="56" class="st133" width="0.9" height="19.5"/>
<rect x="62.3" y="56" class="st134" width="0.9" height="19.5"/>
<rect x="61.4" y="56" class="st135" width="0.9" height="19.5"/>
<rect x="60.5" y="56" class="st136" width="0.9" height="19.5"/>
<rect x="59.6" y="56" class="st137" width="0.9" height="19.5"/>
<rect x="58.7" y="56" class="st138" width="0.9" height="19.5"/>
<rect x="57.8" y="56" class="st139" width="0.9" height="19.5"/>
<rect x="56.9" y="56" class="st140" width="0.9" height="19.5"/>
<rect x="56" y="56" class="st141" width="0.9" height="19.5"/>
<rect x="55.1" y="56" class="st142" width="0.9" height="19.5"/>
<rect x="54.2" y="56" class="st143" width="0.9" height="19.5"/>
<rect x="53.3" y="56" class="st144" width="0.9" height="19.5"/>
<rect x="52.4" y="56" class="st145" width="0.9" height="19.5"/>
<rect x="51.5" y="56" class="st146" width="0.9" height="19.5"/>
<rect x="50.6" y="56" class="st147" width="0.9" height="19.5"/>
<rect x="49.7" y="56" class="st148" width="0.9" height="19.5"/>
<rect x="48.8" y="56" class="st149" width="0.9" height="19.5"/>
<rect x="47.9" y="56" class="st150" width="0.9" height="19.5"/>
<rect x="47" y="56" class="st151" width="0.9" height="19.5"/>
<rect x="46.1" y="56" class="st152" width="0.9" height="19.5"/>
<rect x="45.2" y="56" class="st153" width="0.9" height="19.5"/>
<rect x="44.3" y="56" class="st154" width="0.9" height="19.5"/>
<rect x="43.4" y="56" class="st155" width="0.9" height="19.5"/>
<rect x="42.5" y="56" class="st156" width="0.9" height="19.5"/>
<rect x="41.6" y="56" class="st157" width="0.9" height="19.5"/>
<rect x="40.7" y="56" class="st158" width="0.9" height="19.5"/>
<rect x="39.8" y="56" class="st159" width="0.9" height="19.5"/>
<rect x="38.9" y="56" class="st160" width="0.9" height="19.5"/>
<rect x="38" y="56" class="st161" width="0.9" height="19.5"/>
<rect x="37.1" y="56" class="st162" width="0.9" height="19.5"/>
<rect x="15.2" y="56" class="st162" width="21.9" height="19.5"/>
</g>
</g>
</g>
</g>
<g class="st163">
<g>
<g>
<defs>
<polygon id="SVGID_7_" points="39,27.6 15.2,15 15.2,62.9 39,75.5 "/>
</defs>
<clipPath id="SVGID_8_">
<use xlink:href="#SVGID_7_" style="overflow:visible;"/>
</clipPath>
<polygon class="st164" points="37.7,75.5 39,73.7 39,75.5 "/>
<polygon class="st165" points="36.4,75.5 39,71.8 39,73.7 37.7,75.5 "/>
<polygon class="st166" points="35.1,75.5 39,70 39,71.8 36.4,75.5 "/>
<polygon class="st167" points="33.8,75.5 39,68.1 39,70 35.1,75.5 "/>
<polygon class="st168" points="32.5,75.5 39,66.2 39,68.1 33.8,75.5 "/>
<polygon class="st169" points="31.9,75.5 31.4,75.2 39,64.4 39,66.2 32.5,75.5 "/>
<polygon class="st170" points="31.4,75.2 30.5,74.6 39,62.5 39,64.4 "/>
<polygon class="st171" points="30.5,74.6 29.7,74 39,60.7 39,62.5 "/>
<polygon class="st172" points="29.7,74 28.8,73.4 39,58.8 39,60.7 "/>
<polygon class="st173" points="28.8,73.4 27.9,72.8 39,57 39,58.8 "/>
<polygon class="st174" points="27.9,72.8 27.1,72.1 39,55.1 39,57 "/>
<polygon class="st175" points="27.1,72.1 26.2,71.5 39,53.3 39,55.1 "/>
<polygon class="st176" points="26.2,71.5 25.3,70.9 39,51.4 39,53.3 "/>
<polygon class="st177" points="25.3,70.9 24.4,70.3 39,49.6 39,51.4 "/>
<polygon class="st178" points="24.4,70.3 23.6,69.7 39,47.7 39,49.6 "/>
<polygon class="st179" points="23.6,69.7 22.7,69.1 39,45.9 39,47.7 "/>
<polygon class="st180" points="22.7,69.1 21.8,68.5 39,44 39,45.9 "/>
<polygon class="st181" points="21.8,68.5 21,67.9 39,42.2 39,44 "/>
<polygon class="st182" points="21,67.9 20.1,67.3 39,40.3 39,42.2 "/>
<polygon class="st183" points="20.1,67.3 19.2,66.7 39,38.4 39,40.3 "/>
<polygon class="st184" points="19.2,66.7 18.4,66 39,36.6 39,38.4 "/>
<polygon class="st185" points="18.4,66 17.5,65.4 39,34.7 39,36.6 "/>
<polygon class="st186" points="17.5,65.4 16.6,64.8 39,32.9 39,34.7 "/>
<polygon class="st187" points="16.6,64.8 15.7,64.2 39,31 39,32.9 "/>
<polygon class="st188" points="15.7,64.2 15.2,63.8 15.2,63.2 39,29.2 39,31 "/>
<polygon class="st189" points="15.2,61.3 39,27.3 39,29.2 15.2,63.2 "/>
<polygon class="st190" points="15.2,59.5 38.4,26.3 39,26.7 39,27.3 15.2,61.3 "/>
<polygon class="st191" points="15.2,57.6 37.5,25.7 38.4,26.3 15.2,59.5 "/>
<polygon class="st192" points="15.2,55.7 36.7,25 37.5,25.7 15.2,57.6 "/>
<polygon class="st193" points="15.2,53.9 35.8,24.4 36.7,25 15.2,55.7 "/>
<polygon class="st194" points="15.2,52 34.9,23.8 35.8,24.4 15.2,53.9 "/>
<polygon class="st195" points="15.2,50.2 34.1,23.2 34.9,23.8 15.2,52 "/>
<polygon class="st196" points="15.2,48.3 33.2,22.6 34.1,23.2 15.2,50.2 "/>
<polygon class="st197" points="15.2,46.5 32.3,22 33.2,22.6 15.2,48.3 "/>
<polygon class="st198" points="15.2,44.6 31.5,21.4 32.3,22 15.2,46.5 "/>
<polygon class="st199" points="15.2,42.8 30.6,20.8 31.5,21.4 15.2,44.6 "/>
<polygon class="st200" points="15.2,40.9 29.7,20.2 30.6,20.8 15.2,42.8 "/>
<polygon class="st201" points="15.2,39.1 28.8,19.6 29.7,20.2 15.2,40.9 "/>
<polygon class="st202" points="15.2,37.2 28,18.9 28.8,19.6 15.2,39.1 "/>
<polygon class="st203" points="15.2,35.4 27.1,18.3 28,18.9 15.2,37.2 "/>
<polygon class="st204" points="15.2,33.5 26.2,17.7 27.1,18.3 15.2,35.4 "/>
<polygon class="st205" points="15.2,31.6 25.4,17.1 26.2,17.7 15.2,33.5 "/>
<polygon class="st206" points="15.2,29.8 24.5,16.5 25.4,17.1 15.2,31.6 "/>
<polygon class="st207" points="15.2,27.9 23.6,15.9 24.5,16.5 15.2,29.8 "/>
<polygon class="st208" points="15.2,26.1 22.7,15.3 23.6,15.9 15.2,27.9 "/>
<polygon class="st209" points="15.2,24.2 21.7,15 22.3,15 22.7,15.3 15.2,26.1 "/>
<polygon class="st210" points="15.2,22.4 20.4,15 21.7,15 15.2,24.2 "/>
<polygon class="st211" points="15.2,20.5 19.1,15 20.4,15 15.2,22.4 "/>
<polygon class="st212" points="15.2,18.7 17.8,15 19.1,15 15.2,20.5 "/>
<polygon class="st213" points="15.2,16.8 16.5,15 17.8,15 15.2,18.7 "/>
<polygon class="st214" points="15.2,15 15.2,15 16.5,15 15.2,16.8 "/>
<polygon class="st214" points="15.2,15 15.2,15 15.2,15 "/>
</g>
</g>
</g>
<g class="st215">
<g>
<g>
<defs>
<polygon id="SVGID_9_" points="83,20.8 59.2,8.1 15.2,15 39,27.6 "/>
</defs>
<clipPath id="SVGID_10_">
<use xlink:href="#SVGID_9_" style="overflow:visible;"/>
</clipPath>
<path class="st216" d="M83,27.6v-6.9V27.6z"/>
<rect x="81.7" y="8.1" class="st216" width="1.3" height="19.5"/>
<rect x="80.4" y="8.1" class="st217" width="1.3" height="19.5"/>
<rect x="79.2" y="8.1" class="st218" width="1.3" height="19.5"/>
<rect x="77.9" y="8.1" class="st219" width="1.3" height="19.5"/>
<rect x="76.7" y="8.1" class="st220" width="1.3" height="19.5"/>
<rect x="75.4" y="8.1" class="st221" width="1.3" height="19.5"/>
<rect x="74.2" y="8.1" class="st222" width="1.3" height="19.5"/>
<rect x="72.9" y="8.1" class="st223" width="1.3" height="19.5"/>
<rect x="71.7" y="8.1" class="st224" width="1.3" height="19.5"/>
<rect x="70.4" y="8.1" class="st225" width="1.3" height="19.5"/>
<rect x="69.2" y="8.1" class="st226" width="1.3" height="19.5"/>
<rect x="67.9" y="8.1" class="st227" width="1.3" height="19.5"/>
<rect x="66.6" y="8.1" class="st228" width="1.3" height="19.5"/>
<rect x="65.4" y="8.1" class="st229" width="1.3" height="19.5"/>
<rect x="64.1" y="8.1" class="st230" width="1.3" height="19.5"/>
<rect x="62.9" y="8.1" class="st231" width="1.3" height="19.5"/>
<rect x="61.6" y="8.1" class="st232" width="1.3" height="19.5"/>
<rect x="60.4" y="8.1" class="st233" width="1.3" height="19.5"/>
<rect x="59.1" y="8.1" class="st234" width="1.3" height="19.5"/>
<rect x="57.9" y="8.1" class="st235" width="1.3" height="19.5"/>
<rect x="56.6" y="8.1" class="st236" width="1.3" height="19.5"/>
<rect x="55.3" y="8.1" class="st237" width="1.3" height="19.5"/>
<rect x="54.1" y="8.1" class="st238" width="1.3" height="19.5"/>
<rect x="52.8" y="8.1" class="st239" width="1.3" height="19.5"/>
<rect x="51.6" y="8.1" class="st240" width="1.3" height="19.5"/>
<rect x="50.3" y="8.1" class="st241" width="1.3" height="19.5"/>
<rect x="49.1" y="8.1" class="st242" width="1.3" height="19.5"/>
<rect x="47.8" y="8.1" class="st243" width="1.3" height="19.5"/>
<rect x="46.6" y="8.1" class="st244" width="1.3" height="19.5"/>
<rect x="45.3" y="8.1" class="st245" width="1.3" height="19.5"/>
<rect x="44.1" y="8.1" class="st246" width="1.3" height="19.5"/>
<rect x="42.8" y="8.1" class="st247" width="1.3" height="19.5"/>
<rect x="41.5" y="8.1" class="st248" width="1.3" height="19.5"/>
<rect x="40.3" y="8.1" class="st249" width="1.3" height="19.5"/>
<rect x="39" y="8.1" class="st250" width="1.3" height="19.5"/>
<rect x="37.8" y="8.1" class="st251" width="1.3" height="19.5"/>
<rect x="36.5" y="8.1" class="st252" width="1.3" height="19.5"/>
<rect x="35.3" y="8.1" class="st253" width="1.3" height="19.5"/>
<rect x="34" y="8.1" class="st254" width="1.3" height="19.5"/>
<rect x="32.8" y="8.1" class="st255" width="1.3" height="19.5"/>
<rect x="31.5" y="8.1" class="st256" width="1.3" height="19.5"/>
<rect x="30.2" y="8.1" class="st257" width="1.3" height="19.5"/>
<rect x="29" y="8.1" class="st258" width="1.3" height="19.5"/>
<rect x="27.7" y="8.1" class="st259" width="1.3" height="19.5"/>
<rect x="26.5" y="8.1" class="st260" width="1.3" height="19.5"/>
<rect x="25.2" y="8.1" class="st261" width="1.3" height="19.5"/>
<rect x="24" y="8.1" class="st262" width="1.3" height="19.5"/>
<rect x="22.7" y="8.1" class="st263" width="1.3" height="19.5"/>
<rect x="21.5" y="8.1" class="st264" width="1.3" height="19.5"/>
<rect x="20.2" y="8.1" class="st265" width="1.3" height="19.5"/>
<rect x="18.9" y="8.1" class="st266" width="1.3" height="19.5"/>
<rect x="17.7" y="8.1" class="st267" width="1.3" height="19.5"/>
<rect x="16.4" y="8.1" class="st268" width="1.3" height="19.5"/>
<polygon class="st269" points="15.2,15 15.2,8.1 16.4,8.1 16.4,27.6 15.2,27.6 "/>
<path class="st269" d="M15.2,8.1V15V8.1z"/>
</g>
</g>
</g>
<g class="st215">
<g>
<g>
<defs>
<polygon id="SVGID_11_" points="39,27.6 39,75.5 83,68.7 83,20.8 "/>
</defs>
<clipPath id="SVGID_12_">
<use xlink:href="#SVGID_11_" style="overflow:visible;"/>
</clipPath>
<polygon class="st270" points="77.2,75.5 83,68.7 83,75.5 "/>
<polygon class="st270" points="76.2,75.5 83,67.5 83,68.7 77.2,75.5 "/>
<polygon class="st271" points="75.3,75.5 83,66.3 83,67.5 76.2,75.5 "/>
<polygon class="st272" points="74.3,75.5 83,65.1 83,66.3 75.3,75.5 "/>
<polygon class="st273" points="73.3,75.5 83,64 83,65.1 74.3,75.5 "/>
<polygon class="st274" points="72.3,75.5 83,62.8 83,64 73.3,75.5 "/>
<polygon class="st275" points="71.3,75.5 83,61.6 83,62.8 72.3,75.5 "/>
<polygon class="st276" points="70.3,75.5 83,60.4 83,61.6 71.3,75.5 "/>
<polygon class="st277" points="69.3,75.5 83,59.3 83,60.4 70.3,75.5 "/>
<polygon class="st278" points="68.4,75.5 83,58.1 83,59.3 69.3,75.5 "/>
<polygon class="st279" points="67.4,75.5 83,56.9 83,58.1 68.4,75.5 "/>
<polygon class="st280" points="66.4,75.5 83,55.7 83,56.9 67.4,75.5 "/>
<polygon class="st281" points="65.4,75.5 83,54.6 83,55.7 66.4,75.5 "/>
<polygon class="st282" points="64.4,75.5 83,53.4 83,54.6 65.4,75.5 "/>
<polygon class="st283" points="63.4,75.5 83,52.2 83,53.4 64.4,75.5 "/>
<polygon class="st284" points="62.4,75.5 83,51 83,52.2 63.4,75.5 "/>
<polygon class="st285" points="61.5,75.5 83,49.9 83,51 62.4,75.5 "/>
<polygon class="st286" points="60.5,75.5 83,48.7 83,49.9 61.5,75.5 "/>
<polygon class="st287" points="59.5,75.5 83,47.5 83,48.7 60.5,75.5 "/>
<polygon class="st288" points="58.5,75.5 83,46.3 83,47.5 59.5,75.5 "/>
<polygon class="st289" points="57.5,75.5 83,45.2 83,46.3 58.5,75.5 "/>
<polygon class="st290" points="56.5,75.5 83,44 83,45.2 57.5,75.5 "/>
<polygon class="st291" points="55.6,75.5 83,42.8 83,44 56.5,75.5 "/>
<polygon class="st292" points="54.6,75.5 83,41.7 83,42.8 55.6,75.5 "/>
<polygon class="st293" points="53.6,75.5 83,40.5 83,41.7 54.6,75.5 "/>
<polygon class="st294" points="52.6,75.5 83,39.3 83,40.5 53.6,75.5 "/>
<polygon class="st295" points="51.6,75.5 83,38.1 83,39.3 52.6,75.5 "/>
<polygon class="st296" points="50.6,75.5 83,37 83,38.1 51.6,75.5 "/>
<polygon class="st297" points="49.6,75.5 83,35.8 83,37 50.6,75.5 "/>
<polygon class="st298" points="48.7,75.5 83,34.6 83,35.8 49.6,75.5 "/>
<polygon class="st299" points="47.7,75.5 83,33.4 83,34.6 48.7,75.5 "/>
<polygon class="st300" points="46.7,75.5 83,32.3 83,33.4 47.7,75.5 "/>
<polygon class="st301" points="45.7,75.5 83,31.1 83,32.3 46.7,75.5 "/>
<polygon class="st302" points="44.7,75.5 83,29.9 83,31.1 45.7,75.5 "/>
<polygon class="st303" points="43.7,75.5 83,28.7 83,29.9 44.7,75.5 "/>
<polygon class="st304" points="42.8,75.5 83,27.6 83,28.7 43.7,75.5 "/>
<polygon class="st305" points="41.8,75.5 83,26.4 83,27.6 42.8,75.5 "/>
<polygon class="st306" points="40.8,75.5 83,25.2 83,26.4 41.8,75.5 "/>
<polygon class="st307" points="39.8,75.5 83,24 83,25.2 40.8,75.5 "/>
<polygon class="st308" points="39,75.4 83,22.9 83,24 39.8,75.5 39,75.5 "/>
<polygon class="st309" points="39,74.2 83,21.7 83,22.9 39,75.4 "/>
<polygon class="st310" points="39,73 82.8,20.8 83,20.8 83,21.7 39,74.2 "/>
<polygon class="st311" points="39,71.8 81.8,20.8 82.8,20.8 39,73 "/>
<polygon class="st312" points="39,70.7 80.8,20.8 81.8,20.8 39,71.8 "/>
<polygon class="st313" points="39,69.5 79.8,20.8 80.8,20.8 39,70.7 "/>
<polygon class="st314" points="39,68.3 78.9,20.8 79.8,20.8 39,69.5 "/>
<polygon class="st315" points="39,67.1 77.9,20.8 78.9,20.8 39,68.3 "/>
<polygon class="st316" points="39,66 76.9,20.8 77.9,20.8 39,67.1 "/>
<polygon class="st317" points="39,64.8 75.9,20.8 76.9,20.8 39,66 "/>
<polygon class="st317" points="75.9,20.8 39,64.8 39,20.8 "/>
</g>
</g>
</g>
<g>
<g>
<g>
<path class="st0" d="M36.6,28.1c0-1.4,1.1-2.7,2.5-2.9l22.5-3.6v31.9c0,2.6-1.9,4.7-4.4,5.1L36.5,62L36.6,28.1z M56.7,27.3
l-15.3,2.4l0,26.6l15.4-2.5V27.3z"/>
</g>
</g>
</g>
<g>
<g>
<rect x="36.6" y="48.3" class="st0" width="4.8" height="28.2"/>
</g>
</g>
<g>
<g>
<rect x="59.2" y="3.9" class="st0" width="2.4" height="36.7"/>
</g>
</g>
<g>
<g>
<path class="st0" d="M83,23.4v42.4c0,1.5-1.1,2.9-2.6,3.1l-35.3,5.7c-1.9,0.3-3.6-1.2-3.6-3.1v-7.6c0-1.5,1.1-2.9,2.6-3.1l14-2.2
c2-0.3,3.5-2.1,3.5-4.1l0.2-39.7c0-2.4,2.5-3.9,4.6-2.8l14.3,7.7C82.1,20.4,83,21.8,83,23.4z M86.5,16L62.3,3
c-0.8-0.6-1.9-0.1-1.9,0.9l-1.1,51c0,0.6-0.4,1.1-1,1.2L40,59c-0.6,0.1-1,0.6-1,1.2l0,18.7c0,0.7,0.7,1.3,1.4,1.2L86,71.8
c0.6-0.1,1-0.6,1-1.2V17C87,16.6,86.8,16.3,86.5,16z"/>
</g>
</g>
<g>
<g>
<path class="st0" d="M59.2,11.7l0,7.5c0,1.6-1.2,3-2.7,3.2l-17.1,2.8c-1.6,0.3-2.7,1.6-2.7,3.2l0,40.3c0,2.5-2.6,4-4.8,2.9
l-14.8-7.9c-1.1-0.6-1.7-1.7-1.7-2.9V17.6c0-1.6,1.2-3,2.8-3.2l37.5-5.8C57.4,8.2,59.2,9.7,59.2,11.7z M58.8,2.6l-45.5,7.9
c-0.8,0.1-1.4,0.8-1.4,1.6l-0.2,49.6c-0.1,0.7,0.3,1.3,0.9,1.6l25.2,15.4c1.2,0.6,2.6-0.2,2.5-1.6L39,29.3c0-0.9,0.6-1.7,1.5-1.8
l18.5-2.1c0.9-0.1,1.5-0.8,1.5-1.7l0.2-19.4C60.8,3.3,59.8,2.4,58.8,2.6z"/>
</g>
</g>
<g>
<path class="st0" d="M47.5,43.8c-0.6,0-1.1-0.4-1.2-1c-0.1-0.7,0.3-1.3,1-1.4l10.1-1.6c0.7-0.1,1.3,0.3,1.4,1
c0.1,0.7-0.3,1.3-1,1.4l-10.1,1.6C47.6,43.8,47.6,43.8,47.5,43.8z"/>
</g>
<g>
<g>
<path class="st0" d="M55.2,42.6L55.2,42.6c0.8-0.1,1.6,0.5,1.6,1.3v8.7l4.5,0V30.1l-4.5,0.2V38c0,1.1-0.8,2-1.8,2.2l-1.7,0.3
L55.2,42.6z"/>
</g>
</g>
</g>
<g>
<g>
<polygon class="st318" points="112.5,28.8 112.5,37.1 125.6,37.1 125.6,41.2 112.5,41.2 112.5,49.5 125.6,49.5 125.6,53.6
108,53.6 108,24.7 125.6,24.7 125.6,28.8 "/>
</g>
<g>
<path class="st318" d="M147.2,38.3v14.2l-3.8,1.8h-0.6v-16c0-1.7-0.8-1.9-1.5-1.9h-4.3c-0.7,0-1.5,0.2-1.5,1.9v14.2l-3.8,1.8H131
v-16c0-4,2-6,6-6h4.3C145.2,32.3,147.2,34.3,147.2,38.3z"/>
</g>
<g>
<polygon class="st318" points="161.5,32.3 161.5,32.9 159.8,36.4 156.7,36.4 156.7,52.5 152.8,54.3 152.2,54.3 152.2,27.7
156,25.9 156.7,25.9 156.7,32.3 "/>
</g>
<g>
<path class="st318" d="M174.6,32.3h-4.3c-4,0-6,2-6,6v9.3c0,4,2,6,6,6h4.3c0.6,0,1.1-0.1,1.5-0.3v2c0,1.7-0.8,1.9-1.5,1.9h-10.3
v4.1h10.3c4,0,6-2,6-6v-17C180.5,34.3,178.5,32.3,174.6,32.3z M176.1,47.6c0,1.7-0.8,1.9-1.5,1.9h-4.3c-0.7,0-1.5-0.2-1.5-1.9
v-9.3c0-1.7,0.8-1.9,1.5-1.9h4.3c0.7,0,1.5,0.2,1.5,1.9V47.6z"/>
<path class="st318" d="M197,32.3v0.6l-1.6,3.5H192c-0.7,0-1.5,0.2-1.5,1.9v14.2l-3.8,1.8H186v-16c0-4,2-6,6-6H197z"/>
</g>
<g>
<path class="st318" d="M208,32.3h-7v4.1h7c0.7,0,1.5,0.2,1.5,1.9v1.1c-0.5-0.2-1-0.3-1.5-0.3h-3.9c-4,0-6,2-6,6v2.6c0,4,2,6,6,6
h3.9c0.6,0,1.1-0.1,1.5-0.3v1.4h0.6l3.8-1.8V38.3C214,34.3,212,32.3,208,32.3z M208,49.5h-3.9c-0.7,0-1.5-0.2-1.5-1.9V45
c0-1.7,0.8-1.9,1.5-1.9h3.9c0.7,0,1.5,0.2,1.5,1.9v2.6C209.5,49.3,208.7,49.5,208,49.5z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -1,6 +1,7 @@
{
"Title" : "Title",
"Description" : "Description",
"ShortDescription" : "Short Description",
"Category" : "Category",
"Visibility" : "Visibility",
"Devices" : "Devices",
@ -8,22 +9,26 @@
"Groups" : "Groups",
"Tags" : "Tags",
"Platform" : "Platform",
"Platforms" : "Platfomrs",
"Platforms" : "Platforms",
"Applications": "Applications",
"No.Platform" : "No Platforms",
"Screenshots" : "Screenshots",
"Icon" : "Icon",
"Info" : "Info",
"Banner" : "Banner",
"Create.Application" : "Create Application",
"Back" : "Back",
"Cancel" : "Cancel",
"Finish" : "Finish",
"Continue" : "Continue",
"Name" : "Name",
"Application.Name" : "Application Name",
"General" : "General",
"App.Releases" : "Application Releases",
"Package.Manager" : "Package Manager",
"Save" : "Save",
"Create.Release" : "Create Release",
"Release.Channel" : "Release Channel",
"Release" : "Release",
"New.Release.For" : "New Release for",
"Upload.Package.File" : "Upload Package File",
@ -38,6 +43,25 @@
"Version" : "Version",
"Status" : "Status",
"App.Publisher" : "Application Publisher",
"Login": "Login",
"Logout" : "Logout"
"Search.Apps" : "Search for Applications",
"View.In.Store" : "View in Store",
"Last.Updated" : "Last updated on",
"Installs" : "Installs",
"General.Info" : "General Info",
"Select.Platform": "Select Platform",
"Add.Release" : "Add Release to Application",
"Share.With.Tenants" : "Share with Tenants",
"Disable" : "Disable",
"File.Based" : "File Based",
"Activate" : "Activate",
"Yes" : "Yes",
"No" : "No",
"No.Platform.Tags" : "No Platform Tags",
"Create.Platform" : "Create Platform",
"Optional": "Optional",
"Identifier": "Identifier",
"Next": "Next",
"Platform.Enable": "Enable Platform",
"Share.with.Tenants": "Share between all tenants",
"Platform.Properties": "Platform Properties"
}

View File

@ -0,0 +1,903 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@font-face {
font-family: "Roboto-Medium";
src: url('../../fonts/Roboto-Medium.woff');
src: local("Roboto-Medium"), url("../../fonts/Roboto-Medium.ttf") format("ttf");
src: local("Roboto-Medium"), url("../../fonts/Roboto-Medium.woff") format("woff");
src: local("Roboto-Medium"), url("../../fonts/Roboto-Medium.woff2") format("woff2");
}
@font-face {
font-family: "Roboto-Regular";
src: url("../../fonts/Roboto-Regular.woff");
src: local("Roboto-Regular"), url("../../fonts/Roboto-Regular.ttf") format("ttf");
src: local("Roboto-Regular"), url("../../fonts/Roboto-Regular.woff") format("woff");
src: local("Roboto-Regular"), url("../../fonts/Roboto-Regular.woff2") format("woff2");
}
/*Colors*/
.primary {
color: white;
background-color: #2196f3 !important;
}
.primary-flat {
color: #2196F3 !important;
}
.danger {
color: white;
background-color: #e91e63 !important;
}
.danger-flat {
color: #e91e63 !important;
}
.grey {
color: #b3b3b3 !important;
}
/* ==================================================================== */
/* Custom button styles based on material design specs. */
.custom-raised {
font-family: Roboto-Medium;
text-transform: uppercase !important;
font-size: 14px !important;
padding-left: 16px !important;
border-radius: 2px !important;
padding-right: 16px !important;
height: 36px !important;
border: none !important;
}
.custom-raised:hover {
cursor: pointer;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.08) !important;
-webkit-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.08) !important;
background-color: #1976D2 !important;
}
.custom-raised:focus {
box-shadow: none !important;
-webkit-box-shadow: none !important;
background-color: #1976D2 !important;
}
.custom-flat {
font-family: Roboto-Medium;
height: 36px !important;
border-radius: 2px !important;
margin-left: 8px !important;
margin-right: 8px !important;
padding-left: 8px !important;
padding-right: 8px !important;
background-color: transparent !important;
text-transform: uppercase;
outline: none !important;
border: none !important;
}
.custom-flat:hover {
cursor: pointer;
background-color: rgba(0, 0, 0, 0.12) !important;
}
.custom-flat:focus {
outline: none !important;
border: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
background-color: rgba(0, 0, 0, 0.40) !important;
}
.circle-button {
border-radius: 100% !important;
height: 36px !important;
width: 36px;
}
/* ==================================================================== */
/* Body Styling */
body {
width: 100%;
font-family: "Roboto-Regular" !important;
font-size: 14px !important;
background-color: #e8e8e8 !important;
}
.app-manager-title {
font-family: "Roboto-Medium";
font-size: 20px;
}
.app-manager-sub-title {
font-family: "Roboto-Regular";
font-size: 18px;
}
#app-mgt-footer {
clear: both;
position: relative;
height: 50px;
width: 100%;
color: white;
background-color: #334d88;
}
/* Login page styles*/
#userName {
border-radius: 0;
}
#password {
border-radius: 0;
}
.login-btn {
float: right;
}
.login-header {
background-color: #3f50b5;
color: white;
height: 128px;
width: 100%;
margin: 0 !important;
padding: 20px;
box-shadow: -2px 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
#login-card {
width: 25%;
height: 50%;
margin: 10% auto;
font-family: Roboto-Regular;
font-size: 14px;
border-radius: 0;
background-color: #ffffff;
box-shadow: -2px 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
.login-header-title {
font-family: Roboto-Medium;
font-size: 20px;
font-weight: 500;
}
.login-header-logo {
height: 70px;
width: 150px;
}
.login-form {
margin: 0 !important;
padding: 40px;
}
/* Base layout container */
/* Base layout header content*/
.header-content {
height: 128px !important;
width: 100% !important;
margin: 0 10px 0 0;
background-color: #3f50b5 !important;
position: fixed; /* Set the navbar to fixed position */
top: 0; /* Position the navbar at the top of the page */
z-index: 2;
box-shadow: -2px 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
/* Contains the header styles.*/
.header {
padding: 24px 24px 10px 24px;
/*margin: 16px 16px 20px 16px;*/
position: relative;
}
#header-text {
color: #ffffff;
font-size: 20px;
font-family: Roboto-Medium;
top: 10px;
margin-left: 10px;
}
/* The buttons in the header (User and Notification)*/
.header-button-container {
display: flex;
justify-content: flex-end;
}
.header-user-name {
font-family: Roboto-Medium;
font-size: 14px;
padding-top: 15px;
color: white;
}
.header-image {
height: 43px;
width: 100px;
margin-right: 24px;
}
#header-button {
border-radius: 50%;
background-color: transparent;
border: none;
height: 50px;
width: 50px;
margin-right: 10px;
position: relative;
outline: none;
}
#header-button:hover {
background-color: #4353bd;
cursor: pointer;
}
#header-button i {
position: absolute;
bottom: 19px;
left: 17px;
}
.btn-header {
margin-top: 15px;
margin-right: 20px;
color: white;
}
#sub-title {
font-family: Roboto-Regular;
font-size: 18px;
font-weight: 600;
padding-top: 5px;
padding-left: 18px;
color: RGBA(0, 0, 0, 1);
}
/* Search box styles */
.search-box {
display: flex;
float: right;
}
.search-box i {
position: absolute;
top: 5px;
color: #BaBaBa;
}
#search {
position: relative;
color: white;
background-color: transparent;
left: 15px;
top: 0px;
height: 25px;
outline: none;
border: none;
border-radius: 0%;
}
/* Application Add button */
#add-btn-container {
position: absolute;
top: 98px;
}
.add-btn {
background-color: #ff5722;
}
.add-btn:hover {
background-color: #E64A19;
}
#sub-title-container {
height: 100px;
padding: 50px 0 20px 0;
}
.application-container {
padding: 0 !important;
min-height: 100% !important;
margin-top: 128px !important;
}
/* Holds the app publisher pages. */
.publisher-card {
height: auto;
background-color: white;
box-shadow: 2px 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
padding: 24px;
}
.platform-link-placeholder {
color: #888888;
float: right;
padding-bottom: 10px;
}
.platform-link-placeholder i {
margin-right: 4px;
}
.application-list {
transition: margin-right .5s;
}
#batch-content {
display: flex;
margin-top: 5px;
}
.app-list-icon {
border-radius: 50%;
height: 50px;
width: 50px
}
.app-table-row {
height: 62px;
cursor: pointer;
padding-top: 6px;
font-family: "Roboto-Regular";
font-size: medium;
}
.app-table-row:hover {
color: white;
background-color: #3f50b5;
}
.app-list-table-header {
margin-top: 30px;
margin-bottom: 10px;
font-family: "Roboto-Medium";
font-size: 15px;
}
.app-view-image {
height: 100px;
width: 100px;
border-radius: 50%;
}
#app-visibility-default {
display: none;
}
#app-image-screenshot {
width: 300px;
height: 300px;
}
#app-image-icon {
width: 300px;
height: 300px;
}
#app-image-banner {
width: 400px;
height: 300px;
}
#form-error {
color: red;
}
.application-create-banner-dropzone {
width: 300px;
height: 150px;
border-radius: 5%;
position: relative;
border: dashed #888888 2px;
}
.application-create-banner-dropzone i {
position: absolute;
top: 65px;
left: 145px;
}
.application-create-screenshot-dropzone {
width: 150px;
height: 150px;
margin: 0 5px 0 5px;
border-radius: 10%;
position: relative;
border: dashed #888888 2px;
}
.application-create-screenshot-dropzone i {
position: absolute;
top: 65px;
left: 65px;
}
.application-create-icon-dropzone {
width: 150px;
height: 150px;
border-radius: 10%;
position: relative;
border: dashed #888888 2px;
}
.application-create-icon-dropzone i {
position: absolute;
top: 65px;
left: 65px;
}
#screenshot-container {
max-width: 600px;
display: flex;
overflow-x: auto;
height: 200px;
}
#app-icon-container {
height: 300px;
overflow-x: auto;
}
#modal-body-content {
max-height: 700px;
padding-left: 24px;
overflow-y: auto;
}
.custom-footer {
justify-content: inherit !important;
margin: 0 !important;
}
.footer-main-btn {
display: flex;
justify-content: flex-end;
}
#img-btn-screenshot {
margin: 0 5px 0 5px;
}
#app-create-modal {
max-width: 850px;
border-radius: 0% !important;
}
.app-create-modal-header {
background-color: #4353bd;
color: white;
padding: 24px !important;
}
.app-create-modal-content {
padding: 0 !important;
}
#store {
border: none;
border-bottom: solid #BDBDBD 1px;
border-radius: 0px;
width: 200px;
}
#version {
border: none;
border-bottom: solid #BDBDBD 1px;
border-radius: 0px;
width: 200px;
}
#app-release-switch-content {
display: flex;
}
#app-release-switch-label {
position: absolute;
float: left;
}
#app-release-switch {
position: absolute;
right: 10px;
}
.image-sub-title {
font-style: italic;
font-size: 12px;
color: #818181;
}
/* Application View */
#application-view-content {
width: 100%;
}
#application-view-row {
margin: 10px 10px 0 20px;
}
#app-icon {
height: 100px;
width: 100px;
border: solid 1px black;
border-radius: 50%;
}
.app-updated-date {
color: #888888;
}
.app-install-count {
font-style: italic;
}
.app-details-tbl {
outline: none;
border-color: #2196F3;
}
.app-details-tbl tr {
margin: 20px 0 0 0;
}
.app-details-tbl td {
margin-left: 10px;
max-width: 400px;
}
/* Application Edit Base Layout */
#application-edit-header {
height: 40px;
width: 100%;
margin-top: 20px;
margin-bottom: 20px;
font-size: 25px;
}
.application-header-text {
margin: 10px 0px 0px 10px;
}
#save-btn-content {
float: right;
}
#app-save-btn {
border-radius: 0%;
}
.save-btn {
margin: 5px 5px 5px 0px;
height: 70%;
width: 50%;
float: right;
}
.save-btn:hover {
cursor: pointer;
}
/*Tab styling*/
div.tab {
float: left;
border-right: 1px solid #d8d8d8;
height: 100%;
}
/* Style the tab buttons */
div.tab button {
display: block;
background-color: inherit;
color: black;
padding: 15px 16px;
width: 100%;
border: none;
outline: none;
text-align: left;
cursor: pointer;
transition: 0.3s;
}
/* Change background color of buttons on hover */
div.tab button:hover {
background-color: #ddd6d7;
cursor: pointer;
}
/* Create an active/current "tab button" class */
div.tab button.active {
background-color: #1b3bcc;
color: white;
}
#application-edit-main-container {
display: flex;
}
#application-edit-outer-content {
height: auto;
}
#app-edit-content {
height: 100%;
position: relative;
}
.back-to-app {
position: absolute;
height: 50px;
width: 50px;
border-radius: 50%;
}
.back-to-app i {
padding: 12px 10px 10px 12px;
}
.back-to-app:hover {
cursor: pointer;
background-color: #dedede;
transition: .5s;
}
/* Create Release and Release management */
.release-header {
margin-top: 20px;
margin-bottom: 20px;
}
.release-create {
height: 150px;
margin-bottom: 20px;
}
.release-detail-content {
width: 100%;
margin-top: 20%;
height: 300px;
}
.form-btn {
float: right;
margin-bottom: 10px;
}
.release-content {
height: 180px;
width: 95%;
border: dashed 1px #626262;
border-radius: 2%;
position: relative;
background-color: #e8e8e8;
}
.release-content:after {
content: "";
letter-spacing: 4px;
}
.release {
margin: 30px 10px 20px 30px;
}
.no-release-content {
position: absolute;
margin-top: 10px;
left: 40%;
}
.button-add:hover {
cursor: pointer;
}
.release-inner {
margin-top: 5%;
}
/* Application Edit General Info */
.app-edit-general-info {
margin-top: 20px;
max-width: 100%;
}
.save-info {
float: right;
margin-bottom: 10px;
}
.app-view-field {
font-family: Roboto-Medium;
font-size: 14px;
}
.app-view-text {
font-family: Roboto-Regular;
font-size: 14px;
}
/* Platform Specific Styles. */
#platform-listing {
margin: 10px;
}
.create-platform i {
margin-right: 10px;
}
#platform-list {
margin-top: 20px;
display: flex;
flex-flow: wrap;
}
.platform-content {
margin: 10px;
padding-top: 16px;
box-shadow: 2px 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
.platform-content .row {
margin: 0;
}
.platform-content .col {
padding: 0;
}
.platform-content-basic {
padding: 0 16px 0 16px;
display: flex;
}
.platform-content-more-outer {
}
.platform-content-more {
padding: 16px 16px 24px 16px;
}
.platform-content-footer {
display: flex;
padding: 8px 8px 8px 8px;
}
.platform-text-container {
padding: 8px 16px 0 16px;
}
.circle-button {
float: right;
}
.platform-icon-letter {
text-align: center;
text-transform: uppercase;
font-family: Roboto-Medium;
font-size: 70px;
color: white;
padding-top: 15px;
}
.platform-icon-container {
height: 120px;
width: 120px;
background-color: #01579B;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.08) !important;
-webkit-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.08) !important;
}
.platform-property-container {
padding-top: 20px;
font-family: Roboto-Regular;
font-size: 14px;
}
.platform-property-row {
align-items: center;
}
.circle-btn-clear {
background-color: white !important;
color: rgba(0, 0, 0, 0.50) !important;
}
.circle-btn-clear:hover {
background-color: white !important;
color: rgba(0, 0, 0, 0.38) !important;
}
.circle-btn-clear:focus {
background-color: white !important;
color: rgba(0, 0, 0, 0.60) !important;
}
.data-table-row-cell {
padding-top: 14px;
}
.error-code {
text-align: center;
font-family: Roboto-Medium;
font-weight: 800;
font-size: 15em;
color: #BaBaBa;
}
.error-code p {
}
.error-text {
text-align: center;
font-family: Roboto-Regular;
font-size: 14px;
font-weight: 500;
color: #9e9e9e;
}
.circle-btn-add {
background-color: #bababa !important;
border-radius: 50% !important;
height: 30px !important;
width: 30px;
text-align: -webkit-center;
font-size: 18px;
padding: 6px !important;
}
.circle-btn-add:hover {
background-color: #828282 !important;
}
/**
If you need to change the color of active steps in stepper,
uncomment the following and set the background color and font color as needed.
*/
/*
.stepper-active-index {
background-color: #0a6eff !important;
color: white !important;
}
.stepper-passed-index {
background-color: #0a6eff !important;
color: green !important;
}
*/

View File

@ -0,0 +1,17 @@
const express = require('express');
const bodyParser = require('body-parser');
const pino = require('express-pino-logger')();
const app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(pino);
app.get('/api/greeting', (req, res) => {
const name = req.query.name || 'World';
res.setHeader('Content-Type', 'application/json');
res.send(JSON.stringify({ greeting: `Hello ${name}!` }));
});
app.listen(3001, () =>
console.log('Express server is running on localhost:3001')
);

View File

@ -0,0 +1,33 @@
.App {
text-align: center;
}
.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 40vmin;
pointer-events: none;
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

View File

@ -0,0 +1,22 @@
import React from "react";
import "antd/dist/antd.css";
import { renderRoutes } from "react-router-config";
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
route : props.route
}
}
render() {
return (
<div>
{renderRoutes(this.state.route.routes)}
</div>
);
}
}
export default App;

View File

@ -0,0 +1,9 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
ReactDOM.unmountComponentAtNode(div);
});

Some files were not shown because too many files have changed in this diff Show More