<commit_before>/*
 * Copyright (c) 2016 Open Baton (http://www.openbaton.org)
 *
 * 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 org.openbaton.catalogue.mano.record;

import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import org.openbaton.catalogue.mano.common.AutoScalePolicy;
import org.openbaton.catalogue.mano.common.ConnectionPoint;
import org.openbaton.catalogue.mano.common.LifecycleEvent;
import org.openbaton.catalogue.mano.common.NetworkServiceDeploymentFlavour;
import org.openbaton.catalogue.mano.common.faultmanagement.FaultManagementPolicy;
import org.openbaton.catalogue.util.BaseEntity;

/**
 * Created by lto on 06/02/15.
 *
 * <p>Based on ETSI GS NFV-MAN 001 V1.1.1 (2014-12)
 */
@Entity
public class NetworkServiceRecord extends BaseEntity {

  @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
  private Set<AutoScalePolicy> auto_scale_policy;

  @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
  private Set<ConnectionPoint> connection_point;
  /** Monitoring parameter used in this instance. */
  @ElementCollection(fetch = FetchType.EAGER)
  private Set<String> monitoring_parameter;
  /**
   * References the nsd:service_deployment_flavour used to instantiate this Network Service
   * instance.
   */
  @OneToOne(cascade = CascadeType.REFRESH)
  private NetworkServiceDeploymentFlavour service_deployment_flavour;

  private String vendor;
  private String task;

  private String version;

  @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
  private Set<VirtualLinkRecord> vlr;

  @OneToMany(
    cascade = {
      /*CascadeType.PERSIST, CascadeType.MERGE*/
      CascadeType.ALL
    },
    fetch = FetchType.EAGER
  )
  private Set<VirtualNetworkFunctionRecord> vnfr;

  @OneToMany(
    cascade = {<commit_msg>fix add orphan removal for vnfr<commit_after>/*
 * Copyright (c) 2016 Open Baton (http://www.openbaton.org)
 *
 * 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 org.openbaton.catalogue.mano.record;

import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import org.openbaton.catalogue.mano.common.AutoScalePolicy;
import org.openbaton.catalogue.mano.common.ConnectionPoint;
import org.openbaton.catalogue.mano.common.LifecycleEvent;
import org.openbaton.catalogue.mano.common.NetworkServiceDeploymentFlavour;
import org.openbaton.catalogue.mano.common.faultmanagement.FaultManagementPolicy;
import org.openbaton.catalogue.util.BaseEntity;

/**
 * Created by lto on 06/02/15.
 *
 * <p>Based on ETSI GS NFV-MAN 001 V1.1.1 (2014-12)
 */
@Entity
public class NetworkServiceRecord extends BaseEntity {

  @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
  private Set<AutoScalePolicy> auto_scale_policy;

  @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
  private Set<ConnectionPoint> connection_point;
  /** Monitoring parameter used in this instance. */
  @ElementCollection(fetch = FetchType.EAGER)
  private Set<String> monitoring_parameter;
  /**
   * References the nsd:service_deployment_flavour used to instantiate this Network Service
   * instance.
   */
  @OneToOne(cascade = CascadeType.REFRESH)
  private NetworkServiceDeploymentFlavour service_deployment_flavour;

  private String vendor;
  private String task;

  private String version;

  @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
  private Set<VirtualLinkRecord> vlr;

  @OneToMany(
    cascade = {
      /*CascadeType.PERSIST, CascadeType.MERGE*/
      CascadeType.ALL
    },
    fetch = FetchType.EAGER,
    orphanRemoval = true
  )
  private Set<VirtualNetworkFunctionRecord> vnfr;

  @OneToMany(
    cascade = {
{'fraction_non_alphanumeric': 0.08992666923967581, 'fraction_numerical': 0.010034735623311463, 'mean_word_length': 4.639825897714908, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4827710', 'n_tokens_mistral': 1628, 'n_tokens_neox': 1574, 'n_words': 415}