Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
synergy-api-util
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Raimbek Egemberdiev
synergy-api-util
Commits
7766d560
Commit
7766d560
authored
Nov 16, 2016
by
Raimbek Egemberdiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
перенесены методы StorageManager
parent
7e3cc3c2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
src/main/java/kz/arta/synergy/api/services/StorageService.java
...ain/java/kz/arta/synergy/api/services/StorageService.java
+62
-0
No files found.
src/main/java/kz/arta/synergy/api/services/StorageService.java
View file @
7766d560
...
...
@@ -91,4 +91,66 @@ public class StorageService {
}
return
JsonUtils
.
read
(
restHttpQuery
.
doQuery
(
query
),
new
TypeReference
<
List
<
SynergyFile
>>()
{});
}
public
SynergyFile
findInStorage
(
String
parentId
,
String
fileName
)
throws
IOException
{
List
<
SynergyFile
>
synergyFiles
=
storageList
(
parentId
);
for
(
SynergyFile
synergyFile
:
synergyFiles
)
{
if
(
synergyFile
.
getName
().
equals
(
fileName
))
{
return
synergyFile
;
}
if
(
synergyFile
.
isFolder
())
{
SynergyFile
result
=
findInStorage
(
synergyFile
.
getIdentifier
(),
fileName
);
if
(
result
!=
null
)
{
return
result
;
}
}
}
return
null
;
}
public
String
copy
(
String
identifier
,
String
documentId
)
throws
IOException
{
Query
query
=
Query
.
newInstance
()
.
methodPost
()
.
url
(
"/rest/api/storage/copy"
)
.
formParam
(
"fileID"
,
identifier
)
.
formParam
(
"documentID"
,
documentId
);
String
result
=
restHttpQuery
.
doQuery
(
query
);
return
JsonUtils
.
getValueByKey
(
result
,
"fileID"
);
}
public
String
add
(
String
identifier
,
String
tmpFileName
,
String
synergyFileName
)
throws
IOException
{
Query
query
=
Query
.
newInstance
().
url
(
"/rest/api/storage/add"
)
.
methodPost
()
.
formParam
(
"folderID"
,
identifier
)
.
formParam
(
"path"
,
tmpFileName
)
.
formParam
(
"name"
,
synergyFileName
);
String
result
=
restHttpQuery
.
doQuery
(
query
);
return
JsonUtils
.
getValueByKey
(
result
,
"fileID"
);
}
public
String
move
(
String
fileIdentifier
,
String
folderID
)
throws
IOException
{
Query
query
=
Query
.
newInstance
()
.
methodPost
()
.
url
(
"/rest/api/storage/move"
)
.
formParam
(
"elementID"
,
fileIdentifier
)
.
formParam
(
"folderID"
,
folderID
);
return
restHttpQuery
.
doQuery
(
query
);
}
public
String
createFolder
(
String
parent
,
String
name
)
throws
IOException
{
Query
query
=
Query
.
newInstance
()
.
methodPost
()
.
url
(
"/rest/api/storage/create"
)
.
formParam
(
"folderID"
,
parent
)
.
formParam
(
"folderName"
,
name
);
return
restHttpQuery
.
doQuery
(
query
);
}
public
byte
[]
downloadFile
(
String
identifier
)
throws
IOException
{
Query
query
=
Query
.
newInstance
()
.
url
(
"/rest/api/storage/file/get"
)
.
queryParam
(
"identifier"
,
identifier
)
.
queryParam
(
"inline"
,
"true"
);
return
restHttpQuery
.
doQueryAndReturnBytes
(
query
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment