7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller/*
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller *
0ab07c6ace6fcb4437776e716a96749c8f5f90e6Alin Brici * Copyright (c) 2013-2015 ForgeRock AS. All rights reserved.
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller *
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller * The contents of this file are subject to the terms
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller * of the Common Development and Distribution License
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller * (the License). You may not use this file except in
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller * compliance with the License.
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller *
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller * You can obtain a copy of the License at
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller * http://forgerock.org/license/CDDLv1.0.html
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller * See the License for the specific language governing
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller * permission and limitations under the License.
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller *
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller * When distributing Covered Code, include this CDDL
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller * Header Notice in each file and include the License file
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller * at http://forgerock.org/license/CDDLv1.0.html
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller * If applicable, add the following below the CDDL Header,
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller * with the fields enclosed by brackets [] replaced by
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller * your own identifying information:
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller * "Portions Copyrighted [year] [name of copyright owner]"
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller */
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch
0f63005dc454e8131506be734dc0404f48c8578cJason Lemayimport groovy.sql.Sql
0f63005dc454e8131506be734dc0404f48c8578cJason Lemayimport org.identityconnectors.framework.common.objects.Attribute
0f63005dc454e8131506be734dc0404f48c8578cJason Lemayimport org.identityconnectors.framework.common.objects.ObjectClass
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch
0f63005dc454e8131506be734dc0404f48c8578cJason Lemayimport java.sql.Connection
7f6887b5c5e1d621fbbb48d93b8ac940521d1e38Jason Lemay
0f63005dc454e8131506be734dc0404f48c8578cJason Lemayimport static org.forgerock.json.JsonValue.json;
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller// Parameters:
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller// The connector sends us the following:
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller// connection : SQL connection
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller// log: a handler to the Log facility
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller// objectClass: a String describing the Object class (recon, activity, access)
f4499844e2092e1a97238a393361ff879f13fe15Laurent Bristiel// id: The entry identifier (OpenICF "Name" atribute. Most often matches the uid)
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller// attributes: an Attribute Map, containg the <String> attribute name as a key
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller// and the <List> attribute value(s) as value.
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller// password: password string, clear text
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller// options: a handler to the OperationOptions Map
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branchlog.info("Entering Create Script for {0} with attributes {1}", objectClass, attributes);
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller
7f6887b5c5e1d621fbbb48d93b8ac940521d1e38Jason Lemaydef sql = new Sql(connection as Connection);
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch//Create must return UID. Let's return the id as the UID for now.
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branchdef auditauthentication = new ObjectClass("auditauthentication");
7f6887b5c5e1d621fbbb48d93b8ac940521d1e38Jason Lemaydef auditrecon = new ObjectClass("auditrecon");
7f6887b5c5e1d621fbbb48d93b8ac940521d1e38Jason Lemaydef auditactivity = new ObjectClass("auditactivity");
7f6887b5c5e1d621fbbb48d93b8ac940521d1e38Jason Lemaydef auditaccess = new ObjectClass("auditaccess");
8013147372959d2435f1f8b0305057cfce308168Jason Lemaydef auditsync = new ObjectClass("auditsync");
0f63005dc454e8131506be734dc0404f48c8578cJason Lemaydef auditconfig = new ObjectClass("auditconfig");
7f6887b5c5e1d621fbbb48d93b8ac940521d1e38Jason Lemay
7f6887b5c5e1d621fbbb48d93b8ac940521d1e38Jason Lemay//convert attributes to map
7f6887b5c5e1d621fbbb48d93b8ac940521d1e38Jason LemayMap<String, Attribute> attributeMap = new HashMap<String, Attribute>();
7f6887b5c5e1d621fbbb48d93b8ac940521d1e38Jason Lemayfor (Attribute attribute : attributes) {
7f6887b5c5e1d621fbbb48d93b8ac940521d1e38Jason Lemay attributeMap.put(attribute.getName(), attribute);
7f6887b5c5e1d621fbbb48d93b8ac940521d1e38Jason Lemay}
7f6887b5c5e1d621fbbb48d93b8ac940521d1e38Jason Lemay
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmillerswitch ( objectClass ) {
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch case auditaccess:
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch sql.execute("INSERT INTO auditaccess " +
439aeca927c6a5e03e71c880e729b3143ebc538cJason Lemay "(objectid, activitydate, eventname, transactionid, userid, trackingids, server_ip, server_port, " +
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay "client_ip, client_port, request_protocol, request_operation, request_detail, " +
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay "http_request_secure, http_request_method, http_request_path, http_request_queryparameters, " +
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay "http_request_headers, http_request_cookies, http_response_headers, response_status, " +
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay "response_statuscode, response_elapsedtime, response_elapsedtimeunits, roles" +
439aeca927c6a5e03e71c880e729b3143ebc538cJason Lemay ") values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch [
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch id,
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("activitydate")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("eventname")?.getValue()?.get(0),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("transactionid")?.getValue()?.get(0),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("userid")?.getValue()?.get(0),
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay attributeMap.get("trackingids")?.getValue()?.get(0) != null
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay ? json(attributeMap.get("trackingids")?.getValue()?.get(0)).toString()
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay : null,
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("server")?.getValue()?.get(0)?.get("ip"),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("server")?.getValue()?.get(0)?.get("port"),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("client")?.getValue()?.get(0)?.get("ip"),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("client")?.getValue()?.get(0)?.get("port"),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("request")?.getValue()?.get(0)?.get("protocol"),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("request")?.getValue()?.get(0)?.get("operation"),
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay attributeMap.get("request")?.getValue()?.get(0)?.get("detail") != null
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay ? json(attributeMap.get("request")?.getValue()?.get(0)?.get("detail")).toString()
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay : null,
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay attributeMap.get("http")?.getValue()?.get(0)?.get("request")?.get("secure"),
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay attributeMap.get("http")?.getValue()?.get(0)?.get("request")?.get("method"),
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay attributeMap.get("http")?.getValue()?.get(0)?.get("request")?.get("path"),
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay attributeMap.get("http")?.getValue()?.get(0)?.get("request")?.get("queryParameters") != null
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay ? json(attributeMap.get("http")?.getValue()?.get(0)?.get("request")?.get("queryParameters")).toString()
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay : null,
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay attributeMap.get("http")?.getValue()?.get(0)?.get("request")?.get("headers") != null
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay ? json(attributeMap.get("http")?.getValue()?.get(0)?.get("request")?.get("headers")).toString()
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay : null,
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay attributeMap.get("http")?.getValue()?.get(0)?.get("request")?.get("cookies") != null
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay ? json(attributeMap.get("http")?.getValue()?.get(0)?.get("request")?.get("cookies")).toString()
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay : null,
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay attributeMap.get("http")?.getValue()?.get(0)?.get("response")?.get("headers") != null
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay ? json(attributeMap.get("http")?.getValue()?.get(0)?.get("response")?.get("headers")).toString()
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay : null,
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("response")?.getValue()?.get(0)?.get("status"),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("response")?.getValue()?.get(0)?.get("statusCode"),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("response")?.getValue()?.get(0)?.get("elapsedTime"),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("response")?.getValue()?.get(0)?.get('elapsedTimeUnits'),
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay attributeMap.get("roles")?.getValue() != null
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay ? json(attributeMap.get("roles")?.getValue()).toString()
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay : null,
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch ]);
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch break;
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch case auditauthentication:
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch sql.execute("INSERT INTO auditauthentication " +
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay "(objectid, transactionid, activitydate, userid, eventname, result, principals, context, " +
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay "entries, trackingids" +
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch ") values (?,?,?,?,?,?,?,?,?,?)",
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch [
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch id,
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("transactionid")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("activitydate")?.getValue()?.get(0),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("userid")?.getValue().get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("eventname")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("result")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("principal")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("context")?.getValue()?.get(0) != null
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch ? json(attributeMap.get("context")?.getValue()?.get(0)).toString()
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch : null,
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("entries")?.getValue()?.get(0) != null
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch ? json(attributeMap.get("entries")?.getValue()?.get(0)).toString()
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay : null,
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("trackingids")?.getValue()?.get(0) != null
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay ? json(attributeMap.get("trackingids")?.getValue()?.get(0)).toString()
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch : null
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch ]);
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch break;
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch case auditactivity:
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch sql.execute("INSERT INTO auditactivity (" +
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay "objectid, activitydate, eventname, transactionid, userid, trackingids, runas, activityobjectid, " +
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay "operation, subjectbefore, subjectafter, changedfields, " +
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay "subjectrev, passwordchanged, message, status" +
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay ") values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch [
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch id, // objectid
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("activitydate")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("eventname")?.getValue()?.get(0),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("transactionid")?.getValue()?.get(0),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("userid")?.getValue()?.get(0),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("trackingids")?.getValue()?.get(0) != null
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay ? json(attributeMap.get("trackingids")?.getValue()?.get(0)).toString()
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay : null,
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("runas")?.getValue()?.get(0),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("activityobjectid")?.getValue()?.get(0),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("operation")?.getValue()?.get(0),
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay attributeMap.get("subjectbefore")?.getValue()?.get(0) != null
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay ? json(attributeMap.get("subjectbefore")?.getValue()?.get(0)).toString()
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay : null,
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay attributeMap.get("subjectafter")?.getValue()?.get(0) != null
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay ? json(attributeMap.get("subjectafter")?.getValue()?.get(0)).toString()
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay : null,
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("changedfields")?.getValue()?.get(0) != null
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch ? json(attributeMap.get("changedfields")?.getValue()?.get(0)).toString()
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch : null,
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("subjectrev")?.getValue()?.get(0),
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay attributeMap.get("passwordchanged")?.getValue()?.get(0) != null
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay ? json(attributeMap.get("passwordchanged")?.getValue()?.get(0)).toString()
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay : null,
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("message")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("status")?.getValue()?.get(0)
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch ]);
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch break;
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch case auditrecon:
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch sql.execute("INSERT INTO auditrecon (" +
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay "objectid, transactionid, activitydate, eventname, userid, trackingids, activity, exceptiondetail, linkqualifier, " +
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch "mapping, message, messagedetail, situation, sourceobjectid, status, targetobjectid, reconciling, " +
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch "ambiguoustargetobjectids, reconaction, entrytype, reconid" +
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay ") values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch [
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch id, // objectid
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("transactionid")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("activitydate")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("eventname")?.getValue()?.get(0),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("userid")?.getValue()?.get(0),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("trackingids")?.getValue()?.get(0) != null
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay ? json(attributeMap.get("trackingids")?.getValue()?.get(0)).toString()
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay : null,
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("activity")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("exceptiondetail")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("linkqualifier")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("mapping")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("message")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("messagedetail")?.getValue()?.get(0) != null
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch ? json(attributeMap.get("messagedetail")?.getValue()?.get(0)).toString()
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch : null,
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("situation")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("sourceobjectid")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("status")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("targetobjectid")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("reconciling")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("ambiguoustargetobjectids")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("reconaction")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("entrytype")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("reconid")?.getValue()?.get(0)
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch ]);
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch break;
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller
8013147372959d2435f1f8b0305057cfce308168Jason Lemay case auditsync:
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch sql.execute("INSERT INTO auditsync (" +
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay "objectid, transactionid, activitydate, eventname, userid, trackingids, activity, exceptiondetail, " +
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch "linkqualifier, mapping, message, messagedetail, situation, sourceobjectid, status, targetobjectid" +
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay ") values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
8013147372959d2435f1f8b0305057cfce308168Jason Lemay [
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch id,
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("transactionid")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("activitydate")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("eventname")?.getValue()?.get(0),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("userid")?.getValue()?.get(0),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("trackingids")?.getValue()?.get(0) != null
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay ? json(attributeMap.get("trackingids")?.getValue()?.get(0)).toString()
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay : null,
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("activity")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("exceptiondetail")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("linkqualifier")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("mapping")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("message")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("messagedetail")?.getValue()?.get(0) != null
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch ? json(attributeMap.get("messagedetail")?.getValue()?.get(0)).toString()
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch : null,
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("situation")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("sourceobjectid")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("status")?.getValue()?.get(0),
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch attributeMap.get("targetobjectid")?.getValue()?.get(0)
8013147372959d2435f1f8b0305057cfce308168Jason Lemay ]);
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch break;
8013147372959d2435f1f8b0305057cfce308168Jason Lemay
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay case auditconfig:
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay sql.execute("INSERT INTO auditconfig (" +
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay "objectid, activitydate, eventname, transactionid, userid, trackingids, runas, configobjectid, " +
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay "operation, beforeObject, afterObject, changedfields, " +
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay "rev" +
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay ") values (?,?,?,?,?,?,?,?,?,?,?,?,?)",
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay [
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay id, // objectid
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("activitydate")?.getValue()?.get(0),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("eventname")?.getValue()?.get(0),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("transactionid")?.getValue()?.get(0),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("userid")?.getValue()?.get(0),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("trackingids")?.getValue()?.get(0) != null
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay ? json(attributeMap.get("trackingids")?.getValue()?.get(0)).toString()
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay : null,
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("runas")?.getValue()?.get(0),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("configobjectid")?.getValue()?.get(0),
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("operation")?.getValue()?.get(0),
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay attributeMap.get("beforeObject")?.getValue()?.get(0) != null
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay ? json(attributeMap.get("beforeObject")?.getValue()?.get(0)).toString()
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay : null,
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay attributeMap.get("afterObject")?.getValue()?.get(0) != null
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay ? json(attributeMap.get("afterObject")?.getValue()?.get(0)).toString()
dc357eedd51bb456915886c03247ac04d497ce2bJason Lemay : null,
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("changedfields")?.getValue()?.get(0) != null
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay ? json(attributeMap.get("changedfields")?.getValue()?.get(0)).toString()
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay : null,
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay attributeMap.get("rev")?.getValue()?.get(0)
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay ]);
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay break;
0f63005dc454e8131506be734dc0404f48c8578cJason Lemay
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller default:
548846fe158900a483ca91f47603c6bb6fde9b47Jon Branch log.warn("Didn't match objectClass " + objectClass);
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller}
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmiller
7dcb2f62e25d05f2afeb4e79f10102350d7c2c7bBrendan Mmillerreturn id;