OKMFolder
Basics
Section titled “Basics”On almost methods you’ll see parameter named “fldId”. The value of this parameter can be some valid folder UUID or path.
Also on all methods you’ll see parameter named “token”. When accessing application across SOAP the login process returns a token, what is used to identify the user on all the exposed methods. From default application execution context you must use “null” value what indicates to the application must use the “user session”.
Methods
Section titled “Methods”create
Section titled “create”Description:
| Method | Return values | Description |
|---|---|---|
| create(String token, Folder fld) | Folder | Creates a new folder and returns as a result an object Folder. |
- The variable path into the parameter fld, must be initializated. It indicates the folder path into OpenKM.
Example:
package com.openkm;
import com.openkm.api.OKMFolder;import com.openkm.bean.Folder;
public class Test { public static void main(String[] args) { try { Folder fld = new Folder(); fld.setPath("/okm:root/test"); OKMFolder.getInstance().create(null, fld); } catch (Exception e) { e.printStackTrace(); } }}createSimple
Section titled “createSimple”Description:
| Method | Return values | Description |
|---|---|---|
| createSimple(String token, String fldPath) | Folder | Creates a new folder and returns as a result an object Folder. |
Example:
package com.openkm;
import com.openkm.api.OKMFolder;
public class Test { public static void main(String[] args) { try { String fldPath = "/okm:root/test"; OKMFolder.getInstance().createSimple(null, fldPath); } catch (Exception e) { e.printStackTrace(); } }}getProperties
Section titled “getProperties”Description:
| Method | Return values | Description |
|---|---|---|
| getProperties(String token, String fldId) | Folder | Return the folder properties. |
Example:
package com.openkm;
import com.openkm.api.OKMFolder;import com.openkm.bean.Folder;
public class Test { public static void main(String[] args) { try { Folder fld = OKMFolder.getInstance().getProperties(null, "/okm:root/test"); System.out.println(fld); } catch (Exception e) { e.printStackTrace(); } }}delete
Section titled “delete”Description:
| Method | Return values | Description |
|---|---|---|
| delete(String token, String fldId) | void | Delete a folder. |
Example:
package com.openkm;
import com.openkm.api.OKMFolder;
public class Test { public static void main(String[] args) { try { OKMFolder.getInstance().delete(null, "/okm:root/test"); } catch (Exception e) { e.printStackTrace(); } }}Description:
| Method | Return values | Description |
|---|---|---|
| purge(String token, String fldId) | void | The folder is definitely removed from the repository. |
- Usually you will purge folders into /okm:trash/userId - the personal trash user locations - but it is possible to directly purge any folder from the whole repository.
Example:
package com.openkm;
import com.openkm.api.OKMFolder;
public class Test { public static void main(String[] args) { try { OKMFolder.getInstance().purge(null, "/okm:root/test"); } catch (Exception e) { e.printStackTrace(); } }}rename
Section titled “rename”Description:
| Method | Return values | Description |
|---|---|---|
| rename(String token, String fldId, String newName) | Folder | Rename a folder. |
Example:
package com.openkm;
import com.openkm.api.OKMFolder;
public class Test { public static void main(String[] args) { try { OKMFolder.getInstance().rename(null, "/okm:root/test", "newname"); } catch (Exception e) { e.printStackTrace(); } }}Description:
| Method | Return values | Description |
|---|---|---|
| move(String token, String fldId, String dstId) | void | Moves folder into some folder or record |
- The values of the dstId parameter should be a folder or record UUID or path.
Example:
package com.openkm;
import com.openkm.api.OKMFolder;
public class Test { public static void main(String[] args) { try { OKMFolder.getInstance().move(null, "/okm:root/test", "/okm:root/move/destination"); } catch (Exception e) { e.printStackTrace(); } }}Description:
| Method | Return values | Description |
|---|---|---|
| copy(String token, String fldId, String dstId) | void | Copies a folder into a folder or record. |
- The values of the dstId parameter should be a folder or record UUID or path.
Example:
package com.openkm;
import com.openkm.api.OKMFolder;
public class Test { public static void main(String[] args) { try { OKMFolder.getInstance().copy(null, "/okm:root/test", "/okm:root/move/destination"); } catch (Exception e) { e.printStackTrace(); } }}Description:
| Method | Return values | Description |
|---|---|---|
| copy(String token, String fldId, String dstId, String newName) | void | Copies a folder into a folder or record. |
- The values of the dstId parameter should be a folder or record UUID or path.
- When parameter newName value is null, folder will preservate the same name.
Example:
package com.openkm;
import com.openkm.api.OKMFolder;
public class Test { public static void main(String[] args) { try { OKMFolder.getInstance().copy(null, "/okm:root/test", "/okm:root/move/destination", "newname"); } catch (Exception e) { e.printStackTrace(); } }}extendedCopy
Section titled “extendedCopy”Description:
| Method | Return values | Description |
|---|---|---|
| extendedCopy(String token, String fldId, String dstId, ExtendedAttributes extAttr) | void | Copies a folder with the associated data into some folder or record. |
- The values of the dstId parameter should be a folder or record UUID or path.
Example:
package com.openkm;
import com.openkm.api.OKMFolder;import com.openkm.bean.ExtendedAttributes;
public class Test { public static void main(String[] args) { try { ExtendedAttributes extAttr = new ExtendedAttributes(); extAttr.setKeywords(true); OKMFolder.getInstance().extendedCopy(null, "/okm:root/sample.pdf","/okm:root/test", extAttr);
} catch (Exception e) { e.printStackTrace(); } }}extendedCopy
Section titled “extendedCopy”Description:
| Method | Return values | Description |
|---|---|---|
| extendedCopy(String token, String fldId, String dstId, ExtendedAttributes extAttr, String newName) | void | Copies a folder with the associated data into some folder or record. |
- The values of the dstId parameter should be a folder or record UUID or path.
- When parameter newName value is null, folder will preservate the same name.
Example:
package com.openkm;
import com.openkm.api.OKMFolder;import com.openkm.bean.ExtendedAttributes;
public class Test { public static void main(String[] args) { try { ExtendedAttributes extAttr = new ExtendedAttributes(); extAttr.setKeywords(true); OKMFolder.getInstance().extendedCopy(null, "/okm:root/sample.pdf","/okm:root/test", extAttr, "new_name.pdf");
} catch (Exception e) { e.printStackTrace(); } }}getChilds
Section titled “getChilds”Description:
| Method | Return values | Description |
|---|---|---|
| getChilds(String token, String fldId) | List |
Returns a list of all folders which their parent is fldId. |
- The parameter fldId can be a folder or a record node.
Example:
package com.openkm;
import com.openkm.api.OKMFolder;import com.openkm.bean.Folder;
public class Test { public static void main(String[] args) { try { for (Folder fld : OKMFolder.getInstance().getChilds(null, "/okm:root/test")) { System.out.println(fld); } } catch (Exception e) { e.printStackTrace(); } }}getChildren
Section titled “getChildren”Description:
| Method | Return values | Description |
|---|---|---|
| getChildren(String token, String fldId) | List |
Returns a list of all folders which their parent is fldId. |
- The parameter fldId can be a folder or a record node.
Example:
package com.openkm;
import com.openkm.api.OKMFolder;import com.openkm.bean.Folder;
public class Test { public static void main(String[] args) { try { for (Folder fld : OKMFolder.getInstance().getChildren(null, "/okm:root/test")) { System.out.println(fld); } } catch (Exception e) { e.printStackTrace(); } }}getContentInfo
Section titled “getContentInfo”Description:
| Method | Return values | Description |
|---|---|---|
| getContentInfo(String token, String fldId) | ContentInfo | Return and object ContentInfo with information about folder. |
- The ContentInfo object retrives information about:
Example:
package com.openkm;
import com.openkm.api.OKMFolder;import com.openkm.bean.ContentInfo;
public class Test { public static void main(String[] args) { try { ContentInfo ci = OKMFolder.getInstance().getContentInfo(null, "/okm:root/test"); System.out.println(ci); } catch (Exception e) { e.printStackTrace(); } }}isValid
Section titled “isValid”Description:
| Method | Return values | Description |
|---|---|---|
| isValid(String token, String fldId) | boolean | Returns a boolean that indicates if the node is a folder or not. |
Example:
package com.openkm;
import com.openkm.api.OKMFolder;
public class Test { public static void main(String[] args) { try { boolean valid = OKMFolder.getInstance().isValid(null, "/okm:root/test"); System.out.println(valid); } catch (Exception e) { e.printStackTrace(); } }}getPath
Section titled “getPath”Description:
| Method | Return values | Description |
|---|---|---|
| getPath(String token, String uuid) | String | Convert folder UUID to folder path. |
Example:
package com.openkm;
import com.openkm.api.OKMFolder;
public class Test { public static void main(String[] args) { try { String path = OKMFolder.getInstance().getPath(null, "c52f9ea0-0d6c-45da-bae4-d72b66f42da3"); System.out.println(path); } catch (Exception e) { e.printStackTrace(); } }}setStyle
Section titled “setStyle”Description:
| Method | Return values | Description |
|---|---|---|
| setStyle(String token, String fldId, long styleId) | void | Set the folder style. |
Example:
package com.openkm;
import com.openkm.api.OKMFolder;
public class Test { public static void main(String[] args) { try { OKMFolder.getInstance().setStyle(null, "/okm:root/test", 1); } catch (Exception e) { e.printStackTrace(); } }}createMissingFolders
Section titled “createMissingFolders”Description:
| Method | Return values | Description |
|---|---|---|
| createMissingFolders(String token, String fldPath) | void | Create missing folders based on all the path nodes. |
Example:
package com.openkm;
import com.openkm.api.OKMFolder;
public class Test { public static void main(String[] args) { try { OKMFolder.getInstance().createMissingFolders(null, "/okm:root/test/missing/from/here"); } catch (Exception e) { e.printStackTrace(); } }}