1 package ru
.rentdom
.pages
.admin
;
4 import java
.io
.IOException
;
6 import org
.apache
.commons
.fileupload
.FileUploadException
;
7 import org
.apache
.tapestry5
.PersistenceConstants
;
8 import org
.apache
.tapestry5
.annotations
.Persist
;
9 import org
.apache
.tapestry5
.annotations
.Property
;
10 import org
.apache
.tapestry5
.hibernate
.annotations
.CommitAfter
;
11 import org
.apache
.tapestry5
.ioc
.annotations
.Inject
;
12 import org
.apache
.tapestry5
.upload
.services
.UploadedFile
;
14 import ru
.rentdom
.services
.coords
.CoordsImport
;
16 public class UploadCoords
extends AbstractAdminPage
{
18 private UploadedFile file
;
20 @SuppressWarnings("unused")
21 @Persist(PersistenceConstants
.FLASH
)
22 @Property(write
=false)
23 private String message
;
26 private CoordsImport coordsImport
;
29 public void onSuccess() throws IOException
31 File f
=File
.createTempFile("tmp", ".xls");
33 coordsImport
.process(f
);
35 message
="upload success";
38 Object
onUploadException(FileUploadException ex
)
40 message
= "Upload exception: " + ex
.getMessage();