未验证 提交 4e99e896 编写于 作者: 彭勇升 pengys 提交者: GitHub

Set instance attributes into return value. (#1783)

* Set instance attributes into return value.

* Delete unused code.
上级 cb0b817f
......@@ -28,4 +28,12 @@ import lombok.*;
public class Attribute {
private String name;
private String value;
public Attribute(String name, String value) {
this.name = name;
this.value = value;
}
public Attribute() {
}
}
......@@ -45,10 +45,10 @@ public class ServiceInstanceInventory extends RegisterSource {
public static final String SERVICE_ID = "service_id";
private static final String IS_ADDRESS = "is_address";
private static final String ADDRESS_ID = "address_id";
private static final String OS_NAME = "os_name";
private static final String HOST_NAME = "host_name";
private static final String PROCESS_NO = "process_no";
private static final String IPV4S = "ipv4s";
public static final String OS_NAME = "os_name";
public static final String HOST_NAME = "host_name";
public static final String PROCESS_NO = "process_no";
public static final String IPV4S = "ipv4s";
public static final String LANGUAGE = "language";
@Setter @Getter @Column(columnName = NAME, matchQuery = true) private String name = Const.EMPTY_STRING;
......
......@@ -188,6 +188,14 @@ public class MetadataQueryEsDAO extends EsDAO implements IMetadataQueryDAO {
serviceInstance.setName((String)sourceAsMap.get(ServiceInstanceInventory.NAME));
int languageId = ((Number)sourceAsMap.get(ServiceInstanceInventory.LANGUAGE)).intValue();
serviceInstance.setLanguage(LanguageTrans.INSTANCE.value(languageId));
serviceInstance.getAttributes().add(new Attribute(ServiceInstanceInventory.OS_NAME, (String)sourceAsMap.get(ServiceInstanceInventory.OS_NAME)));
serviceInstance.getAttributes().add(new Attribute(ServiceInstanceInventory.HOST_NAME, (String)sourceAsMap.get(ServiceInstanceInventory.HOST_NAME)));
serviceInstance.getAttributes().add(new Attribute(ServiceInstanceInventory.PROCESS_NO, String.valueOf(((Number)sourceAsMap.get(ServiceInstanceInventory.PROCESS_NO)).intValue())));
List<String> ipv4s = ServiceInstanceInventory.AgentOsInfo.ipv4sDeserialize((String)sourceAsMap.get(ServiceInstanceInventory.IPV4S));
for (String ipv4 : ipv4s) {
serviceInstance.getAttributes().add(new Attribute(ServiceInstanceInventory.IPV4S, ipv4));
}
serviceInstances.add(serviceInstance);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册