This API is used to import an existing batch class. This API takes XML (with input parameters) and batch class to be imported. Batch class is in zip format when exported by Ephesoft which is required by the API

Request Method POST

Web Service URL: http://{serverName}:{port}/dcma/rest/importBatchClass

Inputs to the web service

  • An XML fle for configurations
  • A zip file of batch class

 

 

Input Parameter Values Descriptions
RolesImported Either “true”/”false” This value is used for importing roles with batch class or not.
EmailAccounts Either “true”/”false” This value is used for importing email accounts with batch class or not.
UseSource Either “true”/”false” This value is used for saving the information of source  batch class to be imported
Name This value should not be empty This value is used to configure the batch class name of the imported batch class.
Description This value should not be empty This value is used to configure the description of the imported batch class.
Priority This value should lie in between 1 to 100. This value indicates the priority of batch class.
UseExisting Either “true”/”false” This value is used for overwrite the existing batch class with new batch class.
UncFolder This value should not be empty and have any string value that specified directory path These values specify the UNC folder path for batch class to be imported along with batch class.
BatchClassKey String value to be used as batch class key. The value for batch class key. If algorithm is “NONE” then no value for it is required.
EncryptionAlgorithm Name of encryption algorithm:

  • NONE
  • AES_128

AES_256

The type of algorithm to be used for encryption. If “NONE” is set for encryption algorithm then all encryption from batch class is removed. If UseKey value is set to true then this tag won’t change anything.
Script This tag is configured for ScriptFile to be imported This tag is configured for which Script file to be imported
Folder This tag is configured for Folder to be imported This tag is configured for which folder to be imported along with batch class
importWithLearnFiles Either “true”/”false” This value is used to define if learned files needs to be imported or not

 

Checklist:-

  1. If UseExisting is “true”, existing batch class will be overwriting with the Folders and Script as well as others parameter.
  2. If UseExisting is “false”, new batch class will created and Folders and Scripts will be used as false.
  • If UseSource is “true”, new batch class will have same Name, Description and Priority as source batch class.

 

SampleInputXML:

<ImportBatchClassOptions>

<RolesImported>false</RolesImported>

<EmailAccounts>true</EmailAccounts>

<UseSource>false</UseSource>

<Name>BC9</Name>

<Description>Description </Description>

<Priority>10</Priority>

<UseExisting>false</UseExisting>

<UncFolder>F:\Ephesoft\SharedFolders\bc9unc</UncFolder>

<UseKey>false</UseKey>

<BatchClassKey>key</BatchClassKey>

<EncryptionAlgorithm>NONE</EncryptionAlgorithm>

<importWithLearnFiles>true</importWithLearnFiles> 

<BatchClassDefinition>

<Scripts>

<Script>

<FileName>ScriptDocumentAssembler.java</FileName>

<Selected>true</Selected>

</Script>

<Script>

<FileName>ScriptPageProcessing.java</FileName>

<Selected>true</Selected>

</Script>

</Scripts>

<Folders>

<Folder>

<FileName>image-classification-sample</FileName>

<Selected>false</Selected>

</Folder>

</Folders>

<BatchClassModules>

<BatchClassModule>

<ModuleName></ModuleName>

<PluginConfiguration>true</PluginConfiguration>

</BatchClassModule>

</BatchClassModules>

</BatchClassDefinition>

</ImportBatchClassOptions>

 

Sample client code using apache commons http client:-

private static void importBatchClass() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/importBatchClass";
		PostMethod mPost = new PostMethod(url);
		mPost.setDoAuthentication(true);
		// Input XML for adding parameter.
		File file1 = new File("C:\\sample\\sample.xml");
		// Input zip file for importing batch class.
		File file2 = new File("C:\\sample\\BC4_021315_118.zip");
		Part[] parts = new Part[2];
		try {
			parts[0] = new FilePart(file1.getName(), file1);
			parts[1] = new FilePart(file2.getName(), file2);
			MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
			mPost.setRequestEntity(entity);
			int statusCode = client.executeMethod(mPost);
			if (statusCode == 200) {
				System.out.println("Batch class imported successfully");
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(mPost.getResponseBodyAsString());
			}
		} catch (FileNotFoundException e) {
			System.out.println("File not found for processing.");
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (mPost != null) {
				mPost.releaseConnection();
			}
		}
	}

Was this article helpful to you?

Engineering

Comments are closed.