Adding swagger annotations to beans
revert-70aa11f8
Madhawa 9 years ago
commit ae13f7f889

@ -39,13 +39,19 @@ import org.bouncycastle.cms.CMSException;
import org.bouncycastle.cms.CMSSignedData; import org.bouncycastle.cms.CMSSignedData;
import org.bouncycastle.cms.CMSSignedDataGenerator; import org.bouncycastle.cms.CMSSignedDataGenerator;
import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.openssl.PEMWriter;
import org.bouncycastle.operator.ContentSigner; import org.bouncycastle.operator.ContentSigner;
import org.bouncycastle.operator.OperatorCreationException; import org.bouncycastle.operator.OperatorCreationException;
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder; import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
import org.bouncycastle.pkcs.PKCS10CertificationRequest; import org.bouncycastle.pkcs.PKCS10CertificationRequest;
import org.bouncycastle.util.Store; import org.bouncycastle.util.Store;
import org.jscep.message.*; import org.jscep.message.PkcsPkiEnvelopeDecoder;
import org.jscep.message.PkiMessageDecoder;
import org.jscep.message.PkiMessage;
import org.jscep.message.CertRep;
import org.jscep.message.PkcsPkiEnvelopeEncoder;
import org.jscep.message.PkiMessageEncoder;
import org.jscep.message.MessageEncodingException;
import org.jscep.message.MessageDecodingException;
import org.jscep.transaction.FailInfo; import org.jscep.transaction.FailInfo;
import org.jscep.transaction.Nonce; import org.jscep.transaction.Nonce;
import org.jscep.transaction.TransactionId; import org.jscep.transaction.TransactionId;
@ -65,7 +71,6 @@ import org.wso2.carbon.device.mgt.common.TransactionManagementException;
import javax.security.auth.x500.X500Principal; import javax.security.auth.x500.X500Principal;
import javax.xml.bind.DatatypeConverter; import javax.xml.bind.DatatypeConverter;
import java.io.*; import java.io.*;
import java.math.BigInteger;
import java.security.*; import java.security.*;
import java.security.cert.Certificate; import java.security.cert.Certificate;
import java.security.cert.*; import java.security.cert.*;
@ -629,7 +634,6 @@ public class CertificateGenerator {
} }
public String extractChallengeToken(X509Certificate certificate) { public String extractChallengeToken(X509Certificate certificate) {
byte[] challengePassword = certificate.getExtensionValue( byte[] challengePassword = certificate.getExtensionValue(

@ -17,7 +17,8 @@
~ under the License. ~ under the License.
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>device-mgt</artifactId> <artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>

@ -18,6 +18,9 @@
package org.wso2.carbon.device.mgt.common.configuration.mgt; package org.wso2.carbon.device.mgt.common.configuration.mgt;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
@ -30,10 +33,16 @@ import java.util.List;
*/ */
@XmlRootElement(name = "tenantConfiguration") @XmlRootElement(name = "tenantConfiguration")
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@ApiModel(value = "TenantConfiguration",
description = "This class carries all information related to a Tenant configuration")
public class TenantConfiguration implements Serializable { public class TenantConfiguration implements Serializable {
@XmlElement(name = "type") @XmlElement(name = "type")
@ApiModelProperty(name = "type", value = "type of device", required = true)
private String type; private String type;
@ApiModelProperty(name = "configuration", value = "List of Configuration Entries", required = true)
@XmlElement(name = "configuration") @XmlElement(name = "configuration")
private List<ConfigurationEntry> configuration; private List<ConfigurationEntry> configuration;

@ -80,18 +80,13 @@ utility = function () {
}; };
publicMethods.getDeviceTypeConfig = function (deviceType) { publicMethods.getDeviceTypeConfig = function (deviceType) {
var JFile = Packages.java.io.File; var unitName = publicMethods.getTenantedDeviceUnitName(deviceType, "type-view");
var sep = JFile.separator;
var systemProcess = require('process');
var parent = 'file:///' + (systemProcess.getProperty('jaggery.home') || systemProcess.getProperty('carbon.home')).replace(/[\\]/g, '/').replace(/^[\/]/g, '');
if (deviceType in deviceTypeConfigMap) { if (deviceType in deviceTypeConfigMap) {
return deviceTypeConfigMap[deviceType]; return deviceTypeConfigMap[deviceType];
} }
var deviceTypeConfig; var deviceTypeConfig;
var deviceTypeConfigFile = new File(parent + sep + "repository" + sep + "conf" + sep var deviceTypeConfigFile = new File("/app/units/" + unitName + "/private/config.json");
+ "device-types" + sep + deviceType + ".json");
if (deviceTypeConfigFile.isExists()) { if (deviceTypeConfigFile.isExists()) {
try { try {
deviceTypeConfigFile.open("r"); deviceTypeConfigFile.open("r");

@ -54,7 +54,11 @@ function onRequest(context) {
var deviceTypes = []; var deviceTypes = [];
if (data) { if (data) {
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
var deviceType = utility.getDeviceTypeConfig(data[i].name).deviceType; var config = utility.getDeviceTypeConfig(data[i].name);
if (!config){
continue;
}
var deviceType = config.deviceType;
deviceTypes.push({ deviceTypes.push({
"type": data[i].name, "type": data[i].name,
"category": deviceType.category, "category": deviceType.category,

Loading…
Cancel
Save