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


Java Updatability.READONLY属性代码示例

本文整理汇总了Java中org.apache.chemistry.opencmis.commons.enums.Updatability.READONLY属性的典型用法代码示例。如果您正苦于以下问题:Java Updatability.READONLY属性的具体用法?Java Updatability.READONLY怎么用?Java Updatability.READONLY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.chemistry.opencmis.commons.enums.Updatability的用法示例。


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

示例1: isUpdatable

/**
 * Verify if a property is updatable.
 * @param updatability
 * @param isOnWorkingCopy
 * @return
 */
private boolean isUpdatable(Updatability updatability, Boolean isOnWorkingCopy)
{
    if ((updatability == Updatability.READONLY)
            || (updatability == Updatability.WHENCHECKEDOUT && !isOnWorkingCopy))
    {
        return false;
    }
    else
    {
        return true;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:CMISConnector.java

示例2: checkTypeProperties

/**
 * Checks if the property belong to the type and are settable.
 */
private void checkTypeProperties(Properties properties, String typeId, boolean isCreate) {
    // check type
    TypeDefinition type = typeManager.getInternalTypeDefinition(typeId);
    if (type == null) {
        throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!");
    }

    // check if all required properties are there
    for (PropertyData<?> prop : properties.getProperties().values()) {
        PropertyDefinition<?> propType = type.getPropertyDefinitions().get(prop.getId());

        // do we know that property?
        if (propType == null) {
            throw new CmisConstraintException("Property '" + prop.getId() + "' is unknown!");
        }

        // can it be set?
        if (propType.getUpdatability() == Updatability.READONLY) {
            throw new CmisConstraintException("Property '" + prop.getId() + "' is readonly!");
        }

        if (!isCreate) {
            // can it be set?
            if (propType.getUpdatability() == Updatability.ONCREATE) {
                throw new CmisConstraintException("Property '" + prop.getId() + "' cannot be updated!");
            }
        }
    }
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:32,代码来源:FileBridgeRepository.java

示例3: checkTypeProperties

/**
 * Checks if the property belong to the type and are settable.
 */
private void checkTypeProperties(Properties properties, String typeId,
		boolean isCreate) {
	// check type
	TypeDefinition type = typeManager.getInternalTypeDefinition(typeId);
	if (type == null) {
		throw new CmisObjectNotFoundException("Type '" + typeId
				+ "' is unknown!");
	}

	// check if all required properties are there
	for (PropertyData<?> prop : properties.getProperties().values()) {
		PropertyDefinition<?> propType = type.getPropertyDefinitions().get(
				prop.getId());

		// do we know that property?
		if (propType == null) {
			throw new CmisConstraintException("Property '" + prop.getId()
					+ "' is unknown!");
		}

		// can it be set?
		if (propType.getUpdatability() == Updatability.READONLY) {
			throw new CmisConstraintException("Property '" + prop.getId()
					+ "' is readonly!");
		}

		if (!isCreate) {
			// can it be set?
			if (propType.getUpdatability() == Updatability.ONCREATE) {
				throw new CmisConstraintException("Property '"
						+ prop.getId() + "' cannot be updated!");
			}
		}
	}
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuide,代码行数:38,代码来源:FileBridgeRepository.java

示例4: checkNewProperties

/**
 * Checks a property set for a new object.
 */
private void checkNewProperties(Properties properties, BaseTypeId baseTypeId) {
    // check properties
    if (properties == null || properties.getProperties() == null) {
        throw new CmisInvalidArgumentException("Properties must be set!");
    }

    // check the name
    String name = FileBridgeUtils.getStringProperty(properties, PropertyIds.NAME);
    if (!isValidName(name)) {
        throw new CmisNameConstraintViolationException("Name is not valid!");
    }

    // check the type
    String typeId = FileBridgeUtils.getObjectTypeId(properties);
    if (typeId == null) {
        throw new CmisInvalidArgumentException("Type Id is not set!");
    }

    TypeDefinition type = typeManager.getInternalTypeDefinition(typeId);
    if (type == null) {
        throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!");
    }

    if (type.getBaseTypeId() != baseTypeId) {
        if (baseTypeId == BaseTypeId.CMIS_DOCUMENT) {
            throw new CmisInvalidArgumentException("Type is not a document type!");
        } else if (baseTypeId == BaseTypeId.CMIS_DOCUMENT) {
            throw new CmisInvalidArgumentException("Type is not a folder type!");
        } else {
            throw new CmisRuntimeException("A file system does not support a " + baseTypeId.value() + " type!");
        }
    }

    // check type properties
    checkTypeProperties(properties, typeId, true);

    // check if required properties are missing
    for (PropertyDefinition<?> propDef : type.getPropertyDefinitions().values()) {
        if (propDef.isRequired() && !properties.getProperties().containsKey(propDef.getId())
                && propDef.getUpdatability() != Updatability.READONLY) {
            throw new CmisConstraintException("Property '" + propDef.getId() + "' is required!");
        }
    }
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:47,代码来源:FileBridgeRepository.java

示例5: checkCopyProperties

/**
 * Checks a property set for a copied document.
 */
private void checkCopyProperties(Properties properties, String sourceTypeId) {
    // check properties
    if (properties == null || properties.getProperties() == null) {
        return;
    }

    String typeId = sourceTypeId;

    // check the name
    String name = FileBridgeUtils.getStringProperty(properties, PropertyIds.NAME);
    if (name != null) {
        if (!isValidName(name)) {
            throw new CmisNameConstraintViolationException("Name is not valid!");
        }
    }

    // check the type
    typeId = FileBridgeUtils.getObjectTypeId(properties);
    if (typeId == null) {
        typeId = sourceTypeId;
    }

    TypeDefinition type = typeManager.getInternalTypeDefinition(typeId);
    if (type == null) {
        throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!");
    }

    if (type.getBaseTypeId() != BaseTypeId.CMIS_DOCUMENT) {
        throw new CmisInvalidArgumentException("Target type must be a document type!");
    }

    // check type properties
    checkTypeProperties(properties, typeId, true);

    // check if required properties are missing
    for (PropertyDefinition<?> propDef : type.getPropertyDefinitions().values()) {
        if (propDef.isRequired() && !properties.getProperties().containsKey(propDef.getId())
                && propDef.getUpdatability() != Updatability.READONLY) {
            throw new CmisConstraintException("Property '" + propDef.getId() + "' is required!");
        }
    }
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:45,代码来源:FileBridgeRepository.java

示例6: create

public static PropertyUpdater create(RegistryTypeManager typeManager, String typeId, Properties properties) {
    if (properties == null) {
        throw new CmisConstraintException("No properties!");
    }

    // get the property definitions
    TypeDefinition type = typeManager.getType(typeId);
    if (type == null) {
        throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!");
    }

    PropertyUpdater propertyUpdater = new PropertyUpdater();
    // update properties
    for (PropertyData<?> prop : properties.getProperties().values()) {
        PropertyDefinition<?> propDef = type.getPropertyDefinitions().get(prop.getId());

        // do we know that property?
        if (propDef == null) {
            throw new CmisInvalidArgumentException("Property '" + prop.getId() + "' is unknown!");
        }

        // skip content stream file name
        if (propDef.getId().equals(PropertyIds.CONTENT_STREAM_FILE_NAME)) {
            log.warn("Cannot set " + PropertyIds.CONTENT_STREAM_FILE_NAME + ". Ignoring");
            continue;
        }

        // silently skip name
        if (propDef.getId().equals(PropertyIds.NAME)) {
            continue;
        }

        // can it be set?
        if (propDef.getUpdatability() == Updatability.READONLY) {
            throw new CmisConstraintException("Property '" + prop.getId() + "' is readonly!");
        }

        if (propDef.getUpdatability() == Updatability.ONCREATE) {
            throw new CmisConstraintException("Property '" + prop.getId() + "' can only be set on create!");
        }

        // default or value
        PropertyData<?> newProp;
        newProp = PropertyHelper.isPropertyEmpty(prop)
                ? PropertyHelper.getDefaultValue(propDef)
                : prop;

        // Schedule for remove or update
        if (newProp == null) {
            propertyUpdater.removeProperties.add(prop);
        } else {
            propertyUpdater.updateProperties.add(newProp);
        }
    }

    return propertyUpdater;
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:57,代码来源:RegistryObject.java

示例7: checkNewProperties

/**
 * Checks a property set for a new object.
 */
private void checkNewProperties(Properties properties) {
	// check properties
	if (properties == null || properties.getProperties() == null) {
		throw new CmisInvalidArgumentException("Properties must be set!");
	}

	// check the name
	String name = FileBridgeUtils.getStringProperty(properties,
			PropertyIds.NAME);
	if (!isValidName(name)) {
		throw new CmisNameConstraintViolationException("Name is not valid!");
	}

	// check the type
	String typeId = FileBridgeUtils.getObjectTypeId(properties);
	if (typeId == null) {
		throw new CmisNameConstraintViolationException(
				"Type Id is not set!");
	}

	TypeDefinition type = typeManager.getInternalTypeDefinition(typeId);
	if (type == null) {
		throw new CmisObjectNotFoundException("Type '" + typeId
				+ "' is unknown!");
	}

	// check type properties
	checkTypeProperties(properties, typeId, true);

	// check if required properties are missing
	for (PropertyDefinition<?> propDef : type.getPropertyDefinitions()
			.values()) {
		if (propDef.isRequired()
				&& !properties.getProperties().containsKey(propDef.getId())
				&& propDef.getUpdatability() != Updatability.READONLY) {
			throw new CmisConstraintException("Property '"
					+ propDef.getId() + "' is required!");
		}
	}
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuide,代码行数:43,代码来源:FileBridgeRepository.java

示例8: checkCopyProperties

/**
 * Checks a property set for a copied document.
 */
private void checkCopyProperties(Properties properties, String sourceTypeId) {
	// check properties
	if (properties == null || properties.getProperties() == null) {
		return;
	}

	String typeId = sourceTypeId;

	// check the name
	String name = FileBridgeUtils.getStringProperty(properties,
			PropertyIds.NAME);
	if (name != null) {
		if (!isValidName(name)) {
			throw new CmisNameConstraintViolationException(
					"Name is not valid!");
		}
	}

	// check the type
	typeId = FileBridgeUtils.getObjectTypeId(properties);
	if (typeId == null) {
		typeId = sourceTypeId;
	}

	TypeDefinition type = typeManager.getInternalTypeDefinition(typeId);
	if (type == null) {
		throw new CmisObjectNotFoundException("Type '" + typeId
				+ "' is unknown!");
	}

	if (type.getBaseTypeId() != BaseTypeId.CMIS_DOCUMENT) {
		throw new CmisInvalidArgumentException(
				"Target type must be a document type!");
	}

	// check type properties
	checkTypeProperties(properties, typeId, true);

	// check if required properties are missing
	for (PropertyDefinition<?> propDef : type.getPropertyDefinitions()
			.values()) {
		if (propDef.isRequired()
				&& !properties.getProperties().containsKey(propDef.getId())
				&& propDef.getUpdatability() != Updatability.READONLY) {
			throw new CmisConstraintException("Property '"
					+ propDef.getId() + "' is required!");
		}
	}
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuide,代码行数:52,代码来源:FileBridgeRepository.java


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