Java SDK
From OpenKM Documentation
Download File File:Openkm-sdk4j.jar
Supported OpenKM Versions:
- OpenKM Professional 6.4.5+
- OpenKM Professional 6.2.23+
- OpenKM Community ( expected release time to february 2014 )
Advantage of use
We recommend to use OKMWebservices from jar because it implements an extra layer between webservices and logic -factory- which allow transparently change between webservices versions without major effors. Simply instance other webservices version from factory in your source code.
Example
String host = "http://localhost:8080/OpenKM";
String user = "okmAdmin";
String password = "admin";
OKMWebservices ws= OKMWebservicesFactory.newInstance(OKMWebservicesFactory.PROFESSIONAL_6_4, host, user, password);
try {
System.out.println(ws.getName("okmAdmin"));
System.out.println(ws.getRoles());
System.out.println(ws.getRolesByUser("okmAdmin"));
System.out.println(ws.getGrantedRoles("/okm:root"));
System.out.println(ws.getGrantedUsers("/okm:root"));
System.out.println(ws.getMail("okmAdmin"));
System.out.println(ws.getName("okmAdmin"));
System.out.println(ws.getUsers());
System.out.println(ws.getUsersByRole("ROLE_ADMIN"));
ws.revokeRole("/okm:root", "ROLE_ADMIN", Permission.ALL_GRANTS, false);
ws.revokeUser("/okm:root", "okmAdmin", Permission.ALL_GRANTS, false);
ws.grantRole("/okm:root", "ROLE_ADMIN", Permission.ALL_GRANTS, false);
ws.grantUser("/okm:root", "okmAdmin", Permission.ALL_GRANTS, false);
} catch (DatabaseException e) {
e.printStackTrace();
} catch (RepositoryException e) {
e.printStackTrace();
} catch (PrincipalAdapterException e) {
e.printStackTrace();
} catch (AccessDeniedException e) {
e.printStackTrace();
} catch (WebserviceException e) {
e.printStackTrace();
} catch (PathNotFoundException e) {
e.printStackTrace();
} catch (UnknowException e) {
e.printStackTrace();
}
Classes
- AppVersion
- CheckBox
- Document
- DocumentList
- Folder
- FolderList
- FormElement
- FormElementComplex
- FormElementComplexList
- GrantedRole
- GrantedRoleList
- GrantedUser
- GrantedUserList
- Input
- KeywordMap
- KeywordMapList
- LanguageList
- LockInfo
- Node
- Note
- NoteList
- Option
- PropertyGroup
- PropertyGroupList
- ProposedQueryReceived
- ProposedQuerySent
- QueryParamsList
- QueryResult
- QueryResultList
- QueryParams
- ResultSet
- RoleList
- Select
- Separator
- SimplePropertyGroup
- SuggestBox
- TextArea
- UserList
- Validator
- Version
- VersionList
Auth
public Map<String, Integer> getGrantedRoles(String nodeId) throws AccessDeniedException, RepositoryException, DatabaseException,
PathNotFoundException, UnknowException, WebserviceException;
public Map<String, Integer> getGrantedUsers(String nodeId) throws AccessDeniedException, RepositoryException, DatabaseException,
PathNotFoundException, UnknowException, WebserviceException;
public String getMail(String user) throws PrincipalAdapterException, AccessDeniedException, RepositoryException, DatabaseException,
UnknowException, WebserviceException;
public String getName(String user) throws DatabaseException, RepositoryException, PrincipalAdapterException, AccessDeniedException,
UnknowException, WebserviceException;
public List<String> getRoles() throws AccessDeniedException, RepositoryException, DatabaseException, PrincipalAdapterException,
UnknowException, WebserviceException;
public List<String> getRolesByUser(String user) throws AccessDeniedException, RepositoryException, DatabaseException,
PrincipalAdapterException, UnknowException, WebserviceException;
public List<String> getUsers() throws AccessDeniedException, RepositoryException, DatabaseException, PrincipalAdapterException,
UnknowException, WebserviceException;
public List<String> getUsersByRole(String role) throws AccessDeniedException, RepositoryException, DatabaseException,
PrincipalAdapterException, UnknowException, WebserviceException;
public void revokeRole(String nodeId, String role, int permissions, boolean recursive) throws AccessDeniedException,
RepositoryException, DatabaseException, PathNotFoundException, UnknowException, WebserviceException;
public void revokeUser(String nodeId, String user, int permissions, boolean recursive) throws AccessDeniedException,
RepositoryException, DatabaseException, PathNotFoundException, UnknowException, WebserviceException;
public void grantRole(String nodeId, String role, int permissions, boolean recursive) throws AccessDeniedException,
RepositoryException, DatabaseException, PathNotFoundException, UnknowException, WebserviceException;
public void grantUser(String nodeId, String role, int permissions, boolean recursive) throws AccessDeniedException,
RepositoryException, DatabaseException, PathNotFoundException, UnknowException, WebserviceException;
Document
public Document createDocument(Document okmDocument, InputStream is) throws IOException, UnsupportedMimeTypeException,
FileSizeExceededException, UserQuotaExceededException, VirusDetectedException, ItemExistsException, PathNotFoundException,
AccessDeniedException, RepositoryException, DatabaseException, ExtensionException, AutomationException, UnknowException,
WebserviceException;
public Document createDocumentSimple(String docPath, InputStream is) throws IOException, UnsupportedMimeTypeException,
FileSizeExceededException, UserQuotaExceededException, VirusDetectedException, ItemExistsException, PathNotFoundException,
AccessDeniedException, RepositoryException, DatabaseException, ExtensionException, AutomationException, UnknowException,
WebserviceException;
public void deleteDocument(String docId) throws AccessDeniedException, RepositoryException, PathNotFoundException, LockException,
DatabaseException, ExtensionException, UnknowException, WebserviceException;
public Document getDocumentProperties(String docId) throws RepositoryException, PathNotFoundException, DatabaseException, UnknowException,
WebserviceException;
public InputStream getContent(String docId) throws RepositoryException, IOException, PathNotFoundException, AccessDeniedException,
DatabaseException, UnknowException, WebserviceException;
public InputStream getContentByVersion(String docId, String versionId) throws RepositoryException, IOException, PathNotFoundException,
AccessDeniedException, DatabaseException, UnknowException, WebserviceException;
public List<Document> getDocumentChildren(String fldId) throws RepositoryException, PathNotFoundException, DatabaseException,
UnknowException, WebserviceException;
public void renameDocument(String docId, String newName) throws AccessDeniedException, RepositoryException, PathNotFoundException,
ItemExistsException, LockException, DatabaseException, ExtensionException, UnknowException, WebserviceException;
public void setProperties(Document okmDocument) throws AccessDeniedException, RepositoryException, PathNotFoundException,
VersionException, LockException, DatabaseException, UnknowException, WebserviceException;
public void setLanguage(String docId, String lang) throws VersionException, LockException, PathNotFoundException,
AccessDeniedException, RepositoryException, DatabaseException, UnknowException, WebserviceException;
public void setTitle(String docId, String title) throws VersionException, LockException, PathNotFoundException, AccessDeniedException,
RepositoryException, DatabaseException, UnknowException, WebserviceException;
public void setDocumentNodeClass(String docId, long ncId) throws VersionException, LockException, PathNotFoundException, AccessDeniedException,
RepositoryException, DatabaseException, UnknowException, WebserviceException;
public void checkout(String docId) throws AccessDeniedException, RepositoryException, PathNotFoundException, LockException,
DatabaseException, UnknowException, WebserviceException;
public void cancelCheckout(String docId) throws AccessDeniedException, RepositoryException, PathNotFoundException, LockException,
DatabaseException, UnknowException, WebserviceException;
public void forceCancelCheckout(String docId) throws AccessDeniedException, RepositoryException, PathNotFoundException, LockException,
DatabaseException, PrincipalAdapterException, UnknowException, WebserviceException;
public boolean isCheckedOut(String docId) throws PathNotFoundException, RepositoryException, DatabaseException, UnknowException,
WebserviceException;
public Version checkin(String docId, InputStream is, String comment) throws FileSizeExceededException, UserQuotaExceededException,
VirusDetectedException, LockException, VersionException, PathNotFoundException, AccessDeniedException, RepositoryException,
IOException, DatabaseException, ExtensionException, UnknowException, WebserviceException;
public List<Version> getVersionHistory(String docId) throws PathNotFoundException, RepositoryException, DatabaseException,
UnknowException, WebserviceException;
public LockInfo lock(String docId) throws LockException, PathNotFoundException, AccessDeniedException, RepositoryException,
DatabaseException, UnknowException, WebserviceException;
public void unlock(String docId) throws LockException, PathNotFoundException, AccessDeniedException, RepositoryException,
DatabaseException, UnknowException, WebserviceException;
public void forceUnlock(String docId) throws LockException, PathNotFoundException, AccessDeniedException, RepositoryException,
DatabaseException, PrincipalAdapterException, UnknowException, WebserviceException;
public boolean isLocked(String docId) throws RepositoryException, PathNotFoundException, DatabaseException, UnknowException,
WebserviceException;
public LockInfo getLockInfo(String docId) throws RepositoryException, PathNotFoundException, LockException, DatabaseException,
UnknowException, WebserviceException;
public void purgeDocument(String docId) throws LockException, AccessDeniedException, RepositoryException, PathNotFoundException,
DatabaseException, ExtensionException, UnknowException, WebserviceException;
public void moveDocument(String docId, String dstId) throws LockException, PathNotFoundException, ItemExistsException, AccessDeniedException,
RepositoryException, DatabaseException, ExtensionException, AutomationException, UnknowException, WebserviceException;
public void copyDocument(String docId, String dstId) throws ItemExistsException, PathNotFoundException, AccessDeniedException,
RepositoryException, IOException, DatabaseException, UserQuotaExceededException, ExtensionException, AutomationException,
UnknowException, WebserviceException;
public void restoreVersion(String docId, String versionId) throws AccessDeniedException, PathNotFoundException, LockException,
RepositoryException, DatabaseException, ExtensionException, UnknowException, WebserviceException;
public void purgeVersionHistory(String docId) throws AccessDeniedException, PathNotFoundException, LockException, RepositoryException,
DatabaseException, UnknowException, WebserviceException;
public long getVersionHistorySize(String docId) throws RepositoryException, PathNotFoundException, DatabaseException, UnknowException,
WebserviceException;
public boolean isValidDocument(String docId) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException,
UnknowException, WebserviceException;
public String getDocumentPath(String uuid) throws AccessDeniedException, RepositoryException, DatabaseException, UnknowException,
WebserviceException;
public List<String> getDetectedLanguages() throws RepositoryException, DatabaseException, UnknowException, WebserviceException;
Folder
public Folder createFolder(Folder okmFolder) throws AccessDeniedException, RepositoryException, PathNotFoundException,
ItemExistsException, DatabaseException, ExtensionException, AutomationException, UnknowException, WebserviceException;
public Folder createFolderSimple(String fldPath) throws AccessDeniedException, RepositoryException, PathNotFoundException,
ItemExistsException, DatabaseException, ExtensionException, AutomationException, UnknowException, WebserviceException;
public Folder getFolderProperties(String fldId) throws AccessDeniedException, RepositoryException, PathNotFoundException,
DatabaseException, UnknowException, WebserviceException;
public void deleteFolder(String fldId) throws LockException, PathNotFoundException, AccessDeniedException, RepositoryException,
DatabaseException, UnknowException, WebserviceException;
public void renameFolder(String fldId, String newName) throws PathNotFoundException, ItemExistsException, AccessDeniedException,
RepositoryException, DatabaseException, UnknowException, WebserviceException;
public void moveFolder(String fldId, String dstId) throws PathNotFoundException, ItemExistsException, AccessDeniedException,
RepositoryException, DatabaseException, UnknowException, WebserviceException;
public List<Folder> getFolderChildren(String fldId) throws PathNotFoundException, RepositoryException, DatabaseException, UnknowException,
WebserviceException;
public boolean isValidFolder(String fldId) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException,
UnknowException, WebserviceException;
public String getFolderPath(String uuid) throws AccessDeniedException, RepositoryException, DatabaseException, UnknowException,
WebserviceException;
Note
public Note addNote(String nodeId, String text) throws LockException, PathNotFoundException, AccessDeniedException, RepositoryException,
DatabaseException, UnknowException, WebserviceException;
public Note getNote(String noteId) throws LockException, PathNotFoundException, AccessDeniedException, RepositoryException,
DatabaseException, UnknowException, WebserviceException;
public void deleteNote(String noteId) throws LockException, PathNotFoundException, AccessDeniedException, RepositoryException,
DatabaseException, UnknowException, WebserviceException;
public void setNote(String noteId, String text) throws LockException, PathNotFoundException, AccessDeniedException, RepositoryException,
DatabaseException, UnknowException, WebserviceException;
public List<Note> listNotes(String nodeId) throws LockException, PathNotFoundException, AccessDeniedException, RepositoryException,
DatabaseException, UnknowException, WebserviceException;
PropertyGroup
public void addGroup(String nodeId, String grpName) throws NoSuchGroupException, LockException, PathNotFoundException,
AccessDeniedException, RepositoryException, DatabaseException, ExtensionException, AutomationException, UnknowException,
WebserviceException;
public void removeGroup(String nodeId, String grpName) throws AccessDeniedException, NoSuchGroupException, LockException,
PathNotFoundException, RepositoryException, DatabaseException, ExtensionException, UnknowException, WebserviceException;
public List<PropertyGroup> getGroups(String nodeId) throws IOException, ParseException, PathNotFoundException, RepositoryException,
DatabaseException, UnknowException, WebserviceException;
public List<PropertyGroup> getAllGroups() throws IOException, ParseException, RepositoryException, DatabaseException,
UnknowException, WebserviceException;
public List<FormElement> getPropertyGroupProperties(String nodeId, String grpName) throws IOException, ParseException, NoSuchGroupException,
PathNotFoundException, RepositoryException, DatabaseException, UnknowException, WebserviceException;
public List<FormElement> getPropertyGroupForm(String grpName) throws IOException, ParseException,
NoSuchGroupException, PathNotFoundException, RepositoryException, DatabaseException, UnknowException, WebserviceException;
public void setPropetyGroupProperties(String nodeId, String grpName, List<FormElement> ofeList) throws IOException, ParseException, NoSuchPropertyException,
NoSuchGroupException, LockException, PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException,
ExtensionException, AutomationException, UnknowException, WebserviceException;
public void setPropertyGroupPropertiesSimple(String nodeId, String grpName, Map<String, String> properties) throws IOException, ParseException,
NoSuchPropertyException, NoSuchGroupException, LockException, PathNotFoundException, AccessDeniedException,
RepositoryException, DatabaseException, ExtensionException, AutomationException, UnknowException, WebserviceException;
public boolean hasGroup(String nodeId, String grpName) throws IOException, ParseException, PathNotFoundException, RepositoryException,
DatabaseException, UnknowException, WebserviceException;
Repository
public Folder getRootFolder() throws PathNotFoundException, RepositoryException, DatabaseException, UnknowException,
WebserviceException;
public Folder getTrashFolder() throws PathNotFoundException, RepositoryException, DatabaseException, UnknowException,
WebserviceException;
public Folder getTemplatesFolder() throws PathNotFoundException, RepositoryException, DatabaseException, UnknowException,
WebserviceException;
public Folder getPersonalFolder() throws PathNotFoundException, RepositoryException, DatabaseException, UnknowException,
WebserviceException;
public Folder getMailFolder() throws PathNotFoundException, RepositoryException, DatabaseException, UnknowException,
WebserviceException;
public Folder getThesaurusFolder() throws PathNotFoundException, RepositoryException, DatabaseException, UnknowException,
WebserviceException;
public Folder getCategoriesFolder() throws PathNotFoundException, RepositoryException, DatabaseException, UnknowException,
WebserviceException;
public void purgeTrash() throws PathNotFoundException, AccessDeniedException, LockException, RepositoryException, DatabaseException,
UnknowException, WebserviceException;
public String getUpdateMessage() throws RepositoryException, DatabaseException, UnknowException, WebserviceException;
public String getRepositoryUuid() throws RepositoryException, DatabaseException, UnknowException, WebserviceException;
public boolean hasNode(String nodeId) throws RepositoryException, DatabaseException, UnknowException, WebserviceException;
public String getNodePath(String uuid) throws PathNotFoundException, RepositoryException, DatabaseException, UnknowException,
WebserviceException;
public String getNodeUuid(String nodePath) throws PathNotFoundException, RepositoryException, DatabaseException, UnknowException,
WebserviceException;
public AppVersion getAppVersion() throws RepositoryException, DatabaseException, UnknowException, WebserviceException;
Search
public List<QueryResult> findByContent(String content) throws IOException, ParseException, RepositoryException, DatabaseException,
UnknowException, WebserviceException;
public List<QueryResult> findByName(String name) throws IOException, ParseException, RepositoryException, DatabaseException,
UnknowException, WebserviceException;
public List<QueryResult> findByKeywords(List<String> keywords) throws IOException, ParseException, RepositoryException,
DatabaseException, UnknowException, WebserviceException;
public List<QueryResult> find(QueryParams queryParams) throws IOException, ParseException, RepositoryException,
DatabaseException, UnknowException, WebserviceException;
public ResultSet findPaginated(QueryParams queryParams, int offset, int limit) throws IOException, ParseException,
RepositoryException, DatabaseException, UnknowException, WebserviceException;
public ResultSet findSimpleQueryPaginated(String statement, int offset, int limit) throws IOException, ParseException,
RepositoryException, DatabaseException, UnknowException, WebserviceException;
public ResultSet findMoreLikeThis(String uuid, int max) throws IOException, ParseException, RepositoryException, DatabaseException,
UnknowException, WebserviceException;
public Map<String, Integer> getKeywordMap(List<String> filter) throws RepositoryException, DatabaseException, UnknowException,
WebserviceException;
public List<Document> getCategorizedDocuments(String categoryId) throws RepositoryException, DatabaseException, UnknowException,
WebserviceException;
public long saveSearch(QueryParams params) throws AccessDeniedException, RepositoryException, DatabaseException, UnknowException,
WebserviceException;
public void updateSearch(QueryParams params) throws AccessDeniedException, RepositoryException, DatabaseException, UnknowException,
WebserviceException;
public QueryParams getSearch(int qpId) throws PathNotFoundException, RepositoryException, DatabaseException, UnknowException,
WebserviceException;
public List<QueryParams> getAllSearchs() throws RepositoryException, DatabaseException, UnknowException, WebserviceException;
public void deleteSearch(int qpId) throws AccessDeniedException, RepositoryException, DatabaseException, UnknowException,
WebserviceException;
Property
public void addCategory(String nodeId, String catId) throws VersionException, LockException, PathNotFoundException,
AccessDeniedException, RepositoryException, DatabaseException, UnknowException, WebserviceException;
public void removeCategory(String nodeId, String catId) throws VersionException, LockException, PathNotFoundException,
AccessDeniedException, RepositoryException, DatabaseException, UnknowException, WebserviceException;
public void addKeyword(String nodeId, String keyword) throws VersionException, LockException, PathNotFoundException,
AccessDeniedException, RepositoryException, DatabaseException, UnknowException, WebserviceException;
public void removeKeyword(String nodeId, String keyword) throws VersionException, LockException, PathNotFoundException,
AccessDeniedException, RepositoryException, DatabaseException, UnknowException, WebserviceException;
public void setEncryption(String nodeId, String cipherName) throws VersionException, LockException, PathNotFoundException,
AccessDeniedException, RepositoryException, DatabaseException, UnknowException, WebserviceException;
public void unsetEncryption(String nodeId) throws VersionException, LockException, PathNotFoundException, AccessDeniedException,
RepositoryException, DatabaseException, UnknowException, WebserviceException;
public void setSigned(String nodeId, boolean signed) throws VersionException, LockException, PathNotFoundException,
AccessDeniedException, RepositoryException, DatabaseException, UnknowException, WebserviceException;
Changes between versions
Group | Method | Action | Version |
Variable | For evaluation | For changing | |
PropertyGroup | getPropertyGroupForm | Added | 6.2.27+ and 6.4.9+ |