1 /*******************************************************************************
2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
17 ******************************************************************************/
18 package org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.database.types;
20 import java.util.Collections;
22 import org.eclipse.jdt.annotation.Nullable;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.maintenance.mode.g.filter.Definition;
24 import org.opendaylight.yangtools.yang.binding.Augmentation;
25 import org.opendaylight.yangtools.yang.binding.DataContainer;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
29 import com.fasterxml.jackson.annotation.JsonIgnore;
30 import com.fasterxml.jackson.annotation.JsonProperty;
32 public class EsMaintenanceFilterDefinition implements Definition {
34 private static final Logger LOG = LoggerFactory.getLogger(EsMaintenanceFilterDefinition.class);
35 private static final String ALL = "";
39 private final Map<java.lang.Class<? extends Augmentation<Definition>>, Augmentation<Definition>> augmentation = Collections.emptyMap();
41 private String objectIdRef = ALL;
42 private String problem = ALL;
44 public EsMaintenanceFilterDefinition() {
47 public EsMaintenanceFilterDefinition(Definition definition) {
48 objectIdRef = definition.getObjectIdRef();
49 problem = definition.getProblem();
53 @JsonProperty("object-id-ref")
54 public String getObjectIdRef() {
58 @JsonProperty("object-id-ref")
59 public void setObjectIdRef(String objectIdRef) {
60 this.objectIdRef = objectIdRef == null ? ALL : objectIdRef;
64 @JsonProperty("problem")
65 public String getProblem() {
69 @JsonProperty("problem")
70 public void setProblem(String pProblem) {
71 this.problem = pProblem == null ? ALL : pProblem;
74 public boolean appliesToObjectReference(String pObjectIdRef, String pProblem) {
75 boolean res = (pObjectIdRef.isEmpty() || pObjectIdRef.contains(pObjectIdRef)) && (pProblem.isEmpty() || pProblem.contains(pProblem));
76 LOG.debug("Check result applies {}: {} {} against: {}",res, pObjectIdRef, pProblem, this);
81 public String toString() {
82 return "EsMaintenanceFilterDefinition [objectIdRef=" + objectIdRef + ", problem=" + problem + "]";
86 public Class<? extends DataContainer> getImplementedInterface() {
87 return Definition.class;
91 public <E extends Augmentation<Definition>> @Nullable E augmentation(Class<E> augmentationType) {