Java SDK

From OpenKM Documentation
Revision as of 19:46, 26 November 2013 by Jllort (talk | contribs)

Jump to: navigation, search

Nota advertencia.png Unders construction

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();
}

Object 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;