use of org.talend.utils.exceptions.TalendException in project tdq-studio-se by Talend.
the class SoftwareSystemManager method updateSoftwareSystem.
/**
* Update the software systems given the database connection instance.<br>
*
* @param database connection (Talend type)
* @return
* @throws SQLException
*/
public void updateSoftwareSystem(DatabaseConnection databaseConnection) throws SQLException {
if (databaseConnection == null) {
return;
}
Resource softwareSystemResource = EMFSharedResources.getInstance().getSoftwareDeploymentResource();
List<EObject> softwareSystems = softwareSystemResource.getContents();
Boolean isExisted = Boolean.FALSE;
try {
isExisted = isExistedInSoftwareSystem(databaseConnection, softwareSystems);
} catch (TalendException e) {
log.debug(e.getMessage());
return;
}
if (!isExisted) {
update(databaseConnection, softwareSystems, softwareSystemResource);
}
}
use of org.talend.utils.exceptions.TalendException in project tdq-studio-se by Talend.
the class SoftwareSystemManager method isExistedInSoftwareSystem.
/**
* DOC zhao Comment method "isExistedInSoftwareSystem".
*
* @param databaseConnection
* @return
*/
private Boolean isExistedInSoftwareSystem(DatabaseConnection databaseConnection, List<EObject> softwareSystems) throws TalendException {
String databaseType = TaggedValueHelper.getValueString(TaggedValueHelper.DB_PRODUCT_NAME, databaseConnection);
if (StringUtils.isEmpty(databaseType)) {
// $NON-NLS-1$
throw new TalendException(Messages.getString("SoftwareSystemManager_NULL_DB_TYPE") + databaseConnection.getName());
}
String productVersion = TaggedValueHelper.getValueString(TaggedValueHelper.DB_PRODUCT_VERSION, databaseConnection);
for (EObject system : softwareSystems) {
if (system instanceof TdSoftwareSystem) {
if (StringUtils.equalsIgnoreCase(((TdSoftwareSystem) system).getSubtype(), databaseType) && StringUtils.endsWithIgnoreCase(((TdSoftwareSystem) system).getVersion(), productVersion)) {
// Found the software system given the database type and version.
return Boolean.TRUE;
}
}
}
return Boolean.FALSE;
}
Aggregations