6823da86f78503bbf75d4f1028cf623f3035f163
[aai/graphadmin.git] / src / main / java / org / onap / aai / migration / v13 / MigrateInstanceGroupSubType.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 import java.util.Optional;
22
23 import org.onap.aai.edges.EdgeIngestor;
24 import org.onap.aai.introspection.LoaderFactory;
25 import org.onap.aai.migration.Enabled;
26 import org.onap.aai.migration.MigrationDangerRating;
27 import org.onap.aai.migration.MigrationPriority;
28 import org.onap.aai.migration.PropertyMigrator;
29 import org.onap.aai.serialization.db.EdgeSerializer;
30 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
31
32 import org.janusgraph.core.Cardinality;
33 import org.onap.aai.setup.SchemaVersions;
34
35 @MigrationPriority(20)
36 @MigrationDangerRating(2)
37 @Enabled
38 public class MigrateInstanceGroupSubType extends PropertyMigrator{
39
40     protected static final String SUB_TYPE_PROPERTY = "sub-type";
41     protected static final String INSTANCE_GROUP_ROLE_PROPERTY = "instance-group-role";
42     protected static final String INSTANCE_GROUP_NODE_TYPE = "instance-group";
43
44     public MigrateInstanceGroupSubType(TransactionalGraphEngine engine, LoaderFactory loaderFactory, EdgeIngestor edgeIngestor, EdgeSerializer edgeSerializer, SchemaVersions schemaVersions) {
45         super(engine, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
46         this.initialize(SUB_TYPE_PROPERTY , INSTANCE_GROUP_ROLE_PROPERTY, String.class,Cardinality.SINGLE);
47     }
48     
49     @Override
50     public Optional<String[]> getAffectedNodeTypes() {
51         return Optional.of(new String[]{INSTANCE_GROUP_NODE_TYPE});
52     }
53
54     @Override
55     public String getMigrationName() {
56         return "MigrateInstanceGroupSubType";
57     }
58
59         @Override
60         public boolean isIndexed() {
61                 return true;
62         }
63
64 }