Browse Source

[search-console-b2b] modify ParsedQueueMessage

sunyj 7 years ago
parent
commit
90104c092d

+ 80 - 74
search-console-b2b/src/main/java/com/uas/search/console/b2b/jms/ParsedQueueMessage.java

@@ -1,7 +1,5 @@
 package com.uas.search.console.b2b.jms;
 
-import java.util.Arrays;
-
 /**
  * 对数据库队列里的消息进行解析后所得到的数据
  * 
@@ -10,77 +8,85 @@ import java.util.Arrays;
  */
 public class ParsedQueueMessage {
 
-	/**
-	 * 数据库中表的改动为insert类型
-	 */
-	public static final int INSERT = 1;
-
-	/**
-	 * 改动为update类型
-	 */
-	public static final int UPDATE = 2;
-
-	/**
-	 * 改动为delete类型
-	 */
-	public static final int DELETE = 3;
-
-	/**
-	 * 表改动后,解析消息时,更改的类型
-	 */
-	private int methodType;
-
-	/**
-	 * 存放解析出来的对象
-	 */
-	private Object[] objects;
-
-	/**
-	 * 是否为insert类型
-	 * 
-	 * @return
-	 */
-	public boolean isInsert() {
-		return methodType == INSERT;
-	}
-
-	/**
-	 * 是否为update类型
-	 * 
-	 * @return
-	 */
-	public boolean isUpdate() {
-		return methodType == UPDATE;
-	}
-
-	/**
-	 * 是否为delete类型
-	 * 
-	 * @return
-	 */
-	public boolean isDelete() {
-		return methodType == DELETE;
-	}
-
-	public int getMethodType() {
-		return methodType;
-	}
-
-	public void setMethodType(int methodType) {
-		this.methodType = methodType;
-	}
-
-	public Object[] getObjects() {
-		return objects;
-	}
-
-	public void setObjects(Object[] objects) {
-		this.objects = objects;
-	}
-
-	@Override
-	public String toString() {
-		return "ParsedQueueMessage [methodType=" + methodType + ", object=" + Arrays.toString(objects) + "]";
-	}
+    /**
+     * 数据库中表的改动为insert类型
+     */
+    public static final int INSERT = 1;
+
+    /**
+     * 改动为update类型
+     */
+    public static final int UPDATE = 2;
+
+    /**
+     * 改动为delete类型
+     */
+    public static final int DELETE = 3;
+
+    /**
+     * 表改动后,解析消息时,更改的类型
+     */
+    private int methodType;
+
+    /**
+     * 存放解析出来的对象:kind、brand或component、order、purchase等对象
+     */
+    private Object object;
+
+    public ParsedQueueMessage() {
+    }
+
+    public ParsedQueueMessage(int methodType, Object object) {
+        this.methodType = methodType;
+        this.object = object;
+    }
+
+    /**
+     * 是否为insert类型
+     *
+     * @return
+     */
+    public boolean isInsert() {
+        return methodType == INSERT;
+    }
+
+    /**
+     * 是否为update类型
+     *
+     * @return
+     */
+    public boolean isUpdate() {
+        return methodType == UPDATE;
+    }
+
+    /**
+     * 是否为delete类型
+     *
+     * @return
+     */
+    public boolean isDelete() {
+        return methodType == DELETE;
+    }
+
+    public int getMethodType() {
+        return methodType;
+    }
+
+    public void setMethodType(int methodType) {
+        this.methodType = methodType;
+    }
+
+    public Object getObject() {
+        return object;
+    }
+
+    public void setObject(Object object) {
+        this.object = object;
+    }
+
+    @Override
+    public String toString() {
+        return "ParsedQueueMessage [methodType=" + methodType + ", object=" + object + "]";
+    }
 
 }