本文整理汇总了Java中org.apache.jackrabbit.util.ISO9075类的典型用法代码示例。如果您正苦于以下问题:Java ISO9075类的具体用法?Java ISO9075怎么用?Java ISO9075使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISO9075类属于org.apache.jackrabbit.util包,在下文中一共展示了ISO9075类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getName
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
/**
* Validate that the given value can be converted to a JCR name, and
* return the name.
*
* @param v the value
* @return name value, or {@code null} if the value can not be converted
*/
private String getName(PropertyValue v) {
// TODO correctly validate JCR names - see JCR 2.0 spec 3.2.4 Naming Restrictions
switch (v.getType().tag()) {
case PropertyType.DATE:
case PropertyType.DECIMAL:
case PropertyType.DOUBLE:
case PropertyType.LONG:
case PropertyType.BOOLEAN:
return null;
}
String name = v.getValue(Type.NAME);
// Name escaping (convert _x0020_ to space)
name = ISO9075.decode(name);
// normalize paths (./name > name)
name = PropertyValues.getOakPath(name, query.getNamePathMapper());
if (name.startsWith("[") && !name.endsWith("]")) {
return null;
} else if (!JcrNameParser.validate(name)) {
return null;
}
return name;
}
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:31,代码来源:NodeNameImpl.java
示例2: getGroupNodeByName
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
/**
* Gets the Node for the specified name. If no node with the specified name exists, null is returned.
*
* @param groupName the name of the Group to return
* @return the Node with name groupName
*/
public Node getGroupNodeByName(final String groupName) {
final String escapedGroupName = Text.escapeIllegalJcr10Chars(ISO9075.encode(NodeNameCodec.encode(groupName, true)));
final String queryString = QUERY_GROUP.replace("{}", escapedGroupName);
try {
@SuppressWarnings("deprecation") final Query query = getQueryManager().createQuery(queryString, Query.SQL);
final QueryResult queryResult = query.execute();
final NodeIterator iterator = queryResult.getNodes();
if (!iterator.hasNext()) {
return null;
}
final Node node = iterator.nextNode();
return node;
} catch (RepositoryException e) {
log.error("Unable to check if group '{}' exists, returning true", groupName, e);
return null;
}
}
开发者ID:jreijn,项目名称:hippo-addon-restful-webservices,代码行数:25,代码来源:GroupsResource.java
示例3: internalRemove
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
@Override
protected void internalRemove(String key) throws MessagingException {
try {
Session session = login();
try {
String name = ISO9075.encode(Text.escapeIllegalJcrChars(key));
QueryManager manager = session.getWorkspace().getQueryManager();
Query query = manager.createQuery("/jcr:root/" + MAIL_PATH + "//element(" + name + ",james:mail)", Query.XPATH);
NodeIterator nodes = query.execute().getNodes();
if (nodes.hasNext()) {
while (nodes.hasNext()) {
nodes.nextNode().remove();
}
session.save();
logger.info("Mail " + key + " removed from repository");
} else {
logger.warn("Mail " + key + " not found");
}
} finally {
session.logout();
}
} catch (RepositoryException e) {
throw new MessagingException("Unable to remove message: " + key, e);
}
}
开发者ID:twachan,项目名称:James,代码行数:26,代码来源:JCRMailRepository.java
示例4: getEntitiesByClassNameForRange
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
public Entity[] getEntitiesByClassNameForRange(String path, String className, DateRange range)
throws NotFoundException {
// xpath xs:dateTime function has a specific format (see
// getFormattedDate)
// characters that must remain unchanged must be between '' in
// SimpleDateFormat
// SimpleDateFormat format = new
// SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
// this format does not put semicolon in time zone (
// 2012-01-04T23:59:59.999+0200 instead of
// 2012-01-04T23:59:59.999+02:00)
// so we will use getFormattedDate method instead of formatting with a
// SimpleDateFormat
checkPath(path);
StringBuilder sb = new StringBuilder();
sb.append("/jcr:root").append(ISO9075.encodePath(path)).append("//*[@className='").append(className).append("'")
.append(" and @createdDate <= xs:dateTime('").append(getFormattedDate(range.getEndDate())).append("')")
.append(" and @createdDate >= xs:dateTime('").append(getFormattedDate(range.getStartDate()))
.append("')]");
return getEntities(sb.toString());
}
开发者ID:nextreports,项目名称:nextreports-server,代码行数:23,代码来源:JcrStorageDao.java
示例5: clearUserWidgetData
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
public void clearUserWidgetData(String widgetId) {
try {
String className = "ro.nextreports.server.domain.UserWidgetParameters";
String xpath = "/jcr:root" + ISO9075.encodePath(StorageConstants.USERS_DATA_ROOT) + "//*[@className='"
+ className + "']";
NodeIterator nodes = getTemplate().query(xpath).getNodes();
while (nodes.hasNext()) {
Node node = nodes.nextNode();
if (node.getName().equals(widgetId)) {
node.remove();
}
}
getTemplate().save();
} catch (RepositoryException e) {
throw convertJcrAccessException(e);
}
}
开发者ID:nextreports,项目名称:nextreports-server,代码行数:18,代码来源:JcrStorageDao.java
示例6: modifyDashboardState
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
private void modifyDashboardState() throws RepositoryException {
LOG.info("Modify dashboard state - add columnCount property");
String path = StorageConstants.DASHBOARDS_ROOT;
String className = "ro.nextreports.server.domain.DashboardState";
String statement = "/jcr:root" + ISO9075.encodePath(path) + "//*[@className='" + className + "']";
QueryResult queryResult = getTemplate().query(statement);
NodeIterator nodes = queryResult.getNodes();
LOG.info("Found " + nodes.getSize() + " dashboard state nodes");
while (nodes.hasNext()) {
Node node = nodes.nextNode();
node.setProperty("columnCount", 2);
}
getTemplate().save();
}
开发者ID:nextreports,项目名称:nextreports-server,代码行数:18,代码来源:StorageUpdate10.java
示例7: addRuntimeNameProperty
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
private void addRuntimeNameProperty() throws RepositoryException {
String statement =
"/jcr:root" + ISO9075.encodePath(StorageConstants.REPORTS_ROOT) +
"//*[@className='ro.nextreports.server.domain.Report']" +
"//*[fn:name()='parametersValues']";
QueryResult queryResult = getTemplate().query(statement);
NodeIterator nodes = queryResult.getNodes();
LOG.info("RuntimeHistory : Found " + nodes.getSize() + " parameterValues nodes");
while (nodes.hasNext()) {
Node node = nodes.nextNode();
NodeIterator childrenIt = node.getNodes();
while (childrenIt.hasNext()) {
Node child = childrenIt.nextNode();
child.setProperty("runtimeName", child.getName());
}
}
getTemplate().save();
}
开发者ID:nextreports,项目名称:nextreports-server,代码行数:23,代码来源:StorageUpdate12.java
示例8: updateTemplateNodes
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
private void updateTemplateNodes() throws RepositoryException {
// add shortcutType node to all report templates nodes
String statement =
"/jcr:root" + ISO9075.encodePath(StorageConstants.REPORTS_ROOT) +
"//*[@className='ro.nextreports.server.domain.Report']/templates";
QueryResult queryResult = getTemplate().query(statement);
NodeIterator nodes = queryResult.getNodes();
LOG.info("Add shortcutType node to all report templates nodes : Found " + nodes.getSize() + " report nodes");
while (nodes.hasNext()) {
Node node = nodes.nextNode();
NodeIterator templatesForReport = node.getNodes();
while (templatesForReport.hasNext()) {
Node template = templatesForReport.nextNode();
Node shortcutTypeNode = template.addNode("shortcutType");
shortcutTypeNode.setProperty("type", 0);
shortcutTypeNode.setProperty("timeType", 0);
shortcutTypeNode.setProperty("timeUnits", 0);
}
}
getTemplate().save();
}
开发者ID:nextreports,项目名称:nextreports-server,代码行数:27,代码来源:StorageUpdate15.java
示例9: addAnalystUserProfile
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
private void addAnalystUserProfile() throws RepositoryException {
LOG.info("User profile analyst");
String path = StorageConstants.USERS_ROOT ;
String className = "ro.nextreports.server.domain.User";
String statement = "/jcr:root" + ISO9075.encodePath(path) + "//*[@className='" + className + "']";
QueryResult queryResult = getTemplate().query(statement);
NodeIterator nodes = queryResult.getNodes();
LOG.info("Found " + nodes.getSize() + " nodes");
while (nodes.hasNext()) {
Node node = nodes.nextNode();
node.setProperty("profile", "analyst");
}
getTemplate().save();
}
开发者ID:nextreports,项目名称:nextreports-server,代码行数:18,代码来源:StorageUpdate6.java
示例10: updateInternalSettings
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
private void updateInternalSettings() throws RepositoryException {
// find all internalSettings nodes from DASHBOARDS and change chartId property in entityId
String statement = "/jcr:root" + ISO9075.encodePath(StorageConstants.DASHBOARDS_ROOT) + "//*[fn:name()='internalSettings']";
QueryResult queryResult = getTemplate().query(statement);
NodeIterator nodes = queryResult.getNodes();
LOG.info("Found " + nodes.getSize() + " internalSettings nodes");
while (nodes.hasNext()) {
Node node = nodes.nextNode();
try {
Property prop = node.getProperty("chartId");
node.setProperty("entityId", prop.getValue());
prop.remove();
} catch (PathNotFoundException ex) {
// if property not found we have nothing to do
}
}
}
开发者ID:nextreports,项目名称:nextreports-server,代码行数:18,代码来源:StorageUpdate8.java
示例11: renameChartWidgetClassName
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
private void renameChartWidgetClassName() throws RepositoryException {
LOG.info("Rename chart widget class name");
String path = StorageConstants.DASHBOARDS_ROOT;
String className = "ro.nextreports.server.web.chart.ChartWidget";
String newClassName = "ro.nextreports.server.web.dashboard.chart.ChartWidget";
String statement = "/jcr:root" + ISO9075.encodePath(path) + "//*[@widgetClassName='" + className + "']";
QueryResult queryResult = getTemplate().query(statement);
NodeIterator nodes = queryResult.getNodes();
LOG.info("Found " + nodes.getSize() + " nodes");
while (nodes.hasNext()) {
Node node = nodes.nextNode();
node.setProperty("widgetClassName", newClassName);
}
getTemplate().save();
}
开发者ID:nextreports,项目名称:nextreports-server,代码行数:19,代码来源:StorageUpdate3.java
示例12: escapeXpath
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
public static String escapeXpath(String xpath) {
final Matcher matcher = XPATH.matcher(xpath);
if (matcher.find()) {
final String path = ISO9075.encodePath(matcher.group(1));
final String props = matcher.group(2);
return String.format("/jcr:root%s//%s", path, props);
}
return xpath;
}
开发者ID:cheetah100,项目名称:gravity,代码行数:10,代码来源:IdentifierTools.java
示例13: searchAces
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
@Nonnull
private static Result searchAces(@Nonnull Set<Principal> principals, @Nonnull Root root) throws RepositoryException {
StringBuilder stmt = new StringBuilder("/jcr:root");
stmt.append("//element(*,");
stmt.append(NT_REP_ACE);
stmt.append(")[");
int i = 0;
for (Principal principal : principals) {
if (i > 0) {
stmt.append(" or ");
}
stmt.append('@');
stmt.append(ISO9075.encode(REP_PRINCIPAL_NAME));
stmt.append("='");
stmt.append(principal.getName().replaceAll("'", "''"));
stmt.append('\'');
i++;
}
stmt.append(']');
stmt.append(" order by jcr:path");
try {
QueryEngine queryEngine = root.getQueryEngine();
return queryEngine.executeQuery(
stmt.toString(), Query.XPATH, Long.MAX_VALUE, 0,
QueryEngine.NO_BINDINGS, QueryEngine.NO_MAPPINGS);
} catch (ParseException e) {
String msg = "Error while collecting effective policies.";
log.error(msg, e.getMessage());
throw new RepositoryException(msg, e);
}
}
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:33,代码来源:AccessControlManagerImpl.java
示例14: getUserNodeByName
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
private Node getUserNodeByName(final String username) throws RepositoryException {
Node userNode = null;
final String queryString = QUERY_USER.replace("{}", Text.escapeIllegalJcr10Chars(ISO9075.encode(NodeNameCodec.encode(username))));
final Query query = getQueryManager().createQuery(queryString, Query.SQL);
final NodeIterator nodes = query.execute().getNodes();
if (nodes.hasNext()) {
userNode = nodes.nextNode();
}
return userNode;
}
开发者ID:jreijn,项目名称:hippo-addon-restful-webservices,代码行数:11,代码来源:UsersResource.java
示例15: userExists
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
/**
* Checks if the user with username exists.
*
* @param username the name of the user to check
* @return true if the user exists, false otherwise
*/
public boolean userExists(final String username) {
final String queryString = QUERY_USER.replace("{}", Text.escapeIllegalJcr10Chars(ISO9075.encode(NodeNameCodec.encode(username))));
try {
final Query query = getQueryManager().createQuery(queryString, Query.SQL);
return query.execute().getNodes().hasNext();
} catch (RepositoryException e) {
log.error("Unable to check if user '{}' exists, returning true", username, e);
return true;
}
}
开发者ID:jreijn,项目名称:hippo-addon-restful-webservices,代码行数:17,代码来源:UsersResource.java
示例16: renamePackage
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
private void renamePackage(String path, String propertyName) throws RepositoryException {
String statement = "/jcr:root" + ISO9075.encodePath(path) + "//*[@" + propertyName + "]";
QueryResult queryResult = getTemplate().query(statement);
NodeIterator nodes = queryResult.getNodes();
LOG.info("Found " + nodes.getSize() + " entity nodes with property '" + propertyName + "'");
while (nodes.hasNext()) {
renamePackage(nodes.nextNode(), propertyName);
}
}
开发者ID:nextreports,项目名称:nextreports-server,代码行数:11,代码来源:StorageUpdate20.java
示例17: convertReports
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
private void convertReports() throws RepositoryException {
String statement =
"/jcr:root" + ISO9075.encodePath(StorageConstants.REPORTS_ROOT) +
"//*[@className='ro.nextreports.server.domain.Report' and @type='Next']" +
"//*[fn:name()='jcr:content' and @jcr:mimeType='text/xml']";
QueryResult queryResult = getTemplate().query(statement);
NodeIterator nodes = queryResult.getNodes();
LOG.info("Converter 5.1 : Found " + nodes.getSize() + " report nodes");
while (nodes.hasNext()) {
Node node = nodes.nextNode();
Node reportNode = node.getParent().getParent().getParent().getParent();
String reportName = reportNode.getName();
String reportPath = reportNode.getPath();
LOG.info(" * Start convert '" + reportPath + "'");
Property prop = node.getProperty("jcr:data");
String xml = null;
try {
xml = new Converter_5_2().convertFromInputStream(prop.getBinary().getStream(), true);
if (xml != null) {
ValueFactory valueFactory = node.getSession().getValueFactory();
Binary binaryValue = valueFactory.createBinary(new ByteArrayInputStream(xml.getBytes("UTF-8")));
node.setProperty ("jcr:data", binaryValue);
LOG.info("\t -> OK");
} else {
LOG.error("\t -> FAILED : null xml");
}
} catch (Throwable t) {
LOG.error("\t-> FAILED : " + t.getMessage(), t);
}
}
}
开发者ID:nextreports,项目名称:nextreports-server,代码行数:40,代码来源:StorageUpdate11.java
示例18: resetFirstUsageDates
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
private void resetFirstUsageDates() throws Exception {
LOG.info("Reset firstUsage.date for all users");
String statement = "/jcr:root"
+ ISO9075.encodePath(StorageConstants.USERS_ROOT)
+ "//*[@className='ro.nextreports.server.domain.UserPreferences']";
QueryResult queryResult = jcrTemplate.query(statement);
NodeIterator nodes = queryResult.getNodes();
LOG.info("Found " + nodes.getSize() + " user preferences nodes");
while (nodes.hasNext()) {
Node node = nodes.nextNode();
Node pNode = node.getNode("preferences");
try {
Property property = pNode.getProperty("firstUsage.date");
if (property.getValue() != null) {
LOG.info(" removed firstUsage.date = " + property.getString() + " for user " + node.getParent().getName());
String s = null;
pNode.setProperty("firstUsage.date", s);
}
} catch (PathNotFoundException ex) {
// nothing to do
}
}
jcrTemplate.save();
}
开发者ID:nextreports,项目名称:nextreports-server,代码行数:28,代码来源:StorageUpdater.java
示例19: addDestinations
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
private void addDestinations() throws RepositoryException {
LOG.info("Add destinations to scheduler jobs");
String path = StorageConstants.SCHEDULER_ROOT ;
String className = "ro.nextreports.server.domain.SchedulerJob";
String statement = "/jcr:root" + ISO9075.encodePath(path) + "//*[@className='" + className + "']";
QueryResult queryResult = getTemplate().query(statement);
NodeIterator nodes = queryResult.getNodes();
LOG.info("Found " + nodes.getSize() + " scheduler job nodes");
while (nodes.hasNext()) {
Node node = nodes.nextNode();
if (node.hasNode("mail")) {
LOG.info("Found 'mail' node for '" + node.getName() + "'");
Node mailNode = node.getNode("mail");
LOG.info("Create '" + StorageConstants.DESTINATIONS + "' node for '" + node.getName() + "'");
Node destinationsNode = node.addNode(StorageConstants.DESTINATIONS);
className = SmtpDestination.class.getName();
LOG.info("Change 'className' property for 'mail' node to '" + className + "'");
mailNode.setProperty("className", className);
LOG.info("Move '" + mailNode.getName() + "' to '" + destinationsNode.getName() + "/mail");
getTemplate().move(mailNode.getPath(), destinationsNode.getPath() + "/mail");
}
}
getTemplate().save();
}
开发者ID:nextreports,项目名称:nextreports-server,代码行数:28,代码来源:StorageUpdate7.java
示例20: onUpdate
import org.apache.jackrabbit.util.ISO9075; //导入依赖的package包/类
private void onUpdate() throws RepositoryException {
String statement = "/jcr:root" + ISO9075.encodePath(StorageConstants.DATASOURCES_ROOT) + "//*[@className='ro.nextreports.server.domain.DataSource']";
QueryResult queryResult = getTemplate().query(statement);
NodeIterator nodes = queryResult.getNodes();
LOG.info("Found " + nodes.getSize() + " data sources nodes");
while (nodes.hasNext()) {
Node node = nodes.nextNode();
Node propertiesNode = node.addNode(StorageConstants.PROPERTIES);
}
getTemplate().save();
}
开发者ID:nextreports,项目名称:nextreports-server,代码行数:15,代码来源:StorageUpdate18.java
注:本文中的org.apache.jackrabbit.util.ISO9075类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论