diff --git a/pom.xml b/pom.xml index 3ed6fac7..8771b590 100644 --- a/pom.xml +++ b/pom.xml @@ -247,7 +247,7 @@ com.fasterxml.jackson.core jackson-core - 2.7.2 + 2.8.5 diff --git a/src/main/java/com/ctrip/zeus/service/model/impl/SlbRepositoryImpl.java b/src/main/java/com/ctrip/zeus/service/model/impl/SlbRepositoryImpl.java index 509e6512..afed0928 100644 --- a/src/main/java/com/ctrip/zeus/service/model/impl/SlbRepositoryImpl.java +++ b/src/main/java/com/ctrip/zeus/service/model/impl/SlbRepositoryImpl.java @@ -63,6 +63,7 @@ public class SlbRepositoryImpl implements SlbRepository { try { Slb slb = ContentReaders.readSlbContent(d.getContent()); slb.setCreatedTime(d.getDataChangeLastTime()); + autoFiller.autofill(slb); result.add(slb); } catch (Exception e) { } @@ -86,7 +87,7 @@ public class SlbRepositoryImpl implements SlbRepository { Slb result = ContentReaders.readSlbContent(d.getContent()); result.setCreatedTime(d.getDataChangeLastTime()); - + autoFiller.autofill(result); return result; } diff --git a/src/main/java/com/ctrip/zeus/service/model/impl/VirtualServerRepositoryImpl.java b/src/main/java/com/ctrip/zeus/service/model/impl/VirtualServerRepositoryImpl.java index 301a80b6..9a88f0fe 100644 --- a/src/main/java/com/ctrip/zeus/service/model/impl/VirtualServerRepositoryImpl.java +++ b/src/main/java/com/ctrip/zeus/service/model/impl/VirtualServerRepositoryImpl.java @@ -6,17 +6,15 @@ import com.ctrip.zeus.dal.core.MetaVsArchiveDo; import com.ctrip.zeus.exceptions.ValidationException; import com.ctrip.zeus.model.entity.Domain; import com.ctrip.zeus.model.entity.VirtualServer; -import com.ctrip.zeus.service.model.SelectionMode; -import com.ctrip.zeus.service.model.ValidationFacade; -import com.ctrip.zeus.service.model.VirtualServerRepository; +import com.ctrip.zeus.service.model.*; import com.ctrip.zeus.service.model.common.ValidationContext; import com.ctrip.zeus.service.model.handler.SlbQuery; import com.ctrip.zeus.service.model.validation.VirtualServerValidator; import com.ctrip.zeus.service.model.handler.impl.ContentReaders; import com.ctrip.zeus.service.model.handler.impl.VirtualServerEntityManager; import com.ctrip.zeus.service.nginx.CertificateService; -import com.ctrip.zeus.service.model.IdVersion; import com.ctrip.zeus.service.query.VirtualServerCriteriaQuery; +import com.dianping.cat.Cat; import com.google.common.base.Joiner; import org.springframework.stereotype.Component; import sun.reflect.generics.reflectiveObjects.NotImplementedException; @@ -43,6 +41,8 @@ public class VirtualServerRepositoryImpl implements VirtualServerRepository { private CertificateService certificateService; @Resource private ArchiveVsDao archiveVsDao; + @Resource + private AutoFiller autoFiller; @Override public List listAll(Long[] vsIds) throws Exception { @@ -63,6 +63,7 @@ public class VirtualServerRepositoryImpl implements VirtualServerRepository { try { VirtualServer vs = ContentReaders.readVirtualServerContent(d.getContent()); vs.setCreatedTime(d.getDateTimeLastChange()); + autoFiller.autofill(vs); result.add(vs); } catch (Exception e) { } @@ -85,6 +86,7 @@ public class VirtualServerRepositoryImpl implements VirtualServerRepository { VirtualServer vs = ContentReaders.readVirtualServerContent(d.getContent()); vs.setCreatedTime(d.getDateTimeLastChange()); + autoFiller.autofill(vs); return vs; } @@ -94,6 +96,7 @@ public class VirtualServerRepositoryImpl implements VirtualServerRepository { //TODO render for deprecated field if (virtualServer.getSlbId() != null) { if (!virtualServer.getSlbIds().contains(virtualServer.getSlbId())) { + Cat.logEvent("Vs-Slb.Deprecated", virtualServer.getName().toString()); virtualServer.getSlbIds().add(virtualServer.getSlbId()); } virtualServer.setSlbId(null); @@ -118,6 +121,7 @@ public class VirtualServerRepositoryImpl implements VirtualServerRepository { //TODO render for deprecated field if (virtualServer.getSlbId() != null) { if (!virtualServer.getSlbIds().contains(virtualServer.getSlbId())) { + Cat.logEvent("Vs-Slb.Deprecated", virtualServer.getName().toString()); virtualServer.getSlbIds().add(virtualServer.getSlbId()); } virtualServer.setSlbId(null); diff --git a/src/main/java/com/ctrip/zeus/support/ObjectJsonWriter.java b/src/main/java/com/ctrip/zeus/support/ObjectJsonWriter.java index ec3ade8d..2da5cc96 100644 --- a/src/main/java/com/ctrip/zeus/support/ObjectJsonWriter.java +++ b/src/main/java/com/ctrip/zeus/support/ObjectJsonWriter.java @@ -20,12 +20,12 @@ public class ObjectJsonWriter { objectMapper = new ObjectMapper() .configure(SerializationFeature.INDENT_OUTPUT, true) .setSerializationInclusion(JsonInclude.Include.NON_NULL) - .setSerializationInclusion(JsonInclude.Include.NON_DEFAULT) + .setSerializationInclusion(JsonInclude.Include.NON_EMPTY) .setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")) .setPropertyNamingStrategy(new LowerCaseWithHyphenStrategy()); - objectMapper.addMixInAnnotations(ExtendedView.ExtendedGroup.class, GroupView.class); - objectMapper.addMixInAnnotations(ExtendedView.ExtendedVs.class, VsView.class); - objectMapper.addMixInAnnotations(ExtendedView.ExtendedSlb.class, SlbView.class); + objectMapper.addMixIn(ExtendedView.ExtendedGroup.class, GroupView.class); + objectMapper.addMixIn(ExtendedView.ExtendedVs.class, VsView.class); + objectMapper.addMixIn(ExtendedView.ExtendedSlb.class, SlbView.class); } public static String write(Object obj, String type) throws ValidationException, JsonProcessingException {