微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javax.persistence.AccessType的实例源码

项目:lams    文件JPAOverriddenAnnotationReader.java   
private boolean isProcessingId(XMLContext.Default defaults) {
    boolean isExplicit = defaults.getAccess() != null;
    boolean correctAccess =
            ( PropertyType.PROPERTY.equals( propertyType ) && Accesstype.PROPERTY.equals( defaults.getAccess() ) )
                    || ( PropertyType.FIELD.equals( propertyType ) && Accesstype.FIELD
                    .equals( defaults.getAccess() ) );
    boolean hasId = defaults.canUseJavaAnnotations()
            && ( isPhysicalAnnotationPresent( Id.class ) || isPhysicalAnnotationPresent( EmbeddedId.class ) );
    //if ( properAccessOnMetadataComplete || properOverridingOnMetadatanonComplete ) {
    boolean mirrorAttributeIsId = defaults.canUseJavaAnnotations() &&
            ( mirroredAttribute != null &&
                    ( mirroredAttribute.isAnnotationPresent( Id.class )
                            || mirroredAttribute.isAnnotationPresent( EmbeddedId.class ) ) );
    boolean propertyIsDefault = PropertyType.PROPERTY.equals( propertyType )
            && !mirrorAttributeIsId;
    return correctAccess || ( !isExplicit && hasId ) || ( !isExplicit && propertyIsDefault );
}
项目:lams    文件JPAOverriddenAnnotationReader.java   
private void getAccesstype(List<Annotation> annotationList,Element element) {
    if ( element == null ) {
        return;
    }
    String access = element.attributeValue( "access" );
    if ( access != null ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( Access.class );
        Accesstype type;
        try {
            type = Accesstype.valueOf( access );
        }
        catch ( IllegalArgumentException e ) {
            throw new AnnotationException( access + " is not a valid access type. Check you xml confguration." );
        }

        if ( ( Accesstype.PROPERTY.equals( type ) && this.element instanceof Method ) ||
                ( Accesstype.FIELD.equals( type ) && this.element instanceof Field ) ) {
            return;
        }

        ad.setValue( "value",type );
        annotationList.add( AnnotationFactory.create( ad ) );
    }
}
项目:lams    文件EmbeddableHierarchy.java   
@SuppressWarnings("unchecked")
private EmbeddableHierarchy(
        List<ClassInfo> classInfoList,String propertyName,AnnotationBindingContext context,Accesstype defaultAccesstype) {
    this.defaultAccesstype = defaultAccesstype;

    // the resolved type for the top level class in the hierarchy
    context.resolveAllTypes( classInfoList.get( classInfoList.size() - 1 ).name().toString() );

    embeddables = new ArrayList<EmbeddableClass>();
    ConfiguredClass parent = null;
    EmbeddableClass embeddable;
    for ( ClassInfo info : classInfoList ) {
        embeddable = new EmbeddableClass(
                info,propertyName,parent,defaultAccesstype,context
        );
        embeddables.add( embeddable );
        parent = embeddable;
    }
}
项目:lams    文件ConfiguredClass.java   
public ConfiguredClass(
        ClassInfo classInfo,Accesstype defaultAccesstype,ConfiguredClass parent,AnnotationBindingContext context) {
    this.parent = parent;
    this.classInfo = classInfo;
    this.clazz = context.locateClassByName( classInfo.toString() );
    this.configuredClasstype = determineType();
    this.classAccesstype = determineClassAccesstype( defaultAccesstype );
    this.customTuplizer = determineCustomTuplizer();

    this.simpleAttributeMap = new TreeMap<String,BasicAttribute>();
    this.idAttributeMap = new TreeMap<String,BasicAttribute>();
    this.associationAttributeMap = new TreeMap<String,AssociationAttribute>();

    this.localBindingContext = new EntityBindingContext( context,this );

    collectAttributes();
    attributeOverrideMap = Collections.unmodifiableMap( findAttributeOverrides() );
}
项目:lams    文件EntityHierarchyBuilder.java   
/**
 * @param classes the classes in the hierarchy
 *
 * @return Returns the default access type for the configured class hierarchy independent of explicit
 *         {@code Accesstype} annotations. The default access type is determined by the placement of the
 *         annotations.
 */
private static Accesstype determineDefaultAccesstype(List<ClassInfo> classes) {
    Accesstype accesstypeByEmbeddedIdplacement = null;
    Accesstype accesstypeByIdplacement = null;
    for ( ClassInfo info : classes ) {
        List<AnnotationInstance> idAnnotations = info.annotations().get( JPADotNames.ID );
        List<AnnotationInstance> embeddedIdAnnotations = info.annotations().get( JPADotNames.EMbedDED_ID );

        if ( CollectionHelper.isNotEmpty( embeddedIdAnnotations ) ) {
            accesstypeByEmbeddedIdplacement = determineAccesstypeByIdplacement( embeddedIdAnnotations );
        }
        if ( CollectionHelper.isNotEmpty( idAnnotations ) ) {
            accesstypeByIdplacement = determineAccesstypeByIdplacement( idAnnotations );
        }
    }
    if ( accesstypeByEmbeddedIdplacement != null ) {
        return accesstypeByEmbeddedIdplacement;
    }
    else if ( accesstypeByIdplacement != null ) {
        return accesstypeByIdplacement;
    }
    else {
        return throwIdNotFoundAnnotationException( classes );
    }
}
项目:lams    文件EntityHierarchyBuilder.java   
private static Accesstype determineAccesstypeByIdplacement(List<AnnotationInstance> idAnnotations) {
    Accesstype accesstype = null;
    for ( AnnotationInstance annotation : idAnnotations ) {
        Accesstype tmpAccesstype;
        if ( annotation.target() instanceof FieldInfo ) {
            tmpAccesstype = Accesstype.FIELD;
        }
        else if ( annotation.target() instanceof MethodInfo ) {
            tmpAccesstype = Accesstype.PROPERTY;
        }
        else {
            throw new AnnotationException( "Invalid placement of @Id annotation" );
        }

        if ( accesstype == null ) {
            accesstype = tmpAccesstype;
        }
        else {
            if ( !accesstype.equals( tmpAccesstype ) ) {
                throw new AnnotationException( "Inconsistent placement of @Id annotation within hierarchy " );
            }
        }
    }
    return accesstype;
}
项目:lams    文件EntityMocker.java   
protected Accesstype getAccessFromIndex(DotName className) {
    Map<DotName,List<AnnotationInstance>> indexedAnnotations = indexBuilder.getIndexedAnnotations( className );
    List<AnnotationInstance> accessAnnotationInstances = indexedAnnotations.get( ACCESS );
    if ( MockHelper.isNotEmpty( accessAnnotationInstances ) ) {
        for ( AnnotationInstance annotationInstance : accessAnnotationInstances ) {
            if ( annotationInstance.target() != null && annotationInstance.target() instanceof ClassInfo ) {
                ClassInfo ci = (ClassInfo) ( annotationInstance.target() );
                if ( className.equals( ci.name() ) ) {
                    //todo does ci need to have @Entity or @MappedSuperClass ??
                    return Accesstype.valueOf( annotationInstance.value().asEnum() );
                }
            }
        }
    }
    return null;
}
项目:oma-riista-web    文件EmailToken.java   
@Override
@Id
@Size(min = 16,max = 255)
@Access(value = Accesstype.PROPERTY)
@Column(name = "token_data",nullable = false,length = 255)
public String getId() {
    return id;
}
项目:oma-riista-web    文件SrvaEvent.java   
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "srva_event_id",nullable = false)
@Access(value = Accesstype.PROPERTY)
@Override
public Long getId() {
    return id;
}
项目:oma-riista-web    文件ObservationContextSensitiveFields.java   
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(nullable = false)
@Access(value = Accesstype.PROPERTY)
@Override
public Long getId() {
    return id;
}
项目:lams    文件XMLContext.java   
private void setAccess( String access,Default defaultType) {
    Accesstype type;
    if ( access != null ) {
        try {
            type = Accesstype.valueOf( access );
        }
        catch ( IllegalArgumentException e ) {
            throw new AnnotationException( "Invalid access type " + access + " (check your xml configuration)" );
        }
        defaultType.setAccess( type );
    }
}
项目:lams    文件EntityClass.java   
public EntityClass(
        ClassInfo classInfo,EntityClass parent,Accesstype hierarchyAccesstype,InheritanceType inheritanceType,AnnotationBindingContext context) {
    super( classInfo,hierarchyAccesstype,context );
    this.inheritanceType = inheritanceType;
    this.idType = determineIdType();
    boolean hasOwnTable = definesItsOwnTable();
    this.explicitEntityName = determineExplicitEntityName();
    this.constraintSources = new HashSet<ConstraintSource>();

    if ( hasOwnTable ) {
        AnnotationInstance tableAnnotation = JandexHelper.getSingleAnnotation(
                getClassInfo(),JPADotNames.TABLE
        );
        this.primaryTableSource = createTableSource( tableAnnotation );
    }
    else {
        this.primaryTableSource = null;
    }

    this.secondaryTableSources = createSecondaryTableSources();
    this.customloaderQueryName = determineCustomloader();
    this.synchronizedTableNames = determineSynchronizedTableNames();
    this.batchSize = determineBatchSize();
    this.jpaCallbacks = determineEntityListeners();

    processHibernateEntitySpecificAnnotations();
    processCustomsqlAnnotations();
    processproxygeneration();
    processdiscriminator();
}
项目:lams    文件ConfiguredClass.java   
private Accesstype determineClassAccesstype(Accesstype defaultAccesstype) {
    // default to the hierarchy access type to start with
    Accesstype accesstype = defaultAccesstype;

    AnnotationInstance accessAnnotation = JandexHelper.getSingleAnnotation( classInfo,JPADotNames.ACCESS );
    if ( accessAnnotation != null && accessAnnotation.target().getClass().equals( ClassInfo.class ) ) {
        accesstype = JandexHelper.getEnumValue( accessAnnotation,"value",Accesstype.class );
    }

    return accesstype;
}
项目:lams    文件EmbeddableClass.java   
public EmbeddableClass(
        ClassInfo classInfo,String embeddedAttributeName,context );
    this.embeddedAttributeName = embeddedAttributeName;
    this.parentReferencingAttributeName = checkParentAnnotation();
}
项目:lams    文件EntityHierarchyBuilder.java   
private static void addSubclassEntitySources(AnnotationBindingContext bindingContext,Map<DotName,List<ClassInfo>> classtoDirectSubClassMap,InheritanceType hierarchyInheritanceType,EntityClass entityClass,EntitySource entitySource) {
    List<ClassInfo> subClassInfoList = classtoDirectSubClassMap.get( DotName.createSimple( entitySource.getClassName() ) );
    if ( subClassInfoList == null ) {
        return;
    }
    for ( ClassInfo subClassInfo : subClassInfoList ) {
        EntityClass subclassEntityClass = new EntityClass(
                subClassInfo,entityClass,hierarchyInheritanceType,bindingContext
        );
        SubclassEntitySource subclassEntitySource = new SubclassEntitySourceImpl( subclassEntityClass );
        entitySource.add( subclassEntitySource );
        addSubclassEntitySources(
                bindingContext,classtoDirectSubClassMap,subclassEntityClass,subclassEntitySource
        );
    }
}
项目:lams    文件EntityMocker.java   
protected Accesstype getDefaultAccess() {
    if ( entity.getAccess() != null ) {
        return Accesstype.valueOf( entity.getAccess().value() );
    }

    return null;
}
项目:oma-riista-web    文件Integration.java   
@Override
@Id
@Access(value = Accesstype.PROPERTY)
@Column(name = "integration_id",nullable = false)
@Size(max = 255)
public String getId() {
    return this.id;
}
项目:oma-riista-web    文件AnnouncementSubscriber.java   
@Override
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Access(value = Accesstype.PROPERTY)
@Column(name = "announcement_subscriber_id",nullable = false)
public Long getId() {
    return id;
}
项目:oma-riista-web    文件Announcement.java   
@Override
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Access(value = Accesstype.PROPERTY)
@Column(name = "announcement_id",nullable = false)
public Long getId() {
    return id;
}
项目:oma-riista-web    文件HuntingClubArea.java   
@Override
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Access(value = Accesstype.PROPERTY)
@Column(name = ID_COLUMN_NAME,nullable = false)
public Long getId() {
    return this.id;
}
项目:oma-riista-web    文件MooseDataCardImport.java   
@Override
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Access(value = Accesstype.PROPERTY)
@Column(name = "moose_data_card_import_id",nullable = false)
public Long getId() {
    return id;
}
项目:oma-riista-web    文件GroupHuntingDay.java   
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "group_hunting_day_id",nullable = false)
@Access(value = Accesstype.PROPERTY)
@Override
public Long getId() {
    return id;
}
项目:oma-riista-web    文件ObservationRejection.java   
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "group_observation_rejection_id",nullable = false)
@Access(value = Accesstype.PROPERTY)
@Override
public Long getId() {
    return id;
}
项目:oma-riista-web    文件HarvestRejection.java   
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "group_harvest_rejection_id",nullable = false)
@Access(value = Accesstype.PROPERTY)
@Override
public Long getId() {
    return id;
}
项目:oma-riista-web    文件HuntingClubMemberInvitation.java   
@Override
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Access(value = Accesstype.PROPERTY)
@Column(name = "hunting_club_member_invitation_id",nullable = false)
public Long getId() {
    return id;
}
项目:oma-riista-web    文件BasicclubHuntingSummary.java   
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "hunting_summary_id",nullable = false)
@Access(value = Accesstype.PROPERTY)
@Override
public Long getId() {
    return id;
}
项目:oma-riista-web    文件MooseHuntingSummary.java   
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "moose_hunting_summary_id",nullable = false)
@Access(value = Accesstype.PROPERTY)
@Override
public Long getId() {
    return id;
}
项目:oma-riista-web    文件MooseHarvestReport.java   
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "moose_harvest_report_id",nullable = false)
@Access(value = Accesstype.PROPERTY)
@Override
public Long getId() {
    return id;
}
项目:oma-riista-web    文件GISHirvitalousalue.java   
@Override
@Id
@Access(value = Accesstype.PROPERTY)
@Column(name = "gid",nullable = false)
public Integer getId() {
    return id;
}
项目:oma-riista-web    文件GISMetsahallitusHirvi.java   
@Override
@Id
@Access(value = Accesstype.PROPERTY)
@Column(name = "gid",nullable = false)
public Integer getId() {
    return id;
}
项目:oma-riista-web    文件GISZone.java   
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Access(value = Accesstype.PROPERTY)
@Column(name = ID_COLUMN_NAME,nullable = false)
@Override
public Long getId() {
    return this.id;
}
项目:oma-riista-web    文件SrvaMethod.java   
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = ID_COLUMN_NAME,nullable = false)
@Access(value = Accesstype.PROPERTY)
@Override
public Long getId() {
    return id;
}
项目:oma-riista-web    文件SrvaSpecimen.java   
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = ID_COLUMN_NAME,nullable = false)
@Access(value = Accesstype.PROPERTY)
@Override
public Long getId() {
    return id;
}
项目:oma-riista-web    文件Harvest.java   
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "harvest_id",nullable = false)
@Access(value = Accesstype.PROPERTY)
@Override
public Long getId() {
    return id;
}
项目:oma-riista-web    文件HarvestSpecimen.java   
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "harvest_specimen_id",nullable = false)
@Access(value = Accesstype.PROPERTY)
@Override
public Long getId() {
    return id;
}
项目:oma-riista-web    文件Observation.java   
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "game_observation_id",nullable = false)
@Access(value = Accesstype.PROPERTY)
@Override
public Long getId() {
    return id;
}
项目:oma-riista-web    文件ObservationSpecimen.java   
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "observation_specimen_id",nullable = false)
@Access(value = Accesstype.PROPERTY)
@Override
public Long getId() {
    return id;
}
项目:oma-riista-web    文件GameDiaryImage.java   
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "game_diary_image_id",nullable = false)
@Access(value = Accesstype.PROPERTY)
@Override
public Long getId() {
    return id;
}
项目:oma-riista-web    文件AccountActivityMessage.java   
@Override
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Access(value = Accesstype.PROPERTY)
@Column(name = "message_id",nullable = false)
public Long getId() {
    return id;
}
项目:oma-riista-web    文件SystemUser.java   
@Override
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Access(value = Accesstype.PROPERTY)
@Column(name = "user_id",nullable = false)
public Long getId() {
    return id;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。