<commit_before>/*<license>
Copyright 2005 - $Date$ by PeopleWare n.v..

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
</license>*/

package org.ppwcode.vernacular.persistence_III.dao.jpa;


import static org.apache.commons.beanutils.PropertyUtils.getProperty;
import static org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptors;
import static org.ppwcode.util.reflect_I.PropertyHelpers.propertyValue;
import static org.ppwcode.vernacular.exception_II.ProgrammingErrorHelpers.dependency;
import static org.ppwcode.vernacular.exception_II.ProgrammingErrorHelpers.pre;
import static org.ppwcode.vernacular.exception_II.ProgrammingErrorHelpers.preArgumentNotNull;
import static org.ppwcode.vernacular.exception_II.ProgrammingErrorHelpers.unexpectedException;
import static org.ppwcode.vernacular.semantics_VI.bean.RousseauBeanHelpers.normalize;
import static org.ppwcode.vernacular.semantics_VI.bean.RousseauBeanHelpers.wildExceptions;

import java.beans.PropertyDescriptor;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

import javax.annotation.Resource;
import javax.ejb.EJBContext;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;
import javax.persistence.LockModeType;
import javax.persistence.Query;
import javax.persistence.TransactionRequiredException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.ppwcode.vernacular.exception_II.InternalException;
import org.ppwcode.vernacular.exception_II.SemanticException;
import org.ppwcode.vernacular.persistence_III.IdNotFoundException;
import org.ppwcode.vernacular.persistence_III.PersistentBean;
import org.ppwcode.vernacular.persistence_III.dao.StatelessCrudDao;
import org.ppwcode.vernacular.semantics_VI.bean.RousseauBean;
import org.ppwcode.vernacular.semantics_VI.exception.CompoundPropertyException;
import org.toryt.annotations_I.Basic;
import org.toryt.annotations_I.Expression;
import org.toryt.annotations_I.MethodContract;

/**
 * @mudo work on transaction annotations
 * @mudo unit tests
 * @mudo catch exceptions and log only external exceptions and programming errors
 */
@Stateless
//@WebService MUDO find maven dependency for javax.jws
@TransactionManagement(TransactionManagementType.CONTAINER)
public class JpaStatelessCrudDao extends AbstractJpaDao implements StatelessCrudDao {

  private final static Log _LOG = LogFactory.getLog(JpaStatelessCrudDao.class);

  /*<property name="entity manager">
  -------------------------------------------------------------------------*/

  @Basic
  public final EJBContext getEjbContext() {
    return $ejbContext;
  }

  @MethodContract(
    post = @Expression("ejbContext == _ejbContext")
  )
  public final void setEjbContext(EJBContext manager) {
    $ejbContext = manager;
  }

  @Resource
  private EJBContext $ejbContext;

  /*</property>*/


  @Override
  @MethodContract(post = @Expression("result ? super.isOperational() && (ejbContext != null)"))
  public boolean isOperational() {
    return super.isOperational() && ($ejbContext != null);
  }<commit_msg>intermediate commit<commit_after>/*<license>
Copyright 2005 - $Date$ by PeopleWare n.v..

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
</license>*/

package org.ppwcode.vernacular.persistence_III.dao.jpa;


import static org.apache.commons.beanutils.PropertyUtils.getProperty;
import static org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptors;
import static org.ppwcode.util.reflect_I.PropertyHelpers.propertyValue;
import static org.ppwcode.vernacular.exception_II.ProgrammingErrorHelpers.dependency;
import static org.ppwcode.vernacular.exception_II.ProgrammingErrorHelpers.pre;
import static org.ppwcode.vernacular.exception_II.ProgrammingErrorHelpers.preArgumentNotNull;
import static org.ppwcode.vernacular.exception_II.ProgrammingErrorHelpers.unexpectedException;
import static org.ppwcode.vernacular.semantics_VI.bean.RousseauBeanHelpers.normalize;
import static org.ppwcode.vernacular.semantics_VI.bean.RousseauBeanHelpers.wildExceptions;

import java.beans.PropertyDescriptor;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

import javax.annotation.Resource;
import javax.ejb.EJBContext;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;
import javax.persistence.LockModeType;
import javax.persistence.Query;
import javax.persistence.TransactionRequiredException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.ppwcode.vernacular.exception_II.InternalException;
import org.ppwcode.vernacular.exception_II.SemanticException;
import org.ppwcode.vernacular.persistence_III.IdNotFoundException;
import org.ppwcode.vernacular.persistence_III.PersistentBean;
import org.ppwcode.vernacular.persistence_III.dao.StatelessCrudTransactionDao;
import org.ppwcode.vernacular.semantics_VI.bean.RousseauBean;
import org.ppwcode.vernacular.semantics_VI.exception.CompoundPropertyException;
import org.toryt.annotations_I.Basic;
import org.toryt.annotations_I.Expression;
import org.toryt.annotations_I.MethodContract;

/**
 * @mudo work on transaction annotations
 * @mudo unit tests
 * @mudo catch exceptions and log only external exceptions and programming errors
 */
@Stateless
//@WebService MUDO find maven dependency for javax.jws
@TransactionManagement(TransactionManagementType.CONTAINER)
public class JpaStatelessCrudDao extends AbstractJpaDao implements StatelessCrudTransactionDao {

  private final static Log _LOG = LogFactory.getLog(JpaStatelessCrudDao.class);

  /*<property name="entity manager">
  -------------------------------------------------------------------------*/

  @Basic
  public final EJBContext getEjbContext() {
    return $ejbContext;
  }

  @MethodContract(
    post = @Expression("ejbContext == _ejbContext")
  )
  public final void setEjbContext(EJBContext manager) {
    $ejbContext = manager;
  }

  @Resource
  private EJBContext $ejbContext;

  /*</property>*/


  @Override
  @MethodContract(post = @Expression("result ? super.isOperational() && (ejbContext != null)"))
  public boolean isOperational() {
    return super.isOperational() && ($ejbContext != null);
  }
{'fraction_non_alphanumeric': 0.10372686995048215, 'fraction_numerical': 0.0020849622100599426, 'mean_word_length': 5.395833333333333, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7255993', 'n_tokens_mistral': 2205, 'n_tokens_neox': 2179, 'n_words': 511}