Package com.vdoc.sdk.commons.utils
Class ResourceUtils
java.lang.Object
com.vdoc.sdk.commons.utils.ResourceUtils
Resource utility class
- Author:
- wtoscer
-
Method Summary
Modifier and TypeMethodDescriptionstatic IResourcecloneLinkedResource(IWorkflowModule workflowModule, IContext context, ILinkedResource linkedResource, String parentField) Clone aILinkedResourcestatic ILinkedResourcecloneLinkedResource(IWorkflowModule workflowModule, IContext context, ILinkedResource linkedResource, String parentField, List<String> propertiesName, Boolean exclude) Clone aILinkedResource
You can exclude some properties by passing ListpropertiesName and the Boolean exclude to true
You can choose the properties you want to copy by passing ListpropertiesName and the Boolean exclude to false static IResourcecloneLinkedResource(IWorkflowModule workflowModule, IContext context, IWorkflowInstance destinationWorkflowInstance, ILinkedResource linkedResource, String parentField) Clone aILinkedResourcestatic ILinkedResourcecloneLinkedResource(IWorkflowModule workflowModule, IContext context, IWorkflowInstance destinationWorkflowInstance, ILinkedResource linkedResource, String parentField, List<String> propertiesName, Boolean exclude) Clone aILinkedResource
You can exclude some properties by passing ArrayListpropertiesName and the Boolean exclude to true
You can choose the properties you want to copy by passing ArrayListpropertiesName and the Boolean exclude to false static IResourcecloneResource(IWorkflowModule workflowModule, IContext context, IResource resource) Clone aIResourcestatic IResourcecloneResource(IWorkflowModule workflowModule, IContext context, IResource resource, List<String> propertiesName, Boolean exclude) Clone aIStorageResourceor aIWorkflowInstance
You can exclude some properties by passing ArrayListpropertiesName and set the Boolean exclude argument to Boolean.TRUE.
You can choose the properties you want to copy by passing ArrayListpropertiesName and the Boolean exclude to false static voidcopyAttachement(IWorkflowModule workflowModule, IResource targetResource, String targetPropertyName, Collection<? extends IAttachment> attachementCollection) Deprecated.use copyAttachment insteadstatic voidcopyAttachment(IWorkflowModule workflowModule, IResource sourceResource, IResource targetResource, String sourcePropertyName, String targetPropertyName, boolean withReplacement) copy an file property to another file property.static voidcopyAttachment(IWorkflowModule workflowModule, IResource targetResource, String targetPropertyName, Collection<? extends IAttachment> attachementCollection) static voidcopyProperty(PropertyCopyConfiguration configuration, Boolean ignoreError) Copy propertystatic voidcopyResource(IWorkflowModule workflowModule, IContext context, IResource sourceResource, IResource targetResource, List<String> propertiesName) static voidcopyResource(IWorkflowModule workflowModule, IContext context, IResource sourceResource, IResource targetResource, List<String> propertiesName, Boolean exclude) Copy the values from the source resource to the target resource
You can exclude some properties by passing ArrayListpropertiesName and the Boolean exclude to true
You can choose the properties you want to copy by passing ArrayListpropertiesName and the Boolean exclude to false static voidcopyResource(IWorkflowModule workflowModule, IContext context, IResource sourceResource, IResource targetResource, Map<String, String> propertiesMapping) Copy values from a resource to another by specifying a properties mapping.static voidremoveAttachment(IWorkflowModule workflowModule, IResource resource, String fieldName, String fileName) Remove anIAttachmentfor anIResource
-
Method Details
-
removeAttachment
public static void removeAttachment(IWorkflowModule workflowModule, IResource resource, String fieldName, String fileName) throws WorkflowModuleException Remove anIAttachmentfor anIResource- Parameters:
workflowModule- the moduleresource- theIResourcefrom which we want to remove anIAttachmentfieldName- the name of the field where theIAttachmentis stockedfileName- the name of theIAttachment- Throws:
WorkflowModuleException- on error
-
copyAttachement
@Deprecated public static void copyAttachement(IWorkflowModule workflowModule, IResource targetResource, String targetPropertyName, Collection<? extends IAttachment> attachementCollection) throws WorkflowModuleException Deprecated.use copyAttachment insteadCopy attachement- Parameters:
workflowModule- the moduletargetResource- the target resourcetargetPropertyName- the target property nameattachementCollection- the attachements- Throws:
WorkflowModuleException- on error
-
copyAttachment
public static void copyAttachment(IWorkflowModule workflowModule, IResource targetResource, String targetPropertyName, Collection<? extends IAttachment> attachementCollection) throws WorkflowModuleException - Parameters:
workflowModule- the moduletargetResource- theIResourcewhere we want to copytargetPropertyName- the name of the property of theIResourceattachementCollection- theCollectionofIAttachmentwe want to copy- Throws:
WorkflowModuleException- on error
-
copyAttachment
public static void copyAttachment(IWorkflowModule workflowModule, IResource sourceResource, IResource targetResource, String sourcePropertyName, String targetPropertyName, boolean withReplacement) throws WorkflowModuleException copy an file property to another file property. This will duplicate file for safe delete.- Parameters:
workflowModule- the resource workflow modulesourceResource- the source resourcetargetResource- the target resource (can be the same as source)sourcePropertyName- the source propertytargetPropertyName- the target propertywithReplacement- if true the target is clean before copy- Throws:
WorkflowModuleException- on error
-
copyResource
public static void copyResource(IWorkflowModule workflowModule, IContext context, IResource sourceResource, IResource targetResource, List<String> propertiesName, Boolean exclude) throws WorkflowModuleException Copy the values from the source resource to the target resource
You can exclude some properties by passing ArrayListpropertiesName and the Boolean exclude to true
You can choose the properties you want to copy by passing ArrayListpropertiesName and the Boolean exclude to false - Parameters:
workflowModule- the resource workflow modulecontext- the user contextsourceResource- source resourcetargetResource- target resource to copy properties valuespropertiesName- properties to exclude if exclude == true, properties to copy if exclude == falseexclude- fields to excludeif true / include if false- Throws:
WorkflowModuleException- on error
-
copyProperty
public static void copyProperty(PropertyCopyConfiguration configuration, Boolean ignoreError) throws WorkflowModuleException Copy property- Parameters:
configuration- the configurationignoreError- true to ignore error- Throws:
WorkflowModuleException- on error
-
copyResource
public static void copyResource(IWorkflowModule workflowModule, IContext context, IResource sourceResource, IResource targetResource, List<String> propertiesName) throws WorkflowModuleException Copy the values from the source resource to the target resource.
You can specify the properties you want to copy by setting theArrayListinvalid input: '<'String> propertiesName.- Parameters:
workflowModule- the workflow module.context- the user context.sourceResource- source resource to copy properties values from.targetResource- target resource to copy properties values to.propertiesName- all the properties to copy.- Throws:
WorkflowModuleException- on error
-
copyResource
public static void copyResource(IWorkflowModule workflowModule, IContext context, IResource sourceResource, IResource targetResource, Map<String, String> propertiesMapping) throws WorkflowModuleExceptionCopy values from a resource to another by specifying a properties mapping.- Parameters:
workflowModule- the workflow module.context- the user context.sourceResource- source resource to copy properties values from.targetResource- target resource to copy properties values to.propertiesMapping- aMapinvalid input: '<'String,String>- Throws:
WorkflowModuleException- on error
-
cloneResource
public static IResource cloneResource(IWorkflowModule workflowModule, IContext context, IResource resource, List<String> propertiesName, Boolean exclude) throws WorkflowModuleException Clone aIStorageResourceor aIWorkflowInstance
You can exclude some properties by passing ArrayListpropertiesName and set the Boolean exclude argument to Boolean.TRUE.
You can choose the properties you want to copy by passing ArrayListpropertiesName and the Boolean exclude to false - Parameters:
workflowModule- the resource workflow modulecontext- the user contextresource- resource to clonepropertiesName- properties to exclude if exclude == true, properties to copy if exclude == falseexclude- fields to exclude if true / include if false- Returns:
- the cloned resource
- Throws:
WorkflowModuleException- on error
-
cloneLinkedResource
public static ILinkedResource cloneLinkedResource(IWorkflowModule workflowModule, IContext context, ILinkedResource linkedResource, String parentField, List<String> propertiesName, Boolean exclude) throws WorkflowModuleException Clone aILinkedResource
You can exclude some properties by passing ListpropertiesName and the Boolean exclude to true
You can choose the properties you want to copy by passing ListpropertiesName and the Boolean exclude to false - Parameters:
workflowModule- the resource workflow modulecontext- the user contextlinkedResource- resource to cloneparentField- the field in which the linked Resource ispropertiesName- properties to exclude if exclude == true, properties to copy if exclude == falseexclude- fields to exclude if true / include if false- Returns:
- the cloned resource
- Throws:
WorkflowModuleException- on error
-
cloneLinkedResource
public static ILinkedResource cloneLinkedResource(IWorkflowModule workflowModule, IContext context, IWorkflowInstance destinationWorkflowInstance, ILinkedResource linkedResource, String parentField, List<String> propertiesName, Boolean exclude) throws WorkflowModuleException Clone aILinkedResource
You can exclude some properties by passing ArrayListpropertiesName and the Boolean exclude to true
You can choose the properties you want to copy by passing ArrayListpropertiesName and the Boolean exclude to false - Parameters:
workflowModule- the resource workflow modulecontext- the user contextdestinationWorkflowInstance- the workflowInstance where to copy the linkedresourcelinkedResource- resource to cloneparentField- the field in which the linked Resource ispropertiesName- properties to exclude if exclude == true, properties to copy if exclude == falseexclude- fields to exclude if true / include if false- Returns:
- the cloned resource
- Throws:
WorkflowModuleException- on error
-
cloneResource
public static IResource cloneResource(IWorkflowModule workflowModule, IContext context, IResource resource) throws WorkflowModuleException Clone aIResource- Parameters:
workflowModule- the resource workflow modulecontext- the user contextresource- resource to clone- Returns:
- the cloned resource
- Throws:
WorkflowModuleException- on error
-
cloneLinkedResource
public static IResource cloneLinkedResource(IWorkflowModule workflowModule, IContext context, ILinkedResource linkedResource, String parentField) throws WorkflowModuleException Clone aILinkedResource- Parameters:
workflowModule- the resource workflow modulecontext- the user contextlinkedResource- resource to cloneparentField- the parent field- Returns:
- the cloned resource
- Throws:
WorkflowModuleException- on error
-
cloneLinkedResource
public static IResource cloneLinkedResource(IWorkflowModule workflowModule, IContext context, IWorkflowInstance destinationWorkflowInstance, ILinkedResource linkedResource, String parentField) throws WorkflowModuleException Clone aILinkedResource- Parameters:
workflowModule- the resource workflow modulecontext- the user contextdestinationWorkflowInstance- the workflowInstance where to copy the linkedresourcelinkedResource- resource to cloneparentField- the parent field- Returns:
- the cloned resource
- Throws:
WorkflowModuleException- on error
-