示例#1
0
        public override DynamicObject CreateProxy(EntityMetadata metadata)
        {
            //for ISM we have only a single wsdl for all the web-services
            //so we don´t need to specify one for each of the entities, like the other maximo providers
            ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(
                delegate { return(true); }
                );
            var wsdlPath = MetadataProvider.GlobalProperty(ISMConstants.GlobalWsdlProperty);

            return(DynamicProxyUtil.LookupProxy(wsdlPath, false));
        }
示例#2
0
        public MeaExecutionContext(IOperationData operationData, DynamicObject proxy = null)
            : base(operationData)
        {
            if (proxy == null)
            {
                proxy = DynamicProxyUtil.LookupProxy(operationData.EntityMetadata);
            }
            //            _queryProxy = DynamicProxyUtil.LookupProxy(operationData.EntityMetadata, true);
            var curUser = SecurityFacade.CurrentUser();

            BuildNotify(operationData, proxy, curUser);
        }
示例#3
0
        public MifExecutionContext(IOperationData operationData, DynamicObject proxy = null)
            : base(operationData)
        {
            Proxy = proxy ?? DynamicProxyUtil.LookupProxy(operationData.EntityMetadata);
            CheckCredentials(Proxy);

            var curUser       = SecurityFacade.CurrentUser();
            var operationType = operationData.OperationType;
            var isCreation    = OperationType.Add == operationType;

            _methodName = MifMethodNameUtils.GetMethodName(Metadata, operationType);
            var type = Proxy.ProxyType;

            var mi = type.GetMethod(_methodName);
            var pi = mi.GetParameters().First();
            // element array , like MXSW3_WO_TYPE[]
            var parameterType = pi.ParameterType;

            object notifyInterface;
            object integrationObject;

            if (parameterType.IsArray)
            {
                notifyInterface   = ReflectionUtil.InstantiateArrayWithBlankElements(parameterType.GetElementType(), 1);
                integrationObject = ((Array)notifyInterface).GetValue(0);
            }
            else
            {
                notifyInterface   = ReflectionUtil.InstanceFromType(parameterType);
                integrationObject = notifyInterface;
            }

            r.SetProperty(integrationObject, "actionSpecified", true);
            r.InstantiateProperty(integrationObject, "CHANGEDATE", new { Value = DateTime.Now.FromServerToRightKind() });
            //TODO: get current user, in the mobile case below code may be wrong
            r.InstantiateProperty(integrationObject, "CHANGEBY", new { Value = curUser.Login });
            //TODO: get from user
            r.InstantiateProperty(integrationObject, "ORGID", new { Value = curUser.OrgId });
            r.InstantiateProperty(integrationObject, "SITEID", new { Value = curUser.SiteId });
            r.SetProperty(integrationObject, "action", operationType.ToString());

            IntegrationObject   = integrationObject;
            RootInterfaceObject = notifyInterface;
        }