mirror of
https://github.com/ctripcorp/zeus.git
synced 2024-09-21 16:16:09 +08:00
fill data info in view to db model transforming
This commit is contained in:
parent
fd91860946
commit
cf2ad80eaf
|
@ -145,7 +145,7 @@ public class GroupQueryImpl implements GroupQuery {
|
|||
for (GroupSlbDo d : list) {
|
||||
GroupSlb e = C.toGroupSlb(d);
|
||||
group.addGroupSlb(e);
|
||||
e.setSlbName(slbDao.findById(d.getSlbId(), SlbEntity.READSET_FULL).getName());
|
||||
e.setSlbName(slbDao.findById(e.getSlbId(), SlbEntity.READSET_FULL).getName());
|
||||
querySlbVips(d.getSlbId(), e);
|
||||
queryVirtualServer(d.getSlbVirtualServerId(), e);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class GroupSyncImpl implements GroupSync {
|
|||
if (check.getVersion() > group.getVersion())
|
||||
throw new ValidationException("Newer Group version is detected.");
|
||||
|
||||
GroupDo d= C.toGroupDo(group).setId(group.getId());
|
||||
GroupDo d= C.toGroupDo(group);
|
||||
groupDao.updateById(d, GroupEntity.UPDATESET_FULL);
|
||||
|
||||
GroupDo updated = groupDao.findByName(group.getName(), GroupEntity.READSET_FULL);
|
||||
|
|
|
@ -56,7 +56,7 @@ public class SlbSyncImpl implements SlbSync {
|
|||
SlbDo check = slbDao.findByName(slb.getName(), SlbEntity.READSET_FULL);
|
||||
if (check.getVersion() > slb.getVersion())
|
||||
throw new ValidationException("Newer Slb version is detected.");
|
||||
SlbDo d = C.toSlbDo(slb).setId(slb.getId());
|
||||
SlbDo d = C.toSlbDo(slb);
|
||||
slbDao.updateById(d, SlbEntity.UPDATESET_FULL);
|
||||
|
||||
SlbDo updated = slbDao.findByName(d.getName(), SlbEntity.READSET_FULL);
|
||||
|
|
|
@ -13,6 +13,7 @@ public class C {
|
|||
|
||||
public static Group toGroup(GroupDo d) {
|
||||
return new Group()
|
||||
.setId(d.getId())
|
||||
.setAppId(d.getAppId())
|
||||
.setName(d.getName())
|
||||
.setSsl(d.isSsl())
|
||||
|
@ -31,8 +32,8 @@ public class C {
|
|||
|
||||
public static GroupSlb toGroupSlb(GroupSlbDo d) {
|
||||
return new GroupSlb()
|
||||
.setGroupName(d.getGroupName())
|
||||
.setSlbName(d.getSlbName())
|
||||
.setSlbId(d.getSlbId())
|
||||
.setGroupId(d.getGroupId())
|
||||
.setPath(d.getPath())
|
||||
.setRewrite(d.getRewrite())
|
||||
.setPriority(d.getPriority());
|
||||
|
@ -60,6 +61,7 @@ public class C {
|
|||
|
||||
public static Slb toSlb(SlbDo d) {
|
||||
return new Slb()
|
||||
.setId(d.getId())
|
||||
.setName(d.getName())
|
||||
.setNginxBin(d.getNginxBin())
|
||||
.setNginxConf(d.getNginxConf())
|
||||
|
@ -82,6 +84,7 @@ public class C {
|
|||
|
||||
public static VirtualServer toVirtualServer(SlbVirtualServerDo d) {
|
||||
return new VirtualServer()
|
||||
.setId(d.getId())
|
||||
.setPort(d.getPort())
|
||||
.setName(d.getName())
|
||||
.setSsl(d.isIsSsl());
|
||||
|
@ -89,14 +92,14 @@ public class C {
|
|||
|
||||
public static Archive toGroupArchive(ArchiveGroupDo d) {
|
||||
return new Archive()
|
||||
.setName(d.getName())
|
||||
.setId(d.getId())
|
||||
.setContent(d.getContent())
|
||||
.setVersion(d.getVersion());
|
||||
}
|
||||
|
||||
public static Archive toSlbArchive(ArchiveSlbDo d) {
|
||||
return new Archive()
|
||||
.setName(d.getName())
|
||||
.setId(d.getId())
|
||||
.setContent(d.getContent())
|
||||
.setVersion(d.getVersion());
|
||||
}
|
||||
|
@ -123,7 +126,9 @@ public class C {
|
|||
/*Entity to Do*/
|
||||
|
||||
public static GroupDo toGroupDo(Group e) {
|
||||
return new GroupDo().setAppId(e.setAppId())
|
||||
return new GroupDo()
|
||||
.setId(e.getId())
|
||||
.setAppId(e.getAppId())
|
||||
.setName(e.getName())
|
||||
.setSsl(e.isSsl())
|
||||
.setVersion(e.getVersion());
|
||||
|
@ -141,9 +146,9 @@ public class C {
|
|||
|
||||
public static GroupSlbDo toGroupSlbDo(GroupSlb e) {
|
||||
return new GroupSlbDo()
|
||||
.setGroupName(e.getGroupName())
|
||||
.setSlbName(e.getSlbName())
|
||||
.setSlbVirtualServerName(e.getVirtualServer().getName())
|
||||
.setGroupId(e.getGroupId())
|
||||
.setSlbId(e.getSlbId())
|
||||
.setSlbVirtualServerId(e.getVirtualServer().getId())
|
||||
.setPath(e.getPath())
|
||||
.setRewrite(e.getRewrite())
|
||||
.setPriority(e.getPriority() == null ? 0 : e.getPriority().intValue());
|
||||
|
@ -170,6 +175,7 @@ public class C {
|
|||
|
||||
public static SlbDo toSlbDo(Slb e) {
|
||||
return new SlbDo()
|
||||
.setId(e.getId())
|
||||
.setName(e.getName())
|
||||
.setNginxBin(e.getNginxBin())
|
||||
.setNginxConf(e.getNginxConf())
|
||||
|
@ -192,6 +198,7 @@ public class C {
|
|||
|
||||
public static SlbVirtualServerDo toSlbVirtualServerDo(VirtualServer e) {
|
||||
return new SlbVirtualServerDo()
|
||||
.setId(e.getId())
|
||||
.setPort(e.getPort())
|
||||
.setIsSsl(e.isSsl())
|
||||
.setName(e.getName());
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<entity-ref name="dy-upstream-ops-data" />
|
||||
</entity>
|
||||
<entity name="slb">
|
||||
<attribute name="id" value-type="int" />
|
||||
<attribute name="id" value-type="long" />
|
||||
<attribute name="name" value-type="String" />
|
||||
<attribute name="version" value-type="int" />
|
||||
<element name="nginx-bin" value-type="String" />
|
||||
|
@ -35,12 +35,13 @@
|
|||
<attribute name="ip" value-type="String" />
|
||||
</entity>
|
||||
<entity name="slb-server">
|
||||
<attribute name="slb-id" value-type="int" />
|
||||
<attribute name="slb-id" value-type="long" />
|
||||
<attribute name="ip" value-type="String" />
|
||||
<attribute name="host-name" value-type="String" />
|
||||
<attribute name="enable" value-type="boolean" />
|
||||
</entity>
|
||||
<entity name="virtual-server">
|
||||
<attribute name="name" value-type="String" />
|
||||
<attribute name="id" value-type="long" />
|
||||
<attribute name="ssl" value-type="boolean" />
|
||||
<element name="port" value-type="String" />
|
||||
|
@ -54,7 +55,7 @@
|
|||
<entity-ref name="slb" type="list" names="slbs" xml-indent="true" />
|
||||
</entity>
|
||||
<entity name="group">
|
||||
<attribute name="id" value-type="int" />
|
||||
<attribute name="id" value-type="long" />
|
||||
<attribute name="name" value-type="String" />
|
||||
<attribute name="app-id" value-type="String" />
|
||||
<attribute name="version" value-type="int" />
|
||||
|
@ -68,6 +69,7 @@
|
|||
<attribute name="priority" value-type="int" />
|
||||
<element name="group-id" value-type="long" />
|
||||
<element name="slb-id" value-type="long" />
|
||||
<element name="slb-name" value-type="String" />
|
||||
<element name="path" value-type="String" />
|
||||
<element name="rewrite" value-type="String" />
|
||||
<entity-ref name="vip" type="list" names="slb-vips" xml-indent="true" />
|
||||
|
@ -92,7 +94,7 @@
|
|||
<element name="ip" value-type="String" />
|
||||
</entity>
|
||||
<entity name="archive">
|
||||
<element name="id" value-type="int" />
|
||||
<element name="id" value-type="long" />
|
||||
<element name="content" value-type="String" />
|
||||
<element name="version" value-type="int" />
|
||||
</entity>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<model>
|
||||
<slb id="111111" name="default" version="1">
|
||||
<slb id="123456789012" name="default" version="1">
|
||||
<nginx-bin>/usr/local/nginx/bin</nginx-bin>
|
||||
<nginx-conf>/usr/local/nginx/conf</nginx-conf>
|
||||
<nginx-worker-processes>1</nginx-worker-processes>
|
||||
|
@ -8,18 +8,18 @@
|
|||
<vip/>
|
||||
</vips>
|
||||
<slb-servers>
|
||||
<slb-server slb-id="1" ip="192.168.1.1" host-name="slb001" enable="true"/>
|
||||
<slb-server slb-id="1" ip="192.168.1.2" host-name="slb002" enable="true"/>
|
||||
<slb-server slb-id="123456789012" ip="192.168.1.1" host-name="slb001" enable="true"/>
|
||||
<slb-server slb-id="123456789012" ip="192.168.1.2" host-name="slb002" enable="true"/>
|
||||
</slb-servers>
|
||||
<virtual-servers>
|
||||
<virtual-server id="123456789012" ssl="true">
|
||||
<virtual-server name="vs001" id="123456789012" ssl="true">
|
||||
<port>80,8099</port>
|
||||
<domains>
|
||||
<domain name="www.ctrip.com"/>
|
||||
<domain name="hotel.ctrip.com"/>
|
||||
</domains>
|
||||
</virtual-server>
|
||||
<virtual-server id="1" ssl="true">
|
||||
<virtual-server name="vs001" id="1" ssl="true">
|
||||
<port>80</port>
|
||||
<domains>
|
||||
<domain name="www.ctrip.com"/>
|
||||
|
@ -40,11 +40,12 @@
|
|||
|
||||
<vip ip="192.168.1.1"/>
|
||||
|
||||
<group id="111111" name="gateway" app-id="app921822" version="1" ssl="false">
|
||||
<group id="123456789012" name="gateway" app-id="app921822" version="1" ssl="false">
|
||||
<group-slbs>
|
||||
<group-slb priority="0">
|
||||
<group-id>12345678901</group-id>
|
||||
<slb-id>1</slb-id>
|
||||
<slb-name>default</slb-name>
|
||||
<slb-vips>
|
||||
<vip/>
|
||||
<vip/>
|
||||
|
@ -55,6 +56,7 @@
|
|||
</group-slb>
|
||||
<group-slb priority="0">
|
||||
<group-id>12345678901</group-id>
|
||||
|
||||
<slb-id>1</slb-id>
|
||||
<slb-vips>
|
||||
<vip ip="192.168.1.1"/>
|
||||
|
@ -84,7 +86,7 @@
|
|||
</group>
|
||||
|
||||
<archive>
|
||||
<id>1</id>
|
||||
<id>12345678901</id>
|
||||
<content>groupXmlString</content>
|
||||
<version>1</version>
|
||||
</archive>
|
||||
|
|
Loading…
Reference in a new issue