<commit_before>/*
 * Copyright 2008 FatWire Corporation. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.fatwire.gst.foundation.facade.vwebroot;

import java.util.Comparator;
import java.util.SortedSet;
import java.util.TreeSet;

import COM.FutureTense.Interfaces.ICS;
import COM.FutureTense.Interfaces.IList;

import com.fatwire.assetapi.data.AssetData;
import com.fatwire.gst.foundation.core.service.ICSLocatorSupport;
import com.fatwire.gst.foundation.facade.assetapi.AssetDataUtils;
import com.fatwire.gst.foundation.facade.assetapi.AttributeDataUtils;
import com.fatwire.gst.foundation.facade.runtag.asset.AssetList;
import com.fatwire.gst.foundation.facade.sql.IListIterable;
import com.fatwire.gst.foundation.facade.sql.Row;
import com.fatwire.gst.foundation.facade.wra.WebReferenceableAsset;

/**
 * DAO for working with Virtual Webroots
 *
 * @author <NAME>
 * @since Jul 22, 2010
 */
public final class VirtualWebrootDao {

    private final ICS ics;

    public VirtualWebrootDao() {
        this.ics = new ICSLocatorSupport().getICS();
    }

    public VirtualWebrootDao(ICS ics) {
        this.ics = ics;
    }

    public VirtualWebroot getVirtualWebroot(long cid) {
        AssetData ad = AssetDataUtils.getAssetData("GSTVirtualWebroot", Long.toString(cid), "master_vwebroot", "env_vwebroot", "env_name");
        return new VWebrootBeanImpl(cid, AttributeDataUtils.getWithFallback(ad, "master_vwebroot"), AttributeDataUtils.getWithFallback(ad, "env_vwebroot"), AttributeDataUtils.getWithFallback(ad, "env_name"));

    }

    /**
     * Get all of the virtual webroots, sorted by URL length.
     *
     * @return list of virtual webroots
     */
    public SortedSet<VirtualWebroot> getAllVirtualWebroots() {
        AssetList al = new AssetList();
        al.setExcludeVoided(true);
        al.setList("pr-out");
        ics.RegisterList("pr-out", null);
        al.execute(ics);
        IList ilist = ics.GetList("pr-out");
        ics.RegisterList("pr-out", null);
        if (ilist == null) throw new IllegalStateException("No GSTVirtualWebroots are registered");
<commit_msg>added required "TYPE" arg for AssetList in com.fatwire.gst.foundation.facade.vwebroot.VirtualWebrootDao.getAllVirtualWebroots()<commit_after>/*
 * Copyright 2008 FatWire Corporation. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.fatwire.gst.foundation.facade.vwebroot;

import java.util.Comparator;
import java.util.SortedSet;
import java.util.TreeSet;

import COM.FutureTense.Interfaces.ICS;
import COM.FutureTense.Interfaces.IList;

import com.fatwire.assetapi.data.AssetData;
import com.fatwire.gst.foundation.core.service.ICSLocatorSupport;
import com.fatwire.gst.foundation.facade.assetapi.AssetDataUtils;
import com.fatwire.gst.foundation.facade.assetapi.AttributeDataUtils;
import com.fatwire.gst.foundation.facade.runtag.asset.AssetList;
import com.fatwire.gst.foundation.facade.sql.IListIterable;
import com.fatwire.gst.foundation.facade.sql.Row;
import com.fatwire.gst.foundation.facade.wra.WebReferenceableAsset;

/**
 * DAO for working with Virtual Webroots
 *
 * @author <NAME>
 * @since Jul 22, 2010
 */
public final class VirtualWebrootDao {

    private final ICS ics;

    public VirtualWebrootDao() {
        this.ics = new ICSLocatorSupport().getICS();
    }

    public VirtualWebrootDao(ICS ics) {
        this.ics = ics;
    }

    public VirtualWebroot getVirtualWebroot(long cid) {
        AssetData ad = AssetDataUtils.getAssetData("GSTVirtualWebroot", Long.toString(cid), "master_vwebroot", "env_vwebroot", "env_name");
        return new VWebrootBeanImpl(cid, AttributeDataUtils.getWithFallback(ad, "master_vwebroot"), AttributeDataUtils.getWithFallback(ad, "env_vwebroot"), AttributeDataUtils.getWithFallback(ad, "env_name"));

    }

    /**
     * Get all of the virtual webroots, sorted by URL length.
     *
     * @return list of virtual webroots
     */
    public SortedSet<VirtualWebroot> getAllVirtualWebroots() {
        AssetList al = new AssetList();
        al.setExcludeVoided(true);
        al.setList("pr-out");
        al.setType("GSTVirtualWebroot");
        ics.RegisterList("pr-out", null);
        al.execute(ics);
        IList ilist = ics.GetList("pr-out");
        ics.RegisterList("pr-out", null);
        if (ilist == null) throw new IllegalStateException("No GSTVirtualWebroots are registered");

{'fraction_non_alphanumeric': 0.10417049421275032, 'fraction_numerical': 0.005144221936432115, 'mean_word_length': 4.008279668813247, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4049461', 'n_tokens_mistral': 1725, 'n_tokens_neox': 1687, 'n_words': 418}