コード例 #1
0
ファイル: Group.java プロジェクト: sugiii/SI
  @Override
  public void validate(OPERATION operation) throws OneM2MException {

    if (operation.equals(OPERATION.CREATE)) { // create 요청에 의해 생성된 리소스에 대한 유효성 체크 (DB저장전)

      if (this.creator != null) {
        throw new OneM2MException(
            RESPONSE_STATUS.INVALID_ARGUMENTS, "'creator' is NP on CREATE operation");
      }
      if (this.currentNrOfMembers != null) {
        throw new OneM2MException(
            RESPONSE_STATUS.INVALID_ARGUMENTS, "'currentNrOfMembers' is NP on CREATE operation");
      }
      if (this.memberTypeValidated != null) {
        throw new OneM2MException(
            RESPONSE_STATUS.INVALID_ARGUMENTS, "'memberTypeValidated' is NP on CREATE operation");
      }
      if (this.memberType == null) {
        throw new OneM2MException(
            RESPONSE_STATUS.INVALID_ARGUMENTS, "'memberType' is M on CREATE operation");
      }
      if (this.maxNrOfMembers == null) {
        throw new OneM2MException(
            RESPONSE_STATUS.INVALID_ARGUMENTS, "'maxNrOfMembers' is M on CREATE operation");
      }
      if (this.memberIDs == null) {
        throw new OneM2MException(
            RESPONSE_STATUS.INVALID_ARGUMENTS, "'memberIDs' is M on CREATE operation");
      }

    } else if (operation.equals(OPERATION.UPDATE)) { // update 요청에 의해 생성된 리소스에 대한 유효성 체크 (DB저장전)

      if (this.creator != null) {
        throw new OneM2MException(
            RESPONSE_STATUS.INVALID_ARGUMENTS, "'creator' is NP on CREATE operation");
      }
      if (this.currentNrOfMembers != null) {
        throw new OneM2MException(
            RESPONSE_STATUS.INVALID_ARGUMENTS, "'currentNrOfMembers' is NP on CREATE operation");
      }
      if (this.memberTypeValidated != null) {
        throw new OneM2MException(
            RESPONSE_STATUS.INVALID_ARGUMENTS, "'memberTypeValidated' is NP on CREATE operation");
      }
      if (this.consistencyStrategy != null) {
        throw new OneM2MException(
            RESPONSE_STATUS.INVALID_ARGUMENTS, "'consistencyStrategy' is NP on CREATE operation");
      }
    }

    super.validate(operation);
  }
コード例 #2
0
ファイル: AreaNwkInfo.java プロジェクト: sugiii/SI
  @Override
  public void validate(OPERATION operation) throws OneM2MException {

    if (operation.equals(OPERATION.CREATE)) { // create 요청에 의해 생성된 리소스에 대한 유효성 체크 (DB저장전)

      if (this.mgmtDefinition == null) {
        throw new OneM2MException(
            RESPONSE_STATUS.INVALID_ARGUMENTS, "'mgmtDefinition' is M on CREATE operation");
      }
      if (this.areaNwkType == null) {
        throw new OneM2MException(
            RESPONSE_STATUS.INVALID_ARGUMENTS, "'areaNwkType' is M on memAvailable operation");
      }
      if (this.listOfDevices == null) {
        throw new OneM2MException(
            RESPONSE_STATUS.INVALID_ARGUMENTS, "'listOfDevices' is M on CREATE operation");
      }

    } else if (operation.equals(OPERATION.UPDATE)) { // update 요청에 의해 생성된 리소스에 대한 유효성 체크 (DB저장전)

      if (this.mgmtDefinition != null) {
        throw new OneM2MException(
            RESPONSE_STATUS.INVALID_ARGUMENTS, "'mgmtDefinition' is NP on UPDATE operation");
      }
      if (this.objectIDs != null) {
        throw new OneM2MException(
            RESPONSE_STATUS.INVALID_ARGUMENTS, "'objectIDs' is NP on UPDATE operation");
      }
      if (this.objectPaths != null) {
        throw new OneM2MException(
            RESPONSE_STATUS.INVALID_ARGUMENTS, "'objectPaths' is NP on UPDATE operation");
      }
    }

    super.validate(operation);
  }