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


Java Resource.editPropertyValue方法代码示例

本文整理汇总了Java中org.wso2.carbon.registry.core.Resource.editPropertyValue方法的典型用法代码示例。如果您正苦于以下问题:Java Resource.editPropertyValue方法的具体用法?Java Resource.editPropertyValue怎么用?Java Resource.editPropertyValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.wso2.carbon.registry.core.Resource的用法示例。


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

示例1: attachPropertyToResource

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
 * Add/ edit a property value for the given Registry resource
 *
 * @param activityResource Registry resource to add/set property
 * @param properties       A Map consisting properties and it's values
 * @param isUpdate         True, if it is an update. False, if it is an addition
 */
private void attachPropertyToResource(Resource activityResource, Map<String, String> properties,
                                      boolean isUpdate) {


    for (Map.Entry<String, String> e : properties.entrySet()) {
        if (e.getValue() != null) {
            if (isUpdate) {
                String oldValue = activityResource.getProperty(e.getKey());
                activityResource.editPropertyValue(e.getKey(), oldValue, e.getValue());
            } else {
                activityResource.addProperty(e.getKey(), e.getValue());
            }
        }
    }

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

示例2: attachPropertyToResource

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
 * Add/ edit a property value for the given Registry resource
 *
 * @param msgResource Registry resource to add/set property
 * @param properties  A Map consisting properties and it's values
 * @param isUpdate    True, if it is an update. False, if it is an addition
 */
private void attachPropertyToResource(Resource msgResource, Map<String, String> properties,
                                      boolean isUpdate) {

    for (Map.Entry<String, String> e : properties.entrySet()) {
        if (e.getValue() != null) {
            if (isUpdate) {
                String oldValue = msgResource.getProperty(e.getKey());
                msgResource.editPropertyValue(e.getKey(), oldValue, e.getValue());
            } else {
                msgResource.addProperty(e.getKey(), e.getValue());
            }
        }
    }

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

示例3: getAppDataAddedRegistryResource

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
 * Adds/updates the Map of key-value pairs (appData) to the registry resource
 *
 * @param appDataResource The registry resource to add properties
 * @param values          The Map of key-value appData
 * @param isUpdate        true- if required to update the properties
 *                        false- if required to add the properties
 * @return The registry resource with the appData added as properties
 */

private Resource getAppDataAddedRegistryResource(Resource appDataResource,
                                                 Map<String, String> values, boolean isUpdate) {
    for (Map.Entry<String, String> e : values.entrySet()) {         /* for each key in the map */
        if (e.getValue() != null) {
            /* if (isUpdate) {*/
            String oldValue = appDataResource.getProperty(e.getKey());
            if (oldValue != null) {
                appDataResource.editPropertyValue(e.getKey(), oldValue, e.getValue());  /* edit properties to the resource */
            }
            /* } else {*/
            else {
                appDataResource.addProperty(e.getKey(), e.getValue());  /* add properties to the resource */
            }
            /* }*/
        }
    }
    return appDataResource;
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:29,代码来源:AppDataManagerImpl.java

示例4: testEditingMultivaluedProperties

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public void testEditingMultivaluedProperties() throws Exception {

        Resource r1 = registry.newResource();
        r1.setContent("r1 content");
        r1.addProperty("p1", "v1");
        r1.addProperty("p1", "v2");
        r1.setProperty("test", "value2");
        r1.setProperty("test2", "value2");
        registry.put("/props/t3/r1", r1);

        Resource r1e1 = registry.get("/props/t3/r1");
        r1e1.setContent("r1 content");
        r1e1.editPropertyValue("p1", "v1", "v3");
        List list = r1e1.getPropertyValues("/props/t3/r");

        registry.put("/props/t3/r1", r1e1);

        Resource r1e2 = registry.get("/props/t3/r1");


        assertFalse("Property is not edited.", r1e2.getPropertyValues("p1").contains("v1"));
        assertTrue("Property is not edited.", r1e2.getPropertyValues("p1").contains("v3"));
        assertTrue("Wrong property is removed.", r1e2.getPropertyValues("p1").contains("v2"));


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


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