當前位置: 首頁>>代碼示例>>Java>>正文


Java ClientConstants類代碼示例

本文整理匯總了Java中com.redhat.lightblue.client.util.ClientConstants的典型用法代碼示例。如果您正苦於以下問題:Java ClientConstants類的具體用法?Java ClientConstants怎麽用?Java ClientConstants使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ClientConstants類屬於com.redhat.lightblue.client.util包,在下文中一共展示了ClientConstants類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createJobs

import com.redhat.lightblue.client.util.ClientConstants; //導入依賴的package包/類
/**
 * Create a migration job or jobs to process records created between the
 * given dates. startDate is inclusive, end date is exclusive
 */
protected List<MigrationJob> createJobs(Date startDate, Date endDate, ActiveExecution ae) throws Exception {
    List<MigrationJob> ret = new ArrayList<MigrationJob>();
    LOGGER.debug("Creating the migrator to setup new jobs");
    // We setup a new migration job
    MigrationJob mj = new MigrationJob();
    mj.setConfigurationName(getMigrationConfiguration().getConfigurationName());
    mj.setScheduledDate(getNow());
    mj.setGenerated(true);
    mj.setStatus(MigrationJob.STATE_AVAILABLE);
    mj.setConsistencyChecker(new MigrationJob.ConsistencyChecker());
    mj.getConsistencyChecker().setJobRangeBegin(ClientConstants.getDateFormat().format(startDate));
    mj.getConsistencyChecker().setJobRangeEnd(ClientConstants.getDateFormat().format(endDate));
    mj.getConsistencyChecker().setConfigurationName(mj.getConfigurationName());
    Migrator migrator = createMigrator(mj, ae);
    mj.setQuery(migrator.createRangeQuery(startDate, endDate));
    // At this point, mj.query contains the range query
    LOGGER.debug("Migration job query:{}", mj.getQuery());
    ret.add(mj);
    return ret;
}
 
開發者ID:lightblue-platform,項目名稱:lightblue-migrator,代碼行數:25,代碼來源:ConsistencyCheckerController.java

示例2: valueToJson

import com.redhat.lightblue.client.util.ClientConstants; //導入依賴的package包/類
public static JsonNode valueToJson(Object x) {
    JsonNode node;
    if (x == null) {
        node = JsonNodeFactory.instance.nullNode();
    } else if (x instanceof Date) {
        node = JsonNodeFactory.instance.textNode(ClientConstants.getDateFormat().format((Date) x));
    } else if (x instanceof Number) {
        if (x instanceof BigDecimal) {
            node = JsonNodeFactory.instance.numberNode((BigDecimal) x);
        } else if (x instanceof BigInteger) {
            node = JsonNodeFactory.instance.numberNode((BigInteger) x);
        } else if (x instanceof Double) {
            node = JsonNodeFactory.instance.numberNode((Double) x);
        } else if (x instanceof Float) {
            node = JsonNodeFactory.instance.numberNode((Float) x);
        } else if (x instanceof Long) {
            node = JsonNodeFactory.instance.numberNode((Long) x);
        } else {
            node = JsonNodeFactory.instance.numberNode(((Number) x).intValue());
        }
    } else if (x instanceof Boolean) {
        node = JsonNodeFactory.instance.booleanNode((Boolean) x);
    } else if (x instanceof JsonNode) {
        node = (JsonNode) x;
    } else if (x instanceof Literal) {
        node = ((Literal) x).node;
    } else if (x.getClass().isArray()) {
        if (x instanceof Literal[]) {
            node = toJson((Literal[]) x);
        } else if (x instanceof Object[]) {
            node = toJson(values((Object[]) x));
        } else if (x instanceof int[]) {
            node = toJson(values((int[]) x));
        } else if (x instanceof long[]) {
            node = toJson(values((long[]) x));
        } else if (x instanceof boolean[]) {
            node = toJson(values((boolean[]) x));
        } else {
            throw new UnsupportedOperationException("Array of type " + x.getClass() + " is not supported.");
        }
    } else {
        node = JsonNodeFactory.instance.textNode(x.toString());
    }
    return node;
}
 
開發者ID:lightblue-platform,項目名稱:lightblue-client,代碼行數:46,代碼來源:Literal.java

示例3: testDateArray

import com.redhat.lightblue.client.util.ClientConstants; //導入依賴的package包/類
@Test
public void testDateArray() {
    Date d1 = new Date();

    Date[] values = new Date[]{d1};

    Literal l = Literal.value(values);

    Assert.assertEquals("[\"" + ClientConstants.getDateFormat().format(d1) + "\"]", l.toString());
}
 
開發者ID:lightblue-platform,項目名稱:lightblue-client,代碼行數:11,代碼來源:LiteralTest.java


注:本文中的com.redhat.lightblue.client.util.ClientConstants類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。