当前位置: 首页>>代码示例>>Java>>正文


Java Strings类代码示例

本文整理汇总了Java中org.oscm.string.Strings的典型用法代码示例。如果您正苦于以下问题:Java Strings类的具体用法?Java Strings怎么用?Java Strings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Strings类属于org.oscm.string包,在下文中一共展示了Strings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getInstanceById

import org.oscm.string.Strings; //导入依赖的package包/类
public ServiceInstance getInstanceById(String instanceId)
        throws ServiceInstanceNotFoundException {
    if (Strings.isEmpty(instanceId)) {
        throw new ServiceInstanceNotFoundException(
                "Service instance ID not set or empty.");
    }

    Query query = em.createNamedQuery("ServiceInstance.getForKey");
    query.setParameter("key", instanceId);
    try {
        final ServiceInstance instance = (ServiceInstance) query
                .getSingleResult();
        return instance;
    } catch (NoResultException e) {
        throw new ServiceInstanceNotFoundException(
                "Service instance with ID '%s' not found.", instanceId);
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:19,代码来源:ServiceInstanceDAO.java

示例2: getBESTechnologyManagers

import org.oscm.string.Strings; //导入依赖的package包/类
/**
 * Get all technology managers with specified email address for the service
 * instance.
 */
public List<VOUserDetails> getBESTechnologyManagers(ServiceInstance si) {
    List<VOUserDetails> mailUsers = new ArrayList<>();
    try {
        // Get all technology managers of TP organization
        IdentityService is = getBESWebService(IdentityService.class, si, Optional.empty());
        List<VOUserDetails> orgUsers = is.getUsersForOrganization();
        for (VOUserDetails user : orgUsers) {
            if (user.getUserRoles().contains(
                    UserRoleType.TECHNOLOGY_MANAGER)
                    && !Strings.isEmpty(user.getEMail())) {
                mailUsers.add(user);
            }
        }
    } catch (Exception ex) {
        LOGGER.warn(
                "Technology managers mail addresses cannot be retrieved from CT_MG. [Cause: "
                        + ex.getMessage() + "]", ex);
    }
    if (mailUsers.isEmpty()) {
        LOGGER.warn("No technology managers mails set.");
    }
    return mailUsers;
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:28,代码来源:BesDAO.java

示例3: copyCredentialsFromControllerSettings

import org.oscm.string.Strings; //导入依赖的package包/类
/**
 * For backwards compatibility the technology manager credentials from the
 * controller configuration are applied to the instance parameters.
 * 
 * @param settings
 * @param controllerSettings
 */
public void copyCredentialsFromControllerSettings(
        ProvisioningSettings settings,
        HashMap<String, Setting> controllerSettings) {
    Setting userKey = controllerSettings
            .get(ControllerConfigurationKey.BSS_USER_KEY.name());
    Setting userPwd = controllerSettings
            .get(ControllerConfigurationKey.BSS_USER_PWD.name());
    if (userKey != null && !Strings.isEmpty(userKey.getValue())
            && userPwd != null && !Strings.isEmpty(userPwd.getValue())) {
        // override technology manager user credentials in parameters
        // (for backwards compatibility)
        settings.getParameters().put(InstanceParameter.BSS_USER, userKey);
        settings.getParameters().put(InstanceParameter.BSS_USER_PWD,
                userPwd);
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:24,代码来源:APPConfigurationServiceBean.java

示例4: newKeySelector_keyinfoEmpty

import org.oscm.string.Strings; //导入依赖的package包/类
@Test
public void newKeySelector_keyinfoEmpty() throws Exception {
    // given
    String response = Strings
            .textFileToString("javares/openamResponse.xml");
    response = response.replaceAll(System.lineSeparator(), "").replaceAll(
            "<ds:KeyInfo>.*</ds:KeyInfo>", "<ds:KeyInfo></ds:KeyInfo>");
    Document document = XMLConverter.convertToDocument(response, true);
    NodeList nl = document.getElementsByTagNameNS(XMLSignature.XMLNS,
            "Signature");

    // when
    try {
        factory.newKeySelector(nl.item(0));
        fail();
    } catch (DigitalSignatureValidationException e) {
        assertTrue(e.getMessage().contains(
                "Only RSA/DSA KeyValue and are X509Data supported"));
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:21,代码来源:KeySelectorFactoryTest.java

示例5: newKeySelector_keyinfoMissing

import org.oscm.string.Strings; //导入依赖的package包/类
@Test
public void newKeySelector_keyinfoMissing() throws Exception {
    // given
    String response = Strings
            .textFileToString("javares/openamResponse.xml");
    response = response.replaceAll(System.lineSeparator(), "").replaceAll(
            "<ds:KeyInfo>.*</ds:KeyInfo>", "");
    Document document = XMLConverter.convertToDocument(response, true);
    NodeList nl = document.getElementsByTagNameNS(XMLSignature.XMLNS,
            "Signature");

    try {
        // when
        factory.newKeySelector(nl.item(0));
        fail();
    } catch (DigitalSignatureValidationException e) {
        // then
        assertTrue(e.getMessage().contains(
                "No KeyInfo element found in SAML assertion"));
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:22,代码来源:KeySelectorFactoryTest.java

示例6: newKeySelector_keyValue

import org.oscm.string.Strings; //导入依赖的package包/类
@Test
public void newKeySelector_keyValue() throws Exception {
    // given
    String response = Strings
            .textFileToString("javares/openamResponse.xml");
    Document document = XMLConverter.convertToDocument(
            replaceX509WithKeyValueData(response), true);
    NodeList nl = document.getElementsByTagNameNS(XMLSignature.XMLNS,
            "Signature");

    // when
    KeySelector keySelector = factory.newKeySelector(nl.item(0));

    // then
    assertTrue(keySelector instanceof KeyValueKeySelector);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:17,代码来源:KeySelectorFactoryTest.java

示例7: newKeySelector_firstFound

import org.oscm.string.Strings; //导入依赖的package包/类
@Test
public void newKeySelector_firstFound() throws Exception {
    // given
    String response = Strings
            .textFileToString("javares/openamResponse.xml");
    Document document = XMLConverter.convertToDocument(
            addKeyValueAfterX509Data(response), true);
    NodeList nl = document.getElementsByTagNameNS(XMLSignature.XMLNS,
            "Signature");

    // when
    KeySelector keySelector = factory.newKeySelector(nl.item(0));

    // then
    assertTrue(keySelector instanceof X509KeySelector);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:17,代码来源:KeySelectorFactoryTest.java

示例8: getOperationServiceAdapter

import org.oscm.string.Strings; //导入依赖的package包/类
public static OperationServiceAdapter getOperationServiceAdapter(
        TechnicalProductOperation operation, Integer wsTimeout,
        String username, String password) throws IOException,
        WSDLException, ParserConfigurationException {

    String target = operation.getActionUrl();
    if (Strings.isEmpty(target)) {
        throw new SaaSSystemException(
                String.format(
                        "Failed to retrieve service endpoint for service operation '%s', as the target is not defined.",
                        Long.valueOf(operation.getKey())));
    }
    WSPortConnector portConnector = new WSPortConnector(target, username,
            password);

    SupportedOperationVersions supportedVersion = getSupportedVersion(portConnector);
    OperationServiceAdapter adapter = getAdapterForVersion(supportedVersion);
    final Object port = portConnector.getPort(
            supportedVersion.getLocalWSDL(),
            supportedVersion.getServiceClass(), wsTimeout);
    adapter.setOperationService(port);
    return adapter;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:24,代码来源:OperationServiceAdapterFactory.java

示例9: checkLicenseConstrainsAndStore

import org.oscm.string.Strings; //导入依赖的package包/类
/**
 * Checks if the new license of the technical product can be changed. Saving
 * is done when the technical product doesn't have a license in the provided
 * locale or if no marketing products exist based on the technical product.
 * In case the new license isn't set or equals the existing one, it isn't
 * saved.
 * 
 * @param tp
 *            the technical product value object to get the new license from
 * @param locale
 *            the locale that is used for saving the license
 * @param license
 *            The license for the technical product.
 */
private void checkLicenseConstrainsAndStore(TechnicalProduct tp,
        String locale, String license) {
    if (license == null) {
        return;
    }
    List<VOLocalizedText> localizedValues = localizer.getLocalizedValues(
            tp.getKey(), LocalizedObjectTypes.PRODUCT_LICENSE_DESC);

    String storedLicense = null;
    for (VOLocalizedText text : localizedValues) {
        if (text.getLocale().equals(locale)) {
            storedLicense = text.getText();
        }
    }

    ProductLicenseValidator.validate(tp, storedLicense, license);
    // save in DB only if they are different
    if (!Strings.areStringsEqual(storedLicense, license)) {
        localizer.storeLocalizedResource(locale, tp.getKey(),
                LocalizedObjectTypes.PRODUCT_LICENSE_DESC, license);
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:37,代码来源:ServiceProvisioningServiceBean.java

示例10: executeBilling

import org.oscm.string.Strings; //导入依赖的package包/类
/**
 * Execute the billing calculation for the payment preview report or for the
 * export of billing data.
 */
BillingRun executeBilling(DataProvider dataProvider) {
    BillingRun result = new BillingRun(dataProvider.getPeriodStart(),
            dataProvider.getPeriodEnd());

    for (BillingInput billingInput : dataProvider.getBillingInput()) {

        try {
            BillingResult bill = revenueCalculator
                    .performBillingRunForSubscription(billingInput);

            if (!Strings.isEmpty(bill.getResultXML())) {
                result.addBillingResult(bill);
            }
        } catch (Exception e) {
            logBillingRunFailed(e, billingInput);
            result.clearBillingResults();
            result.setSuccessful(false);
            return result;
        }
    }

    return result;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:28,代码来源:BillingServiceBean.java

示例11: RowData

import org.oscm.string.Strings; //导入依赖的package包/类
RowData(String fromDate, String toDate, String supplierName,
        String supplierID, String amount, String currency,
        String marketplace) {
    this.fromDate = fromDate;
    this.toDate = toDate;
    this.supplierName = supplierName;
    this.supplierId = supplierID;
    this.amount = amount;
    this.currency = currency;
    if (Strings.isEmpty(marketplace)
            || "null".equalsIgnoreCase(marketplace)) {
        this.marketplace = "";
    } else {
        this.marketplace = marketplace;
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:17,代码来源:SupplierRevenueSqlResult.java

示例12: validateMandatoryParametersAreSet

import org.oscm.string.Strings; //导入依赖的package包/类
/**
 * Checks that all mandatory parameters of the passed
 * {@link TechnicalProductOperation} are contained with a non empty value in
 * the passed {@link Map}.
 */
void validateMandatoryParametersAreSet(TechnicalProductOperation tpo,
        Map<String, String> parameters) throws ValidationException {
    List<OperationParameter> list = tpo.getParameters();
    List<String> missingParams = new LinkedList<>();
    for (OperationParameter op : list) {
        if (!op.isMandatory()) {
            continue;
        }
        String value = parameters.get(op.getId());
        if (Strings.isEmpty(value)) {
            missingParams.add(op.getId());
        }
    }
    if (!missingParams.isEmpty()) {
        String member = missingParams.toString();
        member = member.substring(1, member.length() - 1);
        ValidationException ve = new ValidationException(
                ValidationException.ReasonEnum.REQUIRED, member,
                new Object[] { member });
        LOG.logWarn(Log4jLogger.SYSTEM_LOG, ve,
                LogMessageIdentifier.WARN_VALIDATION_FAILED);
        throw ve;
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:30,代码来源:ManageSubscriptionBean.java

示例13: validateUsageLicence

import org.oscm.string.Strings; //导入依赖的package包/类
private String validateUsageLicence(Subscription sub)
        throws OperationNotPermittedException {
    PlatformUser user = dataManager.getCurrentUser();
    UsageLicense lic = sub.getUsageLicenseForUser(user);
    if (lic == null) {
        String message = "User '%s' is not assigned to subscription '%s'.";
        OperationNotPermittedException onp = new OperationNotPermittedException(
                String.format(message, user.getUserId(),
                        sub.getSubscriptionId()));
        LOG.logWarn(
                Log4jLogger.SYSTEM_LOG,
                onp,
                LogMessageIdentifier.WARN_USER_NOT_ASSINGED_TO_SUBSCRIPTION,
                Long.toString(user.getKey()), Long.toString(sub.getKey()));
        throw onp;
    }
    String userId = lic.getApplicationUserId();
    if (Strings.isEmpty(userId)) {
        userId = user.getUserId();
    }
    return userId;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:23,代码来源:ManageSubscriptionBean.java

示例14: setOptions

import org.oscm.string.Strings; //导入依赖的package包/类
public JsonParamBuilder setOptions() {
    List<VOParameterOption> voParamOpts = parameterDef.getParameterOptions();

    if (voParamOpts != null) {
        for (VOParameterOption voOpt : voParamOpts) {
            JsonParameterOption jsonOpt = new JsonParameterOption();
            jsonOpt.setId(Strings.nullToEmpty(voOpt.getOptionId()));
            jsonOpt.setDescription(Strings.nullToEmpty(EscapeUtils.escapeJSON(voOpt.getOptionDescription())));
            if(pricedParameter != null){
             for (VOPricedOption voPricedOpt : pricedParameter.getPricedOptions()) {
                 if(voPricedOpt.getParameterOptionKey() == voOpt.getKey()){
                     jsonOpt.setPricePerUser(voPricedOpt.getPricePerUser().doubleValue());
                     jsonOpt.setPricePerSubscription(voPricedOpt.getPricePerSubscription().doubleValue());
                 }
             }
             jsonParam.getOptions().add(jsonOpt);
            }
        }
    }

    return this;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:23,代码来源:JsonParamBuilder.java

示例15: operationChanged

import org.oscm.string.Strings; //导入依赖的package包/类
public void operationChanged() {
    POSubscription subscription = model.getSelectedSubscription();
    String operationId = subscription.getSelectedOperationId();
    if (Strings.isEmpty(operationId)) {
        subscription.setSelectedOperation(null);
        subscription.setSelectedOperationId(null);
        subscription.setExecuteDisabled(true);
    } else {
        VOTechnicalServiceOperation op = findSelectedOperation(
                subscription.getVOSubscription(), operationId);
        OperationModel operationModel = new OperationModel();
        operationModel.setOperation(op);

        try {
            operationModel.setParameters(
                    convert(op, subscription.getVOSubscription()));
        } catch (SaaSApplicationException e) {
            subscription.setExecuteDisabled(true);
            ui.handleException(e);
        }
        subscription.setSelectedOperation(operationModel);
        subscription.setExecuteDisabled(false);
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:25,代码来源:MySubscriptionsCtrl.java


注:本文中的org.oscm.string.Strings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。