private String getDependency(int buildNumber, String rootModulePath, String subModuleName)
      throws PhrescoException {
    try {
      BuildInfo buildInfo =
          Utility.getBuildInfo(
              buildNumber, getBuildInfoPath(rootModulePath, subModuleName).toString());
      if (buildInfo == null) {
        throw new PhrescoException("Build info is not found for build number " + buildNumber);
      }

      Map<String, Boolean> options = buildInfo.getOptions();
      if (options != null) {
        boolean createIpa = MapUtils.getBooleanValue(buildInfo.getOptions(), CAN_CREATE_IPA);
        boolean deviceDeploy = MapUtils.getBooleanValue(buildInfo.getOptions(), DEVICE_DEPLOY);

        if (!createIpa
            && !deviceDeploy) { // if it is simulator, show popup for following dependency
          return "";
        } else { // if it is device, it should return null and should not show any popup
          return DEVICE_ID;
        }
      }

    } catch (Exception e) {
      throw new PhrescoException(e);
    }
    return "";
  }
Exemplo n.º 2
0
  public List<String> getDepartmentsForPrincipalInRoles(
      String principalId, List<String> roleIds, DateTime asOfDate, boolean isActiveOnly) {
    Set<String> departments = new HashSet<String>();

    Map<String, String> qualifiers = new HashMap<String, String>();
    qualifiers.put(KPMERoleMemberAttribute.WORK_AREA.getRoleMemberAttributeName(), "%");
    qualifiers.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), "%");
    qualifiers.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), "%");
    qualifiers.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), "%");
    List<Map<String, String>> roleQualifiers =
        getRoleQualifiers(principalId, roleIds, qualifiers, asOfDate, isActiveOnly);

    for (Map<String, String> roleQualifier : roleQualifiers) {
      String department =
          MapUtils.getString(
              roleQualifier, KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName());
      String groupKeyCode =
          MapUtils.getString(
              roleQualifier, KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName());
      if (department != null && groupKeyCode != null) {
        departments.add(groupKeyCode + "|" + department);
      }
    }

    List<String> locations =
        getLocationsForPrincipalInRoles(principalId, roleIds, asOfDate, isActiveOnly);
    departments.addAll(
        getDepartmentService().getDepartmentValuesWithLocations(locations, asOfDate.toLocalDate()));

    return new ArrayList<String>(departments);
  }
  private Policy findPolicy(String policyId) {
    if (MapUtils.isEmpty(prePolicies)) {
      log.error("No PreDownloadPolicies found!");
      return null;
    }

    if (MapUtils.isEmpty(postPolicies)) {
      log.error("No PostDownloadPolicies found!");
      return null;
    }

    Policy policy;

    policy = prePolicies.get(policyId);
    if (policy != null) {
      return policy;
    }

    policy = postPolicies.get(policyId);
    if (policy != null) {
      return policy;
    }

    policy = downloadErrorPolicies.get(policyId);
    if (policy != null) {
      return policy;
    }

    return null;
  }
Exemplo n.º 4
0
 /*
  * (non-Javadoc)
  *
  * @see net.grinder.ISingleConsole2#getCurrentExecutionCount()
  */
 @Override
 public long getCurrentExecutionCount() {
   Map<?, ?> totalStatistics = (Map<?, ?>) getStatictisData().get("totalStatistics");
   Double testCount = MapUtils.getDoubleValue(totalStatistics, "Tests", 0D);
   Double errorCount = MapUtils.getDoubleValue(totalStatistics, "Errors", 0D);
   return testCount.longValue() + errorCount.longValue();
 }
Exemplo n.º 5
0
  public CopyOfExportTask(
      String connectUrls,
      String queryProcedure,
      Map<String, String> params,
      String resultProcedure,
      HttpServletRequest request) {
    this.connectUrls = connectUrls;

    this.params = new HashMap<String, String>();
    Object[] keys = params.keySet().toArray();
    this.keys = new String[keys.length];
    for (int i = 0; i < keys.length; i++) { // 把map里所有key转成小写,与执行的存储过程保持一致
      String key = keys[i].toString();
      this.keys[i] = key.toLowerCase();
      this.params.put(key.toLowerCase(), MapUtils.getString(params, key, ""));
    }
    this.queryProcedure = handleSql(queryProcedure.toLowerCase(), this.params);
    this.resultProcedure = resultProcedure.toLowerCase();
    this.fileName =
        MapUtils.getString(params, "modulename", "导出文件")
            + "_"
            + new SimpleDateFormat(Constant.TIMESTAMP_FORMAT_yyyyMMddHHmmssSSS).format(new Date())
            + Constant.EXCEL;
    this.ip = request.getServerName();
    this.port = request.getServerPort();
    this.filePath =
        request.getRealPath(Constant.EXPORT_PATH_FOLDER) + File.separatorChar + this.fileName;
    this.jt = DBUtil.getReadJdbcTemplate(this.connectUrls);
  }
Exemplo n.º 6
0
 @Override
 public void readProperties(Map<Integer, Object> props, boolean partial) {
   if (!partial || props.containsKey(SUB_TYPE))
     setType(Values.toString(MapUtils.getObject(props, SUB_TYPE, "")));
   if (!partial || props.containsKey(SUB_INFO))
     setInfo(Values.toString(MapUtils.getObject(props, SUB_INFO, "")));
   if (!partial || props.containsKey(SUB_INFO))
     flag = (int) Values.toInt(MapUtils.getObject(props, SUB_FLAG, "0"));
   if (!partial || props.containsKey(SUB_LABEL))
     setLabel(Values.toString(MapUtils.getObject(props, SUB_LABEL, "")));
 }
Exemplo n.º 7
0
 /**
  * Get the list of investigational new drugs which match the input parameters.
  *
  * @param paramMap The input parameters.
  * @return The list of investigational new drugs.
  */
 @SuppressWarnings("unchecked")
 public List<InvestigationalNewDrug> searchInvestigationalNewDrugs(Map<String, String> paramMap) {
   return getHibernateTemplate()
       .findByNamedParam(
           SEARCH_IND_QUERY,
           new String[] {"name", "indNo"},
           new String[] {
             "%" + MapUtils.getString(paramMap, "sponsorName", "%") + "%",
             "%" + MapUtils.getString(paramMap, "strINDNumber", "%") + "%"
           });
 }
 /**
  * 分页列表
  *
  * @param param
  * @return
  * @throws Exception
  */
 @ResponseBody
 @RequestMapping(value = "/search", method = RequestMethod.POST)
 public JsonMessage search(ClientParameter param) throws Exception {
   Map<String, String> map = ParameterUtils.getMapFromParameter(param);
   Pagination page =
       new Pagination(
           MapUtils.getIntValue(map, "currentPage"), MapUtils.getIntValue(map, "pageSize"));
   BrandesWeightInfo searchBean = new BrandesWeightInfo();
   BeanUtils.populate(searchBean, map);
   return super.getJsonMessage(
       CommonConst.SUCCESS, brandesWeightInfoService.searchByClient(searchBean, page));
 }
 /**
  * 处理申请
  *
  * @param param 参数
  * @return JsonMessage
  */
 @ResponseBody
 @RequestMapping(value = "/handApply")
 public JsonMessage handApply(ClientParameter param) throws Exception {
   Map<String, String> map = ParameterUtils.getMapFromParameter(param);
   SecurityCert securityCert = new SecurityCert();
   BeanUtils.populate(securityCert, map);
   securityCert.setUserCate(MapUtils.getShort(map, "userCate"));
   securityCert.setApplyType(MapUtils.getShort(map, "applyType"));
   securityCert.setActState(MapUtils.getShort(map, "actState"));
   String actionIp = MapUtils.getString(map, "actionIp");
   securityCert.setActionIp(IPUtil.formatStrIpToInt(actionIp));
   securityCertService.updateActState(securityCert);
   return super.getJsonMessage(CommonConst.SUCCESS);
 }
 /**
  * 列表(分页)
  *
  * @param param 参数
  * @return JsonMessage
  */
 @ResponseBody
 @RequestMapping(value = "/search", method = RequestMethod.POST)
 public JsonMessage search(ClientParameter param) throws Exception {
   Map<String, String> map = ParameterUtils.getMapFromParameter(param);
   Pagination page =
       new Pagination(
           MapUtils.getIntValue(map, "currentPage"), MapUtils.getIntValue(map, "pageSize"));
   SecurityCert searchBean = new SecurityCert();
   searchBean.setUserCate(MapUtils.getShort(map, "userCate"));
   searchBean.setApplyType(MapUtils.getShort(map, "applyType"));
   searchBean.setActState(MapUtils.getShort(map, "actState"));
   PaginateResult<SecurityCert> result = securityCertService.searchByClient(searchBean, page);
   return super.getJsonMessage(CommonConst.SUCCESS, result);
 }
Exemplo n.º 11
0
  private boolean policyExists(String policyId) {
    if (MapUtils.isEmpty(prePolicies)) {
      log.error("No PreDownloadPolicies found!");
      return false;
    }

    if (MapUtils.isEmpty(postPolicies)) {
      log.error("No PostDownloadPolicies found!");
      return false;
    }

    return (prePolicies.containsKey(policyId)
        || postPolicies.containsKey(policyId)
        || downloadErrorPolicies.containsKey(policyId));
  }
Exemplo n.º 12
0
 /**
  * Check if the current test contains too many errors.
  *
  * @return true if error is over 20%
  */
 public boolean hasTooManyError() {
   long currentTestsCount = getCurrentExecutionCount();
   double errors =
       MapUtils.getDoubleValue(
           (Map<?, ?>) getStatictisData().get("totalStatistics"), "Errors", 0D);
   return currentTestsCount == 0 ? false : (errors / currentTestsCount) > 0.2;
 }
  /**
   * Collect and return the subset of hits with the range offset..offset + max
   *
   * @param hits
   * @param options
   * @return
   */
  public Object collect(CompassHits hits, boolean reload, Map options) {
    if (hits.length() == 0) {
      return Collections.EMPTY_LIST;
    }

    int offset = MapUtils.getIntValue(options, "offset");
    int max = MapUtils.getIntValue(options, "max");
    List collectedHits = new ArrayList(max);
    int low = offset;
    int high = Math.min(low + max, hits.length());
    while (low < high) {
      collectedHits.add(getObject(hits.data(low++), reload));
    }

    return collectedHits;
  }
Exemplo n.º 14
0
  @Override
  public BinaryContent transform(Metacard metacard, Map<String, Serializable> arguments)
      throws CatalogTransformerException {
    StringWriter stringWriter = new StringWriter();
    Boolean omitXmlDec = null;
    if (MapUtils.isNotEmpty(arguments)) {
      omitXmlDec = (Boolean) arguments.get(CswConstants.OMIT_XML_DECLARATION);
    }

    if (omitXmlDec == null || !omitXmlDec) {
      stringWriter.append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n");
    }

    PrettyPrintWriter writer = new PrettyPrintWriter(stringWriter, new NoNameCoder());

    MarshallingContext context = new TreeMarshaller(writer, null, null);
    copyArgumentsToContext(context, arguments);

    converterSupplier.get().marshal(metacard, writer, context);

    ByteArrayInputStream bais =
        new ByteArrayInputStream(stringWriter.toString().getBytes(StandardCharsets.UTF_8));

    return new BinaryContentImpl(bais, new MimeType());
  }
Exemplo n.º 15
0
  public static String postRequest(String url, Map<String, String> parameters) {
    HttpClient client = new HttpClient();
    PostMethod method = new PostMethod(url);
    method
        .getParams()
        .setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false));
    if (MapUtils.isNotEmpty(parameters)) {
      NameValuePair[] pairs = new NameValuePair[parameters.size()];
      Iterator<Entry<String, String>> iterator = parameters.entrySet().iterator();
      int index = 0;
      while (iterator.hasNext()) {
        Map.Entry<String, String> entry = (Map.Entry<String, String>) iterator.next();
        pairs[index++] = new NameValuePair(entry.getKey(), entry.getValue());
      }
      method.setRequestBody(pairs);
    }

    try {
      int statusCode = client.executeMethod(method);
      if (statusCode != HttpStatus.SC_OK) {
        logger.error("post method fail.url={},status={}", url, statusCode);
        return "";
      }
      byte[] responseBody = method.getResponseBody();
      return new String(responseBody, "UTF-8");
    } catch (Exception e) {
      logger.error("url=" + url, e);
      return "";
    } finally {
      method.releaseConnection();
    }
  }
Exemplo n.º 16
0
  /**
   * create batch {@link ConfigItem} instances by name and value.
   *
   * @param configItem batch name and value
   * @return {@link ConfigItem} instances
   */
  public List<ConfigItem> newItems(Map<String, String> configItem) {
    if (MapUtils.isEmpty(configItem)) {
      return Collections.emptyList();
    }

    Date createDate = new Date();

    List<ConfigItem> ret = new ArrayList<ConfigItem>(configItem.size());

    Iterator<Entry<String, String>> iter = configItem.entrySet().iterator();
    while (iter.hasNext()) {
      Entry<String, String> entry = iter.next();
      ConfigItem item = new ConfigItem();
      item.setName(entry.getKey());
      item.setVal(entry.getValue());
      item.setRef(false);
      item.setCreateTime(createDate);
      item.setGroupId(getId());
      item.setShareable(false);
      item.setVersionId(getVersionId());

      ret.add(item);
    }

    return ret;
  }
Exemplo n.º 17
0
  public void addProperty(String name, int value) {
    if (MapUtils.isEmpty(integerProperties)) {
      integerProperties = new HashMap<String, Integer>();
    }

    integerProperties.put(name, value);
  }
Exemplo n.º 18
0
  protected Object receiveAction(AdminNotification action, UMOEventContext context)
      throws UMOException {
    UMOMessage result = null;
    try {
      UMOEndpointURI endpointUri = new MuleEndpointURI(action.getResourceIdentifier());
      UMOEndpoint endpoint =
          MuleEndpoint.getOrCreateEndpointForUri(endpointUri, UMOEndpoint.ENDPOINT_TYPE_SENDER);

      UMOMessageDispatcher dispatcher = endpoint.getConnector().getDispatcher(endpoint);
      long timeout =
          MapUtils.getLongValue(
              action.getProperties(),
              MuleProperties.MULE_EVENT_TIMEOUT_PROPERTY,
              MuleManager.getConfiguration().getSynchronousEventTimeout());

      UMOEndpointURI ep = new MuleEndpointURI(action.getResourceIdentifier());
      result = dispatcher.receive(ep, timeout);
      if (result != null) {
        // See if there is a default transformer on the connector
        UMOTransformer trans =
            ((AbstractConnector) endpoint.getConnector()).getDefaultInboundTransformer();
        if (trans != null) {
          Object payload = trans.transform(result.getPayload());
          result = new MuleMessage(payload, result);
        }
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        wireFormat.write(out, result);
        return out.toByteArray();
      } else {
        return null;
      }
    } catch (Exception e) {
      return handleException(result, e);
    }
  }
Exemplo n.º 19
0
  public void addProperty(String name, boolean value) {
    if (MapUtils.isEmpty(booleanProperties)) {
      booleanProperties = new HashMap<String, Boolean>();
    }

    booleanProperties.put(name, value);
  }
Exemplo n.º 20
0
  /** Generates the list of individual deploy actions that has to be sent to each DNode. */
  private static Map<String, List<DeployAction>> generateDeployActionsPerDNode(
      List<DeployRequest> deployRequests, long version) {
    HashMap<String, List<DeployAction>> actions = new HashMap<String, List<DeployAction>>();

    long deployDate =
        System
            .currentTimeMillis(); // Here is where we decide the data of the deployment for all
                                  // deployed tablespaces

    for (DeployRequest req : deployRequests) {
      for (Object obj : req.getReplicationMap()) {
        ReplicationEntry rEntry = (ReplicationEntry) obj;
        PartitionEntry pEntry = null;
        for (PartitionEntry partEntry : req.getPartitionMap()) {
          if (partEntry.getShard() == rEntry.getShard()) {
            pEntry = partEntry;
          }
        }
        if (pEntry == null) {
          throw new RuntimeException(
              "No Partition metadata for shard: "
                  + rEntry.getShard()
                  + " this is very likely to be a software bug.");
        }
        // Normalize DNode ids -> The convention is that DNodes are identified by host:port . So we
        // need to strip the
        // protocol, if any
        for (int i = 0; i < rEntry.getNodes().size(); i++) {
          String dnodeId = rEntry.getNodes().get(i);
          if (dnodeId.startsWith("tcp://")) {
            dnodeId = dnodeId.substring("tcp://".length(), dnodeId.length());
          }
          rEntry.getNodes().set(i, dnodeId);
        }
        for (String dNode : rEntry.getNodes()) {
          List<DeployAction> actionsSoFar =
              (List<DeployAction>)
                  MapUtils.getObject(actions, dNode, new ArrayList<DeployAction>());
          actions.put(dNode, actionsSoFar);
          DeployAction deployAction = new DeployAction();
          deployAction.setDataURI(req.getData_uri() + "/" + rEntry.getShard() + ".db");
          deployAction.setTablespace(req.getTablespace());
          deployAction.setVersion(version);
          deployAction.setPartition(rEntry.getShard());

          // Add partition metadata to the deploy action for DNodes to save it
          PartitionMetadata metadata = new PartitionMetadata();
          metadata.setMinKey(pEntry.getMin());
          metadata.setMaxKey(pEntry.getMax());
          metadata.setNReplicas(rEntry.getNodes().size());
          metadata.setDeploymentDate(deployDate);
          metadata.setInitStatements(req.getInitStatements());

          deployAction.setMetadata(metadata);
          actionsSoFar.add(deployAction);
        }
      }
    }
    return actions;
  }
  private void ensureDestinationImageMap() {
    if (MapUtils.isEmpty(getParameters().getDiskInfoDestinationMap())) {
      diskInfoDestinationMap = new HashMap<>();

      if (getVmTemplate() == null) {
        return;
      }

      if (!Guid.isNullOrEmpty(getParameters().getStorageDomainId())) {
        Guid storageId = getParameters().getStorageDomainId();
        ArrayList<Guid> storageIds = new ArrayList<>();
        storageIds.add(storageId);
        for (DiskImage image : getVmTemplate().getDiskTemplateMap().values()) {
          image.setStorageIds(storageIds);
          diskInfoDestinationMap.put(image.getId(), image);
        }
      } else {
        ImagesHandler.fillImagesMapBasedOnTemplate(
            getVmTemplate(), diskInfoDestinationMap, destStorages);
      }
    } else {
      diskInfoDestinationMap = getParameters().getDiskInfoDestinationMap();
    }

    storageToDisksMap =
        ImagesHandler.buildStorageToDiskMap(
            getVmTemplate().getDiskTemplateMap().values(), diskInfoDestinationMap);
  }
Exemplo n.º 22
0
  /**
   * Parse the template's (Groovy) script. The script must implement {@link IEmailDataScript}.
   *
   * @param keyVals
   * @return
   */
  public Map<String, String> parseScript(Map<String, String> keyVals) {

    Map<String, String> resultMap = new HashMap<String, String>();
    if (null == _script || "".equals(_script)) {
      return resultMap;
    }

    ClassLoader parent = getClass().getClassLoader();
    GroovyClassLoader loader = new GroovyClassLoader(parent);
    Class<?> clazz = loader.parseClass(_script, "EmailDataScript");

    IEmailDataScript scriptDelegate;
    try {
      scriptDelegate = (IEmailDataScript) clazz.newInstance();
      resultMap = scriptDelegate.getEmailData((HashMap<String, String>) keyVals);

      if (MapUtils.isEmpty(resultMap)) {
        // This may not necessarily be an error for some parameter values.
        LOGGER.warn(
            "sendTemplateEmail no data returned from Groovy script for templateID: " + _templateId);
      }
    } catch (InstantiationException e) {
      LOGGER.error(DetailedException.getMessageOrType(e));
    } catch (IllegalAccessException e) {
      LOGGER.error(DetailedException.getMessageOrType(e));
    } catch (CompilationFailedException e) {
      LOGGER.error(DetailedException.getMessageOrType(e));
    }

    return resultMap;
  }
Exemplo n.º 23
0
  public static String constructCacheKey(
      String cacheKeyPrefix, int offset, int limit, RenderProperties renderProperties) {

    StringBuilder key = new StringBuilder("");

    if (cacheKeyPrefix != null) {
      key.append(cacheKeyPrefix);
      key.append("#");
    }

    key.append(offset);
    key.append("#");
    key.append(limit);

    if (renderProperties != null && MapUtils.isNotEmpty(renderProperties.getRenderInstructions())) {

      Map<RenderInstruction, Object> renderInstructions = renderProperties.getRenderInstructions();

      // Get RenderInstructions by specific order
      for (RenderInstruction renderInstruction : RenderInstruction.values()) {

        if (renderInstructions.containsKey(renderInstruction)) {
          key.append("#");
          key.append(renderInstructions.get(renderInstruction).toString());
        }
      }
    }
    return key.toString();
  }
Exemplo n.º 24
0
  public Integer getIntValue(String property) {
    if (MapUtils.isEmpty(integerProperties) || !integerProperties.containsKey(property)) {
      return null;
    }

    return integerProperties.get(property);
  }
  public StringBuilder toString(StringBuilder sb) {
    if (sb == null) {
      sb = new StringBuilder();
    }

    if (MapUtils.isNotEmpty(entitiesMutated)) {
      int i = 0;
      for (Map.Entry<EntityMutations.EntityOperation, List<AtlasEntityHeader>> e :
          entitiesMutated.entrySet()) {
        if (i > 0) {
          sb.append(",");
        }
        sb.append(e.getKey()).append(":");
        if (CollectionUtils.isNotEmpty(e.getValue())) {
          for (int j = 0; i < e.getValue().size(); j++) {
            if (j > 0) {
              sb.append(",");
            }
            e.getValue().get(i).toString(sb);
          }
        }
        i++;
      }
    }

    return sb;
  }
 /**
  * 批量保存品牌权重
  *
  * @param param
  * @return
  * @throws Exception
  */
 @ResponseBody
 @RequestMapping(value = "/batchSave", method = RequestMethod.POST)
 @Deprecated
 public JsonMessage batchSave(ClientParameter param) {
   Map<String, String> map = ParameterUtils.getMapFromParameter(param);
   String data = MapUtils.getString(map, "dataList", "");
   List<BrandesWeightInfo> brandesWeightInfos =
       ParameterUtils.getListObjectFromParameter(data, BrandesWeightInfo.class);
   JsonMessage jsonMessage = super.getJsonMessage(CommonConst.SUCCESS);
   try {
     for (BrandesWeightInfo brandesWeightInfo : brandesWeightInfos) {
       if (!beanValidator(jsonMessage, brandesWeightInfo)) {
         return jsonMessage;
       }
       brandesWeightInfo.setUpdateTime(CalendarUtils.getCurrentLong());
       brandesWeightInfoService.updateByPrimaryKeySelective(brandesWeightInfo);
       BrandesInfo filter1 = new BrandesInfo();
       filter1.setRefrenceId(brandesWeightInfo.getBrandesId());
       // 修改品牌索引
       brandeSolrHandler.addBrandsInfoList(
           brandesInfoService.findBrandesInfoToSolr(filter1, null));
       // 修改旗下产品索引
       ProductInfo filter2 = new ProductInfo();
       filter2.setBrandsId(brandesWeightInfo.getBrandesId());
       List<ProductInfo> productInfos = productInfoService.findProductToSolr(filter2, null);
       productSolrHandler.addProductInfoList(productInfos);
     }
   } catch (BusinessException e) {
     logger.error("品牌权重接口,调用保存失败: " + e.getMessage());
     return this.getJsonMessage(e.getErrorCode());
   }
   return jsonMessage;
 }
  @Override
  public AdvDataInquiryResponse invoke() throws DataInquiryException {
    ResponseBuilder responseBuilder = new ResponseBuilder(dataInquiryRequest, accountId);
    List<DeviceData> devicesData = new ArrayList<>(dataInquiryRequest.getDeviceDataList());
    Map<String, ComponentDataType> componentsMetadata = fetchComponentDataType(devicesData);

    if (MapUtils.isNotEmpty(componentsMetadata)) {
      String[] measureAttributes;
      if (dataInquiryRequest.hasRequestMeasuredAttributes()) {
        measureAttributes = getAttributesFromRequest();
      } else {
        measureAttributes = getAllAttributes(componentsMetadata.keySet());
      }

      dataRetrieveParams.setComponentsAttributes(Arrays.asList(measureAttributes));
      dataRetrieveParams.setComponentsMetadata(componentsMetadata);
      dataRetriever.retrieveAndCount(observationFilterSelector);

      if (!dataInquiryRequest.isCountOnly()) {
        ComponentsBuilderParams parameters =
            new ComponentsBuilderParams(dataInquiryRequest, measureAttributes);
        AdvancedComponentsBuilder advancedComponentsBuilder =
            new AdvancedComponentsBuilder(
                componentsMetadata, dataRetriever.getComponentObservations());
        advancedComponentsBuilder.appendComponentsDetails(devicesData, parameters);
      }

      responseBuilder.build(dataRetriever.getRowCount(), devicesData);
    }
    return responseBuilder.getDataInquiryResponse();
  }
 /**
  * 删除
  *
  * @param param
  * @return
  * @throws Exception
  */
 @ResponseBody
 @RequestMapping(value = "/delete", method = RequestMethod.POST)
 public JsonMessage delete(ClientParameter param) throws Exception {
   Map<String, String> map = ParameterUtils.getMapFromParameter(param);
   rulesCateService.deleteByClient(MapUtils.getString(map, "refrenceId"));
   return super.getJsonMessage(CommonConst.SUCCESS);
 }
Exemplo n.º 29
0
 @Override
 protected AbstractBTGRuleDataEvent getEvent(final HttpServletRequest request) {
   RequestParametersUsedBTGRuleDataEvent result = null;
   final Map<String, String[]> params = request.getParameterMap();
   if (!MapUtils.isEmpty(params)) {
     result = new RequestParametersUsedBTGRuleDataEvent(params);
   }
   return result;
 }
Exemplo n.º 30
0
 /**
  * Returns if jRebel property is activated on the sensor.
  *
  * @return Returns if jRebel property is activated on the sensor.
  */
 public boolean isJRebelActive() {
   if (MapUtils.isNotEmpty(getParameters())) {
     Object jRebelValue = getParameters().get("jRebel");
     if ("true".equals(jRebelValue)) {
       return true;
     }
   }
   return false;
 }