Jelajahi Sumber

增加更多 jaxb 内容

zhaopingxi 5 bulan lalu
induk
melakukan
d4a2d12a12
2 mengubah file dengan 441 tambahan dan 0 penghapusan
  1. 59 0
      jaxb-serde/CatalogResponse.java
  2. 382 0
      jaxb-serde/DeviceItem.java

+ 59 - 0
jaxb-serde/CatalogResponse.java

@@ -0,0 +1,59 @@
+package com.wydpp.gb28181.meta;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+
+import javax.xml.bind.annotation.XmlAccessOrder;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorOrder;
+import javax.xml.bind.annotation.XmlAccessorType;
+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 javax.xml.bind.annotation.XmlType;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * <pre>
+ *
+ * Created by zhaopx.
+ * Date: 2025/5/23
+ * Time: 19:52
+ * Vendor: exlive.cn
+ *
+ * </pre>
+ *
+ * @author zhaopx
+ */
+@XmlType(propOrder = {})
+@XmlRootElement(name = "Response")
+@XmlAccessorType(XmlAccessType.PROPERTY)
+@XmlAccessorOrder(XmlAccessOrder.ALPHABETICAL)
+public class CatalogResponse extends SipResponse {
+
+    /**
+     * 摄像头列表
+     */
+    List<DeviceItem> deviceList;
+
+    public CatalogResponse() {
+        super("Catalog");
+    }
+
+    @XmlElementWrapper(name = "DeviceList")
+    @XmlElement(name = "Item")
+    public List<DeviceItem> getDeviceList() {
+        return deviceList;
+    }
+
+    public void setDeviceList(List<DeviceItem> deviceList) {
+        this.deviceList = deviceList;
+    }
+
+    @Override
+    public String toString() {
+        return "CatalogResponse" + JSON.toJSONString(this, SerializerFeature.PrettyFormat);
+    }
+}

+ 382 - 0
jaxb-serde/DeviceItem.java

@@ -0,0 +1,382 @@
+package com.wydpp.gb28181.meta;
+
+import lombok.NoArgsConstructor;
+import org.apache.commons.lang3.time.FastDateFormat;
+
+import javax.xml.bind.annotation.XmlAccessOrder;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorOrder;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <pre>
+ *
+ * Created by zhaopx.
+ * Date: 2025/5/23
+ * Time: 19:49
+ * Vendor: exlive.cn
+ *
+ * </pre>
+ *
+ * @author zhaopx
+ */
+@NoArgsConstructor
+@XmlType(propOrder = {})
+@XmlRootElement(name = "Item")
+@XmlAccessorType(XmlAccessType.PROPERTY)
+public class DeviceItem implements Serializable, Cloneable {
+
+    /**
+     * 设备 ID。 设备/区域/系统编码(必选)
+     */
+    String deviceID;
+
+    /**
+     * 设备/区域/系统名称(必选)
+     */
+    String name;
+
+    /**
+     * 生产厂商,当为设备时,设备厂商(必选)
+     */
+    String manufacturer;
+
+    /**
+     * 当为设备时,设备型号(必选)
+     */
+    String model = "Model";
+
+    /**
+     * 当为设备时,设备归属(必选)
+     */
+    String owner = "Owner";
+
+    /**
+     * 行政区域(必选)
+     */
+    String civilCode = "CivilCode";
+
+    /**
+     * 警区(可选)
+     */
+    String block = "Block";
+
+    /**
+     * 当为设备时,安装地址(必选)
+     */
+    String address = "上海市五角场合生汇";
+
+    /**
+     * 当为设备时,是否有子设备(必选)1有,0没有
+     */
+    String parental = "0";
+
+    /**
+     *  父设备/区域/系统ID(必选)
+     */
+    String parentID = "${DEVICE_ID}";
+
+    /**
+     * 信令安全模式(可选)缺省为0; 0:不采用;2:S/MIME 签名方式;3:S/ MIME加密签名同时采用方式;4:数字摘要方式
+     */
+    String safetyWay = "0";
+
+    /**
+     * 注册方式(必选)缺省为1;1:符合IETFRFC3261标准的认证注册模 式;2:基于口令的双向认证注册模式;3:基于数字证书的双向认证注册模式
+     */
+    String registerWay = "1";
+
+    /**
+     * 证书序列号(有证书的设备必选)
+     */
+    String certNum = "CertNum1";
+
+    /**
+     * 证书有效标识(有证书的设备必选)缺省为0;证书有效标识:0:无效 1: 有效
+     */
+    String certifiable = "0";
+
+    /**
+     * 无效原因码(有证书且证书无效的设备必选)
+     */
+    String errCode = "400";
+
+    /**
+     * 证书终止有效期(有证书的设备必选)
+     */
+    String endTime = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss").format(new Date());
+
+    /**
+     * 保密属性(必选)缺省为0;0:不涉密,1:涉密
+     */
+    String secrecy = "0";
+
+    /**
+     * 设备/区域/系统IP地址(可选)
+     */
+    String ipAddress = "192.168.3.81";
+
+    /**
+     * 设备/区域/系统端口(可选)
+     */
+    int port = 5060;
+
+    /**
+     * 设备口令(可选)
+     */
+    String password = "Password1";
+
+    /**
+     * 设备状态(必选), ON/OFF
+     */
+    String status = "ON";
+
+    /**
+     * 经度(可选)
+     */
+    double longitude = 171.4;
+
+    /**
+     * 纬度(可选)
+     */
+    double latitude = 34.2;
+
+    /**
+     * 推流来源
+     */
+    String url;
+
+    public DeviceItem(String deviceID, String name, String manufacturer) {
+        this.deviceID = deviceID;
+        this.name = name;
+        this.manufacturer = manufacturer;
+    }
+
+    @XmlElement(name = "DeviceID")
+    public String getDeviceID() {
+        return deviceID;
+    }
+
+    public void setDeviceID(String deviceID) {
+        this.deviceID = deviceID;
+    }
+
+    @XmlElement(name = "Name")
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @XmlElement(name = "Manufacturer")
+    public String getManufacturer() {
+        return manufacturer;
+    }
+
+    public void setManufacturer(String manufacturer) {
+        this.manufacturer = manufacturer;
+    }
+
+    @XmlElement(name = "Model")
+    public String getModel() {
+        return model;
+    }
+
+    public void setModel(String model) {
+        this.model = model;
+    }
+
+    @XmlElement(name = "Owner")
+    public String getOwner() {
+        return owner;
+    }
+
+    public void setOwner(String owner) {
+        this.owner = owner;
+    }
+
+    @XmlElement(name = "CivilCode")
+    public String getCivilCode() {
+        return civilCode;
+    }
+
+    public void setCivilCode(String civilCode) {
+        this.civilCode = civilCode;
+    }
+
+    @XmlElement(name = "Block")
+    public String getBlock() {
+        return block;
+    }
+
+    public void setBlock(String block) {
+        this.block = block;
+    }
+
+    @XmlElement(name = "Address")
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    @XmlElement(name = "Parental")
+    public String getParental() {
+        return parental;
+    }
+
+    public void setParental(String parental) {
+        this.parental = parental;
+    }
+
+    @XmlElement(name = "ParentID")
+    public String getParentID() {
+        return parentID;
+    }
+
+    public void setParentID(String parentID) {
+        this.parentID = parentID;
+    }
+
+    @XmlElement(name = "SafetyWay")
+    public String getSafetyWay() {
+        return safetyWay;
+    }
+
+    public void setSafetyWay(String safetyWay) {
+        this.safetyWay = safetyWay;
+    }
+
+    @XmlElement(name = "RegisterWay")
+    public String getRegisterWay() {
+        return registerWay;
+    }
+
+    public void setRegisterWay(String registerWay) {
+        this.registerWay = registerWay;
+    }
+
+    @XmlElement(name = "CertNum")
+    public String getCertNum() {
+        return certNum;
+    }
+
+    public void setCertNum(String certNum) {
+        this.certNum = certNum;
+    }
+
+    @XmlElement(name = "Certifiable")
+    public String getCertifiable() {
+        return certifiable;
+    }
+
+    public void setCertifiable(String certifiable) {
+        this.certifiable = certifiable;
+    }
+
+    @XmlElement(name = "ErrCode")
+    public String getErrCode() {
+        return errCode;
+    }
+
+    public void setErrCode(String errCode) {
+        this.errCode = errCode;
+    }
+
+    @XmlElement(name = "EndTime")
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
+    @XmlElement(name = "Secrecy")
+    public String getSecrecy() {
+        return secrecy;
+    }
+
+    public void setSecrecy(String secrecy) {
+        this.secrecy = secrecy;
+    }
+
+    @XmlElement(name = "IPAddress")
+    public String getIpAddress() {
+        return ipAddress;
+    }
+
+    public void setIpAddress(String ipAddress) {
+        this.ipAddress = ipAddress;
+    }
+
+    @XmlElement(name = "Port")
+    public int getPort() {
+        return port;
+    }
+
+    public void setPort(int port) {
+        this.port = port;
+    }
+
+    @XmlElement(name = "Password")
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    @XmlElement(name = "Status")
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    @XmlElement(name = "Longitude")
+    public double getLongitude() {
+        return longitude;
+    }
+
+    public void setLongitude(double longitude) {
+        this.longitude = longitude;
+    }
+
+    @XmlElement(name = "Latitude")
+    public double getLatitude() {
+        return latitude;
+    }
+
+    public void setLatitude(double latitude) {
+        this.latitude = latitude;
+    }
+
+    @XmlTransient
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+        return super.clone();
+    }
+}