当前位置: 首页>>代码示例>>Java>>正文


Java ConstraintViolationException类代码示例

本文整理汇总了Java中javax.jcr.nodetype.ConstraintViolationException的典型用法代码示例。如果您正苦于以下问题:Java ConstraintViolationException类的具体用法?Java ConstraintViolationException怎么用?Java ConstraintViolationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ConstraintViolationException类属于javax.jcr.nodetype包,在下文中一共展示了ConstraintViolationException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeProperty

import javax.jcr.nodetype.ConstraintViolationException; //导入依赖的package包/类
/**
 * @see org.apache.jackrabbit.api.security.user.Authorizable#removeProperty(String)
 */
@Override
public boolean removeProperty(String relPath) throws RepositoryException {
    String oakPath = getOakPath(relPath);
    Tree node = getTree();
    TreeLocation propertyLocation = getLocation(node, oakPath);
    if (propertyLocation.getProperty() != null) {
        if (isAuthorizableProperty(node, propertyLocation, true)) {
            return propertyLocation.remove();
        } else {
            throw new ConstraintViolationException("Property " + relPath + " isn't a modifiable authorizable property");
        }
    }
    // no such property or wasn't a property of this authorizable.
    return false;
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:19,代码来源:AuthorizablePropertiesImpl.java

示例2: endChildInfo

import javax.jcr.nodetype.ConstraintViolationException; //导入依赖的package包/类
@Override
public void endChildInfo() throws RepositoryException {
    checkInitialized();
    switch (childStatus) {
        case CHILD_STATUS_ACE:
            // write the ace to the policy
            entry.applyTo(acl);
            entry = null;
            childStatus = CHILD_STATUS_UNDEFINED;
            break;
        case CHILD_STATUS_RESTRICTION:
            // back to ace status
            childStatus = CHILD_STATUS_ACE;
            break;
        default:
            throw new ConstraintViolationException("Invalid child node sequence.");
    }
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:19,代码来源:AccessControlImporter.java

示例3: setProperty

import javax.jcr.nodetype.ConstraintViolationException; //导入依赖的package包/类
public Property setProperty(String s, InputStream inputStream) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    RegistryJCRItemOperationUtil.checkRetentionPolicy(registrySession,getPath());
    RegistryJCRItemOperationUtil.checkRetentionHold(registrySession, getPath());

    registrySession.sessionPending();
    validatePropertyModifyPrivilege(s);

    Resource res = null;
    try {
        res = registrySession.getUserRegistry().newResource();
        if (inputStream != null) {
            res.setContentStream(inputStream);
            res.setProperty("registry.jcr.property.type", "input_stream");
            registrySession.getUserRegistry().put(nodePath + "/" + s, res);
            property = new RegistryProperty(nodePath + "/" + s, registrySession, s,inputStream);
        }
    } catch (RegistryException e) {
        String msg = "failed to resolve the path of the given node or violation of repository syntax " + this;
        log.debug(msg);
        throw new RepositoryException(msg, e);
    }

    isModified = true;
    return property;
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:26,代码来源:RegistryNode.java

示例4: checkSetProperty

import javax.jcr.nodetype.ConstraintViolationException; //导入依赖的package包/类
public void checkSetProperty(PropertyState property) throws RepositoryException {
    PropertyDefinition definition = getDefinition(property);
    if (definition.isProtected()) {
        return;
    }

    NodeType nt = definition.getDeclaringNodeType();
    if (definition.isMultiple()) {
        List<Value> values = ValueFactoryImpl.createValues(property, ntMgr.getNamePathMapper());
        if (!nt.canSetProperty(property.getName(), values.toArray(new Value[values.size()]))) {
            throw new ConstraintViolationException("Cannot set property '" + property.getName() + "' to '" + values + '\'');
        }
    } else {
        Value v = ValueFactoryImpl.createValue(property, ntMgr.getNamePathMapper());
        if (!nt.canSetProperty(property.getName(), v)) {
            throw new ConstraintViolationException("Cannot set property '" + property.getName() + "' to '" + v + '\'');
        }
    }
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:20,代码来源:EffectiveNodeType.java

示例5: removeItem

import javax.jcr.nodetype.ConstraintViolationException; //导入依赖的package包/类
public void removeItem(String s) throws VersionException, LockException, ConstraintViolationException,
        AccessDeniedException, RepositoryException {

    try {

        if (userRegistry.resourceExists(s)) {
            userRegistry.delete(s);
        } else {
            throw new PathNotFoundException("No such path exists" + s);
        }

    } catch (RegistryException e) {
        e.printStackTrace();

    }

}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:18,代码来源:RegistrySession.java

示例6: setPrimaryType

import javax.jcr.nodetype.ConstraintViolationException; //导入依赖的package包/类
public void setPrimaryType(String s) throws NoSuchNodeTypeException, VersionException, ConstraintViolationException, LockException, RepositoryException {

        // Check if node type already exists
        registrySession.getWorkspace().getNodeTypeManager().getNodeType(s);

//        if(s!= null && s.startsWith("mix")) {
//         throw  new ConstraintViolationException("Cannpot set mixin as primary types");
//        }
        try {

            Resource resource = registrySession.getUserRegistry().get(nodePath);
            resource.setProperty("jcr:primaryType", s);
            registrySession.getUserRegistry().put(nodePath, resource);

        } catch (RegistryException e) {
            String msg = "failed to resolve the path of the given node or violation of repository syntax " + this;
            log.debug(msg);
            throw new RepositoryException(msg, e);
        }


    }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:23,代码来源:RegistryNode.java

示例7: removeMixin

import javax.jcr.nodetype.ConstraintViolationException; //导入依赖的package包/类
public void removeMixin(String s) throws NoSuchNodeTypeException, VersionException, ConstraintViolationException, LockException, RepositoryException {
    RegistryJCRItemOperationUtil.checkRetentionHold(registrySession, getPath());

    try {
        Resource resource = registrySession.getUserRegistry().get(nodePath);
        if (resource.getPropertyValues("jcr:mixinTypes").contains(s)) {
            resource.getPropertyValues("jcr:mixinTypes").remove(s);
        } else {
            throw new NoSuchNodeTypeException("No such mix node type to remove");
        }
        registrySession.getUserRegistry().put(nodePath, resource);

    } catch (RegistryException e) {
        String msg = "failed to resolve the path of the given node or violation of repository syntax " + this;
        log.debug(msg);
        throw new RepositoryException(msg, e);
    }
   isModified = true;
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:20,代码来源:RegistryNode.java

示例8: remove

import javax.jcr.nodetype.ConstraintViolationException; //导入依赖的package包/类
public void remove() throws VersionException, LockException, ConstraintViolationException, AccessDeniedException, RepositoryException {
    RegistryJCRItemOperationUtil.validateReadOnlyItemOpr(session);
    RegistryJCRItemOperationUtil.checkRetentionPolicy(session, getNodePath());
    RegistryJCRItemOperationUtil.checkRetentionHold(session, getNodePath());

    try {
        if (isResource) {
            session.getUserRegistry().delete(path);
        } else {
            Resource node = session.getUserRegistry().get(path);
            node.removeProperty(name);
            session.getUserRegistry().put(path, node);
        }
    } catch (RegistryException e) {
        String msg = "failed to remove the property " + this;
        log.debug(msg);
        throw new RepositoryException(msg, e);
    }

}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:21,代码来源:RegistryProperty.java

示例9: setRequiredPrimaryTypeNames

import javax.jcr.nodetype.ConstraintViolationException; //导入依赖的package包/类
public void setRequiredPrimaryTypeNames(String[] strings) throws ConstraintViolationException {

        if (strings == null) {
            throw new ConstraintViolationException("Null is not a valid JCR name");
        }
        for (int i = 0; i < strings.length; i++) {
            if (!RegistryJCRSpecificStandardLoderUtil.isValidJCRName(strings[i])) {
                throw new ConstraintViolationException("Invalid JCR super type type name");
            }

            if (strings[i].contains("{")) {
                strings[i] = RegistryJCRItemOperationUtil.replaceNameSpacePrefixURIS(strings[i]);
            }
        }
        this.reqPrimTypeNames = Arrays.copyOf(strings, strings.length);
    }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:17,代码来源:RegistryNodeDefinitionTemplate.java

示例10: setAction

import javax.jcr.nodetype.ConstraintViolationException; //导入依赖的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();
    }
}
 
开发者ID:rah003,项目名称:neat-tweaks,代码行数:11,代码来源:SaveDialogFormAction.java

示例11: addNode

import javax.jcr.nodetype.ConstraintViolationException; //导入依赖的package包/类
@Override
public Node addNode(String relPath, String primaryNodeTypeName) throws ItemExistsException, PathNotFoundException, NoSuchNodeTypeException, LockException, VersionException, ConstraintViolationException, RepositoryException {
    Node node = new NodeImpl(session, Paths.resolve(getPath(), relPath));
    node.setPrimaryType(primaryNodeTypeName);
    session.changeItem(this);
    return node;
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:8,代码来源:NodeImpl.java

示例12: setProperty

import javax.jcr.nodetype.ConstraintViolationException; //导入依赖的package包/类
@Override
public Property setProperty(String name, Value value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    if (value == null) {
        if (hasProperty(name))
            getProperty(name).remove();
        return null;
    }
    PropertyImpl property = getOrCreateProperty(name);
    property.setValue(value);
    session.changeItem(this);
    return property;
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:13,代码来源:NodeImpl.java

示例13: PropertyImpl

import javax.jcr.nodetype.ConstraintViolationException; //导入依赖的package包/类
public PropertyImpl(@Nonnull SessionImpl session, @Nonnull String path, @Nonnull String[] values) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    this(session, path);
    List<Value> stringValues = new ArrayList<>(values.length);
    for (String value : values)
        stringValues.add(new ValueImpl(value));
    setValue(stringValues.toArray(new Value[stringValues.size()]));
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:8,代码来源:PropertyImpl.java

示例14: setValue

import javax.jcr.nodetype.ConstraintViolationException; //导入依赖的package包/类
@Override
public void setValue(@Nonnull String[] values) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    List<Value> valueList = new ArrayList<>(values.length);
    for (String value : values)
        valueList.add(new ValueImpl(value));
    setValue(valueList.toArray(new Value[valueList.size()]));
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:8,代码来源:PropertyImpl.java

示例15: handleFailure

import javax.jcr.nodetype.ConstraintViolationException; //导入依赖的package包/类
/**
 * Handling the import behavior
 *
 * @param msg The message to log a warning in case of {@link ImportBehavior#IGNORE}
 *            or {@link ImportBehavior#BESTEFFORT}
 * @throws javax.jcr.nodetype.ConstraintViolationException
 *          If the import
 *          behavior is {@link ImportBehavior#ABORT}.
 */
private void handleFailure(String msg) throws ConstraintViolationException {
    switch (importBehavior) {
        case ImportBehavior.IGNORE:
        case ImportBehavior.BESTEFFORT:
            log.warn(msg);
            break;
        case ImportBehavior.ABORT:
            throw new ConstraintViolationException(msg);
        default:
            // no other behavior. nothing to do.

    }
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:23,代码来源:UserImporter.java


注:本文中的javax.jcr.nodetype.ConstraintViolationException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。