Exemplo n.º 1
0
        internal static void OrgUnitStopUsingItSystem(string orgUnitUuid, string itSystemUuid, DateTime timestamp)
        {
            List <string> orgFunctions = organisationFunktionStub.SoegAndGetUuids(UUIDConstants.ORGFUN_IT_USAGE, null, orgUnitUuid, itSystemUuid);

            if (orgFunctions != null && orgFunctions.Count > 0)
            {
                log.Debug("Terminating relationship between itSystem " + itSystemUuid + " and orgUnit " + orgUnitUuid);

                // there shoud only be one, but might as well do a wide cleanup, just in case
                for (int i = 0; i < orgFunctions.Count; i++)
                {
                    OrgFunctionData orgFunction = new OrgFunctionData()
                    {
                        Timestamp = timestamp,
                        Uuid      = orgFunctions[i],
                        OrgUnits  = new List <string>()
                        {
                            orgUnitUuid
                        }
                    };

                    organisationFunktionStub.Ret(orgFunction, UpdateIndicator.NONE, UpdateIndicator.REMOVE, UpdateIndicator.NONE);
                }
            }
            else
            {
                log.Debug("There is no active relationship between itsystem " + itSystemUuid + " and orgUnit " + orgUnitUuid + " to stop - so nothing updated!");
            }
        }
Exemplo n.º 2
0
        internal static void OrgUnitStartUsingItSystem(string orgUnitUuid, string itSystemUuid, DateTime timestamp)
        {
            List <string> orgFunctions = organisationFunktionStub.SoegAndGetUuids(UUIDConstants.ORGFUN_IT_USAGE, null, null, itSystemUuid);

            // ensure that there is an OrgFunction
            if (orgFunctions == null || orgFunctions.Count == 0)
            {
                List <string> itSystem = new List <string>()
                {
                    itSystemUuid
                };

                string uuid = IdUtil.GenerateUuid();
                organisationFunktionStub.Importer(new OrgFunctionData()
                {
                    Uuid             = uuid,
                    ShortKey         = IdUtil.GenerateShortKey(),
                    Name             = "IT-Usage",
                    FunctionTypeUuid = UUIDConstants.ORGFUN_IT_USAGE,
                    OrgUnits         = null,
                    Users            = null,
                    ItSystems        = itSystem,
                    Addresses        = null,
                    Timestamp        = timestamp
                });

                orgFunctions = new List <string>()
                {
                    uuid
                };
            }

            log.Debug("Starting relationship between itSystem " + itSystemUuid + " and orgUnit " + orgUnitUuid);

            OrgFunctionData orgFunction = new OrgFunctionData()
            {
                Timestamp = timestamp,
                Uuid      = orgFunctions[0], // there will ever only be one OrgFunction, but even if there are more, we just pick the first one (any will do)
                OrgUnits  = new List <string>()
                {
                    orgUnitUuid
                }
            };

            organisationFunktionStub.Ret(orgFunction, UpdateIndicator.NONE, UpdateIndicator.ADD, UpdateIndicator.NONE);
        }
Exemplo n.º 3
0
        internal static string EnsurePayoutUnitFunctionExists(string payoutUnitUuid, DateTime timestamp)
        {
            // if there is an existing function, just return the uuid
            List <string> existingFunctions = organisationFunktionStub.SoegAndGetUuids(UUIDConstants.ORGFUN_PAYOUT_UNIT, null, payoutUnitUuid, null);

            if (existingFunctions != null && existingFunctions.Count > 0)
            {
                return(existingFunctions[0]);
            }

            // otherwise create a new function
            OrgFunctionData orgFunction = new OrgFunctionData();

            orgFunction.FunctionTypeUuid = UUIDConstants.ORGFUN_PAYOUT_UNIT;
            orgFunction.Name             = "PayoutUnitFunction";
            orgFunction.OrgUnits.Add(payoutUnitUuid);
            orgFunction.ShortKey  = IdUtil.GenerateShortKey();
            orgFunction.Timestamp = timestamp;
            orgFunction.Uuid      = IdUtil.GenerateUuid();

            organisationFunktionStub.Importer(orgFunction);

            return(orgFunction.Uuid);
        }