Package org.alfresco.rest.v0
Class RecordsAPI
- java.lang.Object
-
- org.alfresco.rest.core.v0.BaseAPI
-
- org.alfresco.rest.v0.RecordsAPI
-
@Component public class RecordsAPI extends BaseAPI
Methods to make API requests using v0 API on records- Since:
- 2.5
- Author:
- Oana Nechiforescu
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.alfresco.rest.core.v0.BaseAPI
BaseAPI.PermissionType, BaseAPI.RETENTION_SCHEDULE, BaseAPI.RM_ACTIONS, BaseAPI.RMProperty
-
-
Field Summary
-
Fields inherited from class org.alfresco.rest.core.v0.BaseAPI
ACTIONS_API, contentService, NODE_PREFIX, NODE_REF_WORKSPACE_SPACES_STORE, RM_ACTIONS_API, RM_SITE_ID, SHARE_ACTION_API, UPDATE_METADATA_API
-
-
Constructor Summary
Constructors Constructor Description RecordsAPI()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.http.HttpResponsecompleteRecord(String user, String password, String recordName)Completes the record given as parameter<K extends Enum<?>>
org.apache.http.HttpResponsecreateNonElectronicRecord(String username, String password, Map<K,String> properties, String categoryName, String folderName)Creates a non-electronic record eg.org.apache.http.HttpResponsedeclareDocumentAsRecord(String user, String password, String siteID, String documentName)Declare documents as recordsorg.apache.http.HttpResponsedeclareDocumentVersionAsRecord(String user, String password, String siteID, String documentName)Declare document version as recordvoiddeleteRecord(String username, String password, String recordName, String categoryName, String folderName)Delete a record from the given path eg.StringgetRecordFullName(String username, String password, String folderName, String recordPartialName)Retrieves record full name for given partial nameStringgetRecordNodeRef(String username, String password, String recordName, String recordPath)Retrieves the record's nodeReforg.apache.http.HttpResponsehideRecord(String user, String password, String nodeId)Hide in place recordorg.apache.http.HttpResponserejectRecord(String user, String password, int expectedStatusCode, String recordName, String reason)Reject the record given as parameterorg.apache.http.HttpResponserejectRecord(String user, String password, String recordName, String reason)Reject the record given as parameterorg.apache.commons.lang3.tuple.Pair<Boolean,String>shareDocument(String user, String password, String nodeId)Share a documentvoiduploadElectronicRecord(String username, String password, Map<BaseAPI.RMProperty,String> properties, String folderName, org.alfresco.dataprep.CMISUtil.DocumentType documentType)Uploads an electronic record-
Methods inherited from class org.alfresco.rest.core.v0.BaseAPI
addPropertyToRequest, deleteItem, doDeleteRequest, doGetRequest, doPostJsonRequest, doPostRequest, doPutJsonRequest, doPutRequest, doSlingshotPostJsonRequest, facetedRequest, getFilePlanPath, getItemNodeRef, getNodeRefSpacesStore, getObjectByPath, getPropertyValue, getPropertyValue, getPropertyValues, getPropertyValuesByUniquePropertyValue
-
-
-
-
Method Detail
-
declareDocumentAsRecord
public org.apache.http.HttpResponse declareDocumentAsRecord(String user, String password, String siteID, String documentName)
Declare documents as records- Parameters:
user- the user declaring the document as recordpassword- the user's passwordsiteID- the site id in which the document existsdocumentName- the document name- Returns:
- The HTTP Response.
-
completeRecord
public org.apache.http.HttpResponse completeRecord(String user, String password, String recordName)
Completes the record given as parameter- Parameters:
user- the user declaring the document as recordpassword- the user's passwordrecordName- the record name- Returns:
- The HTTP Response.
-
rejectRecord
public org.apache.http.HttpResponse rejectRecord(String user, String password, String recordName, String reason)
Reject the record given as parameter- Parameters:
user- the user declaring the document as recordpassword- the user's passwordrecordName- the record namereason- reject reason- Returns:
- The HTTP Response.
- Throws:
AssertionError- If the POST call is not successful.
-
rejectRecord
public org.apache.http.HttpResponse rejectRecord(String user, String password, int expectedStatusCode, String recordName, String reason)
Reject the record given as parameter- Parameters:
user- the user declaring the document as recordpassword- the user's passwordexpectedStatusCode- The expected return status code.recordName- the record namereason- reject reason- Returns:
- The HTTP Response.
- Throws:
AssertionError- If the expectedStatusCode was not returned.
-
declareDocumentVersionAsRecord
public org.apache.http.HttpResponse declareDocumentVersionAsRecord(String user, String password, String siteID, String documentName)
Declare document version as record- Parameters:
user- the user declaring the document version as recordpassword- the user's passwordsiteID- the site id in which the document existsdocumentName- the document name- Returns:
- The HTTP Response.
-
createNonElectronicRecord
public <K extends Enum<?>> org.apache.http.HttpResponse createNonElectronicRecord(String username, String password, Map<K,String> properties, String categoryName, String folderName)
Creates a non-electronic record- eg. of usage for Unfiled records with folder : createNonElectronicRecord(getAdminName(), getAdminPassword(), properties, UNFILED_RECORDS_BREADCRUMB, "unfiled records folder");
- eg. of usage for creating record directly in Unfiled Records : createNonElectronicRecord(getAdminName(), getAdminPassword(), properties, UNFILED_RECORDS_BREADCRUMB, "");
- Parameters:
username- the usernamepassword- the passwordproperties- a map of record properties and their valuescategoryName- the category that contains the record, in the case in which the container would be Unfiled records use UNFILED_RECORDS_BREADCRUMB as valuefolderName- the folder inside which the record exists, in the case in which the folder name is "", the record will be created directly in the specified container this case is useful when trying to create a record directly in Unfiled Records- Returns:
- The HTTP Response (or null if the request was not needed).
-
uploadElectronicRecord
public void uploadElectronicRecord(String username, String password, Map<BaseAPI.RMProperty,String> properties, String folderName, org.alfresco.dataprep.CMISUtil.DocumentType documentType)
Uploads an electronic recordeg. of usage for creating record directly in Unfiled Records : uploadElectronicRecord(getAdminName(), getAdminPassword(), recordPropertiesStringMap, UNFILED_RECORDS_BREADCRUMB, DocumentType.HTML)
- Parameters:
username- the usernamepassword- the passwordproperties- a map of record properties and their valuesfolderName- the folder inside which the record will be created, it needs to have a unique name, as this method doesn't check other containers than the folder name- Throws:
AssertionError- if the upload was unsuccessful.
-
deleteRecord
public void deleteRecord(String username, String password, String recordName, String categoryName, String folderName)
Delete a record from the given path- eg. of usage in the case in which the record is inside a folder in Unfiled Records : deleteRecord(getAdminName(), getAdminPassword(), "f1 (2016-1472716888713)", UNFILED_RECORDS_BREADCRUMB, "unfiled records folder");
- eg. of usage in the case in which the record is created directly in Unfiled Records : deleteRecord(getAdminName(), getAdminPassword(), "f1 (2016-1472716888713)", UNFILED_RECORDS_BREADCRUMB, "");
- Parameters:
username- user's usernamepassword- its passwordrecordName- the record namecategoryName- the name of the category in which the folder is, in case of unfiled record, this will have UNFILED_RECORDS_BREADCRUMB as containerfolderName- folder name, in case in which trying to delete a record in Unfiled records directly, this will be ""- Throws:
AssertionError- If the record could not be deleted.
-
getRecordFullName
public String getRecordFullName(String username, String password, String folderName, String recordPartialName)
Retrieves record full name for given partial name- Parameters:
username- the user's usernamepassword- its passwordfolderName- the folder in which the record is supposed to existrecordPartialName- the String with which the record name starts- Returns:
- the record name in case it exists, empty String otherwise
-
shareDocument
public org.apache.commons.lang3.tuple.Pair<Boolean,String> shareDocument(String user, String password, String nodeId) throws org.json.JSONException
Share a document- Parameters:
user- the user sharing the filepassword- the user's passwordnodeId- the node id of the file- Returns:
Pair. on success will be true and the shareId. on failure will be false and the response status code.- Throws:
org.json.JSONException
-
hideRecord
public org.apache.http.HttpResponse hideRecord(String user, String password, String nodeId)
Hide in place record- Parameters:
user- the userpassword- the user's passwordnodeId- the in place record node id- Returns:
- The HTTP Response.
-
getRecordNodeRef
public String getRecordNodeRef(String username, String password, String recordName, String recordPath)
Retrieves the record's nodeRef- Parameters:
username- the user's usernamepassword- its passwordrecordName- the record full namerecordPath- the String with which the record name starts- Returns:
- the record nodeRef in case it exists, empty string otherwise
-
-