Package org.eclipse.persistence.descriptors

Examples of org.eclipse.persistence.descriptors.ClassDescriptor


                    getUnmarshaller().getUnmarshalListener().afterUnmarshal(currentObject, null);
                }
            }

            // HANDLE POST BUILD EVENTS
            ClassDescriptor xmlDescriptor = treeObjectBuilder.getDescriptor();
            if(xmlDescriptor.hasEventManager()) {
                DescriptorEventManager eventManager = xmlDescriptor.getEventManager();
                if (null != eventManager && eventManager.hasAnyEventListeners()) {
                    DescriptorEvent event = new DescriptorEvent(currentObject);
                    event.setSession(session);
                    event.setRecord(this);
                    event.setEventCode(DescriptorEventManager.PostBuildEvent);
                    eventManager.executeEvent(event);
                }
            }
        } catch (EclipseLinkException e) {
            if (null == xmlReader.getErrorHandler()) {
                throw e;
            } else {
                SAXParseException saxParseException = new SAXParseException(null, null, null, 0, 0, e);
                xmlReader.getErrorHandler().error(saxParseException);
            }
        }

        // if the object has any primary key fields set, add it to the cache
        if (session.isUnitOfWork()) {
            ClassDescriptor xmlDescriptor = treeObjectBuilder.getDescriptor();
            if(null != xmlDescriptor) {
                List primaryKeyFields = xmlDescriptor.getPrimaryKeyFields();
                if(null != primaryKeyFields) {
                    int primaryKeyFieldsSize = primaryKeyFields.size();
                    if (primaryKeyFieldsSize > 0) {
                        Object pk = treeObjectBuilder.extractPrimaryKeyFromObject(currentObject, session);
                        for (int x=0; x<primaryKeyFieldsSize; x++) {
                            Object value = ((CacheId)pk).getPrimaryKey()[x];
                            if (null == value) {
                                XMLField pkField = (XMLField) xmlDescriptor.getPrimaryKeyFields().get(x);
                                ((CacheId)pk).set(x, getUnmarshaller().getXMLContext().getValueByXPath(currentObject, pkField.getXPath(), pkField.getNamespaceResolver(), Object.class));
                            }
                        }
                        CacheKey key = session.getIdentityMapAccessorInstance().acquireDeferredLock(pk, xmlDescriptor.getJavaClass(), xmlDescriptor);
                        key.setRecord(this);
                        key.setObject(currentObject);
                        key.releaseDeferredLock();
                    }
                }
View Full Code Here


            }
            proj.convertClassNamesToClasses(conversionManager.getLoader());
            // need to make sure that the java class is set properly on each
            // descriptor when using java classname - req'd for JOT api implementation
            for (Iterator<ClassDescriptor> descriptorIt = proj.getOrderedDescriptors().iterator(); descriptorIt.hasNext();) {
                ClassDescriptor descriptor = descriptorIt.next();
                if (descriptor.getJavaClass() == null) {
                    descriptor.setJavaClass(conversionManager.convertClassNameToClass(descriptor.getJavaClassName()));
                }
            }


            XMLPlatform platform = new SAXPlatform();
View Full Code Here

    // For aggregate mappings (@Embedded and @EmbeddedId), we need to use the descriptor
    // because its mappings have to be retrieve from this one and not from the descriptor
    // returned when querying it with a Java type
    if (mapping.isAggregateMapping()) {
      ClassDescriptor descriptor = ((AggregateMapping) mapping).getReferenceDescriptor();
      if (descriptor != null) {
        return descriptor.getJavaClass();
      }
    }

    // Relationship mapping
    if (mapping.isForeignReferenceMapping()) {
      ClassDescriptor descriptor = mapping.getReferenceDescriptor();
      if (descriptor != null) {
        return descriptor.getJavaClass();
      }
    }
    // Collection mapping
    else if (mapping.isCollectionMapping()) {
      return mapping.getContainerPolicy().getContainerClass();
View Full Code Here

  ClassDescriptor resolveDescriptor(Expression expression) {

    PathResolver resolver = pathResolver();

    DatabaseMapping oldMapping    = resolver.mapping;
    ClassDescriptor oldDescriptor = resolver.descriptor;

    try {
      resolver.mapping    = null;
      resolver.descriptor = null;
View Full Code Here

    PathResolver resolver = pathResolver();

    QueryKey oldQueryKey          = resolver.queryKey;
    DatabaseMapping oldMapping    = resolver.mapping;
    ClassDescriptor oldDescriptor = resolver.descriptor;

    try {
      resolver.mapping    = null;
      resolver.descriptor = null;
      resolver.queryKey   = null;
View Full Code Here

    PathResolver resolver = pathResolver();

    QueryKey oldQueryKey          = resolver.queryKey;
    DatabaseMapping oldMapping    = resolver.mapping;
    ClassDescriptor oldDescriptor = resolver.descriptor;

    try {
      resolver.mapping    = null;
      resolver.descriptor = null;
      resolver.queryKey   = null;
View Full Code Here

    PathResolver resolver = pathResolver();

    QueryKey oldQueryKey          = resolver.queryKey;
    DatabaseMapping oldMapping    = resolver.mapping;
    ClassDescriptor oldDescriptor = resolver.descriptor;

    try {
      resolver.mapping    = null;
      resolver.descriptor = null;
      resolver.queryKey   = null;
View Full Code Here

    PathResolver resolver = pathResolver();

    QueryKey oldQueryKey          = resolver.queryKey;
    DatabaseMapping oldMapping    = resolver.mapping;
    ClassDescriptor oldDescriptor = resolver.descriptor;

    try {
      resolver.mapping    = null;
      resolver.descriptor = null;
      resolver.queryKey   = null;
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  public void visit(AbstractSchemaName expression) {
    ClassDescriptor descriptor = queryContext.getDescriptor(expression.getText());
    type = descriptor.getJavaClass();
  }
View Full Code Here

   * {@inheritDoc}
   */
  @Override
  public void visit(EntityTypeLiteral expression) {
    String entityTypeName = expression.getEntityTypeName();
    ClassDescriptor descriptor = queryContext.getDescriptor(entityTypeName);
    type = descriptor.getJavaClass();
  }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.descriptors.ClassDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.