/** @see org.apromore.service.ClusterService#getClusteringSummary {@inheritDoc} */ @Override public ClusteringSummary getClusteringSummary() { ClusteringSummary summary = new ClusteringSummary(); List<Object[]> summaryObj = cRepository.getClusteringSummary(); for (Object[] objects : summaryObj) { if (objects[0] != null && ((Long) objects[0]).intValue() > 0) { if (objects[0] != null) { summary.setNumClusters(((Long) objects[0]).intValue()); } if (objects[1] != null) { summary.setMinClusterSize((Integer) objects[1]); } if (objects[2] != null) { summary.setMaxClusterSize((Integer) objects[2]); } if (objects[3] != null) { summary.setMinAvgFragmentSize((Float) objects[3]); } if (objects[4] != null) { summary.setMaxAvgFragmentSize((Float) objects[4]); } if (objects[5] != null) { summary.setMinBCR((Double) objects[5]); } if (objects[6] != null) { summary.setMaxBCR((Double) objects[6]); } } } return summary; }
/** * @see org.apromore.service.ClusterService#getClusters(org.apromore.service.model.ClusterFilter) * {@inheritDoc} */ @Override public List<org.apromore.service.model.Cluster> getClusters(ClusterFilter filter) { MemberFragment fragment; ProcessAssociation pa; FragmentDistance distance; List<FragmentVersion> fs; List<org.apromore.service.model.Cluster> clusters = new ArrayList<>(); List<Cluster> cinfos = cRepository.getFilteredClusters(filter); for (Cluster cinfo : cinfos) { org.apromore.service.model.Cluster c = new org.apromore.service.model.Cluster(); c.setCluster(cinfo); fs = caRepository.findFragmentVersionByClusterId(cinfo.getId()); for (FragmentVersion f : fs) { fragment = new MemberFragment(f.getId()); fragment.setFragmentSize(f.getFragmentSize()); for (ProcessModelVersion m : f.getProcessModelVersions()) { pa = new ProcessAssociation(); pa.setProcessVersionId(m.getId()); pa.setProcessVersionNumber(m.getVersionNumber()); pa.setProcessBranchName(m.getProcessBranch().getBranchName()); pa.setProcessId(m.getProcessBranch().getProcess().getId()); pa.setProcessName(m.getProcessBranch().getProcess().getName()); fragment.getProcessAssociations().add(pa); } distance = fdRepository.findByFragmentVersionId1AndFragmentVersionId2( cinfo.getMedoidId(), f.getId()); if (distance != null) { fragment.setDistance(distance.getDistance()); } else { fragment.setDistance(-1d); } c.addFragment(fragment); } clusters.add(c); } return clusters; }
/** @see org.apromore.service.ClusterService#getCluster(Integer) {@inheritDoc} */ @Override public org.apromore.service.model.Cluster getCluster(Integer clusterId) { MemberFragment fragment; ProcessAssociation pa; FragmentDistance distance; Cluster cinfo = cRepository.findOne(clusterId); org.apromore.service.model.Cluster c = new org.apromore.service.model.Cluster(); c.setCluster(cinfo); List<FragmentVersion> fs = caRepository.findFragmentVersionByClusterId(clusterId); for (FragmentVersion f : fs) { fragment = new MemberFragment(f.getId()); fragment.setFragmentSize(f.getFragmentSize()); for (ProcessModelVersion m : f.getProcessModelVersions()) { pa = new ProcessAssociation(); pa.setProcessVersionId(m.getId()); pa.setProcessVersionNumber(m.getVersionNumber()); pa.setProcessBranchName(m.getProcessBranch().getBranchName()); pa.setProcessId(m.getProcessBranch().getProcess().getId()); pa.setProcessName(m.getProcessBranch().getProcess().getName()); fragment.getProcessAssociations().add(pa); } distance = fdRepository.findByFragmentVersionId1AndFragmentVersionId2( cinfo.getMedoidId(), f.getId()); if (distance != null) { fragment.setDistance(distance.getDistance()); } else { fragment.setDistance(-1d); } c.addFragment(fragment); } return c; }
/* Delete the previous cluster run. */ @Transactional(readOnly = false) private void clearClusters() { cRepository.deleteAll(); caRepository.deleteAll(); }
/** @see org.apromore.service.ClusterService#getFragmentIds(Integer) {@inheritDoc} */ @Override public List<Integer> getFragmentIds(Integer clusterId) { return cRepository.getFragmentIds(clusterId); }
/** @see org.apromore.service.ClusterService#getClusters() {@inheritDoc} */ @Override public List<Cluster> getClusters() { return cRepository.findAll(); }
/** * @see * org.apromore.service.ClusterService#getClusterSummaries(org.apromore.service.model.ClusterFilter) * {@inheritDoc} */ @Override public List<Cluster> getClusterSummaries(ClusterFilter filter) { return cRepository.getFilteredClusters(filter); }