Ejemplo n.º 1
0
        ///
        ///	 <summary> * gets the matching elements in node that match this devcaps
        ///	 *  </summary>
        ///	 * <param name="node">
        ///	 *            the node to search in </param>
        ///	 * <returns> VElement - the element vector of matching elements,
        ///	 *         <code>null</code> if none were found </returns>
        ///
        public virtual VElement getMatchingElementsFromJMF(JDFMessage messageElement)
        {
            string      nam     = getName();
            EnumContext context = getContext();

            if (!EnumContext.JMF.Equals(context) && !EnumContext.Element.Equals(context))
            {
                return(null);
            }
            VElement vElem;

            if (ElementName.JMF.Equals(nam))
            {
                vElem = new VElement();
                vElem.Add(messageElement.getParentNode_KElement());
            }
            else if (messageElement.LocalName.Equals(nam))
            {
                vElem = new VElement();
                vElem.Add(messageElement);
            }
            else
            {
                vElem = messageElement.getChildElementVector(nam, null, null, true, 0, false);

                if (vElem != null && vElem.Count == 0)
                {
                    vElem = null;
                }
            }
            return(vElem);
        }
Ejemplo n.º 2
0
        public DefinedEnum(ParseInfo parseInfo, EnumContext enumContext) : base(enumContext.Identifier.GetText())
        {
            Kind = TypeKind.Enum;

            _translateInfo = parseInfo.TranslateInfo;
            Scope          = new Scope("enum " + Name);

            if (enumContext.Identifier)
            {
                parseInfo.TranslateInfo.CheckConflict(parseInfo, new(Name), enumContext.Identifier.Range);
                // Set location and symbol link.
                DefinedAt = new Location(parseInfo.Script.Uri, enumContext.Identifier.Range);
                parseInfo.Script.Elements.AddDeclarationCall(this, new(enumContext.Identifier.Range, true));
            }

            // Get the enum members.
            for (int i = 0; i < enumContext.Values.Count; i++)
            {
                if (enumContext.Values[i].Identifier)
                {
                    var expression = enumContext.Values[i].Value != null
                        ? new ExpressionOrWorkshopValue(parseInfo.GetExpression(Scope, enumContext.Values[i].Value))
                        : new ExpressionOrWorkshopValue(Element.Num(i));

                    var newMember = new DefinedEnumMember(parseInfo, this, enumContext.Values[i].Identifier.Text, new Location(parseInfo.Script.Uri, enumContext.Values[i].Identifier.Range), expression);
                    Scope.AddVariable(newMember, parseInfo.Script.Diagnostics, newMember.DefinedAt.range);
                }
            }
        }
Ejemplo n.º 3
0
        public DefinedEnum(ParseInfo parseInfo, EnumContext enumContext) : base(enumContext.Identifier.Text)
        {
            CanBeExtended = false;
            CanBeDeleted  = false;
            Kind          = "enum";

            // Check if a type with the same name already exists.
            if (parseInfo.TranslateInfo.Types.IsCodeType(Name))
            {
                parseInfo.Script.Diagnostics.Error($"A type with the name '{Name}' already exists.", enumContext.Identifier.Range);
            }

            _translateInfo = parseInfo.TranslateInfo;
            Scope          = new Scope("enum " + Name);

            // Set location and symbol link.
            DefinedAt = new Location(parseInfo.Script.Uri, enumContext.Identifier.Range);
            _translateInfo.GetComponent <SymbolLinkComponent>().AddSymbolLink(this, DefinedAt, true);

            // Get the enum members.
            for (int i = 0; i < enumContext.Values.Count; i++)
            {
                if (enumContext.Values[i].Identifier)
                {
                    var expression = enumContext.Values[i].Value != null
                        ? new ExpressionOrWorkshopValue(parseInfo.GetExpression(Scope, enumContext.Values[i].Value))
                        : new ExpressionOrWorkshopValue(new V_Number(i));

                    var newMember = new DefinedEnumMember(parseInfo, this, enumContext.Values[i].Identifier.Text, new Location(parseInfo.Script.Uri, enumContext.Values[i].Identifier.Range), expression);
                    Scope.AddVariable(newMember, parseInfo.Script.Diagnostics, newMember.DefinedAt.range);
                }
            }
        }
Ejemplo n.º 4
0
        public static void Seed(EnumContext context)
        {
            context.AddRange(EnumData.CreateSomeEnumEntities());

            context.SomeEntities.AddRange(
                );
            context.SaveChanges();
        }
Ejemplo n.º 5
0
        internal override void Draw(TMenu instance)
        {
            if (this.lastInstance == null || this.lastContext == null || !this.lastInstance.Equals(instance))
            {
                this.lastContext = this.GetContext(instance);
            }

            this.lastContext.Draw();
        }
Ejemplo n.º 6
0
        ///
        ///	 <summary> * same as getName, except that "Link" is appended in case of
        ///	 * @Context="Link"
        ///	 *  </summary>
        ///	 * <returns> the element name mangled by context </returns>
        ///
        public virtual string getContextName()
        {
            string s = getName();

            if (s == null)
            {
                return(null);
            }
            EnumContext context = getContext();

            if (EnumContext.Link.Equals(context))
            {
                s += JDFConstants.LINK;
            }
            return(s);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 获取枚举成员列表
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static List <EnumContext> GetEnumContextList(Type type)
        {
            List <EnumContext> list = new List <EnumContext>();

            foreach (string str in Enum.GetNames(type))
            {
                int         x    = (int)Enum.Parse(type, str);
                EnumContext item = new EnumContext
                {
                    EnumValue   = x,
                    EnumString  = str,
                    Description = GetDescription(type, str)
                };
                list.Add(item);
            }
            return(list);
        }
Ejemplo n.º 8
0
        ///
        ///	 <summary> * Gets the NamePath of this DevCap in form "
        ///	 * <code>DevCapsName/SubelemName1/SubelemName2/...</code>"<br>
        ///	 * If this DevCap is located in DevCapPool and not in a DevCaps, it
        ///	 * describes the reusable resource. In this case DevCap root will have the
        ///	 * attribute "Name" = value of DevCaps/@Name, but will have no info about
        ///	 * <code>DevCaps/@Context</code> or <code>DevCaps/@LinkUsage</code>.
        ///	 * <p>
        ///	 * default: getNamePath(false)
        ///	 *  </summary>
        ///	 * <param name="bRecurse">
        ///	 *            if true, returns "
        ///	 *            <code>DevCapsName/SubelemName1/SubelemName2/...</code>" </param>
        ///	 * <returns> String - NamePath of this DevCap </returns>
        ///
        public VString getNamePathVector()
        {
            string      result  = getDevCapsName();
            EnumContext cont    = getContext();
            VString     vResult = new VString();

            if (cont.Equals(EnumContext.JMF) && (ParentNode is JDFMessageService) && result.Length > 4)
            {
                JDFMessageService serv = (JDFMessageService)ParentNode;
                List <EnumFamily> vf   = serv.getFamilies();
                if (vf != null)
                {
                    int size = vf.Count;
                    for (int i = 0; i < size; i++)
                    {
                        vResult.Add("JMF/" + vf[i].getName() + "/" + result.Substring(4));
                    }
                }

                if (EnumJMFRole.Sender.Equals(serv.getJMFRole()))
                {
                    vResult.Add("JMF/Response/" + result.Substring(4));
                }
            }
            else
            {
                if (cont.Equals(EnumContext.Link))
                {
                    result = ElementName.JDF + "/" + ElementName.RESOURCELINKPOOL + "/" + result;
                }
                else if (cont.Equals(EnumContext.Resource))
                {
                    string nam = result;
                    result = ElementName.JDF + "/" + ElementName.RESOURCEPOOL + "/" + result;
                    for (int i = 0; i < 6; i++)
                    {
                        vResult.Add(result);
                        result = result + "/" + nam;
                    }
                }

                vResult.Add(result);
            }
            return(vResult);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 打折记录
        /// </summary>
        /// <returns></returns>
        public ActionResult DiscountRecord()
        {
            ViewBag.StartTime = DateTime.Now.AddDays(-7).Date.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T");
            ViewBag.EndTime   = DateTime.Now.Date.AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T");
            List <BaseParkinfo> parkinfos       = ParkingServices.QueryParkingByVillageId(SellerLoginUser.VID);
            List <EnumContext>  parkingContexts = new List <EnumContext>();

            foreach (var item in parkinfos)
            {
                EnumContext model = new EnumContext();
                model.EnumString  = item.PKID;
                model.Description = item.PKName;
                parkingContexts.Add(model);
            }
            ViewBag.CarDerateParkings = parkingContexts;
            ViewBag.CarDerateStatus   = EnumHelper.GetEnumContextList(typeof(CarDerateStatus), true);

            return(View());
        }
Ejemplo n.º 10
0
        private string getDevCapsName()
        {
            string      nam  = getName();
            EnumContext cont = getContext();

            if (cont.Equals(EnumContext.Link))
            {
                nam += JDFConstants.LINK;
            }
            else if (cont.Equals(EnumContext.Element) && !ElementName.JDF.Equals(nam))
            {
                nam = ElementName.JDF + "/" + nam;
            }
            else if (cont.Equals(EnumContext.JMF) && !ElementName.JMF.Equals(nam))
            {
                nam = ElementName.JMF + "/" + nam;
            }
            return(nam); // default is nam for resources
        }
Ejemplo n.º 11
0
        public ActionResult Index()
        {
            List <ParkDerate>  derates        = ParkDerateServices.QueryBySellerID(SellerLoginUser.SellerID);
            List <EnumContext> derateContexts = new List <EnumContext>();

            foreach (var item in derates)
            {
                EnumContext model = new EnumContext();
                model.EnumString  = item.DerateID;
                model.Description = item.Name;
                model.EnumValue   = (int)item.DerateType;
                derateContexts.Add(model);
            }
            ViewBag.DerateContexts  = derateContexts;
            ViewBag.CarDerateStatus = EnumHelper.GetEnumContextList(typeof(CarDerateStatus), true);
            ViewBag.StartTime       = DateTime.Now.AddDays(-7).Date.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T");
            ViewBag.EndTime         = DateTime.Now.Date.AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T");
            return(View());
        }
Ejemplo n.º 12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="type"></param>
        /// <param name="description"></param>
        /// <returns></returns>
        public static EnumContext GetEnumContextByDescription(Type type, string description)
        {
            EnumContext context = null;

            foreach (string str in Enum.GetNames(type))
            {
                if (description.Equals(GetDescription(type, str)))
                {
                    EnumContext item = new EnumContext
                    {
                        EnumString  = str,
                        Description = GetDescription(type, str)
                    };

                    context = item;
                }
            }

            return(context);
        }
Ejemplo n.º 13
0
        public ActionResult Edit(string recordId)
        {
            try
            {
                ParkDerateQRcode derate = new ParkDerateQRcode();
                if (!string.IsNullOrWhiteSpace(recordId))
                {
                    derate = ParkDerateQRcodeServices.QueryByRecordId(recordId);
                }
                else
                {
                    derate.StartTime = DateTime.Now;
                    derate.EndTime   = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
                }

                List <ParkDerate>  derates        = ParkDerateServices.QueryBySellerID(SellerLoginUser.SellerID);
                List <EnumContext> derateContexts = new List <EnumContext>();
                foreach (var item in derates)
                {
                    EnumContext model = new EnumContext();
                    model.EnumString  = item.DerateID;
                    model.Description = item.Name;
                    model.EnumValue   = (int)item.DerateType;
                    derateContexts.Add(model);
                }
                ViewBag.DerateContexts = derateContexts;
                return(View(derate));
            }
            catch (MyException ex)
            {
                return(RedirectToAction("Index", "XFJMDerateQRCode", new { RemindUserContent = ex.Message }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "微信修优免二维码失败", LogFrom.WeiXin);
                return(RedirectToAction("Index", "XFJMDerateQRCode", new { RemindUserContent = "操作失败" }));
            }
        }
Ejemplo n.º 14
0
 //         ---------------------------------------------------------------------
 //        Methods for Attribute Context
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (5) set attribute Context </summary>
 ///          * <param name="enumVar">: the enumVar to set the attribute to </param>
 ///
 public virtual void setContext(EnumContext enumVar)
 {
     setAttribute(AttributeName.CONTEXT, enumVar == null ? null : enumVar.getName(), null);
 }
Ejemplo n.º 15
0
 public static string DefaultConvention(EnumContext context)
 {
     return context.Value?.ToString();
 }
Ejemplo n.º 16
0
 public static string DefaultConvention(EnumContext context)
 {
     return(context.Value?.ToString());
 }
Ejemplo n.º 17
0
        public ActionResult Passed(string recordId)
        {
            try
            {
                List <BaseVillage> villages     = VillageServices.QueryVillageByEmployeeMobilePhone(WeiXinUser.MobilePhone);
                List <EnumContext> parkContexts = new List <EnumContext>();
                if (villages.Count > 0)
                {
                    List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageIds(villages.Select(p => p.VID).ToList());
                    foreach (var item in parkings)
                    {
                        EnumContext model = new EnumContext();
                        model.Description = item.PKName;
                        model.EnumString  = item.PKID;
                        parkContexts.Add(model);
                    }
                }
                ViewBag.ParkContexts = parkContexts;

                ParkMonthlyCarApply monthlyCarApply = ParkMonthlyCarApplyServices.QueryByRecordID(recordId);
                if (monthlyCarApply == null)
                {
                    throw new MyException("申请信息不存在");
                }

                List <ParkArea>    areas        = ParkAreaServices.GetParkAreaByParkingId(monthlyCarApply.PKID);
                List <EnumContext> areaContexts = new List <EnumContext>();
                foreach (var item in areas)
                {
                    EnumContext model = new EnumContext();
                    model.Description = item.AreaName;
                    model.EnumString  = item.AreaID;
                    areaContexts.Add(model);
                }
                ViewBag.AreaContexts = areaContexts;

                List <EnumContext> gateContexts = new List <EnumContext>();
                foreach (var item in areaContexts)
                {
                    List <ParkGate> gates = ParkGateServices.QueryByParkAreaRecordIds(new List <string>()
                    {
                        item.EnumString
                    });

                    foreach (var gate in gates)
                    {
                        EnumContext model = new EnumContext();
                        model.Description = gate.GateName;
                        model.EnumString  = string.Format("{0}|{1}", gate.GateID, item.EnumString);
                        gateContexts.Add(model);
                    }
                }

                ViewBag.GateContexts = gateContexts;

                return(View(monthlyCarApply));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("AdminAduitCarApply", "查看月租车申请详情失败", ex, LogFrom.WeiXin);
                return(RedirectToAction("Index", "AdminAduitCarApply", new { RemindUserContent = "审核失败" }));
            }
        }
Ejemplo n.º 18
0
        ///
        ///	 <summary> * gets the matching elements in node that match this devcap
        ///	 *  </summary>
        ///	 * <param name="node">
        ///	 *            the node to search in </param>
        ///	 * <returns> VElement - the element vector of matching elements,
        ///	 *         <code>null</code> if none were found </returns>
        ///
        private VElement getMatchingElementsFromNode(JDFNode node)
        {
            VElement vElem = new VElement();

            string              nam         = getName();
            EnumContext         context     = getContext();
            JDFResourceLinkPool resLinkPool = node.getResourceLinkPool();

            if (context.Equals(EnumContext.Element))
            { // vElem - for a common return type in all cases
                if (nam.Equals(ElementName.JDF))
                {
                    vElem.Add(node);
                }
                else
                {
                    vElem = node.getChildElementVector(nam, null, null, true, 0, false);
                }
            }
            else if (context.Equals(EnumContext.Link) || context.Equals(EnumContext.Resource))
            {
                if (resLinkPool != null)
                {
                    EnumUsage linkUsage  = getLinkUsage();
                    string    procUsage  = getProcessUsage();
                    bool      bLink      = context.Equals(EnumContext.Link);
                    VElement  vElemLinks = resLinkPool.getInOutLinks(linkUsage, true, nam, null);
                    if (vElemLinks != null)
                    {
                        int linkSize = vElemLinks.Count - 1;
                        for (int j = linkSize; j >= 0; j--)
                        {
                            JDFResourceLink rl             = (JDFResourceLink)vElemLinks[j];
                            string          rlProcessUsage = rl.getProcessUsage();
                            if (!rlProcessUsage.Equals(procUsage))
                            {
                                vElemLinks.RemoveAt(j);
                            }
                        }
                    }

                    if (!bLink)
                    {
                        vElem = JDFResourceLinkPool.resourceVector(vElemLinks, null);
                    }
                    else
                    {
                        vElem = vElemLinks;
                    }
                }
            }
            else if (context.Equals(EnumContext.JMF))
            {
                // TODO __Lena__ ...
            }
            else
            { // Context_Unknown
                throw new JDFException("JDFDevCaps wrong attribute Context value");
            }

            if (vElem != null && vElem.Count == 0)
            {
                vElem = null;
            }

            return(vElem);
        }
Ejemplo n.º 19
0
 ///
 ///          <summary> * (9) get attribute Context </summary>
 ///          * <returns> the value of the attribute </returns>
 ///
 public virtual EnumContext getContext()
 {
     return(EnumContext.getEnum(getAttribute(AttributeName.CONTEXT, null, "Resource")));
 }
Ejemplo n.º 20
0
        ///
        ///	 <summary> * append elements to the node that match this DevCap, if they do not exist
        ///	 * yet
        ///	 *  </summary>
        ///	 * <param name="node">
        ///	 *            the node to append the elements to </param>
        ///	 * <param name="bAll">
        ///	 *            if false, only add if minOccurs>=1 and required=true or a
        ///	 *            default exists
        ///	 *  </param>
        ///	 * <returns> KElement - the last element that was appended </returns>
        ///
        public virtual KElement appendMatchingElementsToNode(JDFNode node, bool bAll, org.cip4.jdflib.util.VectorMap <int, JDFResource> indexResMap, bool bLink)
        {
            KElement e = null;

            EnumContext context = getContext();

            if (!bLink && EnumContext.Link.Equals(context))
            {
                return(null);
            }

            if (bLink && !EnumContext.Link.Equals(context))
            {
                return(null);
            }

            JDFDevCap devCap = getDevCap();

            if (devCap == null)
            {
                return(null);
            }

            int minOcc = devCap.getMinOccurs();

            if (minOcc == 0 && bAll)
            {
                minOcc = 1;
            }

            string nam = getName();

            for (int i = 0; i < minOcc; i++)
            {
                if (context.Equals(EnumContext.Element))
                { // vElem - for a common return type in all cases
                    if (nam.Equals(ElementName.JDF))
                    {
                        // nop - should actually never get here
                    }
                    else
                    {
                        e = node.getCreateElement(nam, getDevNS(), i);
                    }
                }
                else if (context.Equals(EnumContext.Resource) || context.Equals(EnumContext.Link))
                {
                    EnumUsage        linkUsage = getLinkUsage();
                    string           procUsage = getProcessUsage();
                    JDFAttributeMap  map       = new JDFAttributeMap();
                    EnumProcessUsage pu        = null;

                    if (procUsage != null && procUsage.Length > 0)
                    {
                        map.put(AttributeName.PROCESSUSAGE, procUsage);
                        pu = EnumProcessUsage.getEnum(procUsage);
                    }

                    if (linkUsage != null)
                    {
                        map.put(AttributeName.USAGE, linkUsage.getName());
                    }

                    VElement links = node.getResourceLinks(nam, map, null);
                    // now look for the correct combinedprocessindex - remove all
                    // non-matching
                    JDFIntegerRangeList tocNum  = getTypeOccurrenceNum();
                    JDFIntegerList      tocNum2 = tocNum == null ? null : tocNum.getIntegerList();
                    if (links != null && tocNum != null)
                    {
                        for (int ll = links.Count - 1; ll >= 0; ll--)
                        {
                            JDFResourceLink rl = (JDFResourceLink)links[ll];
                            JDFIntegerList  il = rl.getCombinedProcessIndex();
                            if (il == null || !il.Contains(tocNum2))
                            {
                                links.RemoveAt(ll);
                            }
                        }
                    }

                    if (links == null || links.Count <= i)
                    {
                        JDFResource r = null;
                        // get a link hook for the matching combinedprocessindex
                        if (bLink)
                        {
                            int kk = (tocNum2 == null || tocNum2.Count == 0) ? -1 : tocNum2.getInt(0);
                            if (EnumUsage.Input.Equals(linkUsage))
                            {
                                kk--;
                            }
                            List <JDFResource> v = null;
                            indexResMap.TryGetValue(kk, out v);
                            if (v != null)
                            {
                                int sv = v.Count;
                                for (int kkk = 0; kkk < sv; kkk++)
                                {
                                    JDFResource rr = v[kkk];
                                    if (rr.LocalName.Equals(nam))
                                    {
                                        r = rr;
                                        break;
                                    }
                                }
                            }
                        }

                        // we found no matching existing res - make a new one
                        if (r == null)
                        {
                            r = node.addResource(nam, null, linkUsage, pu, null, getDevNS(), null);
                            string id = devCap.getAttribute(AttributeName.ID, null, null);
                            if (id != null)
                            {
                                JDFResourceLink rl = node.getLink(r, linkUsage);

                                r.setID(id);
                                if (rl != null)
                                {
                                    rl.setrRef(id);
                                }
                            }

                            if (tocNum2 == null || tocNum2.Count == 0)
                            {
                                indexResMap.putOne(-1, r); //(new int(-1), r);
                            }
                            else
                            {
                                indexResMap.putOne((int)tocNum2.elementAt(0), r); // only
                            }
                            // support
                            // 1
                            // now
                        }
                        else
                        // preexisting resource - just link it
                        {
                            e = node.linkResource(r, linkUsage, pu);
                        }

                        e = node.getLink(r, linkUsage);
                        if (e != null)
                        {
                            JDFResourceLink rl = (JDFResourceLink)e;
                            rl.setCombinedProcessIndex(tocNum2);
                        }

                        // update partititons
                        JDFEnumerationState pidKeys = devCap.getEnumerationState(AttributeName.PARTIDKEYS);
                        if (pidKeys != null)
                        {
                            VString keys = pidKeys.getAllowedValueList();
                            if (keys != null && keys.Count > 0)
                            {
                                JDFAttributeMap keyMap = new JDFAttributeMap();
                                for (int k = 0; k < keys.Count; k++)
                                {
                                    string sk  = "PartKey" + k;
                                    string key = keys.stringAt(k);
                                    if (key.Equals("RunIndex"))
                                    {
                                        sk = "0~-1";
                                    }
                                    keyMap.put(key, sk);
                                }

                                r.getCreatePartition(keyMap, keys);
                            }
                        }
                    }
                }
                else if (context.Equals(EnumContext.JMF))
                {
                    // TODO __Lena__ ...
                }
            }

            return(e);
        }
Ejemplo n.º 21
0
 static JDFAutoDevCaps()
 {
     atrInfoTable[0]  = new AtrInfoTable(AttributeName.AVAILABILITY, 0x33333311, AttributeInfo.EnumAttributeType.enumeration, JDFDeviceCap.EnumAvailability.getEnum(0), "Installed");
     atrInfoTable[1]  = new AtrInfoTable(AttributeName.CONTEXT, 0x33333311, AttributeInfo.EnumAttributeType.enumeration, EnumContext.getEnum(0), "Resource");
     atrInfoTable[2]  = new AtrInfoTable(AttributeName.DEVCAPREF, 0x33333111, AttributeInfo.EnumAttributeType.IDREFS, null, null);
     atrInfoTable[3]  = new AtrInfoTable(AttributeName.DEVNS, 0x33333331, AttributeInfo.EnumAttributeType.URI, null, "http://www.CIP4.org/JDFSchema_1_1");
     atrInfoTable[4]  = new AtrInfoTable(AttributeName.ID, 0x33333311, AttributeInfo.EnumAttributeType.ID, null, null);
     atrInfoTable[5]  = new AtrInfoTable(AttributeName.LINKUSAGE, 0x33333311, AttributeInfo.EnumAttributeType.enumeration, JDFResourceLink.EnumUsage.getEnum(0), null);
     atrInfoTable[6]  = new AtrInfoTable(AttributeName.MODULEREFS, 0x33333111, AttributeInfo.EnumAttributeType.IDREFS, null, null);
     atrInfoTable[7]  = new AtrInfoTable(AttributeName.NAME, 0x22222221, AttributeInfo.EnumAttributeType.NMTOKEN, null, null);
     atrInfoTable[8]  = new AtrInfoTable(AttributeName.PROCESSUSAGE, 0x33333111, AttributeInfo.EnumAttributeType.NMTOKEN, null, null);
     atrInfoTable[9]  = new AtrInfoTable(AttributeName.REQUIRED, 0x33333311, AttributeInfo.EnumAttributeType.boolean_, null, "false");
     atrInfoTable[10] = new AtrInfoTable(AttributeName.RESOURCEUPDATE, 0x44444331, AttributeInfo.EnumAttributeType.NMTOKENS, null, null);
     atrInfoTable[11] = new AtrInfoTable(AttributeName.RESOURCEUSAGE, 0x33333111, AttributeInfo.EnumAttributeType.NMTOKEN, null, null);
     atrInfoTable[12] = new AtrInfoTable(AttributeName.TYPEOCCURRENCENUM, 0x33333311, AttributeInfo.EnumAttributeType.IntegerRangeList, null, null);
     atrInfoTable[13] = new AtrInfoTable(AttributeName.TYPES, 0x44444431, AttributeInfo.EnumAttributeType.NMTOKENS, null, null);
     elemInfoTable[0] = new ElemInfoTable(ElementName.DEVCAP, 0x33333331);
     elemInfoTable[1] = new ElemInfoTable(ElementName.LOC, 0x33333311);
 }
Ejemplo n.º 22
0
        ///
        ///	 * <param name="testRoot"> </param>
        ///	 * <param name="testlists"> </param>
        ///	 * <param name="level"> </param>
        ///	 * <param name="mrp"> </param>
        ///	 * <param name="irp"> </param>
        ///	 * <param name="resLinkPool"> </param>
        ///	 * <param name="goodElems"> </param>
        ///	 * <param name="badElems"> </param>
        ///	 * <param name="devCaps">
        ///	 * @return </param>
        ///
        public virtual void analyzeDevCaps(KElement testRoot, EnumFitsValue testlists, EnumValidationLevel level, KElement mrp, KElement irp, SupportClass.HashSetSupport goodElems, Hashtable badElems, bool ignoreExtensions)
        {
            EnumAvailability av             = getModuleAvailability();
            KElement         xpathRoot      = testRoot;
            VElement         vElemResources = null;

            if (testRoot is JDFNode)
            {
                JDFNode jdfNode = (JDFNode)testRoot;
                vElemResources = getMatchingElementsFromNode(jdfNode);
                xpathRoot      = jdfNode.getResourceLinkPool();
                if (xpathRoot == null)
                {
                    xpathRoot = testRoot;
                }
            }
            else
            {
                vElemResources = getMatchingElementsFromJMF((JDFMessage)testRoot);
            }

            int svElemResources = vElemResources == null ? 0 : vElemResources.Count;

            EnumContext context = getContext();
            KElement    r       = null;

            if (EnumValidationLevel.isRequired(level) && svElemResources < getMinOccurs() && EnumAvailability.Installed.Equals(av))
            {
                if (EnumContext.Element.Equals(context) || EnumContext.JMF.Equals(context))
                {
                    r = mrp.appendElement("MissingElement");
                    r.setAttribute("XPath", xpathRoot.buildXPath(null, 1) + "/" + getName());
                }
                else
                {
                    EnumUsage linkUsage = getLinkUsage();
                    string    procUsage = getProcessUsage();
                    r = mrp.appendElement("MissingResourceLink");
                    if (linkUsage != null)
                    {
                        r.setAttribute("Usage", linkUsage.getName());
                    }
                    if (procUsage != null && procUsage.Length > 0)
                    {
                        r.setAttribute("ProcessUsage", procUsage);
                    }
                    r.setAttribute("XPath", xpathRoot.buildXPath(null, 1) + "/" + getName());
                }
                r.setAttribute("Name", getName());
                r.setAttribute("CapXPath", getName());
                r.setAttribute("Occurrences", svElemResources, null);
                r.setAttribute("MinOccurs", getMinOccurs(), null);
            }
            else if (svElemResources > getMaxOccurs() || !EnumAvailability.Installed.Equals(av))
            {
                if (context.Equals(EnumContext.Element) || context.Equals(EnumContext.JMF))
                {
                    r = irp.appendElement("ManyElement");
                    r.setAttribute("XPath", testRoot.buildXPath(null, 1) + "/" + getName());
                }
                else
                {
                    EnumUsage linkUsage = getLinkUsage();
                    string    procUsage = getProcessUsage();
                    r = irp.appendElement("ManyResourceLink");
                    if (linkUsage != null)
                    {
                        r.setAttribute("Usage", linkUsage.getName());
                    }

                    if (procUsage != null && procUsage.Length > 0)
                    {
                        r.setAttribute("ProcessUsage", procUsage);
                    }

                    r.setAttribute("XPath", xpathRoot.buildXPath(null, 1) + "/" + getName());
                }

                r.setAttribute("Name", getName());
                r.setAttribute("CapXPath", getName());
                r.setAttribute("Occurrences", svElemResources, null);
                r.setAttribute("MaxOccurs", getMaxOccurs(), null);
                r.setAttribute("Availability", av == null ? "None" : av.getName());
            }

            if (vElemResources != null)
            {
                for (int j = 0; j < svElemResources; j++)
                {
                    KElement elem = vElemResources.item(j);
                    if (!goodElems.Contains(elem))
                    {
                        KElement report = devCapReport(elem, testlists, level, ignoreExtensions, irp); // InvalidResources
                        if (report == null)
                        {
                            goodElems.Add(elem);
                            KElement badReport = (KElement)badElems[elem];
                            if (badReport != null)
                            {
                                badReport.deleteNode();
                            }
                        }
                        else
                        {
                            badElems.Add(elem, report);
                        }
                    }
                }
            }
        }