Package com.google.code.lightssh.common

Examples of com.google.code.lightssh.common.ApplicationException


  /**
   * 更新密码
   */
  public void updatePassword( String name,String password,String newPassword ){
    if( password == null || newPassword == null  )
      throw new ApplicationException("原密码或新密码为空!");
   
    LoginAccount account = getDao().get(name);
    if( account == null )
      throw new ApplicationException("找不到名称为"+name+"的账号!");
   
    String hash_pwd =  CryptographyUtil.hashMd5Hex( password );
    String hash_new_pwd = CryptographyUtil.hashMd5Hex( newPassword );
   
    if( !account.getPassword().equals( hash_pwd ))
      throw new ApplicationException("原密码不正确!");
   
    account.setPassword( hash_new_pwd  );
    account.setLastUpdatePasswordTime(Calendar.getInstance());//密码更新时间
    super.dao.update( account );
  }
View Full Code Here


   * @param newPassword 新密码
   */
  public void resetPassword( String name,String newPassword ){
    LoginAccount account = getDao().get(name);
    if( account == null )
      throw new ApplicationException("找不到名称为"+name+"的账号!");
   
    String hash_new_pwd = CryptographyUtil.hashMd5Hex( newPassword );

    account.setPassword( hash_new_pwd  );
    account.setLastUpdatePasswordTime(Calendar.getInstance());//密码更新时间
View Full Code Here

    log.info("系统登录帐号[{}]密码被重置!",name);
  }
 
  public void save( LoginAccount account,LoginAccount operator ){
    if( account == null )
      throw new ApplicationException( "数据不完整,LoginAccount 为空!" );
   
    boolean inserted = account.isInsert();
    if( inserted ){
      account.setStatus(AuditStatus.NEW);
      account.setCreateDate( new Date() );
      account.setPassword( CryptographyUtil.hashMd5Hex( DEFAULT_PASSWORD ) );
      if( account.getType() == null )
        account.setType(LoginAccount.LoginAccountType.ADMIN);
    }
   
    if( account.getRoles() != null ){
      Set<Role> dbRoles = new HashSet<Role>();
      for( Role role:account.getRoles() ){
        if( role == null )
          continue;
        Role dbRole = roleManager.get(role);
        if( dbRole == null )
          throw new ApplicationException( "所选角色["+role.getId()+"]已不存在!" );
        dbRoles.add(dbRole);
       
      }
      account.setRoles(dbRoles);
    }
   
    LoginAccount dbAcc = getDao().get( account.getLoginName() );
    LoginAccount originalAcc = null,newAcc = account;
    if( dbAcc != null )
      originalAcc = dbAcc.clone();
   
    if( dbAcc == null && !inserted )
      throw new ApplicationException( "登录账号已不存在,不能进行修改操作!" );
   
    if( dbAcc != null && !dbAcc.getIdentity().equals(account.getIdentity()))
      throw new ApplicationException( "登录账号名'"+account.getLoginName()+"'已存在!" );
   
    if( dbAcc != null ){
      if( !dbAcc.isEffective() ){
        dbAcc.setPartyId(account.getPartyId());
        dbAcc.setDescription( account.getDescription() );
View Full Code Here

  }
 
  public void remove( Serializable identity ){
    LoginAccount db_account = dao.read(identity);
    if( db_account != null && ROOT_LOGIN_NAME.equals(db_account.getLoginName()) )
      throw new ApplicationException("系统超级管理员账户不允许删除!");

    //String name = db_account.getLoginName();
    super.remove(identity);
  }
View Full Code Here

  }
 
  public void remove(LoginAccount account,LoginAccount operator,String remark) {
    LoginAccount dbAcc = dao.read(account.getId());
    if( dbAcc == null )
      throw new ApplicationException("登录帐号不存在!");
   
    if( ROOT_LOGIN_NAME.equals(dbAcc.getLoginName()) )
      throw new ApplicationException("系统超级管理员账户不允许删除!");
   
    if( remark == null )
      remark = "删除角色";
    LoginAccount newAcc = dbAcc.clone();
    newAcc.setStatus(AuditStatus.DELETE);
View Full Code Here

      return ;
   
    LoginAccount old = this.get(account);
    if( old == null ){
      log.warn("开启或禁用CA,找不到相关登录账户!");
      throw new ApplicationException("找不到相关数据!");
    }
   
    boolean close = old.isUseCa();
    old.setUseCa( !close );
   
View Full Code Here

  /**
   * 登录失败锁定时间
   */
  public boolean updateLockTime( Long id ){
    if( id == null)
      throw new ApplicationException("参数错误!");
   
    return getDao().updateLockTime(id,Calendar.getInstance()) > 0;
  }
View Full Code Here

  /**
   * 解除登录失败锁定时间
   */
  public void releaseLockTime( LoginAccount la ){
    if( la == null || la.getIdentity() == null )
      throw new ApplicationException("参数错误!");
   
    this.getDao().cleanLockTime(la.getId());
  }
View Full Code Here

   */
  public ProcessInstance start( String procDefKey,String bizKey,String bizName
      ,String userId,Map<String,Object> variables){
   
    if( StringUtils.isEmpty(bizKey) )
      throw new ApplicationException("业务关键字(bizKey)为空!");
   
    //用来设置启动流程的人员ID,引擎会自动把用户ID保存到activiti:initiator中
    if( !StringUtils.isEmpty(userId) )
      identityService.setAuthenticatedUserId(userId);
   
View Full Code Here

   * 认领流程
   */
  public void claim( String taskId,String userId ){
    Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
    if( task == null )
      throw new ApplicationException("任务["+taskId+"]不存在!");
   
    if( StringUtil.hasText( task.getAssignee() ) )
      throw new ApplicationException("任务["+taskId+"]已被用户["+task.getAssignee()+"]认领!");
   
    this.taskLogManager.save(task.getProcessInstanceId(),task.getId()
        ,ExecutionType.CLAIM, userId, "用户["+userId+"]签收任务");
   
    taskService.claim(taskId, userId);
View Full Code Here

TOP

Related Classes of com.google.code.lightssh.common.ApplicationException

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.