2 Replies Latest reply: Dec 11, 2013 9:39 AM by thesimdak RSS

    Client cant show file

    thesimdak

      Hi, I'm trying to do basic things in Adobe Drive SDK. I don't have implemented any server, but I want Adobe Drive Client to show me some "Files" (which in fact doesnt exists). I implemented a GetChildrenHandler and was successfull tu create my own root folder or folder under root folder and so on, but it doesn't work with files. There is a condition in the code, that if a parent is the root, client should create new folder under this root (that works fine). Then, if the folder is not root, I want to tell to client, that it has to show me a file, but this is the part, which doenst work to me. Can you, please, help me? Here is the part of code, which should be done, if parent folder is not root. Thanks

       

      String assetId =  parentPath.toString() + "/test.png"

                      String parentId = parentPath.toString();

                          Path path = Path.newInstance(assetId);

                      UpdateRecipe recipe = response.createFileUpdateRecipe(

                              assetId,

                              path,

                              parentId,

                              1,

                              new ETags());

       

                      long lastModified = System.currentTimeMillis();

                      long j = 123456;

                      Long fileSize = j;

                      String comment = null;

                      String modificationUser = "User";

                      Flags flags = null;

                      MimeType mimeType = MimeType.IMAGE_PNG;

                      long eTagValue = System.currentTimeMillis();

                      recipe.getIdentificationData().getETags().put(DataType.BASIC, new ETag(eTagValue));

                      recipe.createBasicData(

                              lastModified,

                              lastModified,

                              fileSize,

                              comment,

                              new User(modificationUser),

                              Visibility.VISIBLE,

                              flags,

                              mimeType,

                              null);

       

      And this if from log:

       

      2013/12/11 18:04:13,147 [IFSConnection-1] FATAL IFSConnection - NASTY Runtime exception for Request: CREATE

      com.adobe.drive.biz.filesystem.FileSystemException: com.adobe.drive.data.persistence.PersistenceException: query did not return a unique result: 2

      at com.adobe.drive.internal.biz.filesystem.FileSystemService.runWithTransaction(FileSystemSe rvice.java:1762)

      at com.adobe.drive.internal.biz.filesystem.FileSystemService.runWithTransaction(FileSystemSe rvice.java:1727)

      at com.adobe.drive.internal.biz.filesystem.FileSystemService.lookupByPath(FileSystemService. java:562)

      at com.adobe.drive.internal.biz.filesystem.FileSystemService.lookupByPath(FileSystemService. java:555)

      at com.adobe.drive.ifs.job.CreateHandler$1.call(CreateHandler.java:122)

      at com.adobe.drive.ifs.job.CreateHandler$1.call(CreateHandler.java:1)

      at com.adobe.drive.model.context.Context.run(Context.java:88)

      at com.adobe.drive.ifs.internal.IFSConnection.dispatch(IFSConnection.java:187)

      at com.adobe.drive.ifs.internal.IFSConnection.run(IFSConnection.java:142)

      Caused by: com.adobe.drive.data.persistence.PersistenceException: query did not return a unique result: 2

      at com.adobe.drive.data.persistence.PersistenceExceptionFactory.newPersistenceException(Pers istenceExceptionFactory.java:53)

      at com.adobe.drive.data.internal.persistence.Query.get(Query.java:67)

      at com.adobe.drive.data.persistence.factories.AssetFactory.findAssetByParentIdAndName(AssetF actory.java:880)

      at com.adobe.drive.data.persistence.factories.AssetFactory.findAssetByPath(AssetFactory.java :372)

      at com.adobe.drive.data.model.asset.AssetFactory.findAssetByPath(AssetFactory.java:131)

      at com.adobe.drive.internal.data.manager.DataManager.getAsset(DataManager.java:1612)

      at com.adobe.drive.internal.biz.filesystem.FileSystemService$6.execute(FileSystemService.jav a:573)

      at com.adobe.drive.internal.biz.filesystem.FileSystemService$6.execute(FileSystemService.jav a:1)

      at com.adobe.drive.internal.biz.filesystem.FileSystemService$FSCallable.run(FileSystemServic e.java:1793)

      at com.adobe.drive.data.internal.persistence.PersistenceRunner$2.runWithTransaction(Persiste nceRunner.java:186)

      at com.adobe.drive.data.internal.persistence.PersistenceModificationCallable.run(Persistence ModificationCallable.java:71)

      at com.adobe.drive.data.internal.persistence.PersistenceRunner.run(PersistenceRunner.java:11 9)

      at com.adobe.drive.data.internal.persistence.PersistenceRunner.runWithTransaction(Persistenc eRunner.java:181)

      at com.adobe.drive.internal.biz.filesystem.FileSystemService.runWithTransaction(FileSystemSe rvice.java:1748)

      ... 8 more

      Caused by: org.hibernate.NonUniqueResultException: query did not return a unique result: 2

      at org.hibernate.impl.AbstractQueryImpl.uniqueElement(AbstractQueryImpl.java:820)

      at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:811)

      at com.adobe.drive.data.internal.persistence.Query.get(Query.java:63)

      ... 20 more