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


Java PropertyDefinition类代码示例

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


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

示例1: updateProperty

import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition; //导入依赖的package包/类
public void updateProperty(DictionaryService dictionaryService, PropertyDefinitionWrapper propertyDefWrap)
{
    if (propertyDefWrap != null && propertyDefWrap.getPropertyDefinition().getDisplayName() == null)
    {
        AbstractPropertyDefinition<?> property = (AbstractPropertyDefinition<?>) propertyDefWrap.getPropertyDefinition();
        org.alfresco.service.cmr.dictionary.PropertyDefinition propDef = dictionaryService
                .getProperty(QName.createQName(property.getLocalNamespace(), property.getLocalName()));
        if (propDef != null)
        {
            String displayName = propDef.getTitle(dictionaryService);
            String description = propDef.getDescription(dictionaryService);
            property.setDisplayName(displayName == null ? property.getId() : displayName);
            property.setDescription(description == null ? property.getDisplayName() : description);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:17,代码来源:AbstractTypeDefinitionWrapper.java

示例2: getAssocProperties

import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition; //导入依赖的package包/类
public Properties getAssocProperties(CMISNodeInfo info, String filter)
{
    PropertiesImpl result = new PropertiesImpl();

    Set<String> filterSet = splitFilter(filter);

    for (PropertyDefinitionWrapper propDefWrap : info.getType().getProperties())
    {
        PropertyDefinition<?> propDef = propDefWrap.getPropertyDefinition();
        if ((filterSet != null) && (!filterSet.contains(propDef.getQueryName())))
        {
            // skip properties that are not in the filter
            continue;
        }

        CMISPropertyAccessor cmisPropertyAccessor = propDefWrap.getPropertyAccessor();
        Serializable value = cmisPropertyAccessor.getValue(info);
        PropertyType propType = propDef.getPropertyType();
        PropertyData<?> propertyData = getProperty(propType, propDefWrap, value);
        result.addProperty(propertyData);
    }

    return result;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:CMISConnector.java

示例3: writeCommonProperties

import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition; //导入依赖的package包/类
protected final void writeCommonProperties(PropertyDefinition<?> value, JsonGenerator gen,
        SerializerProvider serializers)
        throws IOException {

	gen.writeStringField("name", value.getId());
	gen.writeStringField("queryName", value.getQueryName());
	gen.writeStringField("propertyType", getPropertyType(value.getPropertyType()));

	gen.writeFieldName("defaultValue");
	List<?> lListDefaults = value.getDefaultValue();
	gen.writeObject(lListDefaults.isEmpty() ? null : lListDefaults.get(0));

	gen.writeArrayFieldStart("choices");
	writeChoices(gen, value);
	gen.writeEndArray();

	gen.writeStringField("displayName", value.getDisplayName());
	gen.writeStringField("description", value.getDescription());
	gen.writeBooleanField("required", value.isRequired());
	gen.writeBooleanField("queryable", value.isQueryable());
	
	gen.writeStringField("cardinality", (value.getCardinality() == null)? null : value.getCardinality().value());
}
 
开发者ID:MakeITBologna,项目名称:zefiro,代码行数:24,代码来源:PropertyDefinitionSerializer.java

示例4: EditorType

import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition; //导入依赖的package包/类
public EditorType(TypeDefinition typeDefinition) {
  this.idAndQueryName = typeDefinition.getId();
  this.description = typeDefinition.getDescription();
  this.displayAndLocalName = typeDefinition.getLocalName();
  this.parentId = typeDefinition.getParentTypeId();
  this.baseId = typeDefinition.getBaseTypeId().value();

  if (typeDefinition.getPropertyDefinitions() != null) {
    for (Entry<String, PropertyDefinition<?>> entry : typeDefinition.getPropertyDefinitions()
        .entrySet()) {
      switch (entry.getValue().getPropertyType()) {
        case BOOLEAN:
          propertyDefinitions.put(entry.getKey(),
              new EditorBooleanProperty((PropertyBooleanDefinition) entry.getValue()));
          break;
        case STRING:
          propertyDefinitions.put(entry.getKey(),
              new EditorStringProperty((PropertyStringDefinition) entry.getValue()));
          break;
      }
    }
  }
}
 
开发者ID:empt-ak,项目名称:meditor,代码行数:24,代码来源:EditorType.java

示例5: BasePropertyDefintionWrapper

import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition; //导入依赖的package包/类
public BasePropertyDefintionWrapper(PropertyDefinition<?> propDef, QName alfrescoName,
        TypeDefinitionWrapper owningType, CMISPropertyAccessor accessor, CMISPropertyLuceneBuilder luceneBuilder)
{
    this.propDef = propDef;
    this.alfrescoName = alfrescoName;
    this.owningType = owningType;
    this.accessor = accessor;
    this.luceneBuilder = luceneBuilder;
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:10,代码来源:BasePropertyDefintionWrapper.java

示例6: resolveInheritance

import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition; //导入依赖的package包/类
public void resolveInheritance(CMISMapping cmisMapping,
        CMISDictionaryRegistry registry, DictionaryService dictionaryService)
{
    PropertyDefinition<?> propertyDefintion;

    if (parent != null)
    {
        for (PropertyDefinitionWrapper propDef : parent.getProperties(false))
        {
            if (propertiesById.containsKey(propDef.getPropertyId()))
            {
                continue;
            }

            org.alfresco.service.cmr.dictionary.PropertyDefinition alfrescoPropDef = dictionaryService.getProperty(
                    propDef.getOwningType().getAlfrescoName(), propDef.getAlfrescoName());

            propertyDefintion = createPropertyDefinition(cmisMapping, propDef.getPropertyId(),
                    alfrescoPropDef.getName(), dictionaryService, alfrescoPropDef, true);

            if (propertyDefintion != null)
            {
                registerProperty(new BasePropertyDefintionWrapper(propertyDefintion, alfrescoPropDef.getName(),
                        propDef.getOwningType(), propDef.getPropertyAccessor(), propDef.getPropertyLuceneBuilder()));
            }
        }
    }

    List<TypeDefinitionWrapper> children = registry.getChildren(typeDef.getId());
    for (TypeDefinitionWrapper child : children)
    {
        if (child instanceof AbstractTypeDefinitionWrapper)
        {
            ((AbstractTypeDefinitionWrapper) child).resolveInheritance(cmisMapping, registry,
                    dictionaryService);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:39,代码来源:ShadowTypeDefinitionWrapper.java

示例7: updateTypeDefInclProperties

import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition; //导入依赖的package包/类
public void updateTypeDefInclProperties()
{
    for (PropertyDefinition<?> property : typeDefInclProperties.getPropertyDefinitions().values())
    {
        if (property.getDisplayName() == null)
        {
            typeDefInclProperties.addPropertyDefinition(getPropertyById(property.getId()).getPropertyDefinition());
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:11,代码来源:AbstractTypeDefinitionWrapper.java

示例8: resolveInheritance

import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition; //导入依赖的package包/类
public void resolveInheritance(CMISMapping cmisMapping, CMISDictionaryRegistry registry,
        DictionaryService dictionaryService)
{
    PropertyDefinition<?> propertyDefintion;

    if (parent != null)
    {
        for (PropertyDefinitionWrapper propDef : parent.getProperties(false))
        {
            org.alfresco.service.cmr.dictionary.PropertyDefinition alfrescoPropDef = dictionaryService.getProperty(
                    propDef.getOwningType().getAlfrescoName(), propDef.getAlfrescoName());

            propertyDefintion = createPropertyDefinition(cmisMapping, propDef.getPropertyId(),
                    alfrescoPropDef.getName(), dictionaryService, alfrescoPropDef, true);

            if (propertyDefintion != null)
            {
                registerProperty(new BasePropertyDefintionWrapper(propertyDefintion, alfrescoPropDef.getName(),
                        propDef.getOwningType(), propDef.getPropertyAccessor(), propDef.getPropertyLuceneBuilder()));
            }
        }
    }

    List<TypeDefinitionWrapper> children = registry.getChildren(typeDef.getId());
    for (TypeDefinitionWrapper child : children)
    {
        if (child instanceof AbstractTypeDefinitionWrapper)
        {
            ((AbstractTypeDefinitionWrapper) child).resolveInheritance(cmisMapping, registry, dictionaryService);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:33,代码来源:RelationshipTypeDefintionWrapper.java

示例9: writeChoices

import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition; //导入依赖的package包/类
protected void writeChoices(final JsonGenerator gen, final PropertyDefinition<?> pPropDef) throws IOException {
	for (Choice<?> choice : pPropDef.getChoices()) {
		// FIXME (Alessio): non vengono gestite le scelte di proprietà multivalore. In questo
		// caso viene restituito il primo valore della lista.

		if (choice.getValue().isEmpty()) {
			// Chissà se è un caso possibile...
			continue;
		}

		Object lValue = choice.getValue().get(0);
		switch (pPropDef.getPropertyType()) {
		case BOOLEAN:
			gen.writeBoolean((boolean) lValue);
			break;

		case DATETIME:
			// TODO (Alessio)
			break;

		case DECIMAL:
			gen.writeNumber((BigDecimal) lValue);
			break;

		case INTEGER:
			gen.writeNumber((BigInteger) lValue);
			break;

		case STRING:
		case ID:
		case HTML:
		case URI:
			gen.writeString((String) lValue);
			break;
		}
	}
}
 
开发者ID:MakeITBologna,项目名称:zefiro,代码行数:38,代码来源:PropertyDefinitionSerializer.java

示例10: serialize

import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition; //导入依赖的package包/类
@Override
public void serialize(PropertyDefinition<?> value, JsonGenerator gen, SerializerProvider serializers)
        throws IOException, JsonProcessingException {

	gen.writeStartObject();
	writeCommonProperties(value, gen, serializers);
	gen.writeEndObject();
}
 
开发者ID:MakeITBologna,项目名称:zefiro,代码行数:9,代码来源:PropertyDefinitionSerializer.java

示例11: addTypeDefinition

import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition; //导入依赖的package包/类
/**
 * Adds a type definition.
 */
public synchronized void addTypeDefinition(TypeDefinition type) {
    if (type == null) {
        throw new IllegalArgumentException("Type must be set!");
    }

    if (type.getId() == null || type.getId().trim().length() == 0) {
        throw new IllegalArgumentException("Type must have a valid id!");
    }

    if (type.getParentTypeId() == null || type.getParentTypeId().trim().length() == 0) {
        throw new IllegalArgumentException("Type must have a valid parent id!");
    }

    TypeDefinition parentType = typeDefinitions.get(type.getParentTypeId());
    if (parentType == null) {
        throw new IllegalArgumentException("Parent type doesn't exist!");
    }

    MutableTypeDefinition newType = typeDefinitionFactory.copy(type, true);

    // copy parent type property definitions and mark them as inherited
    for (PropertyDefinition<?> propDef : parentType.getPropertyDefinitions().values()) {
        MutablePropertyDefinition<?> basePropDef = typeDefinitionFactory.copy(propDef);
        basePropDef.setIsInherited(true);
        newType.addPropertyDefinition(basePropDef);
    }

    typeDefinitions.put(newType.getId(), newType);

    if (LOG.isDebugEnabled()) {
        LOG.debug("Added type '{}'.", type.getId());
    }
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:37,代码来源:FileBridgeTypeManager.java

示例12: removeQueryableAndOrderableFlags

import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition; //导入依赖的package包/类
/**
 * Removes the queryable and orderable flags from the property definitions
 * of a type definition because this implementations does neither support
 * queries nor can order objects.
 */
private void removeQueryableAndOrderableFlags(MutableTypeDefinition type) {
    for (PropertyDefinition<?> propDef : type.getPropertyDefinitions().values()) {
        MutablePropertyDefinition<?> mutablePropDef = (MutablePropertyDefinition<?>) propDef;
        mutablePropDef.setIsQueryable(false);
        mutablePropDef.setIsOrderable(false);
    }
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:13,代码来源:FileBridgeTypeManager.java

示例13: checkTypeProperties

import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition; //导入依赖的package包/类
/**
 * 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,代码行数:33,代码来源:FileBridgeRepository.java

示例14: toScriptValue

import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition; //导入依赖的package包/类
@SuppressWarnings("fallthrough")
protected Object toScriptValue(final Object value, final PropertyDefinition<?> definition)
{
    ParameterCheck.mandatory("value", value);
    ParameterCheck.mandatory("definition", definition);

    final Object result;

    switch (definition.getPropertyType())
    {
    case DATETIME:
        if (!(value instanceof GregorianCalendar))
            throw new IllegalArgumentException("CMIS date time should by definition be GregorionCalendar");
        final Date actualDate = ((GregorianCalendar) value).getTime();

        result = ScriptRuntime.newObject(Context.getCurrentContext(), this.scope, "Date",
                new Object[] { Long.valueOf(actualDate.getTime()) });

        break;
    case INTEGER:
        if (!(value instanceof BigInteger))
            throw new IllegalArgumentException("CMIS integer should by definition be BigInteger");
        result = Long.valueOf(((BigInteger) value).longValue());
        break;
    case DECIMAL:
        if (!(value instanceof BigDecimal))
            throw new IllegalArgumentException("CMIS decimal should by definition be BigDecimal");
        result = Double.valueOf(((BigInteger) value).doubleValue());
        break;
    default:
        result = value;
    }

    return result;
}
 
开发者ID:AFaust,项目名称:alfresco-cmis-documentlist,代码行数:36,代码来源:RhinoCMISObjectImpl.java

示例15: getPropertyIdForQueryName

import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition; //导入依赖的package包/类
public String getPropertyIdForQueryName(TypeDefinition typeDefinition, String propQueryName) {
    for (PropertyDefinition<?> pd : typeDefinition.getPropertyDefinitions().values()) {
        if (pd.getQueryName().equals(propQueryName)) {
            return pd.getId();
        }
    }

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


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