本文整理汇总了Java中javax.jcr.Property.getBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java Property.getBoolean方法的具体用法?Java Property.getBoolean怎么用?Java Property.getBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.jcr.Property
的用法示例。
在下文中一共展示了Property.getBoolean方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTasksComplete
import javax.jcr.Property; //导入方法依赖的package包/类
public void getTasksComplete(Card card) throws Exception {
ObjectContentManager ocm = ocmFactory.getOcm();
try{
Node node = ocm.getSession().getNode(String.format(URI.TASKS_URI, card.getBoard(), card.getPhase(), card.getId().toString(),""));
int complete = 0;
NodeIterator nodes = node.getNodes();
while(nodes.hasNext()){
Node nextNode = nodes.nextNode();
Property property = nextNode.getProperty("complete");
if( property!=null && property.getBoolean() ){
complete++;
}
}
card.setCompleteTasks(Long.valueOf(complete));
} finally {
ocm.logout();
}
}
示例2: getRealValue
import javax.jcr.Property; //导入方法依赖的package包/类
public Object getRealValue(Property property) throws ValueFormatException,
RepositoryException {
Object value = null;
switch (property.getType()) {
case PropertyType.BOOLEAN:
value = property.getBoolean();
break;
case PropertyType.DATE:
value = property.getDate().getTime();
break;
case PropertyType.STRING:
value = property.getString();
break;
case PropertyType.LONG:
value = property.getLong();
break;
case PropertyType.DECIMAL:
value = property.getDecimal();
break;
default:
value = null;
}
return value;
}
示例3: setAction
import javax.jcr.Property; //导入方法依赖的package包/类
private void setAction(final Node node, Node actions, String actionName, String implClass) throws RepositoryException, PathNotFoundException, ValueFormatException, VersionException, LockException, ConstraintViolationException, ItemExistsException, AccessDeniedException {
String propName = "default" + StringUtils.capitalize(actionName);
if (node.hasProperty(propName)) {
Property defaultAction = node.getProperty(propName);
if (defaultAction.getBoolean()) {
actions.addNode(actionName, NodeTypes.ContentNode.NAME).setProperty("class", implClass);
}
defaultAction.remove();
}
}
示例4: getTaskSummary
import javax.jcr.Property; //导入方法依赖的package包/类
@PreAuthorize("hasPermission(#boardId, 'BOARD', 'READ,WRITE,ADMIN')")
@RequestMapping(value = "/{cardId}/tasksummary", method=RequestMethod.GET)
public @ResponseBody Map<String,Integer> getTaskSummary(@PathVariable String boardId,
@PathVariable String phaseId,
@PathVariable String cardId) throws Exception {
ObjectContentManager ocm = ocmFactory.getOcm();
Map<String,Integer> result;
try{
Node node = ocm.getSession().getNode(String.format(URI.TASKS_URI, boardId, phaseId, cardId,""));
int complete = 0;
int incomplete = 0;
int all = 0;
NodeIterator nodes = node.getNodes();
while(nodes.hasNext()){
Node nextNode = nodes.nextNode();
Property property = nextNode.getProperty("complete");
if( property!=null){
all++;
if( property.getBoolean() ){
complete++;
} else {
incomplete++;
}
}
}
result = new HashMap<String,Integer>();
result.put("complete", complete);
result.put("incomplete", incomplete);
result.put("all", all);
} finally {
ocm.logout();
}
return result;
}
示例5: readBooleanProperty
import javax.jcr.Property; //导入方法依赖的package包/类
public static boolean readBooleanProperty(final Node node, final String name) throws RepositoryException {
if (node.hasProperty(name)) {
final Property property = node.getProperty(name);
return property.getBoolean();
}
return false;
}
示例6: distill
import javax.jcr.Property; //导入方法依赖的package包/类
/**
* Extract property based on their type and return as object (of Property)
*
* @param property This is a property
* @return content This is node property object
* @throws Exception
*/
public static Object distill(Property property)
throws Exception {
Object content;
boolean isMulti = property.isMultiple();
switch (property.getType()) {
case PropertyType.LONG:
if (isMulti)
content = asLongs(property);
else
content = property.getLong();
break;
case PropertyType.DECIMAL:
case PropertyType.DOUBLE:
if (isMulti)
content = asDoubles(property);
else
content = property.getDouble();
break;
case PropertyType.BOOLEAN:
if (isMulti)
content = asBooleans(property);
else
content = property.getBoolean();
break;
case PropertyType.DATE:
if (isMulti)
content = asDates(property);
else
content = property.getValue().getString();
break;
case PropertyType.NAME:
case PropertyType.STRING:
case PropertyType.PATH:
case PropertyType.URI:
default:
if (isMulti)
content = asStrings(property);
else
content = property.getString();
break;
}
return content;
}
示例7: getPropertyBoolean
import javax.jcr.Property; //导入方法依赖的package包/类
/**
* Convenience method for getting a single-value boolean property from
* a resource.
*
* @param resource The resource from which to get the property.
* @param namePattern Property name.
* @return Property value if present, else false.
*/
public static boolean getPropertyBoolean(Resource resource, String namePattern) throws RepositoryException {
Property prop = getProperty(resource, namePattern);
return prop != null && prop.getBoolean();
}