/*
(non-Javadoc)

@see com.ibm.ws.sib.store.Item#itemReferencesDroppedToZero()
968860
@Override
    public void itemReferencesDroppedToZero()
    {
        super.itemReferencesDroppedToZero();
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "itemReferencesDroppedToZero");

        if (failedInitInRestore)
        {
            try
            {
                initialiseNonPersistent(true);
            } catch (SevereMessageStoreException e)
            {
                FFDCFilter.processException(
                                            e,
                                            "com.ibm.ws.sib.processor.impl.store.items.MessageItem.itemReferencesDroppedToZero",
                                            "1:1617:1.244.1.40",
                                            this);

                //There was a problem getting hold of the itemstream when trying to initilise
                //We wouldn't have registered any callbacks yet so we shouldn't carry on

                SibTr.exception(tc, e);

                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(this, tc, "itemReferencesDroppedToZero", e);

                throw new SIErrorException(e);
            }
        }

        if (REFERENCES_DROPPED_TO_ZERO != null)
        {
            try
            {
                REFERENCES_DROPPED_TO_ZERO.messageEventOccurred(MessageEvents.REFERENCES_DROPPED_TO_ZERO, this, null);
            } catch (SIException e)
            {
                // Exceptions after a commit are bad !
                FFDCFilter.processException(
                                            e,
                                            "com.ibm.ws.sib.processor.impl.store.items.MessageItem.itemReferencesDroppedToZero",
                                            "1:1644:1.244.1.40",
                                            this);

                SibTr.exception(tc, e);

                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(this, tc, "itemReferencesDroppedToZero", e);

                throw new SIErrorException(e);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "itemReferencesDroppedToZero");
    }
641128
@Override
	public void setReference(Record reference) {
		for (int i = 0; i < this.keyFields1.length; i++) {
			if (!reference.getFieldInto(this.keyFields1[i], this.keyHolders1[i])) {
				throw new NullKeyFieldException(this.keyFields1[i]);
			}
		}
	}
459040
public final int childItemPosition(int childAdapterPosition) {
        int itemCount = 0;

        int parentCount = parentItemCount();
        for (int i = 0; i < parentCount; i++) {
            itemCount += 1;

            if (isExpanded(i)) {
                int childCount = childItemCount(i);
                itemCount += childCount;

                if (childAdapterPosition < itemCount) {
                    return childCount - (itemCount - childAdapterPosition);
                }
            } else {
                // itemCount += 1;
            }
        }

        throw new IllegalStateException("The adapter position is invalid: " + childAdapterPosition);
    }
1096430
private void resetGlobalVarReferences(
      Map<Var, ReferenceCollection> globalRefMap) {
    refMap = new LinkedHashMap<>();
    for (Entry<Var, ReferenceCollection> entry : globalRefMap.entrySet()) {
      Var var = entry.getKey();
      if (var.isGlobal()) {
        refMap.put(var.getName(), entry.getValue());
      }
    }
  }
1054342
private void populateRepackagedToCredentialReference(ModelNode payload, String repackagedPropName, String propertyName) {
        ModelNode value = payload.get(repackagedPropName);
        if (payload.hasDefined(repackagedPropName) && value.asString().trim().length() > 0) {
            payload.get(CREDENTIAL_REFERENCE).get(propertyName).set(value);
        }
        payload.remove(repackagedPropName);
    }
546620
public synchronized final void ensureReferencesLoaded() throws SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "ensureReferencesLoaded");

        _references();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "ensureReferencesLoaded");
    }
849244
Object resolveTypeReference(TypeMirror type) {
        Object result = Void.TYPE;
        if (type.getKind().isPrimitive()) {
            result = resolvePrimitiveTypeReference(type);
        } else if (type.getKind() == ARRAY) {
            ArrayType arrayType = (ArrayType) type;
            TypeMirror componentType = arrayType.getComponentType();
            if (componentType.getKind().isPrimitive()) {
                result = classOfPrimitiveArrayFor(resolvePrimitiveTypeReference(componentType).getName());
            } else {
                final TypeMirror erased = typeUtils.erasure(componentType);
                final Element e = typeUtils.asElement(erased);
                if (e instanceof TypeElement) {
                    result = resolveTypeReferenceForTypeElement((TypeElement) e) + "[]";
                }
            }
        } else if (type.getKind() != VOID && type.getKind() != ERROR) {
            final TypeMirror erased = typeUtils.erasure(type);
            final Element element = typeUtils.asElement(erased);
            if (element instanceof TypeElement) {
                TypeElement te = (TypeElement) element;
                result = resolveTypeReferenceForTypeElement(te);
            }
        }
        return result;
    }
1102652
private void processCustomIdNodeMapping(final Map<String, TreeItemIdNode> map, final TreeItemIdNode node) {
		String itemId = node.getItemId();
		if (!Util.empty(itemId)) {
			map.put(itemId, node);
		}

		for (TreeItemIdNode childItem : node.getChildren()) {
			processCustomIdNodeMapping(map, childItem);
		}
	}
282980
@Override
    public void itemCacheSetManagedReference(AbstractItem item)
    {
        // Defect 601995
        if (item != null)
        {
            _itemCacheManagedReference = item;
        }
        else
        {
            // If our cache reference is being set to null then 
            // use the new named class instead.
            _itemCacheManagedReference = NULL_CACHE_REF;
        }
    }
242500
public static <Item extends IItem> void restoreSubItemSelectionStatesForAlternativeStateManagement(Item item, List<String> selectedItems) {
        if (item instanceof IExpandable && !((IExpandable) item).isExpanded() && ((IExpandable) item).getSubItems() != null) {
            List<Item> subItems = (List<Item>) ((IExpandable<Item, ?>) item).getSubItems();
            for (int i = 0, size = subItems.size(); i < size; i++) {
                Item subItem = subItems.get(i);
                String id = String.valueOf(subItem.getIdentifier());
                if (selectedItems != null && selectedItems.contains(id)) {
                    subItem.withSetSelected(true);
                }
                restoreSubItemSelectionStatesForAlternativeStateManagement(subItem, selectedItems);
            }
        }
    }
268327
public synchronized void addDeferredReferenceData(DeferredReferenceData refData) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "addDeferredReferenceData", "this=" + this, refData);
        }

        if (deferredReferenceDatas == null) {
            deferredReferenceDatas = new LinkedHashMap<DeferredReferenceData, Boolean>();
            if (parent != null && deferredReferenceDataEnabled) {
                parent.addDeferredReferenceData(this);
            }
        }
        deferredReferenceDatas.put(refData, null);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "addDeferredReferenceData");
        }
    }
1262126
public List<ItemReference> getItemReference(int itemId) {
		return getResourceFactory().getApiResource(
				"/item/" + itemId + "/reference/").get(
				new GenericType<List<ItemReference>>() {
				});
	}
311718
int readReferenceOrNull (Input input, Class type, boolean mayBeNull) {
		if (type.isPrimitive()) type = getWrapperClass(type);
		boolean referencesSupported = referenceResolver.useReferences(type);
		int id;
		if (mayBeNull) {
			id = input.readVarInt(true);
			if (id == NULL) {
				if (TRACE || (DEBUG && depth == 1)) log("Read", null, input.position());
				readObject = null;
				return REF;
			}
			if (!referencesSupported) {
				readReferenceIds.add(NO_REF);
				return readReferenceIds.size;
			}
		} else {
			if (!referencesSupported) {
				readReferenceIds.add(NO_REF);
				return readReferenceIds.size;
			}
			id = input.readVarInt(true);
		}
		if (id == NOT_NULL) {
			if (TRACE) trace("kryo", "Read: <not null>" + pos(input.position()));
			// First time object has been encountered.
			id = referenceResolver.nextReadId(type);
			if (TRACE) trace("kryo", "Read initial reference " + id + ": " + className(type) + pos(input.position()));
			readReferenceIds.add(id);
			return readReferenceIds.size;
		}
		// The id is an object reference.
		id -= 2; // - 2 because 0 and 1 are used for NULL and NOT_NULL.
		readObject = referenceResolver.getReadObject(type, id);
		if (DEBUG) debug("kryo", "Read reference " + id + ": " + string(readObject) + pos(input.position()));
		return REF;
	}
1025356
public void closeReferenceData() {
        if (_referenceDataActivationManager == null) {
            return;
        }
        final Collection<Object> referenceData = _referenceDataActivationManager.getAllReferenceData();
        for (Object object : referenceData) {
            ComponentDescriptor<? extends Object> descriptor = Descriptors.ofComponent(object.getClass());
            close(descriptor, object, true);
        }
    }
347429
private ArrayList handleDependentReferences(Identity oid, Object userObject,
            Object[] origFields, Object[] newFields, Object[] newRefs)
            throws LockingException
    {
        ClassDescriptor mif = _pb.getClassDescriptor(userObject.getClass());
        FieldDescriptor[] fieldDescs = mif.getFieldDescriptions();
        Collection refDescs = mif.getObjectReferenceDescriptors();
        int count = 1 + fieldDescs.length;
        ArrayList newObjects = new ArrayList();
        int countRefs = 0;

        for (Iterator it = refDescs.iterator(); it.hasNext(); count++, countRefs++)
        {
            ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) it.next();
            Identity origOid = (origFields == null ? null : (Identity) origFields[count]);
            Identity newOid = (Identity) newFields[count];

            if (rds.getOtmDependent())
            {
                if ((origOid == null) && (newOid != null))
                {
                    ContextEntry entry = (ContextEntry) _objects.get(newOid);

                    if (entry == null)
                    {
                        Object relObj = newRefs[countRefs];
                        insertInternal(newOid, relObj, LockType.WRITE_LOCK,
                                       true, oid, new Stack());
                        newObjects.add(newOid);
                    }
                }
                else if ((origOid != null) &&
                         ((newOid == null) || !newOid.equals(origOid)))
                {
                    markDelete(origOid, oid, false);
                }
            }
        }

        return newObjects;
    }
507132
protected final PrcDelItemFromCart<RS> lazyGetPrcDelItemFromCart(
    final Map<String, Object> pAddParam) throws Exception {
    String beanName = PrcDelItemFromCart.class.getSimpleName();
    @SuppressWarnings("unchecked")
    PrcDelItemFromCart<RS> proc = (PrcDelItemFromCart<RS>)
      this.processorsMap.get(beanName);
    if (proc == null) {
      proc = new PrcDelItemFromCart<RS>();
      proc.setSrvOrm(getSrvOrm());
      proc.setSrvShoppingCart(getSrvShoppingCart());
      proc.setProcessorsFactory(this);
      //assigning fully initialized object:
      this.processorsMap.put(beanName, proc);
      this.logger.info(null, FctBnPublicTradeProcessors.class,
        beanName + " has been created.");
    }
    return proc;
  }
27268
public int getPosition(Item item) {
        if (item.getIdentifier() == -1) {
            Log.e("FastAdapter", "You have to define an identifier for your item to retrieve the position via this method");
            return -1;
        }
        return getPosition(item.getIdentifier());
    }