public static ApplicationDTO mapRestResourceToDto(Application app, boolean useAmq) { ApplicationDTO appDto = new ApplicationDTO(app.getName(), useAmq); for (Queue queue : app.getQueues()) { appDto.addQueue(queue.getName()); } return appDto; }
public static Application mapDtoToRestResource(ApplicationDTO appDto) { Application app = new Application(); app.setId(appDto.getId()); app.setName(appDto.getName()); app.setUrl(appDto.getUrl()); List<Queue> queues = new ArrayList<Queue>(); for (QueueDTO qDto : appDto.getQueues()) { Queue q = mapDtoToRestResource(qDto); queues.add(q); } app.setQueues(queues); return app; }