use of org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI in project records-management by Alfresco.
the class RMBaseEventProcessor method createRecordFolder.
/**
* Helper method for creating child record folder with the name starting with provided nameIdentifier and a random generated string.
*
* @param folder - container that will contain created record folder
* @param userModel - UserModel instance with wich rest api will be called
* @param nameIdentifier - a string identifier that the created child record folder will start with
* @param context - the context for created child record folder
* @param loadFilePlanComponentDelay - delay between creation of child record folders
* @throws Exception
*/
public void createRecordFolder(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 child record folder properties
RecordCategoryChild recordCategoryChildModel = RecordCategoryChild.builder().name(newfilePlanComponentName).nodeType(RECORD_FOLDER_TYPE).properties(RecordCategoryChildProperties.builder().title(newfilePlanComponentTitle).description(EMPTY).build()).build();
RecordCategoryAPI recordCategoryAPI = getRestAPIFactory().getRecordCategoryAPI(userModel);
RecordCategoryChild childRecordFolder = recordCategoryAPI.createRecordCategoryChild(recordCategoryChildModel, folder.getId());
String newChildRecordFolderId = childRecordFolder.getId();
fileFolderService.createNewFolder(newChildRecordFolderId, 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.RecordCategoryAPI in project records-management by Alfresco.
the class RMBaseEventProcessor method createRecordCategoryWithFixedName.
/**
* Helper method for creating a child record category with a specified name.
*
* @param folder - container that will contain created child record category
* @param name - the name that created child record category will have
* @return created child record category with a specified name
* @throws Exception
*/
public FolderData createRecordCategoryWithFixedName(FolderData folder, String name) throws Exception {
FolderData createdFolder = null;
String folderPath = folder.getPath();
String newfilePlanComponentTitle = "title: " + name;
// Build filePlan component records folder properties
RecordCategoryChild recordCategoryChildModel = RecordCategoryChild.builder().name(name).nodeType(RECORD_CATEGORY_TYPE).properties(RecordCategoryChildProperties.builder().title(newfilePlanComponentTitle).description(EMPTY).build()).build();
RecordCategoryAPI recordCategoryAPI = getRestAPIFactory().getRecordCategoryAPI();
RecordCategoryChild recordCategoryChild = recordCategoryAPI.createRecordCategoryChild(recordCategoryChildModel, folder.getId());
String newRecordCategoryChildId = recordCategoryChild.getId();
fileFolderService.createNewFolder(newRecordCategoryChildId, RECORD_CATEGORY_CONTEXT, folderPath + "/" + name);
// Increment counts
fileFolderService.incrementFolderCount(folder.getContext(), folderPath, 1);
createdFolder = fileFolderService.getFolder(newRecordCategoryChildId);
return createdFolder;
}
use of org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI in project records-management by Alfresco.
the class RMBaseEventProcessor method createSubCategory.
/**
* Helper method for creating one sub-category with the name starting with provided nameIdentifier and a random generated string.
*
* @param folder - container that will contain created sub-category
* @param userModel - UserModel instance with wich rest api will be called
* @param nameIdentifier - a string identifier that the created sub-category will start with
* @param context - the context for created sub-category
* @param loadFilePlanComponentDelay - delay between creation of sub-categories
* @throws Exception
*/
public void createSubCategory(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 child record category properties
RecordCategoryChild recordCategoryChildModel = RecordCategoryChild.builder().name(newfilePlanComponentName).nodeType(RECORD_CATEGORY_TYPE).properties(RecordCategoryChildProperties.builder().title(newfilePlanComponentTitle).description(EMPTY).build()).build();
RecordCategoryAPI recordCategoryAPI = getRestAPIFactory().getRecordCategoryAPI(userModel);
RecordCategoryChild childRecordCategory = recordCategoryAPI.createRecordCategoryChild(recordCategoryChildModel, folder.getId());
String newChildRecordCategoryId = childRecordCategory.getId();
fileFolderService.createNewFolder(newChildRecordCategoryId, 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.RecordCategoryAPI in project records-management by Alfresco.
the class RMBaseEventProcessor method createRecordFolderWithFixedName.
/**
* Helper method for creating a child record folder with a specified name.
*
* @param folder - container that will contain created child record folder
* @param name - the name that created child record folder will have
* @return created child record folder with a specified name
* @throws Exception
*/
public FolderData createRecordFolderWithFixedName(FolderData folder, String name) throws Exception {
FolderData createdFolder = null;
String folderPath = folder.getPath();
String newfilePlanComponentTitle = "title: " + name;
// Build filePlan component records folder properties
RecordCategoryChild recordCategoryChildModel = RecordCategoryChild.builder().name(name).nodeType(RECORD_FOLDER_TYPE).properties(RecordCategoryChildProperties.builder().title(newfilePlanComponentTitle).description(EMPTY).build()).build();
RecordCategoryAPI recordCategoryAPI = getRestAPIFactory().getRecordCategoryAPI();
RecordCategoryChild recordFolderChild = recordCategoryAPI.createRecordCategoryChild(recordCategoryChildModel, folder.getId());
String newRecordFolderChildId = recordFolderChild.getId();
fileFolderService.createNewFolder(newRecordFolderChildId, RECORD_FOLDER_CONTEXT, folderPath + "/" + name);
// Increment counts
fileFolderService.incrementFolderCount(folder.getContext(), folderPath, 1);
createdFolder = fileFolderService.getFolder(newRecordFolderChildId);
return createdFolder;
}
Aggregations