protected HtmlData getViewAssetUrl(Asset asset) {
    Properties parameters = new Properties();
    parameters.put(KFSConstants.DISPATCH_REQUEST_PARAMETER, KFSConstants.START_METHOD);
    parameters.put(
        CamsPropertyConstants.Asset.CAPITAL_ASSET_NUMBER, asset.getCapitalAssetNumber().toString());
    parameters.put(
        KFSConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, CapitalAssetManagementAsset.class.getName());

    String href = UrlFactory.parameterizeUrl(CamsConstants.INQUIRY_URL, parameters);

    AnchorHtmlData anchorHtmlData =
        new AnchorHtmlData(href, KFSConstants.START_METHOD, CamsConstants.AssetActions.VIEW);
    anchorHtmlData.setTarget("blank");
    return anchorHtmlData;
  }
  /**
   * @see
   *     org.kuali.kfs.module.cam.document.service.AssetPaymentService#validateAssets(java.lang.String,
   *     org.kuali.kfs.module.cam.businessobject.Asset)
   */
  public boolean validateAssets(String errorPath, Asset asset) {
    boolean valid = true;

    // Validating the asset is a capital asset
    if (!this.getAssetService().isCapitalAsset(asset)) {
      GlobalVariables.getMessageMap()
          .putError(
              errorPath,
              CamsKeyConstants.Payment.ERROR_NON_CAPITAL_ASSET,
              asset.getCapitalAssetNumber().toString());
      valid &= false;
    }

    // Validating the asset hasn't been retired
    if (this.getAssetService().isAssetRetired(asset)) {
      GlobalVariables.getMessageMap()
          .putError(
              errorPath,
              CamsKeyConstants.Retirement.ERROR_NON_ACTIVE_ASSET_RETIREMENT,
              asset.getCapitalAssetNumber().toString());
      valid &= false;
    }
    return valid;
  }
  protected Properties getSeparateParameters(Asset asset) {
    Properties parameters = new Properties();
    parameters.put(
        KFSConstants.DISPATCH_REQUEST_PARAMETER, KFSConstants.MAINTENANCE_NEW_METHOD_TO_CALL);
    parameters.put(KFSConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, AssetGlobal.class.getName());
    parameters.put(
        CamsPropertyConstants.AssetGlobal.SEPARATE_SOURCE_CAPITAL_ASSET_NUMBER,
        asset.getCapitalAssetNumber().toString());
    // parameter that tells us this is a separate action. We read this in
    // AssetMaintenanbleImpl.processAfterNew
    parameters.put(
        KFSPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE,
        CamsConstants.PaymentDocumentTypeCodes.ASSET_GLOBAL_SEPARATE);

    return parameters;
  }
  protected HtmlData getMergeUrl(Asset asset) {
    FinancialSystemMaintenanceDocumentAuthorizerBase documentAuthorizer =
        (FinancialSystemMaintenanceDocumentAuthorizerBase)
            SpringContext.getBean(DocumentDictionaryService.class)
                .getDocumentAuthorizer(CamsConstants.DocumentTypeName.ASSET_RETIREMENT_GLOBAL);
    boolean isAuthorized =
        documentAuthorizer.isAuthorized(
            asset,
            CamsConstants.CAM_MODULE_CODE,
            CamsConstants.PermissionNames.MERGE,
            GlobalVariables.getUserSession().getPerson().getPrincipalId());

    if (isAuthorized) {
      Properties parameters = new Properties();
      parameters.put(
          KFSConstants.DISPATCH_REQUEST_PARAMETER, KFSConstants.MAINTENANCE_NEWWITHEXISTING_ACTION);
      parameters.put(
          KFSConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, AssetRetirementGlobal.class.getName());
      parameters.put(
          CamsPropertyConstants.AssetRetirementGlobal.MERGED_TARGET_CAPITAL_ASSET_NUMBER,
          asset.getCapitalAssetNumber().toString());
      parameters.put(
          KFSConstants.OVERRIDE_KEYS,
          CamsPropertyConstants.AssetRetirementGlobal.RETIREMENT_REASON_CODE
              + KFSConstants.FIELD_CONVERSIONS_SEPERATOR
              + CamsPropertyConstants.AssetRetirementGlobal.MERGED_TARGET_CAPITAL_ASSET_NUMBER);
      parameters.put(
          CamsPropertyConstants.AssetRetirementGlobal.RETIREMENT_REASON_CODE,
          CamsConstants.AssetRetirementReasonCode.MERGED);
      parameters.put(
          KFSConstants.REFRESH_CALLER,
          CamsPropertyConstants.AssetRetirementGlobal.RETIREMENT_REASON_CODE
              + "::"
              + CamsConstants.AssetRetirementReasonCode.MERGED);

      String href = UrlFactory.parameterizeUrl(KFSConstants.MAINTENANCE_ACTION, parameters);

      return new AnchorHtmlData(
          href, CamsConstants.AssetActions.MERGE, CamsConstants.AssetActions.MERGE);
    } else {
      return new AnchorHtmlData("", "", "");
    }
  }
  protected HtmlData getTransferUrl(Asset asset) {
    boolean isAuthorized = true;
    boolean assetMovable = false;
    try {
      assetMovable = getAssetService().isAssetMovableCheckByPayment(asset);
    } catch (ValidationException ve) {
      isAuthorized = false;
    }
    if (!assetMovable) {
      FinancialSystemTransactionalDocumentAuthorizerBase documentAuthorizer =
          (FinancialSystemTransactionalDocumentAuthorizerBase)
              SpringContext.getBean(DocumentDictionaryService.class)
                  .getDocumentAuthorizer(CamsConstants.DocumentTypeName.ASSET_TRANSFER);
      isAuthorized =
          documentAuthorizer.isAuthorized(
              asset,
              CamsConstants.CAM_MODULE_CODE,
              CamsConstants.PermissionNames.SEPARATE,
              GlobalVariables.getUserSession().getPerson().getPrincipalId());
    }

    if (isAuthorized) {
      Properties parameters = new Properties();
      parameters.put(KFSConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.DOC_HANDLER_METHOD);
      parameters.put(
          CamsPropertyConstants.AssetTransferDocument.CAPITAL_ASSET_NUMBER,
          asset.getCapitalAssetNumber().toString());
      parameters.put(KFSConstants.PARAMETER_COMMAND, "initiate");
      parameters.put(
          KFSConstants.DOCUMENT_TYPE_NAME, CamsConstants.DocumentTypeName.ASSET_TRANSFER);

      String href =
          UrlFactory.parameterizeUrl(
              CamsConstants.StrutsActions.ONE_UP + CamsConstants.StrutsActions.TRANSFER,
              parameters);

      return new AnchorHtmlData(
          href, KRADConstants.DOC_HANDLER_METHOD, CamsConstants.AssetActions.TRANSFER);
    } else {
      return new AnchorHtmlData("", "", "");
    }
  }
  protected HtmlData getLoanUrl(Asset asset) {
    AnchorHtmlData anchorHtmlData = null;
    List<HtmlData> childURLDataList = new ArrayList<HtmlData>();

    Properties parameters = new Properties();
    parameters.put(KFSConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.DOC_HANDLER_METHOD);
    parameters.put(
        CamsPropertyConstants.AssetTransferDocument.CAPITAL_ASSET_NUMBER,
        asset.getCapitalAssetNumber().toString());
    parameters.put(KFSConstants.PARAMETER_COMMAND, "initiate");
    parameters.put(
        KFSConstants.DOCUMENT_TYPE_NAME,
        CamsConstants.DocumentTypeName.ASSET_EQUIPMENT_LOAN_OR_RETURN);

    if (getAssetService().isAssetLoaned(asset)) {
      anchorHtmlData = new AnchorHtmlData("", "", "");

      AnchorHtmlData childURLData = new AnchorHtmlData("", "", CamsConstants.AssetActions.LOAN);
      childURLDataList.add(childURLData);

      parameters.put(CamsConstants.AssetActions.LOAN_TYPE, CamsConstants.AssetActions.LOAN_RENEW);
      String childHref =
          UrlFactory.parameterizeUrl(
              CamsConstants.StrutsActions.ONE_UP
                  + CamsConstants.StrutsActions.EQUIPMENT_LOAN_OR_RETURN,
              parameters);
      childURLData =
          new AnchorHtmlData(
              childHref, KRADConstants.DOC_HANDLER_METHOD, CamsConstants.AssetActions.LOAN_RENEW);
      childURLDataList.add(childURLData);

      parameters.remove(CamsConstants.AssetActions.LOAN_TYPE);
      parameters.put(CamsConstants.AssetActions.LOAN_TYPE, CamsConstants.AssetActions.LOAN_RETURN);
      childHref =
          UrlFactory.parameterizeUrl(
              CamsConstants.StrutsActions.ONE_UP
                  + CamsConstants.StrutsActions.EQUIPMENT_LOAN_OR_RETURN,
              parameters);
      childURLData =
          new AnchorHtmlData(
              childHref, KRADConstants.DOC_HANDLER_METHOD, CamsConstants.AssetActions.LOAN_RETURN);
      childURLDataList.add(childURLData);

      anchorHtmlData.setChildUrlDataList(childURLDataList);
    } else {
      anchorHtmlData = new AnchorHtmlData("", "", "");
      //
      AnchorHtmlData childURLData = new AnchorHtmlData("", "", "");
      if (asset.getCampusTagNumber() == null) {
        childURLData = new AnchorHtmlData("", "", CamsConstants.AssetActions.LOAN);
        childURLDataList.add(childURLData);
      } else {
        parameters.put(CamsConstants.AssetActions.LOAN_TYPE, CamsConstants.AssetActions.LOAN);
        String childHref =
            UrlFactory.parameterizeUrl(
                CamsConstants.StrutsActions.ONE_UP
                    + CamsConstants.StrutsActions.EQUIPMENT_LOAN_OR_RETURN,
                parameters);
        childURLData =
            new AnchorHtmlData(
                childHref, KRADConstants.DOC_HANDLER_METHOD, CamsConstants.AssetActions.LOAN);
        childURLDataList.add(childURLData);
      }

      childURLData = new AnchorHtmlData("", "", CamsConstants.AssetActions.LOAN_RENEW);
      childURLDataList.add(childURLData);

      childURLData = new AnchorHtmlData("", "", CamsConstants.AssetActions.LOAN_RETURN);
      childURLDataList.add(childURLData);

      anchorHtmlData.setChildUrlDataList(childURLDataList);
    }

    return anchorHtmlData;
  }