Package org.hibernate.criterion

Examples of org.hibernate.criterion.Criterion


        final Criteria criteria)
    {
        criteria.createAlias(VirtualMachineTemplate.CONVERSIONS_PROPERTY, "conversions",
            JoinFragment.LEFT_OUTER_JOIN);

        Criterion finished =
            Restrictions.eq("conversions." + VirtualImageConversion.STATE_PROPERTY,
                ConversionState.FINISHED);

        Criterion compatible =
            Restrictions.in("conversions." + VirtualImageConversion.TARGET_TYPE_PROPERTY, types);

        return Restrictions.and(finished, compatible);
    }
View Full Code Here


    }

    private static Criterion statefulVirtualMachineTemplate(final StatefulInclusion stateful,
        final Criteria criteria)
    {
        Criterion cri = Restrictions.eq(VirtualMachineTemplate.STATEFUL_PROPERTY, true);

        switch (stateful)
        {
            case ALL:
                /*
 
View Full Code Here

    }

    private static Criterion sameEnterpriseOrSharedInRepo(final Enterprise enterprise,
        final com.abiquo.server.core.infrastructure.Repository repository, final String path)
    {
        Criterion sameEnterpriseOrSharedInRepo =
            Restrictions.and(sameRepositoryAndNotStatefull(repository),
                Restrictions.or(sameEnterprise(enterprise), sharedVirtualMachineTemplate()));

        return Restrictions.and(Restrictions.eq(VirtualMachineTemplate.PATH_PROPERTY, path),
            sameEnterpriseOrSharedInRepo);
View Full Code Here

        final com.abiquo.server.core.infrastructure.Repository repository, final Category category,
        final HypervisorType hypervisor, final OSType ostype, final Boolean is64b,
        final boolean imported, final FilterOptions filters)
    {
        Criteria crit = null;
        Criterion sameEnterpriseOrShared = sameEnterpriseOrSharedInRepo(enterprise, repository);

        if (imported)
        {
            Criterion importedTemplate = importedVirtualMachineTemplate(enterprise);
            crit = createCriteria(Restrictions.or(sameEnterpriseOrShared, importedTemplate));
        }
        else
        {
            crit = createCriteria(sameEnterpriseOrShared);
View Full Code Here

     * @return The global <code>FitPolicyRuleHB</code>.
     */
    public FitPolicyRule getGlobalFitPolicy()
    {
        Criteria criteria = getSession().createCriteria(FitPolicyRule.class);
        Criterion noDatacenter = Restrictions.isNull(FitPolicyRule.DATACENTER_PROPERTY);
        criteria.add(noDatacenter);

        FitPolicyRule result = getSingleResult(criteria);

        return result;
View Full Code Here

     * @return The global <code>FitPolicyRuleHB</code>.
     */
    public List<FitPolicyRule> getDatacenterFitPolicies()
    {
        Criteria criteria = getSession().createCriteria(FitPolicyRule.class);
        Criterion anyDatacenter = Restrictions.isNotNull(FitPolicyRule.DATACENTER_PROPERTY);
        criteria.add(anyDatacenter);

        // criteria.addOrder(Order.asc(FitPolicyRule.ID_PROPERTY));

        List<FitPolicyRule> result = getResultList(criteria);
View Full Code Here

        return Restrictions.eq(VirtualImageConversion.VIRTUAL_MACHINE_TEMPLATE_PROPERTY, image);
    }

    private static Criterion sameImageAndSourcePath(final VirtualImageConversion conversion)
    {
        final Criterion sameimage =
            Restrictions.eq(VirtualImageConversion.VIRTUAL_MACHINE_TEMPLATE_PROPERTY,
                conversion.getVirtualMachineTemplate());

        final Criterion samesourcepath =
            Restrictions
                .eq(VirtualImageConversion.SOURCE_PATH_PROPERTY, conversion.getSourcePath());

        return Restrictions.and(sameimage, samesourcepath);
    }
View Full Code Here

     */
    @SuppressWarnings("unchecked")
    public List<VirtualImageConversion> compatilbeConversions(
        final VirtualMachineTemplate virtualImage, final HypervisorType hypervisorType)
    {
        final Criterion compat =
            Restrictions.and(sameImage(virtualImage),
                targetFormatIn(hypervisorType.compatibilityTable));

        return createCriteria(compat).list();
    }
View Full Code Here

     */
    public List<VirtualImageConversion> getConversionsOptionalHypervisorTypeAndState(
        final VirtualMachineTemplate virtualImage, final HypervisorType hypervisorType,
        final ConversionState state)
    {
        Criterion criterion = sameImage(virtualImage);

        if (hypervisorType != null)
        {
            criterion =
                Restrictions.and(criterion, targetFormatIn(hypervisorType.compatibilityTable));
View Full Code Here

        return null;
    }

    public boolean isConverted(final VirtualMachineTemplate image, final DiskFormatType targetType)
    {
        final Criterion compat = Restrictions.and(sameImage(image), targetFormatIn(targetType));
        return !createCriteria(compat).list().isEmpty();
    }
View Full Code Here

TOP

Related Classes of org.hibernate.criterion.Criterion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.