diff options
Diffstat (limited to 'catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal')
7 files changed, 201 insertions, 0 deletions
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/AbstractGraphVertexHeal.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/AbstractGraphVertexHeal.java new file mode 100644 index 0000000000..9be730ca95 --- /dev/null +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/AbstractGraphVertexHeal.java @@ -0,0 +1,24 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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.openecomp.sdc.be.dao.jsongraph.heal; + +import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; +import org.openecomp.sdc.common.log.wrappers.Logger; + +public abstract class AbstractGraphVertexHeal implements Heal<GraphVertex> { + + protected Logger logger = Logger.getLogger(AbstractGraphVertexHeal.class); +} diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/AbstractTitanVertexHeal.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/AbstractTitanVertexHeal.java new file mode 100644 index 0000000000..e01ddab989 --- /dev/null +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/AbstractTitanVertexHeal.java @@ -0,0 +1,22 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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.openecomp.sdc.be.dao.jsongraph.heal; + +import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; + +public abstract class AbstractTitanVertexHeal implements Heal<GraphNode> { + +} diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/Heal.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/Heal.java new file mode 100644 index 0000000000..6c60772e8a --- /dev/null +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/Heal.java @@ -0,0 +1,27 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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.openecomp.sdc.be.dao.jsongraph.heal; + +public interface Heal<V> { + + + HealVersion fromVersion(); + + void healData(V parentV); + + + +} diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/HealConstants.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/HealConstants.java new file mode 100644 index 0000000000..ce1b24ab36 --- /dev/null +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/HealConstants.java @@ -0,0 +1,10 @@ +package org.openecomp.sdc.be.dao.jsongraph.heal; + +public class HealConstants { + + public static final Integer DEFAULT_HEAL_VERSION = 0; + private HealConstants() { + } + + +} diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/HealVersion.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/HealVersion.java new file mode 100644 index 0000000000..55d3f43c79 --- /dev/null +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/HealVersion.java @@ -0,0 +1,22 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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.openecomp.sdc.be.dao.jsongraph.heal; + +public interface HealVersion<T> extends Comparable<HealVersion> { + + T getVersion(); +} diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/HealVersionBuilder.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/HealVersionBuilder.java new file mode 100644 index 0000000000..3a7b0645c1 --- /dev/null +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/HealVersionBuilder.java @@ -0,0 +1,28 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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.openecomp.sdc.be.dao.jsongraph.heal; + +public class HealVersionBuilder { + + private HealVersionBuilder() { + } + + public static HealVersion<Integer> build(Integer version) { + return new HealVersionImpl(version); + } + +} diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/HealVersionImpl.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/HealVersionImpl.java new file mode 100644 index 0000000000..4ce28debc1 --- /dev/null +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/heal/HealVersionImpl.java @@ -0,0 +1,68 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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.openecomp.sdc.be.dao.jsongraph.heal; + +import com.google.common.base.MoreObjects; +import java.util.Objects; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; + +class HealVersionImpl<T extends Comparable> implements HealVersion<T> { + + private final T version; + + public HealVersionImpl(T version) { + Objects.requireNonNull(version, "Version cannot be null"); + this.version = version; + } + + public T getVersion() { + return version; + } + + + @Override + public int compareTo(HealVersion o) { + return this.version.compareTo( o.getVersion()); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (!(o instanceof HealVersionImpl)) { + return false; + } + + HealVersionImpl that = (HealVersionImpl) o; + + return new EqualsBuilder().append(getVersion(), that.getVersion()).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder(17, 37).append(getVersion()).toHashCode(); + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(this).add("version", version).toString(); + } +} |