use of org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI in project records-management by Alfresco.
the class RMBaseEventProcessor method createRootUnfiledRecordFolderWithFixedName.
/**
* Helper method for creating a root unfiled record folder with a specified name.
*
* @param folder - container that will contain created root unfiled record folder
* @param name - the name that created root unfiled record folder will have
* @return created root unfiled record folder with a specified name
* @throws Exception
*/
public FolderData createRootUnfiledRecordFolderWithFixedName(FolderData folder, String name) throws Exception {
FolderData createdFolder = null;
String folderPath = folder.getPath();
String newfilePlanComponentTitle = "title: " + name;
// Build root unfiled record folder properties
UnfiledContainerChild unfiledContainerChildModel = UnfiledContainerChild.builder().name(name).nodeType(UNFILED_RECORD_FOLDER_TYPE).properties(UnfiledContainerChildProperties.builder().title(newfilePlanComponentTitle).description(EMPTY).build()).build();
UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI();
UnfiledContainerChild rootUnfiledRecordFolder = unfiledContainersAPI.createUnfiledContainerChild(unfiledContainerChildModel, folder.getId());
String newRootUnfiledRecordFolderId = rootUnfiledRecordFolder.getId();
fileFolderService.createNewFolder(newRootUnfiledRecordFolderId, UNFILED_CONTEXT, folderPath + "/" + name);
// Increment counts
fileFolderService.incrementFolderCount(folder.getContext(), folderPath, 1);
createdFolder = fileFolderService.getFolder(newRootUnfiledRecordFolderId);
return createdFolder;
}
use of org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI in project records-management by Alfresco.
the class RMBaseEventProcessor method createRootUnfiledRecordFolder.
/**
* Helper method for creating one root unfiled record folder with the name starting with provided nameIdentifier and a random generated string.
*
* @param folder - container that will contain created root unfiled record folder
* @param userModel - UserModel instance with wich rest api will be called
* @param nameIdentifier - a string identifier that the created root unfiled record folder will start with
* @param context - the context for created root unfiled record folder
* @param loadFilePlanComponentDelay - delay between creation of root unfiled record folders
* @throws Exception
*/
public void createRootUnfiledRecordFolder(FolderData folder, UserModel userModel, String nameIdentifier, String context, long loadFilePlanComponentDelay) throws Exception {
String unique;
String folderPath = folder.getPath();
unique = UUID.randomUUID().toString();
String newfilePlanComponentName = nameIdentifier + unique;
String newfilePlanComponentTitle = "title: " + newfilePlanComponentName;
// Build root unfiled records folder properties
UnfiledContainerChild unfiledContainerChildModel = UnfiledContainerChild.builder().name(newfilePlanComponentName).nodeType(UNFILED_RECORD_FOLDER_TYPE).properties(UnfiledContainerChildProperties.builder().title(newfilePlanComponentTitle).description(EMPTY).build()).build();
UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI(userModel);
UnfiledContainerChild unfiledContainerChild = unfiledContainersAPI.createUnfiledContainerChild(unfiledContainerChildModel, folder.getId());
String newUnfiledContainerChildId = unfiledContainerChild.getId();
fileFolderService.createNewFolder(newUnfiledContainerChildId, context, folderPath + "/" + newfilePlanComponentName);
TimeUnit.MILLISECONDS.sleep(loadFilePlanComponentDelay);
// Increment counts
fileFolderService.incrementFolderCount(folder.getContext(), folderPath, 1);
}
use of org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI in project records-management by Alfresco.
the class RMBaseEventProcessor method createNonElectonicRecordInUnfiledContext.
/**
* Helper method for creating specified number of non-electronic documents in specified unfiled container or unfiled record folder.
*
* @param folder - unfiled container or unfiled record folder that will contain created non-electronic document
* @param userModel - UserModel instance with wich rest api will be called
* @param nameIdentifier - a string identifier that the created non-electronic documents will start with
* @param loadFilePlanComponentDelay - delay between creation of non-electronic documents
* @throws Exception
*/
public void createNonElectonicRecordInUnfiledContext(FolderData folder, UserModel userModel, String nameIdentifier, long loadFilePlanComponentDelay) throws Exception {
String unique;
boolean isUnfiledContainer = fileFolderService.getFolder(UNFILED_CONTEXT, UNFILED_RECORD_CONTAINER_PATH).equals(folder);
String folderPath = folder.getPath();
unique = UUID.randomUUID().toString();
String newfilePlanComponentName = nameIdentifier + unique;
String newfilePlanComponentTitle = "title: " + newfilePlanComponentName;
// Build non electronic record properties
UnfiledContainerChild unfiledContainerChildModel = UnfiledContainerChild.builder().name(newfilePlanComponentName).nodeType(NON_ELECTRONIC_RECORD_TYPE).properties(UnfiledContainerChildProperties.builder().title(newfilePlanComponentTitle).description(EMPTY).build()).build();
String newRecordId;
String newRecordName;
if (isUnfiledContainer) {
UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI(userModel);
UnfiledContainerChild createdRecord = unfiledContainersAPI.createUnfiledContainerChild(unfiledContainerChildModel, folder.getId());
newRecordId = createdRecord.getId();
newRecordName = createdRecord.getName();
} else {
UnfiledRecordFolderAPI unfiledRecordFoldersAPI = getRestAPIFactory().getUnfiledRecordFoldersAPI(userModel);
UnfiledContainerChild createdRecord = unfiledRecordFoldersAPI.createUnfiledRecordFolderChild(unfiledContainerChildModel, folder.getId());
newRecordId = createdRecord.getId();
newRecordName = createdRecord.getName();
}
RecordData record = new RecordData(newRecordId, RecordContext.RECORD, newRecordName, folderPath, null, ExecutionState.UNFILED_RECORD_DECLARED);
recordService.createRecord(record);
TimeUnit.MILLISECONDS.sleep(loadFilePlanComponentDelay);
// Increment counts
fileFolderService.incrementFileCount(folder.getContext(), folderPath, 1);
}
Aggregations