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

sql.resourceRest.ftl Maven / Gradle / Ivy

package ${packageName};

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.context.annotation.Lazy;

import ${importEntity};
import ${importService};
import br.com.anteros.persistence.session.service.SQLService;
import br.com.anteros.security.spring.AnterosSecurityManager;
import br.com.anteros.spring.web.resource.AbstractSQLResourceRest;
import br.com.anteros.persistence.session.repository.Page;
import br.com.anteros.persistence.session.repository.PageRequest;
import br.com.anteros.persistence.session.repository.Pageable;
import br.com.anteros.persistence.session.repository.impl.PageImpl;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
*  Generated by Anteros Generator Maven Plugin at ${time}
**/

@RestController
@RequestMapping(value = "${requestMapping}")
public class ${resource} extends AbstractSQLResourceRest<${entityType}, Long> {

	@Autowired
	@Lazy
	private ${interfaceService} ${service};

	@Autowired
	@Lazy
	protected AnterosSecurityManager anterosSecurityManager;

	@Override
	public SQLService<${entityType}, Long> getService() {
		return ${service};
	}
	
	@Override
	protected Page<${entityType}> createConcretePage(List<${entityType}> content, PageRequest pageRequest,
			long totalElements) {
		return new Page${entityType}(content, pageRequest, totalElements);
	}

	class Page${entityType} extends PageImpl<${entityType}> {
		public Page${entityType}(List<${entityType}> content) {
			super(content);
		}

		public Page${entityType}(List<${entityType}> content, Pageable pageable, long total) {
			super(content, pageable, total);
		}
	}
	
	@Override
	protected List<${entityType}> createConcreteList(List<${entityType}> result) {
		return new List${entityType}(result);
	}
	
	class List${entityType} extends ArrayList<${entityType}>{
		public List${entityType}(Collection c) {
			super(c);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy