AppResourceRepository.java
/*
* Copyright 2020 Global Crop Diversity Trust
*
* 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 org.gringlobal.persistence;
import org.gringlobal.model.AppResource;
import org.gringlobal.spring.persistence.ExtendedJpaRepository;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.stereotype.Repository;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* The Interface AppResourceRepository.
*
* @author Matija Obreza
*/
@Repository
public interface AppResourceRepository extends AppResourceRepositoryCustom, ExtendedJpaRepository<AppResource, Long>, QuerydslPredicateExecutor<AppResource> {
/**
* Simplified AppResource for clients
*/
public static class AppResourceInfo {
@JsonIgnore
public String formName;
@JsonIgnore
public String resourceName;
public String lang;
public String valueMember;
public String displayMember;
public Integer sortOrder;
public String description;
public String properties;
public AppResourceInfo(AppResource appResource) {
this.lang = appResource.getSysLang().getIetfTag();
this.formName = appResource.getFormName();
this.resourceName = appResource.getAppResourceName();
this.valueMember = appResource.getValueMember();
this.description = appResource.getDescription();
this.displayMember = appResource.getDisplayMember();
this.properties = appResource.getProperties();
this.sortOrder = appResource.getSortOrder();
}
}
}