public virtual void DoCreate(MaximoOperationExecutionContext maximoTemplateData)
        {
            var resultData = maximoTemplateData.InvokeProxy();
            var idProperty = maximoTemplateData.Metadata.Schema.IdAttribute.Name;
            var resultOb   = (Array)resultData;
            var firstOb    = resultOb.GetValue(0);
            var id         = (string)WsUtil.GetRealValue(firstOb, idProperty);

            maximoTemplateData.ResultObject = new MaximoResult(id, resultData);
        }
        public virtual void PopulateIntegrationObject(MaximoOperationExecutionContext maximoExecutionContext)
        {
            object integrationObject = maximoExecutionContext.IntegrationObject;
            var    operationData     = (CrudOperationData)maximoExecutionContext.OperationData;
            var    entityMetadata    = maximoExecutionContext.OperationData.EntityMetadata;
            var    idFieldName       = entityMetadata.IdFieldName;

            if (operationData.Id != null)
            {
                w.SetValueIfNull(integrationObject, idFieldName, operationData.Id);
            }
            w.SetValueIfNull(integrationObject, "class", operationData.Class);
            TargetConstantHandler.SetConstantValues(integrationObject, entityMetadata);
            TargetAttributesHandler.SetValuesFromJSON(integrationObject, entityMetadata, operationData);

            foreach (var attribute in operationData.Attributes)
            {
                if (attribute.Value == null)
                {
                    continue;
                }
                try {
                    w.SetValue(integrationObject, attribute.Key.ToUpper(), attribute.Value);
                }
                catch (Exception e) {
                    var entityName = maximoExecutionContext.Metadata.Name;
                    throw new InvalidOperationException(String.Format("Error setting property {0} of entity {1}. {2}",
                                                                      attribute.Key.ToUpper(), entityName, e.Message), e);
                }
            }
            var curUser = SecurityFacade.CurrentUser();

            w.SetValueIfNull(integrationObject, "ORGID", curUser.OrgId);
            w.SetValueIfNull(integrationObject, "SITEID", curUser.SiteId);

            // Set uppercase for maximo users (usernames are upper case and case sensitive)
            SetUppercase(integrationObject, operationData, "affectedperson");
            SetUppercase(integrationObject, operationData, "reportedby");
        }
Example #3
0
 protected MaximoOperationExecutionContext GetContext(ApplicationMetadata applicationMetadata, EntityMetadata entityMetadata, OperationType operationType, string id = null)
 {
     return(MaximoOperationExecutionContext.GetInstance(new BaseOperationData(entityMetadata, applicationMetadata, operationType, id), null));
 }
Example #4
0
 protected MaximoOperationExecutionContext GetContext(OperationData operationData)
 {
     return(MaximoOperationExecutionContext.GetInstance(operationData, null));
 }
 public void AfterFindById(MaximoOperationExecutionContext maximoExecutionContext)
 {
     //NOOP
 }
        public virtual void DoFindById(MaximoOperationExecutionContext maximoTemplateData)
        {
            var resultData = maximoTemplateData.FindById(maximoTemplateData.OperationData.Id);

            maximoTemplateData.ResultObject = new MaximoResult(maximoTemplateData.OperationData.Id, resultData);
        }
 public void BeforeFindById(MaximoOperationExecutionContext maximoExecutionContext)
 {
     //NOOP
 }
 public void AfterCreation(MaximoOperationExecutionContext maximoExecutionContext)
 {
     //NOOP
 }
 public void BeforeCreation(MaximoOperationExecutionContext maximoExecutionContext)
 {
     //NOOP
 }
 public void AfterDeletion(MaximoOperationExecutionContext maximoTemplateData)
 {
     //NOOP
 }
        public void DoDelete(MaximoOperationExecutionContext maximoTemplateData)
        {
            var resultData = maximoTemplateData.InvokeProxy();

            maximoTemplateData.ResultObject = new MaximoResult(maximoTemplateData.OperationData.Id, resultData);
        }
 public void AfterUpdate(MaximoOperationExecutionContext maximoExecutionContext)
 {
     //NOOP
 }
 public void BeforeUpdate(MaximoOperationExecutionContext maximoExecutionContext)
 {
     //NOOP
 }