org.wso2.carbon.registry.core.Association.getAssociationType()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(12.4k)|赞(0)|评价(0)|浏览(82)

本文整理了Java中org.wso2.carbon.registry.core.Association.getAssociationType()方法的一些代码示例,展示了Association.getAssociationType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Association.getAssociationType()方法的具体详情如下:
包路径:org.wso2.carbon.registry.core.Association
类名称:Association
方法名:getAssociationType

Association.getAssociationType介绍

暂无

代码示例

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.resource

public static boolean hasAssociations(String path,String type,UserRegistry registry) throws Exception {
  if(type == null || path == null) {
   return false;
  }
  Association [] associations = registry.getAssociations(path,type);
  for(Association association:associations){
    if (association.getAssociationType() != null && association.getAssociationType().equals(type)
        && association.getSourcePath().equals(path)) {
      return true;
    }
  }
 return false;
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions

private void persistAssociations(Registry registry, List <Association> associations)
      throws RegistryException {
    Iterator <Association> associationIterator = associations.iterator();

    while(associationIterator.hasNext()) {

      Association association = associationIterator.next();
      registry.addAssociation(association.getSourcePath(), association.getDestinationPath(),
                  association.getAssociationType());
    }
  }
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions

public void persistAssociations() throws RegistryException {
  Iterator<Association> associationIterator = associationsBuffer.iterator();
  while (associationIterator.hasNext()) {
    Association association = associationIterator.next();
    registry.addAssociation(association.getSourcePath(), association.getDestinationPath(),
                association.getAssociationType());
  }
}

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.registry.extensions

public static void copyAssociations(Registry registry, String newPath, String path) throws RegistryException {
  Association[] associations = registry.getAllAssociations(path);
  for (Association association : associations) {
    if (!association.getAssociationType().equals(CommonConstants.DEPENDS)) {
      if (association.getSourcePath().equals(path)) {
        registry.addAssociation(newPath,
            association.getDestinationPath(), association.getAssociationType());
      } else {
        registry.addAssociation(association.getSourcePath(), newPath,
            association.getAssociationType());
      }
    }
  }
}

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.registry.extensions

public static void makeOtherDependencies(RequestContext requestContext, Map<String, String> oldPathNewPathMap
    , List<String> otherDependencies) throws RegistryException {
  Registry registry = requestContext.getRegistry();
  for (Map.Entry<String, String> entry : oldPathNewPathMap.entrySet()) {
    Association[] associations = registry.getAllAssociations(entry.getKey());
    for (Association association : associations) {
      for (String dependency : otherDependencies) {
        if (association.getDestinationPath().equals(dependency)) {
          registry.addAssociation(entry.getValue(), dependency, association.getAssociationType());
        }
        if (association.getSourcePath().equals(dependency)) {
          registry.addAssociation(dependency, entry.getValue(), association.getAssociationType());
        }
      }
    }
  }
}
public static List evaluateXpath(OMElement contentElement, String xpathString) {

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.resource

private static boolean isADependency(Association associationBean,UserRegistry registry,String scrPath,String COLLECTION) throws Exception {
  if(associationBean.getDestinationPath() == null ||
      (!registry.resourceExists(associationBean.getDestinationPath()))){
    return false;
  }
  ResourceData resourceData = ContentUtil.getResourceData(new String[]{associationBean.getDestinationPath()}, registry)[0];
   boolean isCollection = resourceData.getResourceType().equals(COLLECTION);
   return (associationBean.getAssociationType() != null && associationBean.getAssociationType().equals("depends")
       && associationBean.getSourcePath().equals(scrPath) && !isCollection);
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.indexing

/**
 *  Method to set the resource Association types and destinations to IndexDocument attribute list.
 */
private void addAssociations() throws RegistryException {
  // Add resource association types and destinations
  Association[] associations;
  try {
    associations = registry.getAllAssociations(resourcePath);
  } catch (RegistryException e) {
    String message = "Error at IndexDocumentCreator when getting Registry Associations.";
    log.error(message, e);
    throw new RegistryException(message, e);
  }
  List<String> associationTypeList = new ArrayList<>();
  List<String> associationDestinationList = new ArrayList<>();
  if (associations != null && associations.length > 0) {
    for (Association association : associations) {
      associationTypeList.add(association.getAssociationType());
      associationDestinationList.add(association.getDestinationPath());
    }
    if (associationTypeList.size() > 0) {
      attributes.put(IndexingConstants.FIELD_ASSOCIATION_TYPES, associationTypeList);
    }
    if (associationDestinationList.size() > 0) {
      attributes.put(IndexingConstants.FIELD_ASSOCIATION_DESTINATIONS, associationDestinationList);
    }
  }
}

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.api

if (type.equals(association.getAssociationType()) &&
    ((isSource && association.getSourcePath().equals(path)) ||
        (isTarget && association.getDestinationPath().equals(path)))) {
  existingSet.add(association.getSourcePath() + SEPARATOR +
      association.getDestinationPath() +
      SEPARATOR + association.getAssociationType());
updatedSet.add(association.getSourcePath() + SEPARATOR +
    association.getDestinationPath() +
    SEPARATOR + association.getAssociationType());

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.relations

Association tmpAsso = (Association) iAssociations.next();
  if (tmpAsso.getAssociationType().equals(CommonConstants.ASSOCIATION_TYPE01)
      && assoType.equals(CommonConstants.ASSOCIATION_TYPE01) && tmpAsso.getSourcePath().equals(path))
    associations.add(tmpAsso);
  if (!tmpAsso.getAssociationType().equals(CommonConstants.ASSOCIATION_TYPE01)
      && !assoType.equals(CommonConstants.ASSOCIATION_TYPE01) && tmpAsso.getSourcePath().equals(path))
    associations.add(tmpAsso);

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions

/**
 * Save associations to the registry if they do not exist.
 * Execution time could be improved if registry provides a better way to check existing associations.
 *
 * @throws RegistryException Thrown in case a association cannot be saved
 */
private void saveAssociations() throws RegistryException {
  // until registry provides a functionality to check existing associations, this method will consume a LOT of time
  for (Association association : associations) {
    boolean isAssociationExist = false;
    Association[] existingAssociations = registry.getAllAssociations(association.getSourcePath());
    if (existingAssociations != null) {
      for (Association currentAssociation : existingAssociations) {
        if (currentAssociation.getDestinationPath().equals(association.getDestinationPath()) &&
            currentAssociation.getAssociationType().equals(association.getAssociationType())) {
          isAssociationExist = true;
          break;
        }
      }
    }
    if (!isAssociationExist) {
      registry.addAssociation(association.getSourcePath(),
          association.getDestinationPath(),
          association.getAssociationType());
    }
  }
}

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.registry.extensions

/**
 * Save associations to the registry if they do not exist.
 * Execution time could be improved if registry provides a better way to check existing associations.
 *
 * @throws org.wso2.carbon.registry.core.exceptions.RegistryException Thrown in case a association cannot be saved
 */
private void saveAssociations() throws RegistryException {
  // until registry provides a functionality to check existing associations, this method will consume a LOT of time
  for (Association association : associations) {
    boolean isAssociationExist = false;
    Association[] existingAssociations = registry.getAllAssociations(association.getSourcePath());
    if (existingAssociations != null) {
      for (Association currentAssociation : existingAssociations) {
        if (currentAssociation.getDestinationPath().equals(association.getDestinationPath()) &&
            currentAssociation.getAssociationType().equals(association.getAssociationType())) {
          isAssociationExist = true;
          break;
        }
      }
    }
    if (!isAssociationExist) {
      registry.addAssociation(association.getSourcePath(),
          association.getDestinationPath(),
          association.getAssociationType());
    }
  }
}

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.gadgets.resourceimpact

public static AssociationBean[] getAssociations(String path, Registry registry,
                          boolean isDependency) throws RegistryException {
    List<AssociationBean> associationBeanList = new ArrayList<AssociationBean>();

    Association[] associations = registry.getAllAssociations(path);

    for (Association association : associations) {
      if ((!isDependency && path.equals(association.getSourcePath()) &&
          !association.getDestinationPath().contains(";version:")) ||
          (isDependency && association.getAssociationType().equals("depends") &&
              path.equals(association.getDestinationPath()) &&
              !association.getSourcePath().contains(";version:"))) {
        AssociationBean bean = new AssociationBean();
        bean.setAssociationType(association.getAssociationType());
        bean.setDestinationPath(association.getDestinationPath());
        bean.setSourcePath(association.getSourcePath());

        associationBeanList.add(bean);
      }
    }

    return associationBeanList.toArray(new AssociationBean[associationBeanList.size()]);
  }
}

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.registry.extensions

|| !(oldPathNewPathMap.containsValue(association.getDestinationPath()))) {
registry.removeAssociation(association.getSourcePath(), association.getDestinationPath()
    , association.getAssociationType());
    oldPathNewPathMap.get(association.getSourcePath())
    , oldPathNewPathMap.get(association.getDestinationPath())
    , association.getAssociationType());

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions

for (Association currentAssociation: existingAssociations) {
  if (currentAssociation.getDestinationPath().equals(association.getDestinationPath()) &&
      currentAssociation.getAssociationType().equals(association.getAssociationType())) {
    isAssociationExist = true;
    break;
registry.addAssociation(association.getSourcePath(),
    association.getDestinationPath(),
    association.getAssociationType());

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.registry.extensions

for (Association currentAssociation: existingAssociations) {
  if (currentAssociation.getDestinationPath().equals(association.getDestinationPath()) &&
      currentAssociation.getAssociationType().equals(association.getAssociationType())) {
    isAssociationExist = true;
    break;
registry.addAssociation(association.getSourcePath(),
    association.getDestinationPath(),
    association.getAssociationType());

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.api

new LinkedHashMap<String, AssociationInteger>();
for (Association relationship : relationshipDefinitions) {
  String type = relationship.getAssociationType();
  String source = relationship.getSourcePath();
  String target = relationship.getDestinationPath();

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions

for (Association association : associations) {
  associatedRes.add(association.getDestinationPath());
  registry.removeAssociation(resourcePath.getPath(), association.getDestinationPath(), association.getAssociationType());
  for (Association association : allAssociations) {
    allAssociatedRes.add(association.getDestinationPath());
    registry.removeAssociation(path, association.getDestinationPath(), association.getAssociationType());

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.registry.extensions

if (associations != null && associations.length != 0) {
  for (Association association : associations) {
    if (association.getAssociationType().equals(CommonConstants.DEPENDS)) {
      if (requestContext.getResource().getPath().equals(association.getSourcePath())) {
        currentParameterMap.put(association.getDestinationPath(),

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.registry.extensions

if (associations != null && associations.length != 0) {
  for (Association association : associations) {
    if (association.getAssociationType().equals(CommonConstants.DEPENDS)) {
      if (requestContext.getResource().getPath().equals(association.getSourcePath())) {
        currentParameterMap.put(association.getDestinationPath(),

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.relations

Association as = asso[i];
beans[i] = new AssociationBean(as.getSourcePath(), as.getDestinationPath(),
    as.getAssociationType());

相关文章

微信公众号

最新文章

更多