com.autonomy.nonaci.indexing.impl.AbstractExportCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of indexing-api Show documentation
Show all versions of indexing-api Show documentation
API for indexing into IDOL using Java
/*
* (c) Copyright 2008-2015 Micro Focus or one of its affiliates.
*
* Licensed under the MIT License (the "License"); you may not use this file
* except in compliance with the License.
*
* The only warranties for products and services of Micro Focus and its affiliates
* and licensors ("Micro Focus") are as may be set forth in the express warranty
* statements accompanying such products and services. Nothing herein should be
* construed as constituting an additional warranty. Micro Focus shall not be
* liable for technical or editorial errors or omissions contained herein. The
* information contained herein is subject to change without notice.
*/
package com.autonomy.nonaci.indexing.impl;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.math.NumberUtils;
/**
* Abstract base class for {@link DreExportIdxCommand} and {@link DreExportXmlCommand} that contains accessor methods
* for all their shared parameters.
*
* @author boba
*/
public abstract class AbstractExportCommand extends IndexCommandImpl {
/**
* Creates a new instance of AbstractExportCommand
*
* @param command The command to be executed.
*/
protected AbstractExportCommand(final String command) {
super(command);
}
public int getBatchSize() {
return NumberUtils.toInt(get(PARAM_BATCH_SIZE));
}
/**
* The number of document sections that you want to export to one IDX file.
*
* @param batchSize The number of document sections to be exported to one IDX file.
*/
public void setBatchSize(final int batchSize) {
put(PARAM_BATCH_SIZE, String.valueOf(batchSize));
}
public boolean isCompress() {
return BooleanUtils.toBoolean(get(PARAM_COMPRESS));
}
/**
* Enter true if you want to compress the exported files. Enter false if you don't want to
* compress the files.
*
* @param compress true to compress the exported files.
*/
public void setCompress(final boolean compress) {
put(PARAM_COMPRESS, BooleanUtils.toStringTrueFalse(compress));
}
public String getDatabaseMatch() {
return get(PARAM_DATABASE_MATCH);
}
/**
* If you don't want to export documents from all IDOL server databases, enter one or more databases to which you
* want to restrict the export. If you want to specify multiple databases, you must separate them with plus symbols,
* commas or spaces (there must be no space before or after plus symbols or commas).
*
* @param databaseMatch The databases to export documents from.
*/
public void setDatabaseMatch(final String databaseMatch) {
put(PARAM_DATABASE_MATCH, databaseMatch);
}
public boolean isDelete() {
return BooleanUtils.toBoolean(get(PARAM_DELETE));
}
/**
* Enter true if you want to delete the documents from IDOL server after exporting them. (Documents
* are deleted only if the export is successful.)
*
* Enter false if you don't want to delete the documents.
*
* @param delete Specifies whether the exported documents are to be deleted.
*/
public void setDelete(final boolean delete) {
put(PARAM_DELETE, BooleanUtils.toStringTrueFalse(delete));
}
public String getFileName() {
return get(PARAM_FILE_NAME);
}
/**
* The path to the directory where the IDX files that are exported will be stored. The path must include a basic
* file name which IDOL server will postfix with incremental numbers and an appropriate extension. If you don't
* specify a file name the files are exported to the current working directory (IDOLserver\IDOL\content
* ), and IDOL server creates a filename in the format:
* AUTN-IDX-EXPORT-<host>-<port>-<date>-<time>-<incremental number>.<extension>.
*
* Use the hostDetails parameter to add host details to the file name.
*
* @param fileName The path to the directory where the exported files are to be stored.
*/
public void setFileName(final String fileName) {
put(PARAM_FILE_NAME, fileName);
}
public boolean isHostDetails() {
return BooleanUtils.toBoolean(get(PARAM_HOST_DETAILS));
}
/**
* Adds host details to the exported filename. For example, the following action could generate a series of files
* named backup-myservername.domain.com-16502-0.idx.gz:
*
* DREEXPORTIDX&filename=backup&hostdetails=true
*
* @param hostDetails Adds host details to the exported filename.
*/
public void setHostDetails(final boolean hostDetails) {
put(PARAM_HOST_DETAILS, BooleanUtils.toStringTrueFalse(hostDetails));
}
public String getMaxDate() {
return get(PARAM_MAX_DATE);
}
/**
* The latest creation date or time that a document can have in order to be exported.
*
* To specify a date use:
*
* - DD/MM/YYYY or DD/MM/YY
Note that you can specify the date using three numbers that are separated by
* slashes. The first of these numbers determines the day, the second the time and the third the year. If the
* year is a number less than 40, it is read as a year in the 2000s. If the year is a number between 40 and
* 99, it is read as a year in the 1900s. For example, 1/02/1 is read as February 1st 2001,
* while 01/3/40 is read as March 1st 1940.
* - a positive or negative number in order to specify a number of days from today (for example, 3
* or -3 to specify today's date plus 3 days or today's date minus
* 3 days).
*
* To specify a time use:
*
* - a positive or negative number postfixed with an s in order to specify a number of seconds
* from now (for example, 100s or -100s to specify the current time plus
* 100 seconds or the current time minus 100 seconds).
* - a positive number postfixed with an e in order to specify epoch seconds (for example,
* 1023782400e to specify 11th June 2002, 9 am).
*
*
* @param maxDate The latest creation date of documents to be exported.
*/
public void setMaxDate(final String maxDate) {
put(PARAM_MAX_DATE, maxDate);
}
public int getMaxId() {
return NumberUtils.toInt(get(PARAM_MAX_ID));
}
/**
* The maximum document ID number (inclusive) that should be exported.
*
* @param maxId The maximum document ID number (inclusive) that should be exported.
*/
public void setMaxId(final int maxId) {
put(PARAM_MAX_ID, String.valueOf(maxId));
}
public int getMatchId() {
return NumberUtils.toInt(get(PARAM_MATCH_ID));
}
/**
* If you don't want to export all IDX documents, enter the IDs of the documents that you want to export. If you
* specify multiple IDs, you must separate them with spaces or plus symbols (there must be no space before or after
* a plus symbol).
* You can also specify a range of IDs, using a hyphen (for example, 1000-1100).
*
* @param matchId The IDs of documents to be exported.
*/
public void setMatchId(final int matchId) {
put(PARAM_MATCH_ID, String.valueOf(matchId));
}
public String getMatchReference() {
return get(PARAM_MATCH_REFERENCE);
}
/**
* If you don't want to export all IDX documents, enter the references of the documents that you want to export. If
* you specify multiple references, you must separate them with spaces or plus symbols (there must be no space
* before or after a plus symbol).
*
* @param matchReference The references of documents to be exported.
*/
public void setMatchReference(final String matchReference) {
put(PARAM_MATCH_REFERENCE, matchReference);
}
public String getMinDate() {
return get(PARAM_MIN_DATE);
}
/**
* The earliest creation date or time that a document can have in order to be exported.
*
* To specify a date use:
*
* - DD/MM/YYYY or DD/MM/YY
Note that you can specify the date using three numbers that are separated by
* slashes. The first of these numbers determines the day, the second the time and the third the year. If the
* year is a number less than 40, it is read as a year in the 2000s. If the year is a number between 40 and
* 99, it is read as a year in the 1900s. For example, 1/02/1 is read as February 1st 2001,
* while 01/3/40 is read as March 1st 1940.
* - a positive or negative number in order to specify a number of days from today (for example, 3
* or -3 to specify today's date plus 3 days or today's date minus
* 3 days).
*
* To specify a time use:
*
* - a positive or negative number postfixed with an s in order to specify a number of seconds
* from now (for example, 100s or -100s to specify the current time plus
* 100 seconds or the current time minus 100 seconds).
* - a positive number postfixed with an e in order to specify epoch seconds (for example,
* 1023782400e to specify 11th June 2002, 9 am).
*
*
* @param minDate The earliest creation date of documents to be exported.
*/
public void setMinDate(final String minDate) {
put(PARAM_MIN_DATE, minDate);
}
public int getMinId() {
return NumberUtils.toInt(get(PARAM_MIN_ID));
}
/**
* The minimum document ID number (inclusive) that should be exported.
*
* @param minId The minimum document ID number (inclusive) that should be exported.
*/
public void setMinId(final int minId) {
put(PARAM_MIN_ID, String.valueOf(minId));
}
public int getStateMatchId() {
return NumberUtils.toInt(get(PARAM_STATE_MATCH_ID));
}
/**
* Allows you to restrict the documents to be exported to those listed in the specified state token (created earlier
* with the StoreState parameter of the Query, Suggest, or
* SuggestOnText actions).
*
* If you specify the token name only, all documents listed in the token can be exported. If you add a (zero-based)
* index range -- or individual numbers separated by plus signs -- in square brackets after the token name, only
* that range or set of documents can be exported. (Note that you must list the entries in increasing numerical
* order.)
*
* @param stateMatchId Export only documents listed in the specified state token.
*/
public void setStateMatchId(final int stateMatchId) {
put(PARAM_STATE_MATCH_ID, String.valueOf(stateMatchId));
}
}