return connInstance;
}
public ConnInstance updateConnInstance(final long connInstanceId, final ConnInstanceTO connInstanceTO) {
SyncopeClientCompositeErrorException scce = new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
SyncopeClientException requiredValuesMissing = new SyncopeClientException(
SyncopeClientExceptionType.RequiredValuesMissing);
if (connInstanceId == 0) {
requiredValuesMissing.addElement("connector id");
}
ConnInstance connInstance = connInstanceDAO.find(connInstanceId);
if (connInstanceTO.getLocation() != null) {
connInstance.setLocation(connInstanceTO.getLocation());
}
if (connInstanceTO.getBundleName() != null) {
connInstance.setBundleName(connInstanceTO.getBundleName());
}
if (connInstanceTO.getVersion() != null) {
connInstance.setVersion(connInstanceTO.getVersion());
}
if (connInstanceTO.getConnectorName() != null) {
connInstance.setConnectorName(connInstanceTO.getConnectorName());
}
if (connInstanceTO.getConfiguration() != null && !connInstanceTO.getConfiguration().isEmpty()) {
connInstance.setConfiguration(connInstanceTO.getConfiguration());
}
if (connInstanceTO.getDisplayName() != null) {
connInstance.setDisplayName(connInstanceTO.getDisplayName());
}
if (connInstanceTO.getConnRequestTimeout() != null) {
connInstance.setConnRequestTimeout(connInstanceTO.getConnRequestTimeout());
}
connInstance.setCapabilities(connInstanceTO.getCapabilities());
if (!requiredValuesMissing.isEmpty()) {
scce.addException(requiredValuesMissing);
}
// Throw composite exception if there is at least one element set
// in the composing exceptions
if (scce.hasExceptions()) {
throw scce;
}
return connInstance;
}