Tabnine Logo
GenericEntityService.getDao
Code IndexAdd Tabnine to your IDE (free)

How to use
getDao
method
in
org.hswebframework.web.service.GenericEntityService

Best Java code snippets using org.hswebframework.web.service.GenericEntityService.getDao (Showing top 4 results out of 315)

origin: hs-web/hsweb-framework

@Override
public PK insert(E entity) {
  if (!StringUtils.isEmpty(entity.getId())) {
    if ((entity.getId() instanceof String) && !StringUtils.isEmpty(entity.getId())) {
      tryValidateProperty(entity.getId().toString().matches("[a-zA-Z0-9_\\-]+"), "id", "只能由数字,字母,下划线,和-组成");
    }
    tryValidateProperty(selectByPk(entity.getId()) == null, "id", entity.getId() + "已存在");
  }
  if (StringUtils.isEmpty(entity.getId()) && getIDGenerator() != null) {
    entity.setId(getIDGenerator().generate());
  }
  if (entity instanceof RecordCreationEntity) {
    ((RecordCreationEntity) entity).setCreateTimeNow();
  }
  tryValidate(entity, CreateGroup.class);
  getDao().insert(entity);
  return entity.getId();
}
origin: hs-web/hsweb-framework

@Override
public E deleteByPk(PK pk) {
  E old = selectByPk(pk);
  if (old == null) {
    return null;
  }
  if (old instanceof LogicalDeleteEntity) {
    LogicalDeleteEntity deleteEntity = (LogicalDeleteEntity) old;
    deleteEntity.setDeleted(true);
    deleteEntity.setDeleteTime(System.currentTimeMillis());
    createUpdate()
        .set(deleteEntity::getDeleted)
        .set(deleteEntity::getDeleteTime)
        .where(GenericEntity.id, pk)
        .exec();
  } else {
    getDao().deleteByPk(pk);
  }
  return old;
}
origin: org.hswebframework.web/hsweb-commons-service-simple

@Override
public PK insert(E entity) {
  if (!StringUtils.isEmpty(entity.getId())) {
    if ((entity.getId() instanceof String) && !StringUtils.isEmpty(entity.getId())) {
      tryValidateProperty(entity.getId().toString().matches("[a-zA-Z0-9_\\-]+"), "id", "只能由数字,字母,下划线,和-组成");
    }
    tryValidateProperty(selectByPk(entity.getId()) == null, "id", entity.getId() + "已存在");
  }
  if (StringUtils.isEmpty(entity.getId()) && getIDGenerator() != null) {
    entity.setId(getIDGenerator().generate());
  }
  if (entity instanceof RecordCreationEntity) {
    ((RecordCreationEntity) entity).setCreateTimeNow();
  }
  tryValidate(entity, CreateGroup.class);
  getDao().insert(entity);
  return entity.getId();
}
origin: org.hswebframework.web/hsweb-commons-service-simple

@Override
public E deleteByPk(PK pk) {
  E old = selectByPk(pk);
  if (old == null) {
    return null;
  }
  if (old instanceof LogicalDeleteEntity) {
    LogicalDeleteEntity deleteEntity = (LogicalDeleteEntity) old;
    deleteEntity.setDeleted(true);
    deleteEntity.setDeleteTime(System.currentTimeMillis());
    createUpdate()
        .set(deleteEntity::getDeleted)
        .set(deleteEntity::getDeleteTime)
        .where(GenericEntity.id, pk)
        .exec();
  } else {
    getDao().deleteByPk(pk);
  }
  return old;
}
org.hswebframework.web.serviceGenericEntityServicegetDao

Popular methods of GenericEntityService

  • deleteByPk
  • updateByPk
  • insert
  • saveOrUpdate
  • selectByPk
  • count
  • createQuery
  • createUpdate
  • dataExisted
  • getEntityInstanceType
  • getIDGenerator
    获取ID生成器,在insert的时候,如果ID为空,则调用生成器进行生成
  • select
  • getIDGenerator,
  • select,
  • tryValidate,
  • tryValidateProperty

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • notifyDataSetChanged (ArrayAdapter)
  • startActivity (Activity)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now