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


Java Resource.getProperties方法代码示例

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


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

示例1: copyProperties

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public static void copyProperties(Resource originResource, Resource targetResource){
    Properties properties = originResource.getProperties();
    if (properties != null) {
        List<String> linkProperties = Arrays.asList(
                RegistryConstants.REGISTRY_LINK,
                RegistryConstants.REGISTRY_USER,
                RegistryConstants.REGISTRY_MOUNT,
                RegistryConstants.REGISTRY_AUTHOR,
                RegistryConstants.REGISTRY_MOUNT_POINT,
                RegistryConstants.REGISTRY_TARGET_POINT,
                RegistryConstants.REGISTRY_ACTUAL_PATH,
                RegistryConstants.REGISTRY_REAL_PATH);
        for (Map.Entry<Object, Object> e : properties.entrySet()) {
            String key = (String) e.getKey();
            if (!linkProperties.contains(key)) {
                targetResource.setProperty(key, (List<String>) e.getValue());
            }
        }
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:21,代码来源:CommonUtil.java

示例2: getLCInfo

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
private String[] getLCInfo(Resource resource) {
    String[] LCInfo = new String[2];
    String lifecycleState;
    if(resource.getProperties()!=null){
        if (resource.getProperty("registry.LC.name") != null) {
            LCInfo[0] =resource.getProperty("registry.LC.name");
        }

        if(LCInfo[0]!=null){
            lifecycleState = "registry.lifecycle." + LCInfo[0] + ".state";
            if (resource.getProperty("registry.lifecycle.ServiceLifeCycle.state") != null) {
                LCInfo[1] = resource.getProperty("registry.lifecycle.ServiceLifeCycle.state");
            }
        }
    }
    return LCInfo;
}
 
开发者ID:wso2,项目名称:carbon-governance,代码行数:18,代码来源:ListMetadataService.java

示例3: getConfigurationBean

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
private ReportConfigurationBean getConfigurationBean(String path)
        throws RegistryException, CryptoException, TaskException {
    Registry registry = getConfigSystemRegistry();
    Resource resource = registry.get(path);
    ReportConfigurationBean bean = new ReportConfigurationBean();
    String name = RegistryUtils.getResourceName(path);
    bean.setName(name);
    bean.setCronExpression(resource.getProperty("cronExpression"));
    TaskManager taskManager = ReportingServiceComponent.getTaskManager(
            ((UserRegistry) getRootRegistry()).getTenantId());
    bean.setScheduled(taskManager.isTaskScheduled(name));
    bean.setReportClass(resource.getProperty("class"));
    bean.setResourcePath(resource.getProperty("resourcePath"));
    bean.setTemplate(resource.getProperty("template"));
    bean.setType(resource.getProperty("type"));
    bean.setUsername(resource.getProperty("registry.username"));
    bean.setTenantId(Integer.parseInt(resource.getProperty("registry.tenantId")));
    Map<String, String> attributes = new HashMap<String, String>();
    Properties props = resource.getProperties();
    for (Object key : props.keySet()) {
        String propKey = (String) key;
        if (propKey.startsWith("attribute.")) {
            attributes.put(propKey.substring("attribute.".length()),
                    resource.getProperty(propKey));
        }
    }
    bean.setAttributes(CommonUtil.mapToAttributeArray(attributes));
    return bean;
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:30,代码来源:ReportingAdminService.java

示例4: getSubscription

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
 * creates the subscription object from the subscription resource
 *
 * @param subscriptionResource
 * @return
 */
public static Subscription getSubscription(Resource subscriptionResource) {

    Subscription subscription = new Subscription();
    subscription.setTenantId(CarbonContext.getThreadLocalCarbonContext().getTenantId());
    Properties properties = subscriptionResource.getProperties();
    if ((properties != null) && (!properties.isEmpty())) {
        for (Enumeration enumeration = properties.propertyNames(); enumeration.hasMoreElements();) {
            String propertyName = (String) enumeration.nextElement();
            if (EventBrokerConstants.EB_RES_SUBSCRIPTION_URL.equals(propertyName)) {
                subscription.setEventSinkURL(
                        subscriptionResource.getProperty(EventBrokerConstants.EB_RES_SUBSCRIPTION_URL));
            } else if (EventBrokerConstants.EB_RES_EVENT_DISPATCHER_NAME.equals(propertyName)) {
                subscription.setEventDispatcherName(
                        subscriptionResource.getProperty(EventBrokerConstants.EB_RES_EVENT_DISPATCHER_NAME));
            } else if (EventBrokerConstants.EB_RES_EXPIRS.equals(propertyName)) {
                subscription.setExpires(
                        ConverterUtil.convertToDateTime(
                                subscriptionResource.getProperty(EventBrokerConstants.EB_RES_EXPIRS)));
            } else if (EventBrokerConstants.EB_RES_OWNER.equals(propertyName)) {
                subscription.setOwner(subscriptionResource.getProperty(EventBrokerConstants.EB_RES_OWNER));
            } else if (EventBrokerConstants.EB_RES_TOPIC_NAME.equals(propertyName)) {
                subscription.setTopicName(subscriptionResource.getProperty(EventBrokerConstants.EB_RES_TOPIC_NAME));
            } else if (EventBrokerConstants.EB_RES_CREATED_TIME.equals(propertyName)) {
                subscription.setCreatedTime(new Date(Long.parseLong(subscriptionResource.getProperty(EventBrokerConstants.EB_RES_CREATED_TIME))));
            } else if (EventBrokerConstants.EB_RES_MODE.equals(propertyName)) {
                subscription.setMode(subscriptionResource.getProperty(EventBrokerConstants.EB_RES_MODE));
            } else {
                subscription.addProperty(propertyName, subscriptionResource.getProperty(propertyName));
            }
        }
    }
    return subscription;
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:40,代码来源:JavaUtil.java

示例5: transformResourceToWSResource

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public static WSResource transformResourceToWSResource(Resource resource, DataHandler dataHandler) {
    WSResource wsResource = null;
    if (resource instanceof Collection) {
        wsResource = new WSCollection();
    }
    else {
        wsResource = new WSResource();             
    }
    wsResource.setContentFile(dataHandler);
    wsResource.setAuthorUserName(resource.getAuthorUserName());

    if (resource.getCreatedTime() != null) wsResource.setCreatedTime(resource.getCreatedTime().getTime());
    //         wsResource.setDbBasedContentID(resource)
    wsResource.setDescription(resource.getDescription());

    wsResource.setId(resource.getId());
    if (resource.getLastModified() != null) wsResource.setLastModified(resource.getLastModified().getTime());
    wsResource.setLastUpdaterUserName(resource.getLastUpdaterUserName());
    if (resource instanceof ResourceImpl) {
        wsResource.setMatchingSnapshotID(((ResourceImpl)resource).getMatchingSnapshotID());
    }
    wsResource.setMediaType(resource.getMediaType());
    //         wsResource.setName(resource.)
    wsResource.setParentPath(resource.getParentPath());
    wsResource.setPath(resource.getPath());
    //         wsResource.setPathID();
    wsResource.setPermanentPath(resource.getPermanentPath());
    if (resource.getProperties() != null) wsResource.setProperties(getPropertiesForWSResource(resource.getProperties()));
    wsResource.setState(resource.getState());
    wsResource.setUUID(resource.getUUID());
    //         resource.get
    return wsResource;
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:34,代码来源:CommonUtil.java

示例6: getRegistryResourceProperties

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
private List<Property> getRegistryResourceProperties(String registryResourcePath, String applicationId)
        throws RegistryException, MetadataException {
    Registry tempRegistry = getRegistry();
    if (!tempRegistry.resourceExists(registryResourcePath)) {
        return null;
    }

    // We are using only super tenant registry to persist
    PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
    ctx.setTenantId(MultitenantConstants.SUPER_TENANT_ID);
    ctx.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);

    Resource regResource = tempRegistry.get(registryResourcePath);
    ArrayList<Property> newProperties = new ArrayList<>();
    Properties props = regResource.getProperties();
    Enumeration<?> x = props.propertyNames();
    while (x.hasMoreElements()) {
        String key = (String) x.nextElement();
        List<String> values = regResource.getPropertyValues(key);
        Property property = new Property();
        property.setKey(key);
        String[] valueArr = new String[values.size()];
        property.setValues(values.toArray(valueArr));

        newProperties.add(property);
    }
    return newProperties;
}
 
开发者ID:apache,项目名称:stratos,代码行数:29,代码来源:MetadataApiRegistry.java

示例7: getPossibleActions

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
private List<String> getPossibleActions(Resource resource, String currentState) {

        Properties propertyNameValues = resource.getProperties();
        Iterator propIterator = propertyNameValues.entrySet().iterator();
        List<CheckItemBean> checkItems = checkListItems.get(currentState);
        List<String> events = new ArrayList<String>(stateEvents.get(currentState));

        if (checkItems !=null && checkItems.size()>0) {
            while (propIterator.hasNext()) {
                Map.Entry entry = (Map.Entry) propIterator.next();
                String propertyName = (String) entry.getKey();

                if (propertyName.startsWith(LifecycleConstants.REGISTRY_CUSTOM_LIFECYCLE_CHECKLIST_OPTION + aspectName)) {
                    List<String> propValues = (List<String>) entry.getValue();
                    for (String propValue : propValues)
                        if (propValue.startsWith("name:"))
                            for (CheckItemBean checkItem : checkItems)
                                if ((checkItem.getName().equals(propValue.substring(propValue.indexOf(":") + 1))) &&
                                        (checkItem.getEvents() != null) && propValues.contains("value:false")) {
                                    events.removeAll(checkItem.getEvents());
                                }
                }

            }
        }
        return events;
    }
 
开发者ID:wso2,项目名称:carbon-governance,代码行数:28,代码来源:DefaultLifeCycle.java

示例8: getLifeCycleName

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public static String getLifeCycleName(Resource resource) {
    String lifeCycleName = "";
    if (resource.getProperties() != null) {
        if (resource.getProperty("registry.LC.name") != null) {
            lifeCycleName = resource.getProperty("registry.LC.name");
        }
    }
    return lifeCycleName;
}
 
开发者ID:wso2,项目名称:carbon-governance,代码行数:10,代码来源:CommonUtil.java

示例9: getLifeCycleState

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public static String getLifeCycleState(Resource resource) {
    String lifeCycleState = "";
    if (resource.getProperties() != null) {
        if (!getLifeCycleName(resource).equals("")) {
            String LCStatePropertyName = "registry.lifecycle." + getLifeCycleName(resource) + ".state";
            if (resource.getProperty(LCStatePropertyName) != null) {
                lifeCycleState = resource.getProperty(LCStatePropertyName);
            }
        }

    }
    return lifeCycleState;
}
 
开发者ID:wso2,项目名称:carbon-governance,代码行数:14,代码来源:CommonUtil.java

示例10: sendInitialNotification

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
    * 
    * @param requestContext
    * @param relativePath
    * @return boolean True value return when at least one approval doesn't dependent on check list.
    */
   private boolean sendInitialNotification(RequestContext requestContext, String relativePath) {    	
       Resource newResource = requestContext.getResource(); 
       Properties newProps = newResource.getProperties();    	
   	boolean sendNotification =  false;    	
   	for (Map.Entry<Object, Object> e : newProps.entrySet()) {
           String propKey = (String) e.getKey();
           if (propKey.matches("registry\\p{Punct}.*\\p{Punct}votes\\p{Punct}.*")) {               
               List<String> newPropValues = (List<String>) newProps.get(propKey);
               if (newPropValues == null)
                   continue;
               if (newPropValues.size() > 2) {                   
                   String newName = null;
                   for (String param : newPropValues) {
                       if (param.startsWith("name:")) {
                           newName = param.substring(5);
                       }
                   }
                   if(newName !=  null && !newName.isEmpty()){
                   	sendNotification = true;
                   	return sendNotification;
                   }
               }
           }
   	}
   	return sendNotification;
}
 
开发者ID:wso2,项目名称:carbon-governance,代码行数:33,代码来源:GovernanceEventingHandler.java

示例11: loadDetails

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
 * Method to load the details into this artifact.
 *
 * @throws GovernanceException if the operation failed.
 */
public void loadDetails() throws GovernanceException {
    checkRegistryResourceAssociation();
    Registry registry = getAssociatedRegistry();
    String path = getPath();
    String id = getId();
    Resource resource;
    try {
        resource = registry.get(path);
        this.content = (byte[]) resource.getContent();
        this.mediaType = resource.getMediaType();
    } catch (RegistryException e) {
        throw new GovernanceException("Error in getting the qualified name for the artifact. " +
                "artifact id: " + id + ", " + "path: " + path + ".", e);
    }
    // get the target namespace.
    String fileName = RegistryUtils.getResourceName(path);
    this.qName = new QName(null, fileName);

    // and then iterate all the properties and add.
    Properties properties = resource.getProperties();
    if (properties != null) {
        Set keySet = properties.keySet();
        if (keySet != null) {
            for (Object keyObj : keySet) {
                String key = (String) keyObj;
                List values = (List) properties.get(key);
                if (values != null) {
                    for (Object valueObj : values) {
                        String value = (String) valueObj;
                        addAttribute(key, value);
                    }
                }
            }
        }
    }
}
 
开发者ID:wso2,项目名称:carbon-governance,代码行数:42,代码来源:GenericArtifactImpl.java

示例12: readStatus

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
private synchronized List<StatusHolder> readStatus(String path, String about) throws EntitlementException {

        Resource resource = null;
        Registry registry = null;
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            registry = EntitlementServiceComponent.getRegistryService().
                    getGovernanceSystemRegistry(tenantId);
            if (registry.resourceExists(path)) {
                resource = registry.get(path);
            }
        } catch (RegistryException e) {
            log.error(e);
            throw new EntitlementException("Error while persisting policy status", e);
        }

        List<StatusHolder> statusHolders = new ArrayList<StatusHolder>();
        if (resource != null && resource.getProperties() != null) {
            Properties properties = resource.getProperties();
            for (Map.Entry<Object, Object> entry : properties.entrySet()) {
                PublisherPropertyDTO dto = new PublisherPropertyDTO();
                dto.setId((String) entry.getKey());
                Object value = entry.getValue();
                if (value instanceof ArrayList) {
                    List list = (ArrayList) entry.getValue();
                    if (list != null && list.size() > 0 && list.get(0) != null) {
                        StatusHolder statusHolder = new StatusHolder(about);
                        if (list.size() > 0 && list.get(0) != null) {
                            statusHolder.setType((String) list.get(0));
                        }
                        if (list.size() > 1 && list.get(1) != null) {
                            statusHolder.setTimeInstance((String) list.get(1));
                        } else {
                            continue;
                        }
                        if (list.size() > 2 && list.get(2) != null) {
                            String user = (String) list.get(2);
                            statusHolder.setUser(user);
                        } else {
                            continue;
                        }
                        if (list.size() > 3 && list.get(3) != null) {
                            statusHolder.setKey((String) list.get(3));
                        }
                        if (list.size() > 4 && list.get(4) != null) {
                            statusHolder.setSuccess(Boolean.parseBoolean((String) list.get(4)));
                        }
                        if (list.size() > 5 && list.get(5) != null) {
                            statusHolder.setMessage((String) list.get(5));
                        }
                        if (list.size() > 6 && list.get(6) != null) {
                            statusHolder.setTarget((String) list.get(6));
                        }
                        if (list.size() > 7 && list.get(7) != null) {
                            statusHolder.setTargetAction((String) list.get(7));
                        }
                        if (list.size() > 8 && list.get(8) != null) {
                            statusHolder.setVersion((String) list.get(8));
                        }
                        statusHolders.add(statusHolder);
                    }
                }
            }
        }
        if (statusHolders.size() > 0) {
            StatusHolder[] array = statusHolders.toArray(new StatusHolder[statusHolders.size()]);
            java.util.Arrays.sort(array, new StatusHolderComparator());
            if (statusHolders.size() > maxRecodes) {
                statusHolders = new ArrayList<StatusHolder>();
                for (int i = 0; i < maxRecodes; i++) {
                    statusHolders.add(array[i]);
                }
                persistStatus(path, statusHolders, true);
            } else {
                statusHolders = new ArrayList<StatusHolder>(Arrays.asList(array));
            }
        }

        return statusHolders;
    }
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:81,代码来源:SimplePAPStatusDataHandler.java

示例13: PublisherDataHolder

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public PublisherDataHolder(Resource resource, boolean returnSecrets) {
    List<PublisherPropertyDTO> propertyDTOs = new ArrayList<PublisherPropertyDTO>();
    if (resource != null && resource.getProperties() != null) {
        Properties properties = resource.getProperties();
        for (Map.Entry<Object, Object> entry : properties.entrySet()) {
            PublisherPropertyDTO dto = new PublisherPropertyDTO();
            dto.setId((String) entry.getKey());
            Object value = entry.getValue();
            if (value instanceof ArrayList) {
                List list = (ArrayList) entry.getValue();
                if (list != null && list.size() > 0 && list.get(0) != null) {
                    dto.setValue((String) list.get(0));

                    if (list.size() > 1 && list.get(1) != null) {
                        dto.setDisplayName((String) list.get(1));
                    }
                    if (list.size() > 2 && list.get(2) != null) {
                        dto.setDisplayOrder(Integer.parseInt((String) list.get(2)));
                    }
                    if (list.size() > 3 && list.get(3) != null) {
                        dto.setRequired(Boolean.parseBoolean((String) list.get(3)));
                    }
                    if (list.size() > 4 && list.get(4) != null) {
                        dto.setSecret(Boolean.parseBoolean((String) list.get(4)));
                    }

                    if (dto.isSecret()) {
                        if (returnSecrets) {
                            String password = dto.getValue();
                            try {
                                password = new String(CryptoUtil.getDefaultCryptoUtil().
                                        base64DecodeAndDecrypt(dto.getValue()));
                            } catch (CryptoException e) {
                                log.error(e);
                                // ignore
                            }
                            dto.setValue(password);
                        }
                    }
                }
            }
            if (MODULE_NAME.equals(dto.getId())) {
                moduleName = dto.getValue();
                continue;
            }

            propertyDTOs.add(dto);
        }
    }
    this.propertyDTOs = propertyDTOs.toArray(new PublisherPropertyDTO[propertyDTOs.size()]);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:52,代码来源:PublisherDataHolder.java

示例14: getAvailableAspects

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
 * Method to obtain all available aspects for the given tenant.
 *
 * @return list of available aspects.
 * @throws RegistryException if the operation failed.
 */
public static String[] getAvailableAspects() throws RegistryException {
    int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    Registry systemRegistry = registryService.getConfigSystemRegistry(tenantId);
    String[] aspectsToAdd = systemRegistry.getAvailableAspects();
    if (aspectsToAdd == null) {
        return new String[0];
    }
    List<String> lifecycleAspectsToAdd = new LinkedList<String>();
    boolean isTransactionStarted = false;
    String tempResourcePath = "/governance/lcm/" + UUIDGenerator.generateUUID();
    for (String aspectToAdd : aspectsToAdd) {
        if (systemRegistry.getRegistryContext().isReadOnly()) {
            lifecycleAspectsToAdd.add(aspectToAdd);
            continue;
        }
        Map<String, Boolean> aspectsMap;
        if (!lifecycleAspects.containsKey(tenantId)) {
            synchronized (ASPECT_MAP_LOCK) {
                if (!lifecycleAspects.containsKey(tenantId)) {
                    aspectsMap = new HashMap<String, Boolean>();
                    lifecycleAspects.put(tenantId, aspectsMap);
                } else {
                    aspectsMap = lifecycleAspects.get(tenantId);
                }
            }
        } else {
            aspectsMap = lifecycleAspects.get(tenantId);
        }
        Boolean isLifecycleAspect = aspectsMap.get(aspectToAdd);
        if (isLifecycleAspect == null) {
            if (!isTransactionStarted) {
                systemRegistry.beginTransaction();
                isTransactionStarted = true;
            }
            systemRegistry.put(tempResourcePath, systemRegistry.newResource());
            systemRegistry.associateAspect(tempResourcePath, aspectToAdd);
            Resource r = systemRegistry.get(tempResourcePath);
            Properties props = r.getProperties();
            Set keys = props.keySet();
            for (Object key : keys) {
                String propKey = (String) key;
                if (propKey.startsWith("registry.lifecycle.")
                        || propKey.startsWith("registry.custom_lifecycle.checklist.")) {
                    isLifecycleAspect = Boolean.TRUE;
                    break;
                }
            }
            if (isLifecycleAspect == null) {
                isLifecycleAspect = Boolean.FALSE;
            }
            aspectsMap.put(aspectToAdd, isLifecycleAspect);
        }
        if (isLifecycleAspect) {
            lifecycleAspectsToAdd.add(aspectToAdd);
        }
    }
    if (isTransactionStarted) {
        systemRegistry.delete(tempResourcePath);
        systemRegistry.rollbackTransaction();
    }
    return lifecycleAspectsToAdd.toArray(new String[lifecycleAspectsToAdd.size()]);
}
 
开发者ID:wso2,项目名称:carbon-governance,代码行数:69,代码来源:GovernanceUtils.java

示例15: getUserActivity

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
 * Retrieves the Activity object for the given userId,appId,activityId combination
 *
 * @param userId     The id of the person
 * @param appId      The id of the application
 * @param activityId The ide of the activity
 * @return An Activiy object for the passed in userId,appId,activityId combination
 * @throws RegistryException
 */

private Activity getUserActivity(String userId, String appId, String activityId)
        throws RegistryException {
    registry = getRegistry();
    Activity userActivity;
    // retrieve activity for user {userId}

    String selfActivityResourcePath = SocialImplConstants.USER_REGISTRY_ROOT + userId +
            SocialImplConstants.ACTIVITY_PATH + appId +
            SocialImplConstants.SEPARATOR + activityId;
    Resource selfActivityResource;
    if (registry.resourceExists(selfActivityResourcePath)) {
        // requested activity exists
        selfActivityResource = registry.get(selfActivityResourcePath);
        userActivity = getPropertyAddedActivityObj(selfActivityResource);

        /* Handle media items */
        String mediaItemResourcePath = selfActivityResourcePath +
                SocialImplConstants.ACTIVITY_MEDIA_ITEM_PATH;
        int noOfMediaItems;
        if (registry.resourceExists(mediaItemResourcePath) &&
                registry.get(mediaItemResourcePath).getProperty(
                        SocialImplConstants.ACTIVITY_MEDIA_ITEM_NOS) != null) {
            noOfMediaItems = Integer.valueOf(registry.get(mediaItemResourcePath).
                    getProperty(SocialImplConstants.ACTIVITY_MEDIA_ITEM_NOS));
            String itemResourcePath;
            List<MediaItem> mediaItemList = new ArrayList<MediaItem>();
            for (int index = 0; index < noOfMediaItems; index++) {
                itemResourcePath = mediaItemResourcePath +
                        SocialImplConstants.SEPARATOR + index;
                Resource mediaItemResource;
                if (registry.resourceExists(itemResourcePath)) {
                    mediaItemResource = registry.get(itemResourcePath);
                    // retrieve mediaItem properties
                    // add to mediaItems list
                    mediaItemList.add(getPropertiesAddedMediaItemObj(mediaItemResource));
                }
            }
            // add the mediaItem list to the activity object
            userActivity.setMediaItems(mediaItemList);
        }


        /* Handle Template Params */
        String templateParamResourcePath = selfActivityResourcePath +
                SocialImplConstants.
                        ACTIVITY_TEMPLATE_PARAMS_PATH;
        Resource templateParamResource;
        if (registry.resourceExists(templateParamResourcePath)) {
            templateParamResource = registry.get(templateParamResourcePath);
            Properties props = templateParamResource.getProperties();
            userActivity.setTemplateParams(new HashMap<String, String>((Map) props));
        }

    } else {
        //requested activity doesn't exist
        log.error("No activity found with id " + activityId);
        return null;

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


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