All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jp.co.tis.gsp.tools.db.beans.Erd Maven / Gradle / Ivy

Go to download

To automate the routine work of the DBA, it is a tool to be able to concentrate on the data modeling work.

There is a newer version: 5.0.0
Show newest version
/*
 * Copyright (C) 2015 coastland
 *
 * 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 jp.co.tis.gsp.tools.db.beans;

import java.util.List;

import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement;

import org.apache.commons.lang.StringUtils;

@XmlRootElement(name="ERD")
public class Erd {
	@XmlElementRef(name="ENTITY")
	public List entityList;

	@XmlElementRef(name="MODELVIEW")
	public List modelViewList;

	private List relationList;

	private List dataTypeList;

	private List viewList;

	private String schema;


	@XmlElementRef(name="RELATION")
	public List getRelationList() {
		return relationList;
	}

	public void setRelationList(List relationList) {
		this.relationList = relationList;
	}

	@XmlElementRef(name="TYPETABLE")
	public List getDataTypeList() {
		return dataTypeList;
	}

	public void setDataTypeList(List dataTypeList) {
		this.dataTypeList = dataTypeList;
	}

	public DataType getDataType(String name) {
		for(DataType dataType : dataTypeList) {
			if (StringUtils.equals(dataType.getName(), name))
				return dataType;
		}
		return null;
	}

	public Relation getRelation(Integer relationId) {
		for(Relation relation : relationList) {
			if ((int)relation.getId() == (int)relationId) {
				return relation;
			}
		}

		return null;
	}

	public Entity getEntity(Integer entityId) {
		for(Entity entity : entityList) {
			if ((int)entity.getId() == (int)entityId) {
				return entity;
			}
		}
		return null;
	}

	@XmlElementRef(name="VIEW")
	public List getViewList() {
		return viewList;
	}

	public void setViewList(List viewList) {
		this.viewList = viewList;
	}

	public String getSchema() {
		return schema;
	}

	public void setSchema(String schema) {
		this.schema = schema;
	}
	
	public View getView(Integer viewId) {
		for(View view : viewList) {
			if ((int)view.getId() == (int)viewId) {
				return view;
			}
		}
		return null;
	}

	public void init() {
		for(Entity entity : entityList) {
			entity.setErd(this);
			entity.init();
		}

		for(ModelView modelView : modelViewList) {
			// MODELVIEWはENTITYのIDだけしかないので本物の参照させる
			List modelViewEntityList = modelView.getEntityList();
			if (modelViewEntityList != null) {
				for(int i=0; i modelViewViewList = modelView.getViewList();
			if(modelViewViewList != null) {
				for(int i=0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy