// Path: libreplan-business/src/main/java/org/libreplan/business/common/entities/Connector.java
// public class Connector extends BaseEntity {
// 
//     public static Connector create(String name) {
//         return create(new Connector(name));
//     }
// 
//     private String name;
// 
//     private List<ConnectorProperty> properties = new ArrayList<>();
// 
//     /**
//      * Constructor for Hibernate. Do not use!
//      */
//     protected Connector() {
//     }
// 
//     private Connector(String name) {
//         this.name = name;
//     }
// 
//     @NotEmpty(message = "name not specified")
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     @Valid
//     public List<ConnectorProperty> getProperties() {
//         return Collections.unmodifiableList(properties);
//     }
// 
//     public void setProperties(List<ConnectorProperty> properties) {
//         this.properties = properties;
//     }
// 
//     public void addProperty(ConnectorProperty property) {
//         properties.add(property);
//     }
// 
//     public Map<String, String> getPropertiesAsMap() {
//         Map<String, String> map = new HashMap<>();
//         for (ConnectorProperty property : properties) {
//             map.put(property.getKey(), property.getValue());
//         }
// 
//         return map;
//     }
// 
//     @AssertTrue(message = "connector name is already being used")
//     public boolean isUniqueConnectorNameConstraint() {
//         if ( StringUtils.isBlank(name) ) {
//             return true;
//         }
// 
//         IConnectorDAO connectorDAO = Registry.getConnectorDAO();
//         if ( isNewObject() ) {
//             return !connectorDAO.existsByNameAnotherTransaction(this);
//         } else {
//             Connector found = connectorDAO.findUniqueByNameAnotherTransaction(name);
// 
//             return found == null || found.getId().equals(getId());
//         }
// 
//     }
// 
//     public boolean isActivated() {
//         return getPropertiesAsMap().get(PredefinedConnectorProperties.ACTIVATED).equalsIgnoreCase("Y");
//     }
// 
//     /**
//      * Check if connector's connections values are valid
//      *
//      * @return true if connection values are valid
//      */
//     public boolean areConnectionValuesValid() {
//         String serverUrl = getPropertiesAsMap().get(PredefinedConnectorProperties.SERVER_URL);
//         try {
//             new URL(serverUrl);
//         } catch (MalformedURLException e) {
//             return false;
//         }
// 
//         return !StringUtils.isBlank(getPropertiesAsMap().get(PredefinedConnectorProperties.USERNAME)) &&
//                 !StringUtils.isBlank(getPropertiesAsMap().get(PredefinedConnectorProperties.PASSWORD));
// 
//     }
// }


import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.libreplan.business.common.daos.IConnectorDAO;
import org.libreplan.business.common.daos.IJobSchedulerConfigurationDAO;
import org.libreplan.business.common.entities.Connector;
import org.libreplan.business.common.entities.JobClassNameEnum;
import org.libreplan.business.common.entities.JobSchedulerConfiguration;
import org.quartz.CronExpression;
import org.quartz.CronTrigger;
import org.quartz.JobExecutionContext;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.TriggerKey;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Scope;
import org.springframework.scheduling.quartz.CronTriggerFactoryBean;
import org.springframework.scheduling.quartz.JobDetailFactoryBean;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
            return;
        }

        if ( !jobSchedulerConfiguration.isSchedule() ) {
            deleteJob(jobSchedulerConfiguration);

            return;
        }
        scheduleNewJob(jobSchedulerConfiguration);
    }

    /**
     * Check if {@link JobSchedulerConfiguration} has a connector
     *
     * @param connectorName
     *            the connector to check for
     * @return true if connector is not null or empty
     */
    private boolean hasConnector(String connectorName) {
        return !StringUtils.isBlank(connectorName);
    }

    /**
     * Check if the specified <code>{@link Connector}</code> is activated
     *
     * @param connectorName
     *            the connector to check for activated
     * @return true if activated
     */
    private boolean isConnectorActivated(String connectorName) {
// Path: libreplan-business/src/main/java/org/libreplan/business/common/entities/Connector.java
// public class Connector extends BaseEntity {
// 
//     public static Connector create(String name) {
//         return create(new Connector(name));
//     }
// 
//     private String name;
// 
//     private List<ConnectorProperty> properties = new ArrayList<>();
// 
//     /**
//      * Constructor for Hibernate. Do not use!
//      */
//     protected Connector() {
//     }
// 
//     private Connector(String name) {
//         this.name = name;
//     }
// 
//     @NotEmpty(message = "name not specified")
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     @Valid
//     public List<ConnectorProperty> getProperties() {
//         return Collections.unmodifiableList(properties);
//     }
// 
//     public void setProperties(List<ConnectorProperty> properties) {
//         this.properties = properties;
//     }
// 
//     public void addProperty(ConnectorProperty property) {
//         properties.add(property);
//     }
// 
//     public Map<String, String> getPropertiesAsMap() {
//         Map<String, String> map = new HashMap<>();
//         for (ConnectorProperty property : properties) {
//             map.put(property.getKey(), property.getValue());
//         }
// 
//         return map;
//     }
// 
//     @AssertTrue(message = "connector name is already being used")
//     public boolean isUniqueConnectorNameConstraint() {
//         if ( StringUtils.isBlank(name) ) {
//             return true;
//         }
// 
//         IConnectorDAO connectorDAO = Registry.getConnectorDAO();
//         if ( isNewObject() ) {
//             return !connectorDAO.existsByNameAnotherTransaction(this);
//         } else {
//             Connector found = connectorDAO.findUniqueByNameAnotherTransaction(name);
// 
//             return found == null || found.getId().equals(getId());
//         }
// 
//     }
// 
//     public boolean isActivated() {
//         return getPropertiesAsMap().get(PredefinedConnectorProperties.ACTIVATED).equalsIgnoreCase("Y");
//     }
// 
//     /**
//      * Check if connector's connections values are valid
//      *
//      * @return true if connection values are valid
//      */
//     public boolean areConnectionValuesValid() {
//         String serverUrl = getPropertiesAsMap().get(PredefinedConnectorProperties.SERVER_URL);
//         try {
//             new URL(serverUrl);
//         } catch (MalformedURLException e) {
//             return false;
//         }
// 
//         return !StringUtils.isBlank(getPropertiesAsMap().get(PredefinedConnectorProperties.USERNAME)) &&
//                 !StringUtils.isBlank(getPropertiesAsMap().get(PredefinedConnectorProperties.PASSWORD));
// 
//     }
// }


// Path: libreplan-webapp/src/main/java/org/libreplan/importers/SchedulerManager.java
import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.libreplan.business.common.daos.IConnectorDAO;
import org.libreplan.business.common.daos.IJobSchedulerConfigurationDAO;
import org.libreplan.business.common.entities.Connector;
import org.libreplan.business.common.entities.JobClassNameEnum;
import org.libreplan.business.common.entities.JobSchedulerConfiguration;
import org.quartz.CronExpression;
import org.quartz.CronTrigger;
import org.quartz.JobExecutionContext;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.TriggerKey;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Scope;
import org.springframework.scheduling.quartz.CronTriggerFactoryBean;
import org.springframework.scheduling.quartz.JobDetailFactoryBean;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

            return;
        }

        if ( !jobSchedulerConfiguration.isSchedule() ) {
            deleteJob(jobSchedulerConfiguration);

            return;
        }
        scheduleNewJob(jobSchedulerConfiguration);
    }

    /**
     * Check if {@link JobSchedulerConfiguration} has a connector
     *
     * @param connectorName
     *            the connector to check for
     * @return true if connector is not null or empty
     */
    private boolean hasConnector(String connectorName) {
        return !StringUtils.isBlank(connectorName);
    }

    /**
     * Check if the specified <code>{@link Connector}</code> is activated
     *
     * @param connectorName
     *            the connector to check for activated
     * @return true if activated
     */
    private boolean isConnectorActivated(String connectorName) {
        Connector connector = connectorDAO.findUniqueByName(connectorName);