// Path: src/main/java/io/pivotal/strepsirrhini/chaosloris/data/Application.java
// @Entity
// public class Application {
// 
//     @Column(nullable = false, unique = true)
//     private UUID applicationId;
// 
//     @Column(nullable = false)
//     @GeneratedValue
//     @Id
//     @JsonIgnore
//     private Long id;
// 
//     /**
//      * Create a new instance
//      *
//      * @param applicationId the Cloud Foundry application id
//      */
//     public Application(UUID applicationId) {
//         this.applicationId = applicationId;
//     }
// 
//     Application() {
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) {
//             return true;
//         }
//         if (o == null || getClass() != o.getClass()) {
//             return false;
//         }
//         Application that = (Application) o;
//         return Objects.equals(this.applicationId, that.applicationId) &&
//             Objects.equals(this.id, that.id);
//     }
// 
//     /**
//      * Returns the application id
//      *
//      * @return the application id
//      */
//     public UUID getApplicationId() {
//         return this.applicationId;
//     }
// 
//     /**
//      * Returns the id
//      *
//      * @return the id
//      */
//     public Long getId() {
//         return this.id;
//     }
// 
//     /**
//      * Sets the id
//      *
//      * @param id the id
//      */
//     public void setId(Long id) {
//         this.id = id;
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(this.applicationId, this.id);
//     }
// 
//     @Override
//     public String toString() {
//         return "Application{" +
//             "applicationId=" + this.applicationId +
//             ", id=" + this.id +
//             '}';
//     }
// 
// }
// 
// Path: src/main/java/io/pivotal/strepsirrhini/chaosloris/data/ApplicationRepository.java
// @Repository
// public interface ApplicationRepository extends JpaRepository<Application, Long> {
// 
// }


import io.pivotal.strepsirrhini.chaosloris.data.Application;
import io.pivotal.strepsirrhini.chaosloris.data.ApplicationRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PagedResourcesAssembler;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.DELETE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
/*
 * Copyright 2015-2018 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 io.pivotal.strepsirrhini.chaosloris.web;




@RestController
@RequestMapping("/applications")
public class ApplicationController {

    private final ApplicationRepository applicationRepository;

    private final ApplicationResourceAssembler applicationResourceAssembler;

    @Autowired
    ApplicationController(ApplicationRepository applicationRepository, ApplicationResourceAssembler applicationResourceAssembler) {
        this.applicationRepository = applicationRepository;
        this.applicationResourceAssembler = applicationResourceAssembler;
    }

    @Transactional
    @RequestMapping(method = POST, value = "", consumes = APPLICATION_JSON_VALUE)
    public ResponseEntity create(@Valid @RequestBody ApplicationCreateInput input) {
// Path: src/main/java/io/pivotal/strepsirrhini/chaosloris/data/Application.java
// @Entity
// public class Application {
// 
//     @Column(nullable = false, unique = true)
//     private UUID applicationId;
// 
//     @Column(nullable = false)
//     @GeneratedValue
//     @Id
//     @JsonIgnore
//     private Long id;
// 
//     /**
//      * Create a new instance
//      *
//      * @param applicationId the Cloud Foundry application id
//      */
//     public Application(UUID applicationId) {
//         this.applicationId = applicationId;
//     }
// 
//     Application() {
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) {
//             return true;
//         }
//         if (o == null || getClass() != o.getClass()) {
//             return false;
//         }
//         Application that = (Application) o;
//         return Objects.equals(this.applicationId, that.applicationId) &&
//             Objects.equals(this.id, that.id);
//     }
// 
//     /**
//      * Returns the application id
//      *
//      * @return the application id
//      */
//     public UUID getApplicationId() {
//         return this.applicationId;
//     }
// 
//     /**
//      * Returns the id
//      *
//      * @return the id
//      */
//     public Long getId() {
//         return this.id;
//     }
// 
//     /**
//      * Sets the id
//      *
//      * @param id the id
//      */
//     public void setId(Long id) {
//         this.id = id;
//     }
// 
//     @Override
//     public int hashCode() {
//         return Objects.hash(this.applicationId, this.id);
//     }
// 
//     @Override
//     public String toString() {
//         return "Application{" +
//             "applicationId=" + this.applicationId +
//             ", id=" + this.id +
//             '}';
//     }
// 
// }
// 
// Path: src/main/java/io/pivotal/strepsirrhini/chaosloris/data/ApplicationRepository.java
// @Repository
// public interface ApplicationRepository extends JpaRepository<Application, Long> {
// 
// }


// Path: src/main/java/io/pivotal/strepsirrhini/chaosloris/web/ApplicationController.java
import io.pivotal.strepsirrhini.chaosloris.data.Application;
import io.pivotal.strepsirrhini.chaosloris.data.ApplicationRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PagedResourcesAssembler;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.DELETE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;

/*
 * Copyright 2015-2018 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 io.pivotal.strepsirrhini.chaosloris.web;




@RestController
@RequestMapping("/applications")
public class ApplicationController {

    private final ApplicationRepository applicationRepository;

    private final ApplicationResourceAssembler applicationResourceAssembler;

    @Autowired
    ApplicationController(ApplicationRepository applicationRepository, ApplicationResourceAssembler applicationResourceAssembler) {
        this.applicationRepository = applicationRepository;
        this.applicationResourceAssembler = applicationResourceAssembler;
    }

    @Transactional
    @RequestMapping(method = POST, value = "", consumes = APPLICATION_JSON_VALUE)
    public ResponseEntity create(@Valid @RequestBody ApplicationCreateInput input) {
        Application application = new Application(input.getApplicationId());