/*
 * $Id: UrlConversionRequest.java,v 1.4 2007/08/09 14:38:58 marbobo Exp $
 *
 * Copyright (c) Siemens AG 2008 
 *           (c) Universität Paderborn 2008 
 * Licensed under EUPL 1.1. 
 *
 * $Log: UrlConversionRequest.java,v $
 * Revision 1.4  2007/08/09 14:38:58  marbobo
 * - 2 falsch zugeordnete LDAP- Parameter entfernt
 * + Löschen und Aktivieren von Lizenzen hinzugefügt
 *
 * Revision 1.3  2004/02/25 18:35:08  koppy
 * Bestimmung der docTypeId
 *
 * Revision 1.2  2004/02/24 09:23:21  koppy
 * + toString()
 *
 * Revision 1.1  2004/01/16 14:19:39  koppy
 * Initiale Version
 *
 */
package vkc.converter.common;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.Collection;

import vkc.converter.DocConverter;

/**
 * This class represents a request for the ConverterServer. It contains all
 * neccessary information for a conversion of a link (URL)
 * 
 * @author koppy
 */
public class UrlConversionRequest extends ConversionRequest {
    private String link;

    /**
     * Constructs a converter request
     * 
     * @param link
     *            for this link
     */
    public UrlConversionRequest(String link) {
        super();
        this.link = link;

    }

    /**
     * Constructs a converter request
     * 
     * @param link
     *            for this link
     * @param conversions
     *            for this desired output conversions (collection of type
     *            VKCDocumentType)
     */
    public UrlConversionRequest(String link, Collection conversions) {
        super(conversions);
        this.link = link;
    }

    /**
     * @return
     */
    public String getLink() {
        return link;
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.lang.Object#toString()
     */
    public String toString() {
        return "URLconversion: link=" + this.link;
    }

    /*
     * (non-Javadoc)
     * 
     * @see vkc.converter.common.ConversionRequest#getDocTypeId()
     */
    public int getDocTypeId() {
        try {
            return DocConverter.calculateDocTypeID(new URL(link));
        } catch (MalformedURLException e) {
            // unbekannt
            return 0;
        }
    }
}