Skip to content

Commit

Permalink
Merge pull request #285 from fayranne/feature/bhOneEntities
Browse files Browse the repository at this point in the history
Feature/bh one entities
  • Loading branch information
johnsully83 authored Apr 13, 2020
2 parents d825261 + 4c1c30d commit 325f3c8
Show file tree
Hide file tree
Showing 36 changed files with 3,363 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.bullhorn</groupId>
<artifactId>sdk-rest</artifactId>
<version>1.2.55</version>
<version>1.3.0</version>
<packaging>jar</packaging>

<name>Bullhorn REST SDK</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
package com.bullhornsdk.data.model.entity.association;

import com.bullhornsdk.data.model.entity.association.paybill.BillingProfileAssociations;
import com.bullhornsdk.data.model.entity.association.paybill.InvoiceTermAssociations;
import com.bullhornsdk.data.model.entity.association.paybill.LocationAssociations;
import com.bullhornsdk.data.model.entity.association.standard.*;
import com.bullhornsdk.data.model.entity.core.paybill.BillingProfile;
import com.bullhornsdk.data.model.entity.core.paybill.Location;
import com.bullhornsdk.data.model.entity.core.paybill.invoice.InvoiceTerm;
import com.bullhornsdk.data.model.entity.core.standard.*;
import com.bullhornsdk.data.model.entity.core.type.AssociationEntity;
import com.bullhornsdk.data.model.entity.core.type.BullhornEntity;
Expand Down Expand Up @@ -29,6 +35,9 @@ public class AssociationFactory {
private static final LeadAssociations leadAssociations = LeadAssociations.getInstance();
private static final TearsheetAssociations tearsheetAssociations = TearsheetAssociations.getInstance();
private static final WorkersCompensationAssociations workersCompensationAssociations = WorkersCompensationAssociations.getInstance();
private static final BillingProfileAssociations billingProfileAssociations = BillingProfileAssociations.getInstance();
private static final LocationAssociations locationAssociations = LocationAssociations.getInstance();
private static final InvoiceTermAssociations invoiceTermAssociations = InvoiceTermAssociations.getInstance();

/**
* Returns the AssociationField for the passed in entity type (Candiate, ClientContact etc.), with the association name of the
Expand Down Expand Up @@ -117,6 +126,18 @@ private static <T extends AssociationEntity> EntityAssociations<T> getEntityAsso
return (EntityAssociations<T>) workersCompensationAssociations;
}

if (type == BillingProfile.class) {
return (EntityAssociations<T>) billingProfileAssociations;
}

if (type == InvoiceTerm.class) {
return (EntityAssociations<T>) invoiceTermAssociations;
}

if (type == Location.class) {
return (EntityAssociations<T>) locationAssociations;
}

return null;

}
Expand Down Expand Up @@ -252,6 +273,33 @@ public static TearsheetAssociations tearsheetAssociations() {
return tearsheetAssociations;
}

/**
* Returns the associations for BillingProfileAssociations
*
* @return
*/
public static BillingProfileAssociations billingProfileAssociations() {
return billingProfileAssociations;
}

/**
* Returns the associations for LocationAssociations
*
* @return
*/
public static LocationAssociations locationAssociations() {
return locationAssociations;
}

/**
* Returns the associations for InvoiceTermAssociations
*
* @return
*/
public static InvoiceTermAssociations invoiceTermAssociations() {
return invoiceTermAssociations;
}

/**
* Returns the associations for WorkersCompensation
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.bullhornsdk.data.model.entity.association.paybill;

import com.bullhornsdk.data.model.entity.association.AssociationField;
import com.bullhornsdk.data.model.entity.association.EntityAssociations;
import com.bullhornsdk.data.model.entity.association.standard.StandardAssociationField;
import com.bullhornsdk.data.model.entity.core.paybill.BillingProfile;
import com.bullhornsdk.data.model.entity.core.paybill.BillingProfileVersion;
import com.bullhornsdk.data.model.entity.core.type.BullhornEntity;

import java.util.ArrayList;
import java.util.List;

/**
* Created by fayranne.lipton 4/10/2020
*/
public class BillingProfileAssociations implements EntityAssociations<BillingProfile> {

private List<AssociationField<BillingProfile, ? extends BullhornEntity>> allAssociations;
private final AssociationField<BillingProfile, BillingProfileVersion> versions = instantiateAssociationField("versions", BillingProfileVersion.class);

private static final BillingProfileAssociations INSTANCE = new BillingProfileAssociations();

private BillingProfileAssociations() {
super();
}

public static BillingProfileAssociations getInstance() {
return INSTANCE;
}

public AssociationField<BillingProfile, BillingProfileVersion> versions() {
return versions;
}

private <E extends BullhornEntity> AssociationField<BillingProfile, E> instantiateAssociationField(String associationName, Class<E> associationType) {
return new StandardAssociationField<BillingProfile, E>(associationName, associationType);
}

@Override
public List<AssociationField<BillingProfile, ? extends BullhornEntity>> allAssociations() {
if (allAssociations == null) {
allAssociations = new ArrayList<AssociationField<BillingProfile, ? extends BullhornEntity>>();
allAssociations.add(versions());

}
return allAssociations;
}

@Override
public AssociationField<BillingProfile, ? extends BullhornEntity> getAssociation(String associationName) {
for (AssociationField<BillingProfile, ? extends BullhornEntity> associationField : allAssociations()) {
if (associationName.equalsIgnoreCase(associationField.getAssociationFieldName())) {
return associationField;
}
}

throw new IllegalArgumentException("There is no association on entity BillingProfile called: " + associationName);
}
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.bullhornsdk.data.model.entity.association.paybill;

import com.bullhornsdk.data.model.entity.association.AssociationField;
import com.bullhornsdk.data.model.entity.association.EntityAssociations;
import com.bullhornsdk.data.model.entity.association.standard.StandardAssociationField;
import com.bullhornsdk.data.model.entity.core.paybill.invoice.InvoiceTerm;
import com.bullhornsdk.data.model.entity.core.paybill.invoice.InvoiceTermVersion;
import com.bullhornsdk.data.model.entity.core.type.BullhornEntity;

import java.util.ArrayList;
import java.util.List;

/**
* Created by fayranne.lipton 4/10/2020
*/
public class InvoiceTermAssociations implements EntityAssociations<InvoiceTerm> {

private List<AssociationField<InvoiceTerm, ? extends BullhornEntity>> allAssociations;
private final AssociationField<InvoiceTerm, InvoiceTermVersion> versions = instantiateAssociationField("versions", InvoiceTermVersion.class);

private static final InvoiceTermAssociations INSTANCE = new InvoiceTermAssociations();

private InvoiceTermAssociations() {
super();
}

public static InvoiceTermAssociations getInstance() {
return INSTANCE;
}

public AssociationField<InvoiceTerm, InvoiceTermVersion> versions() {
return versions;
}

private <E extends BullhornEntity> AssociationField<InvoiceTerm, E> instantiateAssociationField(String associationName, Class<E> associationType) {
return new StandardAssociationField<InvoiceTerm, E>(associationName, associationType);
}

@Override
public List<AssociationField<InvoiceTerm, ? extends BullhornEntity>> allAssociations() {
if (allAssociations == null) {
allAssociations = new ArrayList<AssociationField<InvoiceTerm, ? extends BullhornEntity>>();
allAssociations.add(versions());

}
return allAssociations;
}

@Override
public AssociationField<InvoiceTerm, ? extends BullhornEntity> getAssociation(String associationName) {
for (AssociationField<InvoiceTerm, ? extends BullhornEntity> associationField : allAssociations()) {
if (associationName.equalsIgnoreCase(associationField.getAssociationFieldName())) {
return associationField;
}
}

throw new IllegalArgumentException("There is no association on entity InvoiceTerm called: " + associationName);
}
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.bullhornsdk.data.model.entity.association.paybill;

import com.bullhornsdk.data.model.entity.association.AssociationField;
import com.bullhornsdk.data.model.entity.association.EntityAssociations;
import com.bullhornsdk.data.model.entity.association.standard.StandardAssociationField;
import com.bullhornsdk.data.model.entity.core.paybill.Location;
import com.bullhornsdk.data.model.entity.core.paybill.LocationVersion;
import com.bullhornsdk.data.model.entity.core.type.BullhornEntity;

import java.util.ArrayList;
import java.util.List;

/**
* Created by fayranne.lipton 4/10/2020
*/
public class LocationAssociations implements EntityAssociations<Location> {

private List<AssociationField<Location, ? extends BullhornEntity>> allAssociations;
private final AssociationField<Location, LocationVersion> versions = instantiateAssociationField("versions", LocationVersion.class);

private static final LocationAssociations INSTANCE = new LocationAssociations();

private LocationAssociations() {
super();
}

public static LocationAssociations getInstance() {
return INSTANCE;
}

public AssociationField<Location, LocationVersion> versions() {
return versions;
}

private <E extends BullhornEntity> AssociationField<Location, E> instantiateAssociationField(String associationName, Class<E> associationType) {
return new StandardAssociationField<Location, E>(associationName, associationType);
}

@Override
public List<AssociationField<Location, ? extends BullhornEntity>> allAssociations() {
if (allAssociations == null) {
allAssociations = new ArrayList<AssociationField<Location, ? extends BullhornEntity>>();
allAssociations.add(versions());

}
return allAssociations;
}

@Override
public AssociationField<Location, ? extends BullhornEntity> getAssociation(String associationName) {
for (AssociationField<Location, ? extends BullhornEntity> associationField : allAssociations()) {
if (associationName.equalsIgnoreCase(associationField.getAssociationFieldName())) {
return associationField;
}
}

throw new IllegalArgumentException("There is no association on entity Location called: " + associationName);
}
}


Loading

0 comments on commit 325f3c8

Please sign in to comment.