Skip to content

Commit

Permalink
Add parent code methods to interface (#793)
Browse files Browse the repository at this point in the history
  • Loading branch information
joniles authored Dec 16, 2024
1 parent f55dfa8 commit 3604a1c
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 188 deletions.
1 change: 1 addition & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<action dev="joniles" type="update">Marked the `ActivityCodeValue.getParent()` method as deprecated. Use `ActivityCodeValue.getParentValue()` instead.</action>
<action dev="joniles" type="update">Marked the `ActivityCodeValue.getParentUniqueID()` method as deprecated. Use `ActivityCodeValue.getParentValueUniqueID()` instead.</action>
<action dev="joniles" type="update">Marked the `ActivityCodeValue.Builder.parent()` method as deprecated. Use `ActivityCodeValue.Builder.parentValue()` instead.</action>
<action dev="joniles" type="update">Marked the `ActivityCodeValue.getActivityCode()` method as deprecated. Use `ActivityCodeValue.getParentCode()` instead.</action>
</release>
<release date="2024-11-25" version="13.7.0">
<action dev="joniles" type="update">Update the MPXJ ruby gem to allow access to calendar data.</action>
Expand Down
17 changes: 9 additions & 8 deletions src/main/java/net/sf/mpxj/ActivityCodeValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private ActivityCodeValue(Builder builder)
* Retrieves the parent activity code.
*
* @return ActivityCode instance
* @deprecated use getActivityCode instead
* @deprecated use getParentCode instead
*/
@Deprecated public ActivityCode getType()
{
Expand All @@ -63,18 +63,19 @@ private ActivityCodeValue(Builder builder)
* Retrieves the parent activity code.
*
* @return ActivityCode instance
* @deprecated use getParentCode instead
*/
public ActivityCode getActivityCode()
@Deprecated public ActivityCode getActivityCode()
{
return m_activityCode;
}

/**
* Retrieves the parent activity code unique ID.
*
* @return parent activity code unique ID
*/
public Integer getActivityCodeUniqueID()
@Override public ActivityCode getParentCode()
{
return m_activityCode;
}

@Override public Integer getParentCodeUniqueID()
{
return m_activityCode == null ? null : m_activityCode.getUniqueID();
}
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/net/sf/mpxj/CodeValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ public interface CodeValue
*/
Integer getUniqueID();

/**
* Retrieve the parent Code.
*
* @return parent Code instance
*/
Code getParentCode();

/**
* Retrieve the parent code's unique ID.
*
* @return parent code unique ID
*/
Integer getParentCodeUniqueID();

/**
* Retrieves the sequence number for this value.
*
Expand Down
14 changes: 2 additions & 12 deletions src/main/java/net/sf/mpxj/ProjectCodeValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,12 @@ private ProjectCodeValue(Builder builder)
m_parentValue = builder.m_parentValue;
}

/**
* Retrieves the parent project code.
*
* @return ProjectCode instance
*/
public ProjectCode getProjectCode()
@Override public ProjectCode getParentCode()
{
return m_projectCode;
}

/**
* Retrieves the parent project code unique ID.
*
* @return parent project code unique ID
*/
public Integer getProjectCodeUniqueID()
@Override public Integer getParentCodeUniqueID()
{
return m_projectCode == null ? null : m_projectCode.getUniqueID();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/sf/mpxj/ProjectProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -3598,7 +3598,7 @@ public void setProjectWebsiteUrl(String value)
*/
@SuppressWarnings("unchecked") public void addProjectCodeValue(ProjectCodeValue value)
{
((Map<ProjectCode, ProjectCodeValue>) get(ProjectField.PROJECT_CODE_VALUES)).put(value.getProjectCode(), value);
((Map<ProjectCode, ProjectCodeValue>) get(ProjectField.PROJECT_CODE_VALUES)).put(value.getParentCode(), value);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/sf/mpxj/Resource.java
Original file line number Diff line number Diff line change
Expand Up @@ -2712,7 +2712,7 @@ public void setPrimaryRole(Resource role)
*/
@SuppressWarnings("unchecked") public void addResourceCodeValue(ResourceCodeValue value)
{
((Map<ResourceCode, ResourceCodeValue>) get(ResourceField.RESOURCE_CODE_VALUES)).put(value.getResourceCode(), value);
((Map<ResourceCode, ResourceCodeValue>) get(ResourceField.RESOURCE_CODE_VALUES)).put(value.getParentCode(), value);
}

/**
Expand All @@ -2732,7 +2732,7 @@ public void setPrimaryRole(Resource role)
*/
@SuppressWarnings("unchecked") public void addRoleCodeValue(RoleCodeValue value)
{
((Map<RoleCode, RoleCodeValue>) get(ResourceField.ROLE_CODE_VALUES)).put(value.getRoleCode(), value);
((Map<RoleCode, RoleCodeValue>) get(ResourceField.ROLE_CODE_VALUES)).put(value.getParentCode(), value);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/sf/mpxj/ResourceAssignment.java
Original file line number Diff line number Diff line change
Expand Up @@ -3030,7 +3030,7 @@ public Rate getEffectiveRate(LocalDateTime date)
*/
@SuppressWarnings("unchecked") public void addResourceAssignmentCodeValue(ResourceAssignmentCodeValue value)
{
((Map<ResourceAssignmentCode, ResourceAssignmentCodeValue>) get(AssignmentField.RESOURCE_ASSIGNMENT_CODE_VALUES)).put(value.getResourceAssignmentCode(), value);
((Map<ResourceAssignmentCode, ResourceAssignmentCodeValue>) get(AssignmentField.RESOURCE_ASSIGNMENT_CODE_VALUES)).put(value.getParentCode(), value);
}

/**
Expand Down
14 changes: 2 additions & 12 deletions src/main/java/net/sf/mpxj/ResourceAssignmentCodeValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,12 @@ private ResourceAssignmentCodeValue(Builder builder)
m_parentValue = builder.m_parentValue;
}

/**
* Retrieves the parent assignment code.
*
* @return ResourceAssignmentCode instance
*/
public ResourceAssignmentCode getResourceAssignmentCode()
@Override public ResourceAssignmentCode getParentCode()
{
return m_resourceAssignmentCode;
}

/**
* Retrieves the parent assignment code unique ID.
*
* @return parent assignment code unique ID
*/
public Integer getResourceAssignmentCodeUniqueID()
@Override public Integer getParentCodeUniqueID()
{
return m_resourceAssignmentCode == null ? null : m_resourceAssignmentCode.getUniqueID();
}
Expand Down
14 changes: 2 additions & 12 deletions src/main/java/net/sf/mpxj/ResourceCodeValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,12 @@ private ResourceCodeValue(Builder builder)
m_parentValue = builder.m_parentValue;
}

/**
* Retrieves the parent resource code.
*
* @return ResourceCode instance
*/
public ResourceCode getResourceCode()
@Override public ResourceCode getParentCode()
{
return m_resourceCode;
}

/**
* Retrieves the parent resource code unique ID.
*
* @return parent resource code unique ID
*/
public Integer getResourceCodeUniqueID()
@Override public Integer getParentCodeUniqueID()
{
return m_resourceCode == null ? null : m_resourceCode.getUniqueID();
}
Expand Down
14 changes: 2 additions & 12 deletions src/main/java/net/sf/mpxj/RoleCodeValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,12 @@ private RoleCodeValue(Builder builder)
m_parentValue = builder.m_parentValue;
}

/**
* Retrieves the parent role code.
*
* @return RoleCode instance
*/
public RoleCode getRoleCode()
@Override public RoleCode getParentCode()
{
return m_roleCode;
}

/**
* Retrieves the parent role code unique ID.
*
* @return parent role code unique ID
*/
public Integer getRoleCodeUniqueID()
@Override public Integer getParentCodeUniqueID()
{
return m_roleCode == null ? null : m_roleCode.getUniqueID();
}
Expand Down
Loading

0 comments on commit 3604a1c

Please sign in to comment.