use of org.apache.jackrabbit.spi.commons.conversion.NameException in project jackrabbit by apache.
the class VersionHistoryImpl method getVersionByLabel.
/**
* @see javax.jcr.version.VersionHistory#getVersionByLabel(String)
*/
public javax.jcr.version.Version getVersionByLabel(String label) throws RepositoryException {
try {
Name qLabel = sessionContext.getQName(label);
InternalVersion v = getInternalVersionHistory().getVersionByLabel(qLabel);
if (v == null) {
throw new VersionException("No version with label '" + label + "' exists in this version history.");
}
return (Version) sessionContext.getSessionImpl().getNodeById(v.getId());
} catch (NameException e) {
throw new VersionException(e);
}
}
use of org.apache.jackrabbit.spi.commons.conversion.NameException in project jackrabbit by apache.
the class VersionHistoryImpl method removeVersionLabel.
/**
* @see javax.jcr.version.VersionHistory#removeVersionLabel(String)
*/
public void removeVersionLabel(String label) throws RepositoryException {
try {
// check permissions
checkVersionManagementPermission();
InternalVersion existing = sessionContext.getSessionImpl().getInternalVersionManager().setVersionLabel(getSession(), getInternalVersionHistory(), null, sessionContext.getQName(label), true);
if (existing == null) {
throw new VersionException("No version with label '" + label + "' exists in this version history.");
}
} catch (NameException e) {
throw new VersionException(e);
}
}
use of org.apache.jackrabbit.spi.commons.conversion.NameException in project jackrabbit by apache.
the class VersionHistoryImpl method getVersion.
/**
* @see javax.jcr.version.VersionHistory#getVersion(String)
*/
public javax.jcr.version.Version getVersion(String versionName) throws VersionException, RepositoryException {
try {
Name name = sessionContext.getQName(versionName);
InternalVersion v = getInternalVersionHistory().getVersion(name);
if (v == null) {
throw new VersionException("No version with name '" + versionName + "' exists in this version history.");
}
return (Version) sessionContext.getSessionImpl().getNodeById(v.getId());
} catch (NameException e) {
throw new VersionException(e);
}
}
use of org.apache.jackrabbit.spi.commons.conversion.NameException in project jackrabbit by apache.
the class VersionHistoryImpl method addVersionLabel.
/**
* @see javax.jcr.version.VersionHistory#addVersionLabel(String, String, boolean)
*/
public void addVersionLabel(String versionName, String label, boolean move) throws VersionException, RepositoryException {
try {
// check permissions
checkVersionManagementPermission();
sessionContext.getSessionImpl().getInternalVersionManager().setVersionLabel(getSession(), getInternalVersionHistory(), sessionContext.getQName(versionName), sessionContext.getQName(label), move);
} catch (NameException e) {
throw new VersionException(e);
}
}
use of org.apache.jackrabbit.spi.commons.conversion.NameException in project jackrabbit by apache.
the class ObservationManagerImpl method createEventFilter.
/**
* Creates a new event filter with the given restrictions.
*
* @param eventTypes A combination of one or more event type constants encoded as a bitmask.
* @param absPaths absolute paths.
* @param isDeep a <code>boolean</code>.
* @param uuid array of UUIDs.
* @param nodeTypeName array of node type names.
* @param noLocal a <code>boolean</code>.
* @param noExternal a <code>boolean</code>.
* @param noInternal a <code>boolean</code>.
* @return the event filter with the given restrictions.
* @throws RepositoryException if an error occurs.
*/
public EventFilter createEventFilter(int eventTypes, List<String> absPaths, boolean isDeep, String[] uuid, String[] nodeTypeName, boolean noLocal, boolean noExternal, boolean noInternal) throws RepositoryException {
// create NodeType instances from names
NodeTypeImpl[] nodeTypes;
if (nodeTypeName == null) {
nodeTypes = null;
} else {
NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
nodeTypes = new NodeTypeImpl[nodeTypeName.length];
for (int i = 0; i < nodeTypes.length; i++) {
nodeTypes[i] = (NodeTypeImpl) ntMgr.getNodeType(nodeTypeName[i]);
}
}
List<Path> paths = new ArrayList<Path>();
for (String absPath : absPaths) {
try {
Path normalizedPath = session.getQPath(absPath).getNormalizedPath();
if (!normalizedPath.isAbsolute()) {
throw new RepositoryException("absPath must be absolute");
}
paths.add(normalizedPath);
} catch (NameException e) {
String msg = "invalid path syntax: " + absPath;
log.debug(msg);
throw new RepositoryException(msg, e);
}
}
NodeId[] ids = null;
if (uuid != null) {
ids = new NodeId[uuid.length];
for (int i = 0; i < uuid.length; i++) {
ids[i] = NodeId.valueOf(uuid[i]);
}
}
// create filter
return new EventFilter(session, eventTypes, paths, isDeep, ids, nodeTypes, noLocal, noExternal, noInternal);
}
Aggregations