本文整理汇总了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;
}
示例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;
}
示例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());
}