Ścieżka do servletu: api/documents/query
Metoda: GET
Parametry:
Odpowiedź:
[
{
"id":2236,
"documentClass":{
"id":3281,
"name":"xx",
"description":"xx",
"expiration":"",
"expirationType":"on",
"directory":null,
"encoding":true,
"compressing":false,
"ftsServerId":null,
"cipherAlgorithm":"AES",
"keyLength":128,
"orderId":6,
"indexPath":"C:\\temp\\qq\\\\k\\indexDir_3281",
"indexing":false,
"files":null,
"actions":null,
"indexes":null,
"linkConnections":null,
"expirationDate":null
},
"description":"xx",
"compressed":false,
"encrypted":true,
"cipherAlgorithm":"AES",
"cipherKey":"-72,-27,-19,-29,-27,87,-47,112,19,-55,-37,-21,-112,-13,-128,21",
"fileName":"PIARedist.exe",
"systemFileName":"IMG7882392016468885022.exe",
"fileDate":1391771512507,
"path":"C:\\temp\\qq\\k\\",
"uploader":"admin",
"size":6876816,
"version":{
"file":null,
"parentFile":null,
"newestFile":null,
"checkOutDate":null,
"checkInDate":1391727600000,
"replaceDate":null,
"checkOutUserName":"admin",
"state":"STATE_READY",
"comment":null,
"version":1,
"id":2236,
"activityDocuments":null
},
"activityDocuments":null,
"fullPath":"C:\\temp\\qq\\k\\/IMG7882392016468885022.exe"
}
] |
Ścieżka do servletu: api/documents/view/query
Metoda: GET
Parametry:
Odpowiedź:
[
{
"file":{
"id":2236,
"documentClass":{
"id":3281,
"name":"xx",
"description":"xx",
"expiration":"",
"expirationType":"on",
"directory":null,
"encoding":true,
"compressing":false,
"ftsServerId":null,
"cipherAlgorithm":"AES",
"keyLength":128,
"orderId":6,
"indexPath":"C:\\temp\\qq\\\\k\\indexDir_3281",
"indexing":false,
"files":null,
"actions":null,
"indexes":null,
"linkConnections":null,
"expirationDate":null
},
"description":"xx",
"compressed":false,
"encrypted":true,
"cipherAlgorithm":"AES",
"cipherKey":"-72,-27,-19,-29,-27,87,-47,112,19,-55,-37,-21,-112,-13,-128,21",
"fileName":"PIARedist.exe",
"systemFileName":"IMG7882392016468885022.exe",
"fileDate":1391771512507,
"path":"C:\\temp\\qq\\k\\",
"uploader":"admin",
"size":6876816,
"version":{
"file":null,
"parentFile":null,
"newestFile":null,
"checkOutDate":null,
"checkInDate":1391727600000,
"replaceDate":null,
"checkOutUserName":"admin",
"state":"STATE_READY",
"comment":null,
"version":1,
"id":2236,
"activityDocuments":null
},
"activityDocuments":null,
"fullPath":"C:\\temp\\qq\\k\\/IMG7882392016468885022.exe"
},
"actions":[
"SHOW",
"DETACH",
"CHANGE"
]
}
] |
Ścieżka do servletu: api/documents/classes
Metoda: GET
Parametry:
Odpowiedź:
Ścieżka do servletu: api/documents/indexes/{documentClassId}
Metoda: GET
Parametry:
Odpowiedź:
Ścieżka do servletu: api/documents/upload
Metoda: POST
enctype: multipart/form-data
Treść zapytania:
Formularz HTML zawierający definicję dokumentu. Definicja powinna zawierać następujące pole:
indexes - (opcjonalny) Wartości indeksów dodawanego dokumentu. Wartości powinny być przekazane zgodnie z typem żądania form-data, czyli w formie
indexes[1]: "Wartość indeksu o id 1" indexes[3]: "Wartość indeksu o id 3" |
POST /PlusWorkflow/api/documents/upload HTTP/1.1 Host: localhost:8080 Cache-Control: no-cache Postman-Token: 4ab6c224-0ea3-9ecc-c8ac-a4823501a54b Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="file"; filename="Nowy dokument tekstowy.txt" Content-Type: text/plain ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="documentClassId" 1 ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="newVersion" false ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="indexes[1]" wartosc indeksu o id 1 ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="indexes[3]" wartosc indeksu o id 3 ------WebKitFormBoundary7MA4YWxkTrZu0gW-- |
Parametry activityId i processId są opcjonalne:
Odpowiedź:
Ext4.widget('window',{
title:'Nowy dokument',
width:500,
height:300,
autoShow:true,
items:[
{
xtype:'form',
items:[
{
xtype:'fileuploadfield',
name:'file'
},{
xtype:'textfield',
value:3,
name:'documentClassId'
},{
xtype:'textfield',
value:processId,
name:'processId'
},{
xtype:'textfield',
value:activityId,
name:'activityId'
},{
xtype:'textfield',
value:123,
name:'indexes[1]'//id indeksu z bazy danych
},{
xtype:'textfield',
value:'wartosc',
name:'indexes[4]'//id indeksu z bazy danych
}
]
}
],
buttons:[
{
text:'Zapisz',
handler:function(){
var form=this.up('window').down('form').getForm();
form.submit({
url:'api/documents/upload'
});
}
}
]
}); |
W przeglądarce InternetExplorer aby wykonać upload pliku serwer musi odpowiedzieć z nagłówkiem Content-Type: text/html. Należy w takim wypadku wywołać żądanie z dodatkowym parametrem: responseAsHtml - true wymusza ustawienie nagłówka Content-Type na text/html |
Ścieżka do servletu: api/documents/download/{fileId}
Metoda: GET
Parametry:
Odpowiedź:
Ścieżka do servletu: api/documents/get/{filename}
Metoda : GET
Parametry :
Uwaga, parametr systemowy 'AuthorizeUserForFile' określa czy jest wymagana autoryzacja użytkownika dla tego servletu.
Odpowiedź : pobrany plik dokumentu.
Ścieżka do servletu: api/documents/activity
Metoda : GET
Parametry :
Odpowiedź : Informacje o dokumentach tj. a więc poza plikami także dodatkowe informacje o dokumencie np. przez kogo został podłączony do archiwum i przez kogo został podłączony do procesu itp.
Ścieżka do servletu: api/documents/{fileId}/{processId}
Metoda: DELETE
Parametry:
Odpowiedź:
Metoda usuwa plik z systemu. Jeżeli usuwany plik jest w wersji np.: 2, a cały dokument ma wersji 5, to usunięte zostaną wszystkie wersje w górę, czyli zostanie tylko plik w wersji 1, chyba że parametr {@code deleteAllVersions=true}, to wtedy zostaną usunięte wszystkie wersje.
Użytkownik musi posiadać uprawnienia do usunięcia tego pliku.
Ścieżka do servletu: api/documents/{fileId}
Metoda: DELETE
Parametry:
Odpowiedź:
Metoda zmienia przekazane wartości indeksów w podanym dokumencie. Użytkownik musi mieć uprawnienia do modyfikacji dokumentu.
Ścieżka do servletu: api/documents/{fileId}/indexes
Metoda: PUT
Request Content-Type: application/json
Parametry:
fileId - Id pliku, którego indeksy chcemy zmienić( parametr przekazany w ścieżce servlet'u)
{
"2":"Nowa wartość indeksu o id 2",
"7":"Nowa wartość indeksu o id 7",
"11":234.62 /* Nowa wartość indeksu zmiennoprzecinkowego o id 11 */
} |
Odpowiedź:
Metoda wyszukuje dokumenty na podstawie podanych filtrów. Brane są pod uwagę uprawnienia użytkownika. Wyszukiwać można w klasie dokumentów (musi być podane id klasy dokumentów w parametrze documentClassId) albo w zestawie dokumentów (musi być podane id zestawu dokumentów w parametrze documentSetId). Nie można wyszukiwać jednocześnie po klasie dokumentów i zestawie dokumentów (tylko jeden parametr może być uzupełniony). Obecnie dodatkowym filtrem są jeszcze indeksy klasy dokumentów/zestawu dokumentów. Jeżeli nie podamy indeksów, to zostaną wyszukane wszystkie dokumenty z podanej klasy dokumentów/zestawu dokumentów.
Ścieżka do servletu: api/documents/query
Metoda: POST
Request Content-Type: application/json
Parametry:
obiekt JSON zawierający filtry
{
"documentClassId": 1, //id klasy dokumentów
//lub
"documentSetId": 3, //id zestawu dokumentów
"indexes": { //indeksy dokumentu
"2":"Wartość indeksu o id 2",
"7":"Wartość indeksu o id 7",
"11":234.62 /* Wartość indeksu zmiennoprzecinkowego o id 11 */
}
} |
Odpowiedź:
[
{
"documentId":81,
"fileId":110,
"documentClassId":1,
"indexes":[
{
"id":17,
"name":"Data",
"value":"2016-02-25",
"type":"DATE"
},
{
"id":16,
"name":"Wartość",
"value":1,
"type":"LONG"
},
{
"id":7,
"name":"Opis",
"value":"To jest opis",
"type":"STRING"
},
{
"id":8,
"name":"Uwagi",
"value":null,
"type":"STRING"
}
]
}
] |
Ścieżka do servletu: api/documents/versions/{fileId}
Metoda: GET
Parametry:
Odpowiedź:
[
{
"id": 201,
"documentClass": null,
"description": "opis",
"compressed": false,
"encrypted": false,
"cipherAlgorithm": null,
"cipherKey": null,
"fileName": "file1.txt",
"systemFileName": "IMG2940464874411094485.txt",
"fileDate": 1560167912486,
"path": "C:\\Temp\\Urządzenia\\Katalog1\\",
"uploader": "admin",
"size": 31,
"version": {
"file": null,
"parentFile": null,
"newestFile": null,
"checkOutDate": 1560808800000,
"checkInDate": 1560117600000,
"replaceDate": 1560808800000,
"checkOutUserName": "admin",
"state": "STATE_EDIT",
"comment": null,
"version": 1,
"id": 201,
"activityDocuments": null
},
"activityDocuments": null
},
{
"id": 212,
"documentClass": null,
"description": "opis2",
"compressed": false,
"encrypted": false,
"cipherAlgorithm": null,
"cipherKey": null,
"fileName": "file2.txt",
"systemFileName": "IMG859030577728292225.txt",
"fileDate": 1560864125553,
"path": "C:\\Temp\\Urządzenia\\Katalog1\\",
"uploader": "admin",
"size": 33,
"version": {
"file": null,
"parentFile": null,
"newestFile": null,
"checkOutDate": 1560895200000,
"checkInDate": 1560808800000,
"replaceDate": 1560895200000,
"checkOutUserName": "admin",
"state": "STATE_EDIT",
"comment": "",
"version": 2,
"id": 212,
"activityDocuments": null
},
"activityDocuments": null
}
]
|
Zmienia dane w bazie danych odnośnie pobrania dokumentu do zmiany. Ustawia odpowiedni status, datę pobrania dokumentu, oraz użytkownika pobierającego.
Ścieżka do servletu: api/documents/checkOut
Metoda: PUT
Parametry:
Odpowiedź:
Anuluje wprowadzenie zmian do pobranego dokumentu
Anuluje wprowadzanie zmian do dokumentu. Ustawia odpowiedni status, resetuje datę pobrania dokumentu, oraz użytkownika pobierającego.
Ścieżka do servletu: api/documents/undoCheckOut
Metoda: PUT
Parametry:
Odpowiedź:
Zapisuje nową wersję pliku
Zapisuje nową wersję pliku, który wcześniej pobraliśmy do zmiany.
Ścieżka do servletu: api/documents/checkIn
Metoda: POST
enctype: multipart/form-data
Treść zapytania:
Formularz HTML zawierający definicję dokumentu. Definicja powinna zawierać następujące pole:
POST /PlusWorkflow/api/documents/checkIn HTTP/1.1 Host: localhost:8080 Authorization: Basic YWRtaW46ZW5oeWRyYQ== Cache-Control: no-cache Postman-Token: 201b80af-904e-de34-2678-c476fda6d348 Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="file"; filename="x6.docx" Content-Type: ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="parentFileId" 179 ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="comment" my comment ------WebKitFormBoundary7MA4YWxkTrZu0gW-- |
Parametry activityId i processId są opcjonalne:
Odpowiedź:
Ścieżka do servletu: api/documents/getLastOpenedFile
Metoda: GET
Odpowiedź: