private static void permissionPath(Registry tenantGovReg, String permissionPath) throws RegistryException { Collection appCollection = (Collection) tenantGovReg.get(permissionPath); String[] childern = appCollection.getChildren(); if (childern == null || childern.length == 0) { paths.add(permissionPath.replace(applicationNode, "").substring(2)); } while (childern != null && childern.length != 0) { for (int i = 0; i < childern.length; i++) { permissionPath(tenantGovReg, childern[i]); } break; } }
private static void permissionPath(Registry tenantGovReg, String permissionPath, List<String> paths, String applicationNode) throws RegistryException { Collection appCollection = (Collection) tenantGovReg.get(permissionPath); String[] childern = appCollection.getChildren(); if (childern == null || childern.length == 0) { paths.add(permissionPath.replace(applicationNode, "").substring(2)); } while (childern != null && childern.length != 0) { for (int i = 0; i < childern.length; i++) { permissionPath(tenantGovReg, childern[i], paths, applicationNode); } break; } }
@Override public String[] getVersions(String policyId) throws EntitlementException { List<String> versions = new ArrayList<String>(); Registry registry = EntitlementServiceComponent. getGovernanceRegistry(CarbonContext.getThreadLocalCarbonContext().getTenantId()); Collection collection = null; try { try { collection = (Collection) registry. get(PDPConstants.ENTITLEMENT_POLICY_VERSION + policyId); } catch (ResourceNotFoundException e) { // ignore } if (collection != null && collection.getChildren() != null) { String[] children = collection.getChildren(); for (String child : children) { versions.add(RegistryUtils.getResourceName(child)); } } } catch (RegistryException e) { log.error("Error while creating new version of policy", e); } return versions.toArray(new String[versions.size()]); } }
@Override public String[] getVersions(String policyId) throws EntitlementException { List<String> versions = new ArrayList<String>(); Registry registry = EntitlementServiceComponent. getGovernanceRegistry(CarbonContext.getThreadLocalCarbonContext().getTenantId()); Collection collection = null; try { try { collection = (Collection) registry. get(PDPConstants.ENTITLEMENT_POLICY_VERSION + policyId); } catch (ResourceNotFoundException e) { // ignore } if (collection != null && collection.getChildren() != null) { String[] children = collection.getChildren(); for (String child : children) { versions.add(RegistryUtils.getResourceName(child)); } } } catch (RegistryException e) { log.error("Error while creating new version of policy", e); } return versions.toArray(new String[versions.size()]); } }
@Override public String[] getVersions(String policyId) throws EntitlementException { List<String> versions = new ArrayList<String>(); Registry registry = EntitlementServiceComponent. getGovernanceRegistry(CarbonContext.getThreadLocalCarbonContext().getTenantId()); Collection collection = null; try { try { collection = (Collection) registry. get(PDPConstants.ENTITLEMENT_POLICY_VERSION + policyId); } catch (ResourceNotFoundException e) { // ignore } if (collection != null && collection.getChildren() != null) { String[] children = collection.getChildren(); for (String child : children) { versions.add(RegistryUtils.getResourceName(child)); } } } catch (RegistryException e) { log.error("Error while creating new version of policy", e); } return versions.toArray(new String[versions.size()]); } }
String[] childPaths = seqCollection.getChildren();
/** * Get stored custom inSequences from governanceSystem registry * * @throws org.wso2.carbon.appmgt.api.AppManagementException */ public List<String> getCustomInSequences() throws AppManagementException { List<String> sequenceList = new ArrayList<String>(); try { UserRegistry registry = ServiceReferenceHolder.getInstance().getRegistryService() .getGovernanceSystemRegistry(tenantId); if (registry.resourceExists(AppMConstants.API_CUSTOM_INSEQUENCE_LOCATION)) { org.wso2.carbon.registry.api.Collection inSeqCollection = (org.wso2.carbon.registry.api.Collection) registry.get(AppMConstants.API_CUSTOM_INSEQUENCE_LOCATION); if (inSeqCollection != null) { // SequenceMediatorFactory factory = new SequenceMediatorFactory(); String[] inSeqChildPaths = inSeqCollection.getChildren(); for (int i = 0; i < inSeqChildPaths.length; i++) { Resource inSequence = registry.get(inSeqChildPaths[i]); OMElement seqElment = AppManagerUtil.buildOMElement(inSequence.getContentStream()); sequenceList.add(seqElment.getAttributeValue(new QName("name"))); } } } } catch (Exception e) { handleException("Issue is in getting custom InSequences from the Registry", e); } return sequenceList; }
/** * Get stored custom outSequences from governanceSystem registry * * @throws org.wso2.carbon.appmgt.api.AppManagementException */ public List<String> getCustomOutSequences() throws AppManagementException { List<String> sequenceList = new ArrayList<String>(); try { UserRegistry registry = ServiceReferenceHolder.getInstance().getRegistryService() .getGovernanceSystemRegistry(tenantId); if (registry.resourceExists(AppMConstants.API_CUSTOM_OUTSEQUENCE_LOCATION)) { org.wso2.carbon.registry.api.Collection outSeqCollection = (org.wso2.carbon.registry.api.Collection) registry.get(AppMConstants.API_CUSTOM_OUTSEQUENCE_LOCATION); if (outSeqCollection !=null) { String[] outSeqChildPaths = outSeqCollection.getChildren(); for (int i = 0; i < outSeqChildPaths.length; i++) { Resource outSequence = registry.get(outSeqChildPaths[i]); OMElement seqElment = AppManagerUtil.buildOMElement(outSequence.getContentStream()); sequenceList.add(seqElment.getAttributeValue(new QName("name"))); } } } } catch (Exception e) { handleException("Issue is in getting custom OutSequences from the Registry", e); } return sequenceList; }
String[] childern = appNodeCollec.getChildren();
String[] childern = appNodeCollec.getChildren();