diff options
author | liamfallon <liam.fallon@est.tech> | 2019-03-05 09:35:16 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2019-03-05 09:35:16 +0000 |
commit | b694be156d4b022e24347259f494ee3b46d47bdb (patch) | |
tree | 157848f4edaf56233e49890cda02e339d1d49558 /models-tosca/src/main/java/org | |
parent | ec6fe7ea854632943a2c3c30ffa49e799bb1fc49 (diff) |
Add DAO module for Models
This patch set fixes some typos and license headers.
Issue-ID: POLICY-1195
Change-Id: I2d15b00fcb50ea92746ab7c5a87b57efa07196fe
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-tosca/src/main/java/org')
12 files changed, 900 insertions, 0 deletions
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaConstraint.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaConstraint.java new file mode 100644 index 000000000..47a4d35a6 --- /dev/null +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaConstraint.java @@ -0,0 +1,93 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.models.tosca; + +import com.google.gson.annotations.SerializedName; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the Constraint of property in TOSCA definition. + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaConstraint { + + @Getter + @Setter + @SerializedName("equal") + private String equal; + + @Getter + @Setter + @SerializedName("greater_than") + private String greaterThan; + + @Getter + @Setter + @SerializedName("greater_or_equal") + private String greaterOrEqual; + + @Getter + @Setter + @SerializedName("less_than") + private String lessThan; + + @Getter + @Setter + @SerializedName("less_or_equal") + private String lessOrEqual; + + @Getter + @Setter + @SerializedName("in_range") + private String inRange; + + @Getter + @Setter + @SerializedName("valid_values") + private String validValues; + + @Getter + @Setter + @SerializedName("length") + private String length; + + @Getter + @Setter + @SerializedName("min_length") + private String minLength; + + @Getter + @Setter + @SerializedName("max_length") + private String maxLength; + + @Getter + @Setter + @SerializedName("pattern") + private String pattern; +}
\ No newline at end of file diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaDataType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaDataType.java new file mode 100644 index 000000000..0366ee467 --- /dev/null +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaDataType.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.models.tosca; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import java.util.Map; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent custom data type in TOSCA definition. + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaDataType { + @Getter + @Setter + @SerializedName("derived_from") + private String derivedFrom; + + @Getter + @Setter + @SerializedName("version") + private String version; + + @Getter + @Setter + @SerializedName("metadata") + private Map<String, String> metadata; + + @Getter + @Setter + @SerializedName("description") + private String description; + + @Getter + @Setter + @SerializedName("constraints") + private List<ToscaConstraint> constraints; + + @Getter + @Setter + @SerializedName("properties") + private List<Map<String, ToscaProperty>> properties; +}
\ No newline at end of file diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaEntityType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaEntityType.java new file mode 100644 index 000000000..52a82cc53 --- /dev/null +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaEntityType.java @@ -0,0 +1,168 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.models.tosca; + +import com.google.gson.annotations.SerializedName; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TreeMap; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NonNull; + +import org.onap.policy.common.utils.validation.Assertions; +import org.onap.policy.models.base.PfConcept; +import org.onap.policy.models.base.PfConceptKey; +import org.onap.policy.models.base.PfKey; +import org.onap.policy.models.base.PfValidationResult; + +/** + * Class to represent the EntrySchema of list/map property in TOSCA definition. + */ +@Entity +@Table(name = "ToscaEntityType") +@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) +@Data +@EqualsAndHashCode(callSuper = false) +public class ToscaEntityType extends PfConcept { + private static final long serialVersionUID = -1330661834220739393L; + + @EmbeddedId + @NonNull + private PfConceptKey key = PfConceptKey.getNullKey(); + + @SerializedName("derived_from") + @Column(name = "derivedFrom") + private PfConceptKey derivedFrom; + + @OneToMany(cascade = CascadeType.ALL) + private Map<String, String> metadata; + + @Column(name = "description") + private String description; + + /** + * The Default Constructor creates a {@link ToscaEntityType} object with a null key. + */ + public ToscaEntityType() { + this(new PfConceptKey()); + } + + /** + * The Key Constructor creates a {@link ToscaEntityType} object with the given concept key. + * + * @param key the key + */ + public ToscaEntityType(@NonNull final PfConceptKey key) { + this.key = key; + } + + /** + * Copy constructor. + * + * @param copyConcept the concept to copy from + */ + public ToscaEntityType(final ToscaEntityType copyConcept) { + super(copyConcept); + } + + @Override + public List<PfKey> getKeys() { + final List<PfKey> keyList = new ArrayList<>(); + keyList.add(getKey()); + return keyList; + } + + @Override + public void clean() { + description = description.trim(); + + for (Entry<String, String> metadataEntry : metadata.entrySet()) { + metadataEntry.setValue(metadataEntry.getValue().trim()); + } + } + + @Override + public PfValidationResult validate(PfValidationResult result) { + return null; + } + + @Override + public int compareTo(final PfConcept otherConcept) { + if (otherConcept == null) { + return -1; + } + if (this == otherConcept) { + return 0; + } + if (getClass() != otherConcept.getClass()) { + return this.hashCode() - otherConcept.hashCode(); + } + + final ToscaEntityType other = (ToscaEntityType) otherConcept; + if (!key.equals(other.key)) { + return key.compareTo(other.key); + } + + if (!derivedFrom.equals(other.derivedFrom)) { + return derivedFrom.compareTo(other.derivedFrom); + } + + if (!metadata.equals(other.metadata)) { + return (metadata.hashCode() - other.metadata.hashCode()); + } + + return description.compareTo(other.description); + } + + @Override + public PfConcept copyTo(@NonNull PfConcept target) { + final Object copyObject = target; + Assertions.instanceOf(copyObject, PfConcept.class); + + final ToscaEntityType copy = ((ToscaEntityType) copyObject); + copy.key = new PfConceptKey(key); + copy.derivedFrom = new PfConceptKey(derivedFrom); + + final Map<String, String> newMatadata = new TreeMap<>(); + for (final Entry<String, String> metadataEntry : metadata.entrySet()) { + newMatadata.put(metadataEntry.getKey(), metadataEntry.getValue()); + } + copy.metadata = newMatadata; + + copy.description = description; + + return copy; + } +} diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaEntrySchema.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaEntrySchema.java new file mode 100644 index 000000000..b3079afc0 --- /dev/null +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaEntrySchema.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.models.tosca; + +import com.google.gson.annotations.SerializedName; +import java.util.List; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the EntrySchema of list/map property in TOSCA definition. + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaEntrySchema { + + @Getter + @Setter + @SerializedName("description") + private String description; + + @Getter + @Setter + @SerializedName("type") + private String type; + + @Getter + @Setter + @SerializedName("constraints") + private List<ToscaConstraint> constraints; +}
\ No newline at end of file diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaEventFilter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaEventFilter.java new file mode 100644 index 000000000..34d791202 --- /dev/null +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaEventFilter.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.models.tosca; + +import com.google.gson.annotations.SerializedName; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the EventFilter in TOSCA definition. + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaEventFilter { + + @Getter + @Setter + @SerializedName("node") + private String node; + + @Getter + @Setter + @SerializedName("requirement") + private String requirement; + + @Getter + @Setter + @SerializedName("capability") + private String capability; +}
\ No newline at end of file diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicy.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicy.java new file mode 100644 index 000000000..4f9210c43 --- /dev/null +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicy.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.models.tosca; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import java.util.Map; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the policy in TOSCA definition. + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaPolicy { + + @Getter + @Setter + @SerializedName("type") + private String type; + + @Getter + @Setter + @SerializedName("description") + private String description; + + @Getter + @Setter + @SerializedName("metadata") + private Map<String, String> metadata; + + @Getter + @Setter + @SerializedName("properties") + private List<Map<String, String>> properties; + + @Getter + @Setter + @SerializedName("targets") + private List<String> targets; + + @Getter + @Setter + @SerializedName("triggers") + private List<Map<String, ToscaTrigger>> triggers; +}
\ No newline at end of file diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicyList.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicyList.java new file mode 100644 index 000000000..ad8f1a498 --- /dev/null +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicyList.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.models.tosca; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import java.util.Map; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the policy list in TOSCA definition. + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaPolicyList { + + @Getter + @Setter + @SerializedName("policies") + private List<Map<String, ToscaPolicy>> policies; + + @Getter + @Setter + @SerializedName("data_types") + private List<Map<String, ToscaDataType>> dataTypes; +}
\ No newline at end of file diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicyType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicyType.java new file mode 100644 index 000000000..241e178f5 --- /dev/null +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicyType.java @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.models.tosca; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import java.util.Map; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the policy type in TOSCA definition. + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaPolicyType { + + @Getter + @Setter + @SerializedName("derived_from") + private String derivedFrom; + + @Getter + @Setter + @SerializedName("version") + private String version; + + @Getter + @Setter + @SerializedName("metadata") + private Map<String, String> metadata; + + @Getter + @Setter + @SerializedName("description") + private String description; + + @Getter + @Setter + @SerializedName("properties") + private List<Map<String, ToscaProperty>> properties; + + @Getter + @Setter + @SerializedName("targets") + private List<String> targets; + + @Getter + @Setter + @SerializedName("triggers") + private List<Map<String, ToscaTrigger>> triggers; +}
\ No newline at end of file diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicyTypeList.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicyTypeList.java new file mode 100644 index 000000000..4a6a42dbd --- /dev/null +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicyTypeList.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.models.tosca; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import java.util.Map; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the policy type list in TOSCA definition. + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaPolicyTypeList { + + @Getter + @Setter + @SerializedName("policy_types") + private List<Map<String, ToscaPolicyType>> policyTypes; + + @Getter + @Setter + @SerializedName("data_types") + private List<Map<String, ToscaDataType>> dataTypes; +}
\ No newline at end of file diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaProperty.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaProperty.java new file mode 100644 index 000000000..4ee5c45ec --- /dev/null +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaProperty.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.models.tosca; + +import com.google.gson.annotations.SerializedName; +import java.util.List; + +import javax.persistence.Column; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import org.onap.policy.models.base.PfConceptKey; + +/** + * Class to represent the property in TOSCA definition. + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaProperty { + + @Getter + @Setter + @SerializedName("type") + @Column(name = "derivedFrom") + private PfConceptKey type; + + @Getter + @Setter + @SerializedName("description") + private String description; + + @Getter + @Setter + @SerializedName("required") + private boolean required; + + @Getter + @Setter + @SerializedName("default_value") + private Object defaultValue; + + @Getter + @Setter + @SerializedName("status") + private String status; + + @Getter + @Setter + @SerializedName("constraints") + private List<ToscaConstraint> constraints; + + @Getter + @Setter + @SerializedName("entry_schema") + private ToscaEntrySchema entrySchema; +}
\ No newline at end of file diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaTimeInterval.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaTimeInterval.java new file mode 100644 index 000000000..86334ab7f --- /dev/null +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaTimeInterval.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.models.tosca; + +import com.google.gson.annotations.SerializedName; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the TimeInterval in TOSCA definition. + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaTimeInterval { + @Getter + @Setter + @SerializedName("start_time") + private String startTime; + + @Getter + @Setter + @SerializedName("end_time") + private String endTime; + +}
\ No newline at end of file diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaTrigger.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaTrigger.java new file mode 100644 index 000000000..2464c2e06 --- /dev/null +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaTrigger.java @@ -0,0 +1,88 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.models.tosca; + +import com.google.gson.annotations.SerializedName; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the trigger of policy type in TOSCA definition. + * + * @author Chenfei Gao (cgao@research.att.com) + * + */ +@ToString +public class ToscaTrigger { + + @Getter + @Setter + @SerializedName("description") + private String description; + + @Getter + @Setter + @SerializedName("event_type") + private String eventType; + + @Getter + @Setter + @SerializedName("schedule") + private ToscaTimeInterval schedule; + + @Getter + @Setter + @SerializedName("target_filter") + private ToscaEventFilter targetFilter; + + @Getter + @Setter + @SerializedName("condition") + private ToscaConstraint condition; + + @Getter + @Setter + @SerializedName("constraint") + private ToscaConstraint constraint; + + @Getter + @Setter + @SerializedName("period") + private String period; + + @Getter + @Setter + @SerializedName("evaluations") + private int evaluations; + + @Getter + @Setter + @SerializedName("method") + private String method; + + @Getter + @Setter + @SerializedName("action") + private String action; +}
\ No newline at end of file |