// Path: services/ldap/api/src/main/java/eu/hlavki/identity/services/ldap/LdapSystemException.java
// public class LdapSystemException extends RuntimeException {
// 
//     private static final long serialVersionUID = 1L;
// 
// 
//     public LdapSystemException(String message) {
//         super(message);
//     }
// 
// 
//     public LdapSystemException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
// 
//     public LdapSystemException(Throwable cause) {
//         super(cause);
//     }
// 
// 
//     public LdapSystemException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
// }
// 
// Path: services/synchronize/api/src/main/java/eu/hlavki/identity/services/sync/AccountSyncService.java
// public interface AccountSyncService {
// 
//     void synchronizeUserGroups(UserInfo userInfo);
// 
// 
//     void synchronizeGroup(String groupEmail) throws ResourceNotFoundException;
// 
// 
//     void removeGroup(String groupEmail);
// 
// 
//     void synchronizeAllGroups();
// 
// 
//     void synchronizeGSuiteUser(String email);
// 
// 
//     void synchronizeGSuiteUsers();
// 
// 
//     void removeUserByEmail(String email);
// 
// 
//     void cleanExternalUsers();
// }


import eu.hlavki.identity.services.ldap.LdapSystemException;
import eu.hlavki.identity.services.sync.AccountSyncService;
import org.apache.karaf.scheduler.Job;
import org.apache.karaf.scheduler.JobContext;
import org.apache.karaf.scheduler.Scheduler;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
package eu.hlavki.identity.services.scheduler;


@Component(immediate = true, property = {
    Scheduler.PROPERTY_SCHEDULER_EXPRESSION + "=0 0 * * * ?",
    Scheduler.PROPERTY_SCHEDULER_NAME + "=SyncGroups",
    Scheduler.PROPERTY_SCHEDULER_CONCURRENT + ":Boolean=false"})
public class SyncGroupsJob implements Job {

    private static final Logger LOG = LoggerFactory.getLogger(SyncGroupsJob.class);

    @Reference
    private AccountSyncService syncService;

    @Override
    public void execute(JobContext context) {
        try {
            LOG.info("Running scheduler for synchronizing all group");
            syncService.synchronizeAllGroups();
// Path: services/ldap/api/src/main/java/eu/hlavki/identity/services/ldap/LdapSystemException.java
// public class LdapSystemException extends RuntimeException {
// 
//     private static final long serialVersionUID = 1L;
// 
// 
//     public LdapSystemException(String message) {
//         super(message);
//     }
// 
// 
//     public LdapSystemException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
// 
//     public LdapSystemException(Throwable cause) {
//         super(cause);
//     }
// 
// 
//     public LdapSystemException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
// }
// 
// Path: services/synchronize/api/src/main/java/eu/hlavki/identity/services/sync/AccountSyncService.java
// public interface AccountSyncService {
// 
//     void synchronizeUserGroups(UserInfo userInfo);
// 
// 
//     void synchronizeGroup(String groupEmail) throws ResourceNotFoundException;
// 
// 
//     void removeGroup(String groupEmail);
// 
// 
//     void synchronizeAllGroups();
// 
// 
//     void synchronizeGSuiteUser(String email);
// 
// 
//     void synchronizeGSuiteUsers();
// 
// 
//     void removeUserByEmail(String email);
// 
// 
//     void cleanExternalUsers();
// }


// Path: services/synchronize/scheduler/src/main/java/eu/hlavki/identity/services/scheduler/SyncGroupsJob.java
import eu.hlavki.identity.services.ldap.LdapSystemException;
import eu.hlavki.identity.services.sync.AccountSyncService;
import org.apache.karaf.scheduler.Job;
import org.apache.karaf.scheduler.JobContext;
import org.apache.karaf.scheduler.Scheduler;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

package eu.hlavki.identity.services.scheduler;


@Component(immediate = true, property = {
    Scheduler.PROPERTY_SCHEDULER_EXPRESSION + "=0 0 * * * ?",
    Scheduler.PROPERTY_SCHEDULER_NAME + "=SyncGroups",
    Scheduler.PROPERTY_SCHEDULER_CONCURRENT + ":Boolean=false"})
public class SyncGroupsJob implements Job {

    private static final Logger LOG = LoggerFactory.getLogger(SyncGroupsJob.class);

    @Reference
    private AccountSyncService syncService;

    @Override
    public void execute(JobContext context) {
        try {
            LOG.info("Running scheduler for synchronizing all group");
            syncService.synchronizeAllGroups();
        } catch (LdapSystemException e) {