// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/LockDTO.java
// @Getter @Setter @NoArgsConstructor @AllArgsConstructor
// public class LockDTO implements Serializable {
// 
//     /**
//      * Serial Version UID.
//      */
//     private static final long serialVersionUID = -1244256114246115089L;
// 
//     /**
//      * The UID that has been now locked.
//      */
//     private String UID;
// 
//     /**
//      * A Unique Lock ID that has been defined to hold this lock.
//      */
//     private String lockID;
// 
//     /**
//      * The owner of this lock.
//      */
//     private String lockOwner;
// 
//     /**
//      * The DateTime that this lock will expire.
//      */
//     private DateTime lockExpiration;
// 
// }
// 
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/NewLockDTO.java
// @Getter @Setter @NoArgsConstructor
// public class NewLockDTO implements Serializable {
// 
//     /**
//      * Serial Version UID.
//      */
//     private static final long serialVersionUID = 8706080938884218602L;
// 
//     /**
//      * The Unique Identifier that the caller attempts to lock.
//      */
//     private String UID;
// 
//     /**
//      * The owner of this lock.
//      */
//     private String lockOwner;
// 
//     /**
//      * If provided, the expiration of the lock is set to this DateTime.
//      * </p>
//      * If not provided, the default lock expiration is set to T0+30m. Lock Expiration cannot be set to more than 8hrs.
//      */
//     private DateTime lockExpiration;
// 
//     /**
//      * Constructor with Mandatory fields.
//      *
//      * @param UID            a String with the UID
//      * @param lockOwner      a String with owner of this lock
//      */
//     public NewLockDTO(final String UID, final String lockOwner) {
//         this.UID = UID;
//         this.lockOwner = lockOwner;
//         lockExpiration = new DateTime().plusMinutes(30);
//     }
// 
// }
// 
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/QueryLockDTO.java
// @Getter @Setter @NoArgsConstructor @AllArgsConstructor
// public class QueryLockDTO implements Serializable {
// 
//     /**
//      * Serial Version UID.
//      */
//     private static final long serialVersionUID = 3214527307576872325L;
// 
//     /**
//      * The Unique Identifier that the caller attempts to lock.
//      */
//     @NotNull
//     private String UID;
// 
// }
// 
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/exceptions/LockNotAllowed.java
// public class LockNotAllowed extends BusinessException {
// 
//     /**
//      * Serial Version UID.
//      */
//     private static final long serialVersionUID = -8248743010140162906L;
//     
//     /**
//      * Constructor that allows a specific error message to be specified.
//      *
//      * @param message detail message.
//      */
//     public LockNotAllowed(String message) {
//         super(message);
//     }
// }
// 
// Path: server/src/main/java/com/sastix/cms/server/services/lock/LockService.java
// public interface LockService extends LockApi{
//     // Add any additional implementation
// }


import com.sastix.cms.common.lock.LockDTO;
import com.sastix.cms.common.lock.NewLockDTO;
import com.sastix.cms.common.lock.QueryLockDTO;
import com.sastix.cms.common.lock.exceptions.LockNotAllowed;
import com.sastix.cms.common.lock.exceptions.LockNotHeld;
import com.sastix.cms.server.services.lock.LockService;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
/*
 * Copyright(c) 2017 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.sastix.cms.server.services.lock.dummy;



@Slf4j
@Service
@Profile("dummy")
public class DummyLockService implements LockService {

    @Override
    public LockDTO lockResource(final NewLockDTO newLockDTO) throws LockNotAllowed {
        log.info("DummyLockService->lockResource");
        return null;
    }

    @Override
    public void unlockResource(final LockDTO lockDTO) throws LockNotHeld {
        log.info("DummyLockService->unlockResource");
    }

    @Override
    public LockDTO renewResourceLock(final LockDTO lockDTO) throws LockNotHeld, LockNotAllowed {
        log.info("DummyLockService->renewResourceLock");
        return null;
    }

    @Override
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/LockDTO.java
// @Getter @Setter @NoArgsConstructor @AllArgsConstructor
// public class LockDTO implements Serializable {
// 
//     /**
//      * Serial Version UID.
//      */
//     private static final long serialVersionUID = -1244256114246115089L;
// 
//     /**
//      * The UID that has been now locked.
//      */
//     private String UID;
// 
//     /**
//      * A Unique Lock ID that has been defined to hold this lock.
//      */
//     private String lockID;
// 
//     /**
//      * The owner of this lock.
//      */
//     private String lockOwner;
// 
//     /**
//      * The DateTime that this lock will expire.
//      */
//     private DateTime lockExpiration;
// 
// }
// 
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/NewLockDTO.java
// @Getter @Setter @NoArgsConstructor
// public class NewLockDTO implements Serializable {
// 
//     /**
//      * Serial Version UID.
//      */
//     private static final long serialVersionUID = 8706080938884218602L;
// 
//     /**
//      * The Unique Identifier that the caller attempts to lock.
//      */
//     private String UID;
// 
//     /**
//      * The owner of this lock.
//      */
//     private String lockOwner;
// 
//     /**
//      * If provided, the expiration of the lock is set to this DateTime.
//      * </p>
//      * If not provided, the default lock expiration is set to T0+30m. Lock Expiration cannot be set to more than 8hrs.
//      */
//     private DateTime lockExpiration;
// 
//     /**
//      * Constructor with Mandatory fields.
//      *
//      * @param UID            a String with the UID
//      * @param lockOwner      a String with owner of this lock
//      */
//     public NewLockDTO(final String UID, final String lockOwner) {
//         this.UID = UID;
//         this.lockOwner = lockOwner;
//         lockExpiration = new DateTime().plusMinutes(30);
//     }
// 
// }
// 
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/QueryLockDTO.java
// @Getter @Setter @NoArgsConstructor @AllArgsConstructor
// public class QueryLockDTO implements Serializable {
// 
//     /**
//      * Serial Version UID.
//      */
//     private static final long serialVersionUID = 3214527307576872325L;
// 
//     /**
//      * The Unique Identifier that the caller attempts to lock.
//      */
//     @NotNull
//     private String UID;
// 
// }
// 
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/exceptions/LockNotAllowed.java
// public class LockNotAllowed extends BusinessException {
// 
//     /**
//      * Serial Version UID.
//      */
//     private static final long serialVersionUID = -8248743010140162906L;
//     
//     /**
//      * Constructor that allows a specific error message to be specified.
//      *
//      * @param message detail message.
//      */
//     public LockNotAllowed(String message) {
//         super(message);
//     }
// }
// 
// Path: server/src/main/java/com/sastix/cms/server/services/lock/LockService.java
// public interface LockService extends LockApi{
//     // Add any additional implementation
// }


// Path: server/src/main/java/com/sastix/cms/server/services/lock/dummy/DummyLockService.java
import com.sastix.cms.common.lock.LockDTO;
import com.sastix.cms.common.lock.NewLockDTO;
import com.sastix.cms.common.lock.QueryLockDTO;
import com.sastix.cms.common.lock.exceptions.LockNotAllowed;
import com.sastix.cms.common.lock.exceptions.LockNotHeld;
import com.sastix.cms.server.services.lock.LockService;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;

/*
 * Copyright(c) 2017 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.sastix.cms.server.services.lock.dummy;



@Slf4j
@Service
@Profile("dummy")
public class DummyLockService implements LockService {

    @Override
    public LockDTO lockResource(final NewLockDTO newLockDTO) throws LockNotAllowed {
        log.info("DummyLockService->lockResource");
        return null;
    }

    @Override
    public void unlockResource(final LockDTO lockDTO) throws LockNotHeld {
        log.info("DummyLockService->unlockResource");
    }

    @Override
    public LockDTO renewResourceLock(final LockDTO lockDTO) throws LockNotHeld, LockNotAllowed {
        log.info("DummyLockService->renewResourceLock");
        return null;
    }

    @Override
    public LockDTO queryResourceLock(QueryLockDTO queryLockDTO) {