egovframework.rte.itl.integration.metadata.ServiceDefinition.java Source code

Java tutorial

Introduction

Here is the source code for egovframework.rte.itl.integration.metadata.ServiceDefinition.java

Source

/*
 * Copyright 2008-2009 MOPAS(Ministry of Public Administration and Security).
 *
 * 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 egovframework.rte.itl.integration.metadata;

import java.util.concurrent.atomic.AtomicBoolean;

import org.springframework.util.StringUtils;

import egovframework.rte.itl.integration.util.Validatable;

/**
 *    ??  '' ?   ?
 * <p>
 * <b>NOTE:</b> ?    ??  '' ? 
 * Class?. <br>
 *    <code>id</code>  ,   
 * Type Id (<code>requestMessageTypeId</code>) ? 
 * Type Id (<code>responseMessageTypeId</code>) 
 * . Attribute <code>serviceProviderBeanId</code>
 *   ?? id Spring Framework? Application
 * Context? ??  bean id?.  <code>null</code> ?
 *  ?   ?.
 * @author   ?
 * @since 2009.06.01
 * @version 1.0
 * @see <pre>
 *  == ?(Modification Information) ==
 *   
 *   ?      ?           
 *  -------    --------    ---------------------------
 *   2009.06.01  ?            ?
 * 
 * </pre>
 */
public class ServiceDefinition implements Validatable {

    /** Key */
    private String key;

    /**  */
    private SystemDefinition system;

    /**  Id */
    private String id;

    /**   */
    private String name;

    /**   Type Id */
    private String requestMessageTypeId;

    /** ?  Type Id */
    private String responseMessageTypeId;

    /**   Bean Id */
    private String serviceProviderBeanId;

    /**  */
    private boolean standard;

    /**  */
    private boolean using;

    /** valid */
    private boolean valid = false;

    /** statucChanged flag */
    private AtomicBoolean statusChanged = new AtomicBoolean(false);

    /**
     * Default Constructor
     */
    public ServiceDefinition() {
        super();
    }

    /**
     * ServiceDefinition ? ?.
     * @param key
     *        KEY
     * @param system
     *        
     * @param id
     *         Id
     * @param name
     *         
     * @param requestMessageTypeId
     *          Type Id
     * @param responseMessageTypeId
     *        ?  Type Id
     * @param serviceProviderBeanId
     *          Bean Id
     * @param standard
     *         
     * @param using
     *         
     */
    public ServiceDefinition(String key, SystemDefinition system, String id, String name,
            String requestMessageTypeId, String responseMessageTypeId, String serviceProviderBeanId,
            boolean standard, boolean using) {
        super();
        this.key = key;
        this.system = system;
        this.id = id;
        this.name = name;
        this.requestMessageTypeId = requestMessageTypeId;
        this.responseMessageTypeId = responseMessageTypeId;
        this.serviceProviderBeanId = serviceProviderBeanId;
        this.standard = standard;
        this.using = using;
        this.statusChanged.set(true);
    }

    /**
     * @return the key
     */
    public String getKey() {
        return key;
    }

    /**
     * @param key
     *        the key to set
     */
    public void setKey(String key) {
        this.key = key;
        this.statusChanged.set(true);
    }

    /**
     * @return the system
     */
    public SystemDefinition getSystem() {
        return system;
    }

    /**
     * @param system
     *        the system to set
     */
    public void setSystem(SystemDefinition system) {
        this.system = system;
        this.statusChanged.set(true);
    }

    /**
     * @return the id
     */
    public String getId() {
        return id;
    }

    /**
     * @param id
     *        the id to set
     */
    public void setId(String id) {
        this.id = id;
        this.statusChanged.set(true);
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name
     *        the name to set
     */
    public void setName(String name) {
        this.name = name;
        this.statusChanged.set(true);
    }

    /**
     * @return the requestMessageTypeId
     */
    public String getRequestMessageTypeId() {
        return requestMessageTypeId;
    }

    /**
     * @param requestMessageTypeId
     *        the requestMessageTypeId to set
     */
    public void setRequestMessageTypeId(String requestMessageTypeId) {
        this.requestMessageTypeId = requestMessageTypeId;
        this.statusChanged.set(true);
    }

    /**
     * @return the responseMessageTypeId
     */
    public String getResponseMessageTypeId() {
        return responseMessageTypeId;
    }

    /**
     * @param responseMessageTypeId
     *        the responseMessageTypeId to set
     */
    public void setResponseMessageTypeId(String responseMessageTypeId) {
        this.responseMessageTypeId = responseMessageTypeId;
        this.statusChanged.set(true);
    }

    /**
     * @return the serviceProviderBeanId
     */
    public String getServiceProviderBeanId() {
        return serviceProviderBeanId;
    }

    /**
     * @param serviceProviderBeanId
     *        the serviceProviderBeanId to set
     */
    public void setServiceProviderBeanId(String serviceProviderBeanId) {
        this.serviceProviderBeanId = serviceProviderBeanId;
        this.statusChanged.set(true);
    }

    /**
     * @return the standard
     */
    public boolean isStandard() {
        return standard;
    }

    /**
     * @param standard
     *        the standard to set
     */
    public void setStandard(boolean standard) {
        this.standard = standard;
        // this.statusChanged.set(true);
    }

    /**
     * @return the using
     */
    public boolean isUsing() {
        return using;
    }

    /**
     * @param using
     *        the using to set
     */
    public void setUsing(boolean using) {
        this.using = using;
        // this.statusChanged.set(true);
    }

    public boolean isValid() {
        if (statusChanged.getAndSet(false)) {
            valid = (StringUtils.hasText(key) && system != null && StringUtils.hasText(id)
                    && StringUtils.hasText(name) && StringUtils.hasText(requestMessageTypeId)
                    && StringUtils.hasText(responseMessageTypeId));
            if (system != null) {
                valid = valid && system.isValid();
            }
        }
        return valid;
    }

    @Override
    public String toString() {
        StringBuffer sb = new StringBuffer();
        sb.append(this.getClass().getName()).append(" {").append("\n\tkey = ").append(StringUtils.quote(key));
        if (system == null) {
            sb.append("\n\tsystem = null");
        } else {
            sb.append("\n\tsystem.key = ").append(StringUtils.quote(system.getKey()));
        }
        sb.append("\n\tid = ").append(StringUtils.quote(id)).append("\n\tname = ").append(StringUtils.quote(name))
                .append("\n\trequestMessageTypeId = ").append(StringUtils.quote(requestMessageTypeId))
                .append("\n\tresponseMessageTypeId = ").append(StringUtils.quote(responseMessageTypeId))
                .append("\n\tserivceProviderBeanId = ").append(StringUtils.quote(serviceProviderBeanId))
                .append("\n\tusing = ").append(using).append("\n\tstandard = ").append(standard).append("\n}");
        return sb.toString();
    }
}