public bool IsSetToImplicitDefault(IObjectFacade objectFacade)
        {
            // return true if it's scalar and and still set to its implicit default value (eg 0 for an int)
            if (!DefaultTypeIsExplicit(objectFacade) && WrappedSpec.ReturnSpec.IsParseable)
            {
                var dflt         = WrappedSpec.GetDefault(objectFacade.WrappedAdapter());
                var currentValue = GetValue(objectFacade);

                return(dflt?.Object == currentValue?.Object);
            }

            return(false);
        }
Esempio n. 2
0
        public string GetObjectId(IObjectFacade objectFacade) {
            INakedObjectAdapter owner = objectFacade.WrappedAdapter();
            string postFix = "";

            if (owner.Spec.IsCollection) {
                var elementFacet = owner.Spec.GetFacet<ITypeOfFacet>();
                var elementType = elementFacet.GetValue(owner);

                postFix = Sep + elementType.Name;
            }

            return owner.Spec.ShortName + postFix;
        }
Esempio n. 3
0
        public string GetObjectId(IObjectFacade objectFacade)
        {
            INakedObjectAdapter owner = objectFacade.WrappedAdapter();
            string postFix            = "";

            if (owner.Spec.IsCollection)
            {
                var elementFacet = owner.Spec.GetFacet <ITypeOfFacet>();
                var elementType  = elementFacet.GetValue(owner);

                postFix = Sep + elementType.Name;
            }

            return(owner.Spec.ShortName + postFix);
        }
Esempio n. 4
0
        public string GetAggregateFieldInputId(IObjectFacade objectFacade, IAssociationFacade propertyFacade)
        {
            string fieldId;
            INakedObjectAdapter nakedObject = objectFacade.WrappedAdapter();

            var aoid = nakedObject.Oid as IAggregateOid;

            if (aoid != null)
            {
                IAssociationSpec parent = ((IObjectSpec)aoid.ParentOid.Spec).Properties.SingleOrDefault(p => p.Id == aoid.FieldName);
                fieldId = parent.Id + Sep + GetObjectId(objectFacade) + Sep + propertyFacade.Id + Sep + InputOrSelect(propertyFacade.WrappedSpec().ReturnSpec);
            }
            else
            {
                fieldId = GetFieldInputId(objectFacade, propertyFacade);
            }
            return(fieldId);
        }
Esempio n. 5
0
        public string GetActionId(string propertyName, IActionFacade actionContextActionFacade, IObjectFacade actionObjectFacade, IObjectFacade targetObjectFacade, IActionFacade targetActionFacade) {
            IActionSpec actionContextAction = actionContextActionFacade == null ? null :  actionContextActionFacade.WrappedSpec();
            INakedObjectAdapter actionContextTarget = actionObjectFacade == null ? null : actionObjectFacade.WrappedAdapter();
            IActionSpec targetActionContextAction = targetActionFacade == null ? null : targetActionFacade.WrappedSpec();
            INakedObjectAdapter targetActionContextTarget = targetObjectFacade == null ? null : targetObjectFacade.WrappedAdapter();

            string contextActionName = actionContextAction == null ? "" : actionContextAction.Id + Sep;
            string contextNakedObjectId = actionContextTarget == null || actionContextTarget == targetActionContextTarget ? "" : GetObjectId(actionObjectFacade) + Sep;
            string propertyId = string.IsNullOrEmpty(propertyName) ? "" : NameUtils.CapitalizeName(propertyName) + Sep;
            return contextNakedObjectId + contextActionName + propertyId + GetObjectId(targetObjectFacade) + Sep + targetActionContextAction.Id;
        }
Esempio n. 6
0
        public string GetAggregateFieldInputId(IObjectFacade objectFacade, IAssociationFacade propertyFacade) {
            string fieldId;
            INakedObjectAdapter nakedObject = objectFacade.WrappedAdapter();

            var aoid = nakedObject.Oid as IAggregateOid;
            if (aoid != null) {
                IAssociationSpec parent = ((IObjectSpec) aoid.ParentOid.Spec).Properties.SingleOrDefault(p => p.Id == aoid.FieldName);           
                fieldId = parent.Id + Sep + GetObjectId(objectFacade) + Sep + propertyFacade.Id + Sep + InputOrSelect(propertyFacade.WrappedSpec().ReturnSpec);
            }
            else {
                fieldId = GetFieldInputId(objectFacade, propertyFacade);
            }
            return fieldId;
        }
Esempio n. 7
0
        public string GetServiceLabel(IObjectFacade objectFacade) {
            INakedObjectAdapter nakedObject = objectFacade.WrappedAdapter();

            return nakedObject.TitleString();
        }
Esempio n. 8
0
        public string GetGenericActionId(IObjectFacade objectFacade, string type) {
            INakedObjectAdapter owner = objectFacade.WrappedAdapter();

            return IdConstants.ActionName + Sep + owner.Spec.ShortName + Sep + type;
        }
Esempio n. 9
0
        public string GetCollectionContainerId(IObjectFacade collectionFacade) {
            INakedObjectAdapter collection = collectionFacade.WrappedAdapter();

            return IdConstants.CollContainerName + Sep + collection.Spec.ShortName;
        }
Esempio n. 10
0
 public string GetSubMenuId(IObjectFacade owner, IObjectFacade serviceFacade) {
     INakedObjectAdapter service = serviceFacade.WrappedAdapter();
     return EnsureEndsWithColon(GetObjectId(owner) + Sep + service.Spec.ShortName);
 }
        public bool IsSetToImplicitDefault(IObjectFacade objectFacade) {
            // return true if it's scalar and and still set to its implicit default value (eg 0 for an int)
            if (!DefaultTypeIsExplicit(objectFacade) && WrappedSpec.ReturnSpec.IsParseable) {
                var dflt = WrappedSpec.GetDefault(objectFacade.WrappedAdapter());
                var currentValue = GetValue(objectFacade);

                return dflt?.Object == currentValue?.Object;

            }

            return false;
        }
Esempio n. 12
0
        public string GetServiceLabel(IObjectFacade objectFacade)
        {
            INakedObjectAdapter nakedObject = objectFacade.WrappedAdapter();

            return(nakedObject.TitleString());
        }
Esempio n. 13
0
        public string GetGenericActionId(IObjectFacade objectFacade, string type)
        {
            INakedObjectAdapter owner = objectFacade.WrappedAdapter();

            return(IdConstants.ActionName + Sep + owner.Spec.ShortName + Sep + type);
        }
Esempio n. 14
0
        public string GetCollectionContainerId(IObjectFacade collectionFacade)
        {
            INakedObjectAdapter collection = collectionFacade.WrappedAdapter();

            return(IdConstants.CollContainerName + Sep + collection.Spec.ShortName);
        }
Esempio n. 15
0
        public string GetSubMenuId(IObjectFacade owner, IObjectFacade serviceFacade)
        {
            INakedObjectAdapter service = serviceFacade.WrappedAdapter();

            return(EnsureEndsWithColon(GetObjectId(owner) + Sep + service.Spec.ShortName));
        }
Esempio n. 16
0
        public string GetActionId(string propertyName, IActionFacade actionContextActionFacade, IObjectFacade actionObjectFacade, IObjectFacade targetObjectFacade, IActionFacade targetActionFacade)
        {
            IActionSpec         actionContextAction       = actionContextActionFacade == null ? null :  actionContextActionFacade.WrappedSpec();
            INakedObjectAdapter actionContextTarget       = actionObjectFacade == null ? null : actionObjectFacade.WrappedAdapter();
            IActionSpec         targetActionContextAction = targetActionFacade == null ? null : targetActionFacade.WrappedSpec();
            INakedObjectAdapter targetActionContextTarget = targetObjectFacade == null ? null : targetObjectFacade.WrappedAdapter();

            string contextActionName    = actionContextAction == null ? "" : actionContextAction.Id + Sep;
            string contextNakedObjectId = actionContextTarget == null || actionContextTarget == targetActionContextTarget ? "" : GetObjectId(actionObjectFacade) + Sep;
            string propertyId           = string.IsNullOrEmpty(propertyName) ? "" : NameUtils.CapitalizeName(propertyName) + Sep;

            return(contextNakedObjectId + contextActionName + propertyId + GetObjectId(targetObjectFacade) + Sep + targetActionContextAction.Id);
        }