public Destination unmarshall(StaxUnmarshallerContext context) throws Exception { Destination destination = new Destination(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1;
@Rule public Destination destination = new Destination("http://localhost:8080/rest/"); @HttpTest( method = Method.GET, path = "/status" ,authentications = @Authentication(type = AuthenticationType.BASIC, user = "joe", password = "doe") ) public void testAuthRhqadmin() { com.eclipsesource.restfuse.Assert.assertOk(response); }
@RunWith( HttpJUnitRunner.class ) public class RestfuseTest { @Rule public Destination destination = new Destination( "http://restfuse.com" ); @Context private Response response; // will be injected after every request @HttpTest( method = Method.GET, path = "/" ) public void checkRestfuseOnlineStatus() { assertOk( response ); } }
if (!model.containsAttribute("destination")) model.addAttribute("destination", new Destination());
model.addAttribute("destination", new Destination());
// Destination[] destinations; ArrayList<Destination> destinationsList = new ArrayList<Destination>(); //add some destinations destinationsList.add(new Destination("1")); destinationsList.add(new Destination("2")); // ..... Object[] destinations = destinationsList.toArray(); destinations[1] = "2"; //simulate switching of one object in the converted array with object that is of other type then Destination for (Object object : destinations) { //we want to do something with Destionations Destination destination = (Destination) object; System.out.println(destination.getCode()); //exception thrown when second memeber of the array is processed }
ModelMapper modelMapper = new ModelMapper(); modelMapper.createTypeMap(Source.class, Destination.class).setConverter( new AbstractConverter<Source, Destination>() { protected Destination convert(Source source) { Destination dest = new Destination(); dest.numOfImages = source.images.size(); return dest; } });
public static void sendEmail(String receiver,String title,String message){ AWSCredentials credentials = getCreds(); AmazonSimpleEmailServiceClient sesClient = new AmazonSimpleEmailServiceClient( credentials ); Content subjectContent = new Content(title); Body messageBody = new Body(new Content(message)); Message feedbackMessage = new Message(subjectContent,messageBody); Destination destination = new Destination().withToAddresses(receiver); SendEmailRequest request = new SendEmailRequest(receiver,destination,feedbackMessage); SendEmailResult result = sesClient.sendEmail(request); }
public Destination unmarshall(StaxUnmarshallerContext context) throws Exception { Destination destination = new Destination();
PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet(); attributes.add(new Destination(new java.net.URI("file:C:/myfile1.pdf"))); try { job.print(attributes); // Print the job if the user didn't cancel printing. } catch(Exception e) { System.out.println(e); }
Date data = new Date(); //Data DateFormat dataform = new SimpleDateFormat("dd-MM-yyyy"); //Data PrintService service=getPrinterService("Microsoft XPS Document Writer"); if(service!=null){ try{ File outputFile = new File(dataform.format(data)+"-Recibo"+nmrRec+".xps"); Doc doc = new SimpleDoc(new myReceipt(), DocFlavor.SERVICE_FORMATTED.PRINTABLE, null); PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet(); attributes.add(new Destination(outputFile.toURI())); DocPrintJob job = service.createPrintJob(); job.print(doc, attributes); } catch(Exception e){ System.out.println("kaboom"+e); } } else{ System.out.println("XPS Printer not found"); }
Date data = new Date(); //Data DateFormat dataform = new SimpleDateFormat("dd-MM-yyyy"); //Data PrintService service=getPrinterService("Microsoft XPS Document Writer"); if(service!=null){ try{ File outputFile = new File(dataform.format(data)+"-Recibo"+nmrRec+".xps"); Doc doc = new SimpleDoc(new myReceipt(), DocFlavor.SERVICE_FORMATTED.PRINTABLE, null); PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet(); attributes.add(new Destination(outputFile.toURI())); DocPrintJob job = service.createPrintJob(); job.print(doc, attributes); } catch(Exception e){ System.out.println("kaboom"+e); } } else{ System.out.println("XPS Printer not found"); }
Iterator iterator= query.list().iterator(); Destination dest; ArrayList<Destination> destinations= new ArrayList<>(); Iterator iterator= query.list().iterator(); while(iterator.hasNext()){ Object[] tuple= (Object[]) iterator.next(); dest= new Destination(); dest.setId((String)tuple[0]); dest.setName((String)tuple[1]); dest.setLat((String)tuple[2]); dest.setLng((String)tuple[3]); destinations.add(dest); }
public static void main(String[] args) throws Exception { Source d = new Source(); d.setProperty(Boolean.TRUE); BeanMap beanMap = new BeanMap(d); Destination s = new Destination(); BeanUtils.populate(s, beanMap); System.out.println("s.getProperty()=" + s.isProperty()); }
private void sendEmail(String subject, Body body, String... recipients) { Destination destination = new Destination(Arrays.asList(recipients)); Message msg = new Message().withBody(body).withSubject(new Content(subject)); SendEmailRequest request = new SendEmailRequest().withSource(fromAddress) .withDestination(destination) .withMessage(msg); emailService.sendEmail(request); } }
@Override public boolean sendEmail(List<String> emails, String subject, String body) { if (emails != null && !emails.isEmpty() && !StringUtils.isBlank(body)) { final SendEmailRequest request = new SendEmailRequest().withSource(Config.SUPPORT_EMAIL); Destination dest = new Destination().withToAddresses(emails); request.setDestination(dest); Content subjContent = new Content().withData(subject); Message msg = new Message().withSubject(subjContent); // Include a body in both text and HTML formats Content textContent = new Content().withData(body).withCharset(Config.DEFAULT_ENCODING); msg.setBody(new Body().withHtml(textContent)); request.setMessage(msg); Para.asyncExecute(new Runnable() { public void run() { sesclient.sendEmail(request); } }); return true; } return false; } }
@Override public boolean sendEmail(List<String> emails, String subject, String body) { if (emails != null && !emails.isEmpty() && !StringUtils.isBlank(body)) { final SendEmailRequest request = new SendEmailRequest().withSource(Config.SUPPORT_EMAIL); Destination dest = new Destination().withToAddresses(emails); request.setDestination(dest); Content subjContent = new Content().withData(subject); Message msg = new Message().withSubject(subjContent); // Include a body in both text and HTML formats Content textContent = new Content().withData(body).withCharset(Config.DEFAULT_ENCODING); msg.setBody(new Body().withHtml(textContent)); request.setMessage(msg); Utils.asyncExecute(new Runnable() { public void run() { sesclient.sendEmail(request); } }); return true; } return false; } }
private void sendSimpleMail(List<String> to, List<String> cc, List<String> ci, String object, String content, boolean htmlContent) { Destination destination = new Destination().withToAddresses(to).withBccAddresses(ci).withCcAddresses(cc); Content subject = new Content().withData(object); Content bodyContent = new Content().withData(content); Body body; if (htmlContent) { body = new Body().withHtml(bodyContent); } else { body = new Body().withText(bodyContent); } Message message = new Message().withSubject(subject).withBody(body); SendEmailRequest request = new SendEmailRequest().withSource(from).withDestination(destination).withMessage(message); try { AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceClient(); client.setRegion(region); client.sendEmail(request); } catch (Exception e) { LOGGER.error("Unable to send email to {} with subject '{}'", StringUtils.join(to, ","), subject, e); } }
private SendEmailRequest prepareMessage(SimpleMailMessage simpleMailMessage) { Destination destination = new Destination(); destination.withToAddresses(simpleMailMessage.getTo()); if (simpleMailMessage.getCc() != null) { destination.withCcAddresses(simpleMailMessage.getCc()); } if (simpleMailMessage.getBcc() != null) { destination.withBccAddresses(simpleMailMessage.getBcc()); } Content subject = new Content(simpleMailMessage.getSubject()); Body body = new Body(new Content(simpleMailMessage.getText())); SendEmailRequest emailRequest = new SendEmailRequest(simpleMailMessage.getFrom(), destination, new Message(subject, body)); if (StringUtils.hasText(simpleMailMessage.getReplyTo())) { emailRequest.withReplyToAddresses(simpleMailMessage.getReplyTo()); } return emailRequest; } }
private SendEmailRequest prepareMessage(SimpleMailMessage simpleMailMessage) { Destination destination = new Destination(); destination.withToAddresses(simpleMailMessage.getTo()); if (simpleMailMessage.getCc() != null) { destination.withCcAddresses(simpleMailMessage.getCc()); } if (simpleMailMessage.getBcc() != null) { destination.withBccAddresses(simpleMailMessage.getBcc()); } Content subject = new Content(simpleMailMessage.getSubject()); Body body = new Body(new Content(simpleMailMessage.getText())); SendEmailRequest emailRequest = new SendEmailRequest(simpleMailMessage.getFrom(), destination, new Message(subject, body)); if (StringUtils.hasText(simpleMailMessage.getReplyTo())) { emailRequest.withReplyToAddresses(simpleMailMessage.getReplyTo()); } return emailRequest; } }