* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.aai.introspection.tools;
+import java.net.URI;
+
import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
import org.onap.aai.parsers.uri.URIToObject;
-import java.net.URI;
+public class InjectKeysFromURI implements IssueResolver {
+
+ private URI uri = null;
+ private Loader loader = null;
+
+ /**
+ * Instantiates a new inject keys from URI.
+ *
+ * @param loader the loader
+ * @param uri the uri
+ */
+ public InjectKeysFromURI(Loader loader, URI uri) {
+ this.loader = loader;
+ this.uri = uri;
+ }
-public class InjectKeysFromURI implements IssueResolver {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean resolveIssue(Issue issue) {
+ boolean result = false;
+ Introspector obj = issue.getIntrospector();
+ if (issue.getType().equals(IssueType.MISSING_KEY_PROP)) {
+ try {
+ URIToObject toObject = new URIToObject(loader, uri);
+ Introspector minimumObj = toObject.getEntity();
+ if (toObject.getEntityName().equals(obj.getDbName())) {
+ obj.setValue(issue.getPropName(), minimumObj.getValue(issue.getPropName()));
+ result = true;
+ }
+ } catch (Exception e) {
+ // log something probably
+ result = false;
+ }
+ }
- private URI uri = null;
- private Loader loader = null;
-
- /**
- * Instantiates a new inject keys from URI.
- *
- * @param loader the loader
- * @param uri the uri
- */
- public InjectKeysFromURI(Loader loader, URI uri) {
- this.loader = loader;
- this.uri = uri;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean resolveIssue(Issue issue) {
- boolean result = false;
- Introspector obj = issue.getIntrospector();
- if (issue.getType().equals(IssueType.MISSING_KEY_PROP)) {
- try {
- URIToObject toObject = new URIToObject(loader, uri);
- Introspector minimumObj = toObject.getEntity();
- if (toObject.getEntityName().equals(obj.getDbName())) {
- obj.setValue(issue.getPropName(), minimumObj.getValue(issue.getPropName()));
- result = true;
- }
- } catch (Exception e) {
- //log something probably
- result = false;
- }
- }
-
- return result;
- }
+ return result;
+ }
}