예제 #1
0
 override public bool Equals(Object obj)
 {
     if (obj is PRIMProduct)
     {
         PRIMProduct pp = (PRIMProduct)obj;
         return(pp.primProdNo.Equals(primProdNo) &&
                pp.primRState.Equals(primRState));
     }
     return(base.Equals(obj));
 }
예제 #2
0
        public List <String> mapToEcr(String ecmProperty, WorkItem workItem)
        {
            List <String> mappedValues = new List <String>();

            List <Property> properties = AttributesMapper.getInstance().getInverseProperties(ecmProperty);

            if (properties == null)
            {
                // Property has no inverse entry in mapping - inconsistent state
                HandlerSettings.LogMessage(
                    String.Format("Property: {0} has no inverse entry in mapping file", ecmProperty),
                    HandlerSettings.LoggingLevel.WARN);
                return(mappedValues);
            }

            foreach (Property property in properties)
            {
                // Get the TFS fieldName mapped to the ecmProperty
                String fieldName = property.getValue();

                // Get the TFS fieldValue for the fieldName
                String fieldValue = getFieldValue(workItem, fieldName);

                // Handle "use" case
                String useMapping = property.getUseMapping();
                if (useMapping != null && useMapping.Equals("ProductMapping"))
                {
                    PRIMProduct primProduct = ProductMapper.getInstance().GetProduct(fieldValue);
                    if (primProduct == null)
                    {
                        // No product found for release, so this is not a maintenance Bug.
                        // Should likely have been caught before this, but return empty.
                        return(mappedValues);
                    }

                    String useKey = property.getUseKey();
                    if (useKey != null)
                    {
                        if (useKey.Equals("primProdNo"))
                        {
                            mappedValues.Add(primProduct.getPrimProdNo());
                        }
                        else if (useKey.Equals("primRState"))
                        {
                            mappedValues.Add(primProduct.getPrimRState());
                        }
                    }

                    return(mappedValues);
                }

                // Get or adjust the TFS value in case of complex mapping
                fieldValue = getTFSFieldValue(workItem, fieldName, fieldValue);

                // Lookup value in the property value map table. If mapped value is found,
                // this is added. Else if defaultValue is defined, this is used. Else the
                // fieldValue itself is returned.

                List <String> values = property.getInverse(fieldValue, workItem);
                if (values != null)
                {
                    foreach (String mappedValue in values)
                    {
                        String adjustedValue = adjustTFSFieldValue(workItem, fieldName, mappedValue);
                        mappedValues.Add(adjustedValue);
                    }
                }
            }

            return(mappedValues);
        }