001// -------------------------------------------------------------------------------- 002// Copyright 2002-2025 Echo Three, LLC 003// 004// Licensed under the Apache License, Version 2.0 (the "License"); 005// you may not use this file except in compliance with the License. 006// You may obtain a copy of the License at 007// 008// http://www.apache.org/licenses/LICENSE-2.0 009// 010// Unless required by applicable law or agreed to in writing, software 011// distributed under the License is distributed on an "AS IS" BASIS, 012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013// See the License for the specific language governing permissions and 014// limitations under the License. 015// -------------------------------------------------------------------------------- 016 017package com.echothree.model.control.contact.server.graphql; 018 019import com.echothree.model.control.graphql.server.graphql.BaseEntityInstanceObject; 020import com.echothree.model.data.contact.server.entity.PartyContactMechanismPurpose; 021import com.echothree.model.data.contact.server.entity.PartyContactMechanismPurposeDetail; 022import graphql.annotations.annotationTypes.GraphQLDescription; 023import graphql.annotations.annotationTypes.GraphQLField; 024import graphql.annotations.annotationTypes.GraphQLName; 025import graphql.annotations.annotationTypes.GraphQLNonNull; 026 027@GraphQLDescription("party contact mechanism purpose object") 028@GraphQLName("PartyContactMechanismPurpose") 029public class PartyContactMechanismPurposeObject 030 extends BaseEntityInstanceObject { 031 032 private final PartyContactMechanismPurpose partyContactMechanismPurpose; // Always Present 033 034 public PartyContactMechanismPurposeObject(PartyContactMechanismPurpose partyContactMechanismPurpose) { 035 super(partyContactMechanismPurpose.getPrimaryKey()); 036 037 this.partyContactMechanismPurpose = partyContactMechanismPurpose; 038 } 039 040 private PartyContactMechanismPurposeDetail partyContactMechanismPurposeDetail; // Optional, use getContactMechanismDetail() 041 042 private PartyContactMechanismPurposeDetail getPartyContactMechanismPurposeDetail() { 043 if(partyContactMechanismPurposeDetail == null) { 044 partyContactMechanismPurposeDetail = partyContactMechanismPurpose.getLastDetail(); 045 } 046 047 return partyContactMechanismPurposeDetail; 048 } 049 050 @GraphQLField 051 @GraphQLDescription("party contact mechanism") 052 @GraphQLNonNull 053 public PartyContactMechanismObject getPartyContactMechanism() { 054 return new PartyContactMechanismObject(getPartyContactMechanismPurposeDetail().getPartyContactMechanism()); 055 } 056 057 @GraphQLField 058 @GraphQLDescription("contact mechanism purpose") 059 @GraphQLNonNull 060 public ContactMechanismPurposeObject getContactMechanismPurpose() { 061 return new ContactMechanismPurposeObject(getPartyContactMechanismPurposeDetail().getContactMechanismPurpose()); 062 } 063 064 @GraphQLField 065 @GraphQLDescription("is default") 066 @GraphQLNonNull 067 public Boolean getIsDefault() { 068 return getPartyContactMechanismPurposeDetail().getIsDefault(); 069 } 070 071 @GraphQLField 072 @GraphQLDescription("sort order") 073 @GraphQLNonNull 074 public Integer getSortOrder() { 075 return getPartyContactMechanismPurposeDetail().getSortOrder(); 076 } 077 078}