Upgrade aai-graphadmin to Janusgraph 0.5.3
[aai/graphadmin.git] / src / main / java / org / onap / aai / migration / v13 / MigrateInstanceGroupModelInvariantId.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *    http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20 package org.onap.aai.migration.v13;
21 /*-
22  * ============LICENSE_START=======================================================
23  * org.onap.aai
24  * ================================================================================
25  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
26  * ================================================================================
27  * Licensed under the Apache License, Version 2.0 (the "License");
28  * you may not use this file except in compliance with the License.
29  * You may obtain a copy of the License at
30  *
31  *      http://www.apache.org/licenses/LICENSE-2.0
32  *
33  * Unless required by applicable law or agreed to in writing, software
34  * distributed under the License is distributed on an "AS IS" BASIS,
35  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36  * See the License for the specific language governing permissions and
37  * limitations under the License.
38  * ============LICENSE_END=========================================================
39  */
40
41
42 import org.janusgraph.core.Cardinality;
43 import org.onap.aai.edges.EdgeIngestor;
44 import org.onap.aai.introspection.LoaderFactory;
45 import org.onap.aai.migration.Enabled;
46 import org.onap.aai.migration.MigrationDangerRating;
47 import org.onap.aai.migration.MigrationPriority;
48 import org.onap.aai.migration.PropertyMigrator;
49 import org.onap.aai.serialization.db.EdgeSerializer;
50 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
51 import org.onap.aai.setup.SchemaVersions;
52
53 import java.util.Optional;
54
55
56 @MigrationPriority(19)
57 @MigrationDangerRating(2)
58 //@Enabled
59 public class MigrateInstanceGroupModelInvariantId extends PropertyMigrator {
60
61     private static final String INSTANCE_GROUP_NODE_TYPE = "instance-group";
62     private static final String INSTANCE_GROUP_MODEL_INVARIANT_ID_PROPERTY = "model-invariant-id";
63     private static final String INSTANCE_GROUP_MODEL_INVARIANT_ID_LOCAL_PROPERTY = "model-invariant-id-local";
64
65     public MigrateInstanceGroupModelInvariantId(TransactionalGraphEngine engine, LoaderFactory loaderFactory, EdgeIngestor edgeIngestor, EdgeSerializer edgeSerializer, SchemaVersions schemaVersions) {
66         super(engine, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
67         this.initialize(INSTANCE_GROUP_MODEL_INVARIANT_ID_PROPERTY, INSTANCE_GROUP_MODEL_INVARIANT_ID_LOCAL_PROPERTY,
68                 String.class, Cardinality.SINGLE);
69     }
70
71     @Override
72     public Optional<String[]> getAffectedNodeTypes() {
73         return Optional.of(new String[]{this.INSTANCE_GROUP_NODE_TYPE});
74     }
75
76     @Override
77     public String getMigrationName() {
78         return "MigrateInstanceGroupModelInvariantId";
79     }
80
81     @Override
82     public boolean isIndexed() {
83         return true;
84     }
85 }