DASISH / qddt-client

DASISH Task 3.2 - Front end web app for QDDT
https://qddt-test.nsd.no/
GNU General Public License v3.0
7 stars 3 forks source link

uploading documents in Module #109

Closed liuy97 closed 7 years ago

liuy97 commented 8 years ago

@hildeorten, Front end should support for uploading documents. Whether has the backend implemented this?

StigNorland commented 8 years ago

lots of bugs this week, and only 3 days to work

StigNorland commented 8 years ago

"/controlconstruct/create", RequestMethod.POST, headers = "content-type=multipart/form-data") returns ControlConstruct RequestParam("controlconstruct") ControlConstruct instance, RequestParam("files") MultipartFile[] files) throws FileUploadException

liuy97 commented 8 years ago

@StigNorland,

Do you create a demo using this api? Has "content-type=multipart/form-data" been used, even without files?

liuy97 commented 8 years ago

@StigNorland, bassed on https://github.com/DASISH/qddt-service/commit/1f512dc1d1532335355d603b59f1c7a80a2e6eef

post

/controlconstruct/createfile/

formdata with Name("ccc")

------WebKitFormBoundary8EmnVABjBOkPvba6
Content-Disposition: form-data; name="controlconstruct"

{"preInstructions":[],"postInstructions":[],"revisionNumber":0,"name":"ccc"}
------WebKitFormBoundary8EmnVABjBOkPvba6--
exceptionMessage='Failed to convert value of type 'java.lang.String' to required type 'no.nsd.qddt.domain.controlconstruct.ControlConstruct'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type java.lang.String to type java.util.UUID for value '{"preInstructions":[],"postInstructions":[],"revisionNumber":0,"name":"ccc"}'; nested exception is java.lang.IllegalArgumentException: Invalid UUID string: {"preInstructions":[],"postInstructions":[],"revisionNumber":0,"name":"ccc"}

But it still has same exception, even if adding a questionitem.

StigNorland commented 7 years ago

@liuy97 Try to upload a document with this adress

ownerUUID is the id of the element that should have a file assosiated. In prinsiple any object/class could have files assosiated, but only QuestionConstruct and Topics have an otherMaterials array attached to them.

othermaterial/upload/{ownerUUID} returnvalue is an OtherMaterial object -> UUID Id DateTime Modified User ModifiedBy UUID owner String fileName String description String fileType String originalName long size

You can add this object to otherMaterials array/list. and display the elements in this list (list of filenames) and download files by this adress: othermaterial/files/{othermaterialId}

liuy97 commented 7 years ago

@StigNorland ,

Post /othermaterial/upload/7f000101-584e-1d1d-8158-528363f00006 The id is a construct id.

{
  "timestamp" : 1478853092443,
  "status" : 500,
  "error" : "Internal Server Error",
  "exception" : "java.util.NoSuchElementException",
  "message" : "org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.util.NoSuchElementException",
  "path" : "/othermaterial/upload/7f000101-584e-1d1d-8158-528363f00006"
}
StigNorland commented 7 years ago

I will look into that.

StigNorland commented 7 years ago

working...