Adding swagger annotations to beans

4.x.x
Madhawa Perera 9 years ago
parent 26c10f84ec
commit 087adafeb7

@ -18,21 +18,52 @@
package org.wso2.carbon.device.mgt.jaxrs.beans; package org.wso2.carbon.device.mgt.jaxrs.beans;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import java.util.List; import java.util.List;
@ApiModel(value = "PolicyWrapper", description = "This class carries all information related to Policy "
+ "Wrappers")
public class PolicyWrapper { public class PolicyWrapper {
@ApiModelProperty(name = "id", value = "The policy ID", required = true)
private int id; private int id;
@ApiModelProperty(name = "profile", value = "Contains the details of the profile that is included in the"
+ " policy", required = true)
private Profile profile; private Profile profile;
@ApiModelProperty(name = "policyName", value = "The name of the policy", required = true)
private String policyName; private String policyName;
@ApiModelProperty(name = "description", value = "Gives a description on the policy", required = true)
private String description; private String description;
@ApiModelProperty(name = "compliance", value = "Provides the non-compliance rules. WSO2 EMM provides the"
+ " following non-compliance rules:\n"
+ "Enforce - Forcefully enforce the policies on the devices\n"
+ "Warning - If the device does not adhere to the given policies a warning message will be sent\n"
+ "Monitor - If the device does not adhere to the given policies the server is notified of the "
+ "violation unknown to the user and the administrator can take the necessary actions with regard"
+ " to the reported", required = true)
private String compliance; private String compliance;
@ApiModelProperty(name = "roles", value = "The roles to whom the policy is applied on", required = true)
private List<String> roles; private List<String> roles;
@ApiModelProperty(name = "ownershipType", value = "The policy ownership type. It can be any of the "
+ "following values:\n"
+ "ANY - The policy will be applied on the BYOD and COPE device types\n"
+ "BYOD (Bring Your Own Device) - The policy will only be applied on the BYOD device type\n"
+ "COPE (Corporate-Owned, Personally-Enabled) - The policy will only be applied on the COPE "
+ "device type", required = true)
private String ownershipType; private String ownershipType;
@ApiModelProperty(name = "devices", value = "Lists out the devices the policy is enforced on",
required = true)
private List<Device> devices; private List<Device> devices;
@ApiModelProperty(name = "users", value = "Lists out the users on whose devices the policy is enforced",
required = true)
private List<String> users; private List<String> users;
@ApiModelProperty(name = "tenantId", value = "The ID of the tenant that created the policy",
required = true)
private int tenantId; private int tenantId;
@ApiModelProperty(name = "profileId", value = "The ID of each profile that is in the selected policy",
required = true)
private int profileId; private int profileId;
public int getId() { public int getId() {

@ -18,9 +18,17 @@
package org.wso2.carbon.device.mgt.jaxrs.beans; package org.wso2.carbon.device.mgt.jaxrs.beans;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "PriorityUpdatedPolicyWrapper", description = "This class carries all information related "
+ "to Priority Updated Policy Wrapper ")
public class PriorityUpdatedPolicyWrapper { public class PriorityUpdatedPolicyWrapper {
@ApiModelProperty(name = "id", value = "Define the ID of the policy", required = true)
private int id; private int id;
@ApiModelProperty(name = "priority", value = "Define the priority of the order, where 1 indicates the "
+ "highest priority", required = true)
private int priority; private int priority;
public int getId() { public int getId() {

@ -53,6 +53,8 @@
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version> <Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
<Bundle-Description>Policy Management Common Bundle</Bundle-Description> <Bundle-Description>Policy Management Common Bundle</Bundle-Description>
<Import-Package> <Import-Package>
javax.xml.bind.annotation,
io.swagger.annotations.*;resolution:=optional
org.wso2.carbon.device.mgt.common.*, org.wso2.carbon.device.mgt.common.*,
org.wso2.carbon.device.mgt.core.dto.*, org.wso2.carbon.device.mgt.core.dto.*,
javax.xml.bind.*, javax.xml.bind.*,
@ -91,6 +93,11 @@
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.core</artifactId> <artifactId>org.wso2.carbon.device.mgt.core</artifactId>
</dependency> </dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

@ -17,6 +17,8 @@
*/ */
package org.wso2.carbon.policy.mgt.common; package org.wso2.carbon.policy.mgt.common;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
@ -29,24 +31,50 @@ import java.util.Map;
* This class will be the used to create policy object with relevant information for evaluating. * This class will be the used to create policy object with relevant information for evaluating.
*/ */
@XmlRootElement @XmlRootElement
@ApiModel(value = "Policy", description = "This class carries all information related to Policies")
public class Policy implements Comparable<Policy>, Serializable { public class Policy implements Comparable<Policy>, Serializable {
private static final long serialVersionUID = 19981017L; private static final long serialVersionUID = 19981017L;
@ApiModelProperty(name = "id", value = "The policy ID", required = true)
private int id; // Identifier of the policy. private int id; // Identifier of the policy.
@ApiModelProperty(name = "priorityId", value = "The priority order of the policy. 1 indicates the highest"
+ " priority", required = true)
private int priorityId; // Priority of the policies. This will be used only for simple evaluation. private int priorityId; // Priority of the policies. This will be used only for simple evaluation.
@ApiModelProperty(name = "profile", value = "Contains the details of the profile that is included in the "
+ "policy", required = true)
private Profile profile; // Profile private Profile profile; // Profile
@ApiModelProperty(name = "policyName", value = "The name of the policy", required = true)
private String policyName; // Name of the policy. private String policyName; // Name of the policy.
@ApiModelProperty(name = "generic", value = "If true, this should be applied to all related device",
required = true)
private boolean generic; // If true, this should be applied to all related device. private boolean generic; // If true, this should be applied to all related device.
@ApiModelProperty(name = "roles", value = "The roles to whom the policy is applied on", required = true)
private List<String> roles; // Roles which this policy should be applied. private List<String> roles; // Roles which this policy should be applied.
@ApiModelProperty(name = "ownershipType", value = "The policy ownership type. It can be any of the "
+ "following values:\n"
+ "ANY - The policy will be applied on the BYOD and COPE device types\n"
+ "BYOD (Bring Your Own Device) - The policy will only be applied on the BYOD device type\n"
+ "COPE (Corporate-Owned, Personally-Enabled) - The policy will only be applied on the COPE "
+ "device type\n", required = true)
private String ownershipType; // Ownership type (COPE, BYOD, CPE) private String ownershipType; // Ownership type (COPE, BYOD, CPE)
@ApiModelProperty(name = "devices", value = "Lists out the devices the policy is enforced on",
required = true)
private List<Device> devices; // Individual devices this policy should be applied private List<Device> devices; // Individual devices this policy should be applied
@ApiModelProperty(name = "users", value = "Lists out the users on whose devices the policy is enforced",
required = true)
private List<String> users; private List<String> users;
@ApiModelProperty(name = "active", value = "If the value is true it indicates that the policy is active. "
+ "If the value is false it indicates that the policy is inactive", required = true)
private boolean active; private boolean active;
@ApiModelProperty(name = "updated", value = "If you have made changes to the policy but have not applied"
+ " these changes to the devices that are registered with EMM, then the value is defined as true."
+ " But if you have already applied any changes made to the policy then the value is defined as"
+ " false.", required = true)
private boolean updated; private boolean updated;
@ApiModelProperty(name = "description", value = "Gives a description on the policy", required = true)
private String description; private String description;
/* Compliance data*/ /* Compliance data*/
private String compliance; private String compliance;

Loading…
Cancel
Save