Commit e6f6cdb5 authored by Noel Alonso's avatar Noel Alonso
Browse files

Añade componentes para el dominio resourceType

parent de9f48f7
Loading
Loading
Loading
Loading
+11 −19
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import javax.persistence.NamedQuery;
import javax.persistence.Table;

import es.redmic.databaselib.common.model.LongModel;
import es.redmic.db.maintenance.administrative.model.ResourceType;

/**
 * The persistent class for the activityresource database table.
@@ -45,11 +46,10 @@ public class ActivityResource extends LongModel implements Serializable {
	@JoinColumn(name = "activityid", nullable = false)
	private ActivityBase activity;

	@Column(nullable = false, length = 100)
	private String name;

	@Column(length = 1500)
	private String description;
	// bi-directional many-to-one association to Rank
	@ManyToOne
	@JoinColumn(name = "resourcetypeid", insertable = false, updatable = false, nullable=false)
	private ResourceType resourceType;

	@Column(name = "urlresource", length = 500)
	private String urlResource;
@@ -66,20 +66,12 @@ public class ActivityResource extends LongModel implements Serializable {
		this.activity = activityBase;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return this.description;
	public ResourceType getResourceType() {
		return this.resourceType;
	}

	public void setDescription(String description) {
		this.description = description;
	public void setResourceType(ResourceType resourceType) {
		this.resourceType = resourceType;
	}

	public String getUrlResource() {
+89 −0
Original line number Diff line number Diff line
package es.redmic.db.maintenance.administrative.model;

/*-
 * #%L
 * DB
 * %%
 * Copyright (C) 2019 REDMIC Project / Server
 * %%
 * 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.
 * #L%
 */

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;


import es.redmic.db.administrative.model.Activity;
import es.redmic.db.administrative.model.ActivityResource;
import es.redmic.db.common.model.DomainModel;

/**
 * The persistent class for the activitytype database table.
 *
 */
@Entity
@Table(name = "resourcetype")
@NamedQuery(name = "ResourceType.findAll", query = "SELECT a FROM ResourceType a")
public class ResourceType extends DomainModel implements Serializable {
	private static final long serialVersionUID = 1L;

	@Column(length = 50)
	private String description;

	// bi-directional many-to-one association to Activityresources
	@OneToMany(mappedBy = "resourcetype")
	private Set<ActivityResource> activityresources;

	public ResourceType() {
		super();
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Set<ActivityResource> getActivityresources() {
		return this.activityresources;
	}

	public void setActivityresources(Set<ActivityResource> activityresources) {
		this.activityresources = activityresources;
	}

	public ActivityResource addActivityresources(ActivityResource activityresources) {
		getActivityresources().add(activityresources);
		activityresources.setResourceType(this);

		return activityresources;
	}

	public ActivityResource removeActivityresources(ActivityResource activityresources) {
		getActivityresources().remove(activityresources);
		activityresources.setResourceType(null);

		return activityresources;
	}
}
+28 −0
Original line number Diff line number Diff line
package es.redmic.db.maintenance.administrative.repository;

/*-
 * #%L
 * DB
 * %%
 * Copyright (C) 2019 REDMIC Project / Server
 * %%
 * 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.
 * #L%
 */

import es.redmic.databaselib.common.repository.BaseRepository;
import es.redmic.db.maintenance.administrative.model.ResourceType;

public interface ResourceTypeRepository extends BaseRepository<ResourceType, Long> {

}
+38 −0
Original line number Diff line number Diff line
package es.redmic.db.maintenance.administrative.service;

/*-
 * #%L
 * DB
 * %%
 * Copyright (C) 2019 REDMIC Project / Server
 * %%
 * 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.
 * #L%
 */

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import es.redmic.db.common.service.ServiceRWImpl;
import es.redmic.db.maintenance.administrative.model.ResourceType;
import es.redmic.db.maintenance.administrative.repository.ResourceTypeRepository;
import es.redmic.models.es.maintenance.administrative.dto.ResourceTypeDTO;

@Service
public class ResourceTypeService extends ServiceRWImpl<ResourceType, ResourceTypeDTO> {

	@Autowired
	public ResourceTypeService(ResourceTypeRepository repository) {
		super(repository);
	}
}