當前位置: 首頁>>代碼示例>>Java>>正文


Java PostLoad類代碼示例

本文整理匯總了Java中javax.persistence.PostLoad的典型用法代碼示例。如果您正苦於以下問題:Java PostLoad類的具體用法?Java PostLoad怎麽用?Java PostLoad使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PostLoad類屬於javax.persistence包,在下文中一共展示了PostLoad類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: postLoad

import javax.persistence.PostLoad; //導入依賴的package包/類
/**
 * Initializes the registered service with default values
 * for fields that are unspecified. Only triggered by JPA.
 * @since 4.1
 */
@PostLoad
public final void postLoad() {
    if (this.proxyPolicy == null) {
        this.proxyPolicy = new RefuseRegisteredServiceProxyPolicy();
    }
    if (this.usernameAttributeProvider == null) {
        this.usernameAttributeProvider = new DefaultRegisteredServiceUsernameProvider();
    }
    if (this.logoutType == null) {
        this.logoutType = LogoutType.BACK_CHANNEL;
    }
    if (this.requiredHandlers == null) {
        this.requiredHandlers = new HashSet<>();
    }
    if (this.accessStrategy == null) {
        this.accessStrategy = new DefaultRegisteredServiceAccessStrategy();
    }
    if (this.properties == null) {
        this.properties = new HashMap<>();
    }
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:27,代碼來源:AbstractRegisteredService.java

示例2: postLoad

import javax.persistence.PostLoad; //導入依賴的package包/類
/**
 * Initializes the registered service with default values
 * for fields that are unspecified. Only triggered by JPA.
 * @since 4.1
 */
@PostLoad
public final void postLoad() {
    if (this.proxyPolicy == null) {
        this.proxyPolicy = new RefuseRegisteredServiceProxyPolicy();
    }
    if (this.usernameAttributeProvider == null) {
        this.usernameAttributeProvider = new DefaultRegisteredServiceUsernameProvider();
    }
    if (this.logoutType == null) {
        this.logoutType = LogoutType.BACK_CHANNEL;
    }
    if (this.requiredHandlers == null) {
        this.requiredHandlers = new HashSet<>();
    }
    if (this.accessStrategy == null) {
        this.accessStrategy = new DefaultRegisteredServiceAccessStrategy();
    }
    if (this.attributeReleasePolicy == null) {
        this.attributeReleasePolicy = new ReturnAllowedAttributeReleasePolicy();
    }
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:27,代碼來源:AbstractRegisteredService.java

示例3: checking

import javax.persistence.PostLoad; //導入依賴的package包/類
@PostLoad
public void checking(Object target) {
    AnnotationCheckingMetadata metadata = AnnotationCheckingMetadata.getMetadata(target.getClass());
    if (metadata.isCheckable()) {
        StringBuilder sb = new StringBuilder();
        for (Field field : metadata.getCheckedFields()) {
            ReflectionUtils.makeAccessible(field);
            Object value = ReflectionUtils.getField(field, target);
            if (value instanceof Date) {
                throw new RuntimeException("不支持時間類型字段解密!");
            }
            sb.append(value).append(" - ");
        }
        sb.append(MD5_KEY);
        LOGGER.debug("驗證數據:" + sb);
        String hex = MD5Utils.encode(sb.toString());
        Field checksumField = metadata.getCheckableField();
        ReflectionUtils.makeAccessible(checksumField);
        String checksum = (String) ReflectionUtils.getField(checksumField, target);
        if (!checksum.equals(hex)) {
            //throw new RuntimeException("數據驗證失敗!");
        }
    }
}
 
開發者ID:onsoul,項目名稱:os,代碼行數:25,代碼來源:CheckingEntityListener.java

示例4: postLoad

import javax.persistence.PostLoad; //導入依賴的package包/類
@PostLoad
public void postLoad() {
    Session session = DatabaseManager.getSession();

    if (this.getRanking() != null) {
        this.rank = (Rank) session.createCriteria(Rank.class)
            .add(Restrictions.le("xpRequired", this.getRanking().getXp().intValue()))
            .addOrder(Order.desc("xpRequired"))
            .setMaxResults(1)
            .uniqueResult();

        this.nextRank = (Rank) session.get(Rank.class, this.rank == null ? 1 : this.rank.getLevel() + 1);
    }

    session.close();
}
 
開發者ID:DevWars,項目名稱:devwars.tv,代碼行數:17,代碼來源:User.java

示例5: postLoad

import javax.persistence.PostLoad; //導入依賴的package包/類
/**
 * Initializes the registered service with default values
 * for fields that are unspecified. Only triggered by JPA.
 * @since 4.1
 */
@PostLoad
public final void postLoad() {
    if (this.proxyPolicy == null) {
        this.proxyPolicy = new RefuseRegisteredServiceProxyPolicy();
    }
    if (this.usernameAttributeProvider == null) {
        this.usernameAttributeProvider = new DefaultRegisteredServiceUsernameProvider();
    }
    if (this.logoutType == null) {
        this.logoutType = LogoutType.BACK_CHANNEL;
    }
    if (this.requiredHandlers == null) {
        this.requiredHandlers = new HashSet<>();
    }
    if (this.accessStrategy == null) {
        this.accessStrategy = new DefaultRegisteredServiceAccessStrategy();
    }
    if (this.attributeReleasePolicy == null) {
        this.attributeReleasePolicy = new ReturnAllowedAttributeReleasePolicy();
    }
    if (this.properties == null) {
        this.properties = new HashMap<>();
    }
}
 
開發者ID:xuchengdong,項目名稱:cas4.1.9,代碼行數:30,代碼來源:AbstractRegisteredService.java

示例6: testLoad

import javax.persistence.PostLoad; //導入依賴的package包/類
@Test
public void testLoad() throws Exception {
    String[] ids = { User.nextId(), User.nextId(), User.nextId(), User.nextId() };
    for (int i = 0; i < ids.length; i++) {
        User user = new User();
        user.id = ids[i];
        user.name = "Mr No." + i;
        user.email = "no." + i + "@somewhere.org";
        warpdb.save(user);
    }
    // test get & fetch:
    User u1 = warpdb.get(User.class, ids[0]);
    assertTrue(u1.callbacks.contains(PostLoad.class));
    User u2 = warpdb.fetch(User.class, ids[1]);
    assertTrue(u2.callbacks.contains(PostLoad.class));
    // test list:
    List<User> us = warpdb.list(User.class, "SELECT * FROM User where id>?", ids[1]);
    assertEquals(2, us.size());
    assertTrue(us.get(0).callbacks.contains(PostLoad.class));
    assertTrue(us.get(1).callbacks.contains(PostLoad.class));
    // test criteria:
    List<User> users = warpdb.from(User.class).where("id>?", ids[1]).list();
    assertEquals(2, users.size());
    assertTrue(users.get(0).callbacks.contains(PostLoad.class));
    assertTrue(users.get(1).callbacks.contains(PostLoad.class));
}
 
開發者ID:michaelliao,項目名稱:warpdb,代碼行數:27,代碼來源:WarpDbCRUDAndCallbackTest.java

示例7: postLoad

import javax.persistence.PostLoad; //導入依賴的package包/類
@PostLoad
private void postLoad() {
    EntityManagerFactory emf = Utility.getEntityManagerFactory();
    EntityManager em = emf.createEntityManager();
    try {
        ProductText productText = getProductText(em);
        if (productText != null) {
            this.name = productText.getName();
            this.shortDescription = productText.getShortDescription();
            this.longDescription = productText.getLongDescription();
        } else {
            this.name = "";
            this.shortDescription = "";
            this.longDescription = "";
        }
    } finally {
        em.close();
    }
}
 
開發者ID:SAP,項目名稱:sap_mobile_platform_espm_olingo_services,代碼行數:20,代碼來源:Product.java

示例8: postLoad

import javax.persistence.PostLoad; //導入依賴的package包/類
/**
 * Updates the values in the attribute values map from the attribute bos and updates the members.
 */
@PostLoad
protected void postLoad() {
    this.attributeValues = new HashMap<String, String>();
    for (PeopleFlowAttributeBo attributeBo: attributeBos) {
        this.attributeValues.put(attributeBo.getAttributeDefinition().getName(), attributeBo.getValue());
    }
    for (PeopleFlowMemberBo member: members) {
        if (member.getMemberName() == null) {
            member.updateRelatedObject();
        }
        for (PeopleFlowDelegateBo delegate: member.getDelegates()) {
            if (delegate.getMemberName() == null) {
                delegate.updateRelatedObject();
            }
        }
    }
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:21,代碼來源:PeopleFlowBo.java

示例9: afterLoad

import javax.persistence.PostLoad; //導入依賴的package包/類
@PostLoad
public void afterLoad() {
    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    try {
        this.pkg = mapper.readValue(this.pkgJsonString, Package.class);
        this.configValues = new ConfigValues();
        if (this.configValuesString != null && StringUtils.hasText(configValuesString)) {
            this.configValues.setRaw(this.configValuesString);
        }
    }
    catch (IOException e) {
        e.printStackTrace();
    }
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-skipper,代碼行數:16,代碼來源:Release.java

示例10: postLoad

import javax.persistence.PostLoad; //導入依賴的package包/類
/**
 * Initializes the registered service with default values
 * for fields that are unspecified. Only triggered by JPA.
 */
@PostLoad
public void postLoad() {
    if (this.scopes == null) {
        this.scopes = new HashSet<>();
    }
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:11,代碼來源:OidcRegisteredService.java

示例11: postLoad

import javax.persistence.PostLoad; //導入依賴的package包/類
/**
 * Post load processing, once the service is located via JPA.
 */
@PostLoad
public void postLoad() {
    if (this.supportedGrantTypes == null) {
        this.supportedGrantTypes = new HashSet<>();
    }
    if (this.supportedResponseTypes == null) {
        this.supportedResponseTypes = new HashSet<>();
    }
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:13,代碼來源:OAuthRegisteredService.java

示例12: postLoad

import javax.persistence.PostLoad; //導入依賴的package包/類
/**
 * Initializes the registered service with default values
 * for fields that are unspecified. Only triggered by JPA.
 *
 * @since 4.1
 */
@PostLoad
public void postLoad() {
    if (this.proxyPolicy == null) {
        this.proxyPolicy = new RefuseRegisteredServiceProxyPolicy();
    }
    if (this.usernameAttributeProvider == null) {
        this.usernameAttributeProvider = new DefaultRegisteredServiceUsernameProvider();
    }
    if (this.logoutType == null) {
        this.logoutType = LogoutType.BACK_CHANNEL;
    }
    if (this.requiredHandlers == null) {
        this.requiredHandlers = new HashSet<>();
    }
    if (this.accessStrategy == null) {
        this.accessStrategy = new DefaultRegisteredServiceAccessStrategy();
    }
    if (this.multifactorPolicy == null) {
        this.multifactorPolicy = new DefaultRegisteredServiceMultifactorPolicy();
    }
    if (this.properties == null) {
        this.properties = new HashMap<>();
    }
    if (this.attributeReleasePolicy == null) {
        this.attributeReleasePolicy = new ReturnAllowedAttributeReleasePolicy();
    }
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:34,代碼來源:AbstractRegisteredService.java

示例13: postLoad

import javax.persistence.PostLoad; //導入依賴的package包/類
@PostLoad
public void postLoad(XmEntity obj) {
    String avatarUrl = obj.getAvatarUrl();
    if (StringUtils.isNoneBlank(avatarUrl)) {
        if (avatarUrl.matches(PATTERN_PART)) {
            obj.setAvatarUrl(getPrefix() + avatarUrl);
        } else {
            obj.setAvatarUrl(null);
        }
    }
}
 
開發者ID:xm-online,項目名稱:xm-ms-entity,代碼行數:12,代碼來源:AvatarUrlListener.java

示例14: processDefaultJpaCallbacks

import javax.persistence.PostLoad; //導入依賴的package包/類
private void processDefaultJpaCallbacks(String instanceCallbackClassName, List<JpaCallbackClass> jpaCallbackClassList) {
    ClassInfo callbackClassInfo = getLocalBindingContext().getClassInfo( instanceCallbackClassName );

    // Process superclass first if available and not excluded
    if ( JandexHelper.getSingleAnnotation( callbackClassInfo, JPADotNames.EXCLUDE_SUPERCLASS_LISTENERS ) != null ) {
        DotName superName = callbackClassInfo.superName();
        if ( superName != null ) {
            processDefaultJpaCallbacks( instanceCallbackClassName, jpaCallbackClassList );
        }
    }

    String callbackClassName = callbackClassInfo.name().toString();
    Map<Class<?>, String> callbacksByType = new HashMap<Class<?>, String>();
    createDefaultCallback(
            PrePersist.class, PseudoJpaDotNames.DEFAULT_PRE_PERSIST, callbackClassName, callbacksByType
    );
    createDefaultCallback(
            PreRemove.class, PseudoJpaDotNames.DEFAULT_PRE_REMOVE, callbackClassName, callbacksByType
    );
    createDefaultCallback(
            PreUpdate.class, PseudoJpaDotNames.DEFAULT_PRE_UPDATE, callbackClassName, callbacksByType
    );
    createDefaultCallback(
            PostLoad.class, PseudoJpaDotNames.DEFAULT_POST_LOAD, callbackClassName, callbacksByType
    );
    createDefaultCallback(
            PostPersist.class, PseudoJpaDotNames.DEFAULT_POST_PERSIST, callbackClassName, callbacksByType
    );
    createDefaultCallback(
            PostRemove.class, PseudoJpaDotNames.DEFAULT_POST_REMOVE, callbackClassName, callbacksByType
    );
    createDefaultCallback(
            PostUpdate.class, PseudoJpaDotNames.DEFAULT_POST_UPDATE, callbackClassName, callbacksByType
    );
    if ( !callbacksByType.isEmpty() ) {
        jpaCallbackClassList.add( new JpaCallbackClassImpl( instanceCallbackClassName, callbacksByType, true ) );
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:39,代碼來源:EntityClass.java

示例15: processJpaCallbacks

import javax.persistence.PostLoad; //導入依賴的package包/類
private void processJpaCallbacks(String instanceCallbackClassName, boolean isListener, List<JpaCallbackClass> callbackClassList) {

        ClassInfo callbackClassInfo = getLocalBindingContext().getClassInfo( instanceCallbackClassName );

        // Process superclass first if available and not excluded
        if ( JandexHelper.getSingleAnnotation( callbackClassInfo, JPADotNames.EXCLUDE_SUPERCLASS_LISTENERS ) != null ) {
            DotName superName = callbackClassInfo.superName();
            if ( superName != null ) {
                processJpaCallbacks(
                        instanceCallbackClassName,
                        isListener,
                        callbackClassList
                );
            }
        }

        Map<Class<?>, String> callbacksByType = new HashMap<Class<?>, String>();
        createCallback( PrePersist.class, JPADotNames.PRE_PERSIST, callbacksByType, callbackClassInfo, isListener );
        createCallback( PreRemove.class, JPADotNames.PRE_REMOVE, callbacksByType, callbackClassInfo, isListener );
        createCallback( PreUpdate.class, JPADotNames.PRE_UPDATE, callbacksByType, callbackClassInfo, isListener );
        createCallback( PostLoad.class, JPADotNames.POST_LOAD, callbacksByType, callbackClassInfo, isListener );
        createCallback( PostPersist.class, JPADotNames.POST_PERSIST, callbacksByType, callbackClassInfo, isListener );
        createCallback( PostRemove.class, JPADotNames.POST_REMOVE, callbacksByType, callbackClassInfo, isListener );
        createCallback( PostUpdate.class, JPADotNames.POST_UPDATE, callbacksByType, callbackClassInfo, isListener );
        if ( !callbacksByType.isEmpty() ) {
            callbackClassList.add( new JpaCallbackClassImpl( instanceCallbackClassName, callbacksByType, isListener ) );
        }
    }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:29,代碼來源:EntityClass.java


注:本文中的javax.persistence.PostLoad類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。