LOGGER.fine("Using Custom Query["
+ configData.get(WHERECLAUSE).trim() + "]");
} else {
this.validation = WHERECLAUSE;
form = makeConfigForm(configData, this.validation);
return new ConfigureResponse(
resource.getString("query_not_having_versionstatus_condition"),
form);
}
} else {
this.validation = WHERECLAUSE;
form = makeConfigForm(configData, this.validation);
return new ConfigureResponse(
resource.getString("query_not_starting_with_SELECT_Id,DateLastModified_FROM_or_with_AND"),
form);
}
} else {
query.append("SELECT TOP 1 Id, DateLastModified FROM Document WHERE VersionStatus=1 and ContentSize IS NOT NULL ");
query.append(configData.get(WHERECLAUSE).trim());
}
try {
if (session != null) {
ISearch search = session.getSearch();
search.execute(query.toString());
}
} catch (RepositoryException e) {
if (e.getCause().toString().trim().contains(ACCESS_DENIED_EXCEPTION)) {
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
this.validation = OBJECT_STORE;
form = makeConfigForm(configData, this.validation);
return new ConfigureResponse(
resource.getString("object_store_access_error"),
form);
} else if (e.getCause().toString().trim().contains(RETRIEVE_SQL_SYNTAX_ERROR)) {
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
this.validation = WHERECLAUSE;
form = makeConfigForm(configData, this.validation);
return new ConfigureResponse(
resource.getString("additional_where_clause_invalid"),
form);
} else {
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
this.validation = "FileNet exception";
form = makeConfigForm(configData, this.validation);
return new ConfigureResponse(e.getLocalizedMessage(),
form);
}
}
StringBuffer deleteuery = new StringBuffer();
if (configData.get(DELETEWHERECLAUSE).trim().toUpperCase()
.startsWith(SELECT)) {
if (configData.get(DELETEWHERECLAUSE).trim().toUpperCase()
.startsWith(QUERYFORMAT)) {
if (configData.get(DELETEWHERECLAUSE).trim().toUpperCase()
.contains(((VERSIONQUERY)).toUpperCase())) {
deleteuery = new StringBuffer(
configData.get(DELETEWHERECLAUSE).trim());
LOGGER.fine("Using Custom Query["
+ configData.get(DELETEWHERECLAUSE).trim()
+ "]");
} else {
this.validation = DELETEWHERECLAUSE;
form = makeConfigForm(configData, this.validation);
return new ConfigureResponse(
resource.getString("delete_query_not_having_versionstatus_condition"),
form);
}
} else {
this.validation = DELETEWHERECLAUSE;
form = makeConfigForm(configData, this.validation);
return new ConfigureResponse(
resource.getString("delete_query_not_starting_with_SELECT_Id,DateLastModified_FROM_or_with_AND"),
form);
}
} else {
deleteuery.append("SELECT TOP 1 Id, DateLastModified FROM Document WHERE VersionStatus=1 and ContentSize IS NOT NULL ");
deleteuery.append(configData.get(DELETEWHERECLAUSE).trim());
}
try {
if (session != null) {
ISearch search = session.getSearch();
search.execute(deleteuery.toString());
}
} catch (RepositoryException e) {
if (e.getCause().toString().trim().contains(ACCESS_DENIED_EXCEPTION)) {
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
this.validation = OBJECT_STORE;
form = makeConfigForm(configData, this.validation);
return new ConfigureResponse(
resource.getString("object_store_access_error"),
form);
} else if (e.getCause().toString().trim().contains(RETRIEVE_SQL_SYNTAX_ERROR)) {
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
this.validation = DELETEWHERECLAUSE;
form = makeConfigForm(configData, this.validation);
return new ConfigureResponse(
resource.getString("delete_additional_where_clause_invalid"),
form);
} else {
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
this.validation = "FileNet exception";
form = makeConfigForm(configData, this.validation);
return new ConfigureResponse(e.getLocalizedMessage(),
form);
}
}
if (!configData.get(WHERECLAUSE).trim().equalsIgnoreCase("")
|| !configData.get(DELETEWHERECLAUSE).trim().equalsIgnoreCase("")) {
if ((configData.get(WHERECLAUSE).trim()).equalsIgnoreCase(configData.get(DELETEWHERECLAUSE).trim())) {
this.validation = DELETEWHERECLAUSE;
form = makeConfigForm(configData, this.validation);
return new ConfigureResponse(
resource.getString("same_additional_where_clause_and_additional_delete_clause"),
form);
}
}
} catch (EngineRuntimeException e) {
String errorKey = e.getExceptionCode().getKey();
String bundleMessage;
try {
if (errorKey.equalsIgnoreCase("E_NULL_OR_INVALID_PARAM_VALUE")) {
bundleMessage = resource.getString("content_engine_url_invalid");
LOGGER.log(Level.SEVERE, bundleMessage, e);
} else {
// bundleMessage =
// resource.getString("required_field_error") +" "+
// e.getLocalizedMessage();
bundleMessage = e.getLocalizedMessage();
LOGGER.log(Level.SEVERE, bundleMessage);
}
} catch (MissingResourceException mre) {
// bundleMessage =
// resource.getString("required_field_error") +" "+
// e.getLocalizedMessage();
bundleMessage = e.getLocalizedMessage();
LOGGER.log(Level.SEVERE, bundleMessage, mre);
}
form = makeConfigForm(configData, validation);
return new ConfigureResponse(bundleMessage, form);
} catch (RepositoryException e) {
String bundleMessage;
try {
if (e.getCause() instanceof EngineRuntimeException) {
EngineRuntimeException ere = (EngineRuntimeException) e.getCause();
String errorKey = ere.getExceptionCode().getKey();
if (errorKey.equalsIgnoreCase("E_OBJECT_NOT_FOUND")) {
bundleMessage = resource.getString("object_store_invalid");
} else if (errorKey.equalsIgnoreCase("E_NOT_AUTHENTICATED")) {
bundleMessage = resource.getString("invalid_credentials_error");
} else if (errorKey.equalsIgnoreCase("E_UNEXPECTED_EXCEPTION")) {
String errorMsg = ere.getCause().getClass().getName();
if (ere.getCause() instanceof NoClassDefFoundError) {
NoClassDefFoundError ncdf = (NoClassDefFoundError) ere.getCause();
errorMsg = ncdf.getMessage();
if (errorMsg.indexOf("activation") != -1) {
bundleMessage = resource.getString("activation_jar_error");
} else {
bundleMessage = resource.getString("content_engine_url_invalid");
}
} else if (ere.getCause() instanceof ExceptionInInitializerError) {
bundleMessage = resource.getString("jaxrpc_jar_error");
} else {
bundleMessage = resource.getString("content_engine_url_invalid");
}
} else if (errorKey.equalsIgnoreCase("API_INVALID_URI")) {
bundleMessage = resource.getString("content_engine_url_invalid");
} else if (errorKey.equalsIgnoreCase("TRANSPORT_WSI_LOOKUP_FAILURE")) {
bundleMessage = resource.getString("wsdl_api_jar_error");
} else {
bundleMessage = resource.getString("required_field_error")
+ " " + e.getLocalizedMessage();
}
} else {
bundleMessage = e.getLocalizedMessage();
}
LOGGER.log(Level.SEVERE, bundleMessage, e);
} catch (MissingResourceException mre) {
bundleMessage = resource.getString("required_field_error")
+ " " + mre.getLocalizedMessage();
// logger.severe(bundleMessage);
LOGGER.log(Level.SEVERE, bundleMessage, mre);
} catch (NullPointerException npe) {
// bundleMessage =
// resource.getString("required_field_error") +" "+
// e.getMessage();
bundleMessage = npe.getLocalizedMessage();
LOGGER.log(Level.SEVERE, "Unable to connect to FileNet server. Got exception: ", npe);
} catch (Throwable th) {
bundleMessage = th.getLocalizedMessage();
LOGGER.log(Level.SEVERE, "Unable to connect to FileNet server. Got exception: ", th);
}
LOGGER.info("request to make configuration form..");
form = makeConfigForm(configData, validation);
return new ConfigureResponse(bundleMessage, form);
}
return null;
}
form = makeConfigForm(configData, validation);
return new ConfigureResponse(resource.getString(validation + "_error"),
form);
}