/** * Copy given component * * @param c component to copy * @return new instance of MutableProjectComponent set with values of the given component */ public static MutableProjectComponent copy(final ProjectComponent c) { MutableProjectComponent mutableProjectComponent = new MutableProjectComponent(c.getId(), c.getName(), c.getDescription(), c.getLead(), c.getAssigneeType(), c.getProjectId()); mutableProjectComponent.setGenericValue(c.getGenericValue()); return mutableProjectComponent; }
/** * Convert the specified GenericValue representing a MutableProjectComponent object to a MutableProjectComponent * object. * * @param componentGV GenericValue object representing a MutableProjectComponent object to be converted to a * MutableProjectComponent object * @return new MutableProjectComponent object that represents the original GenericValue object */ public MutableProjectComponent convertToComponent(GenericValue componentGV) { Long id = componentGV.getLong(OfBizProjectComponentStore.FIELD_ID); String name = componentGV.getString(OfBizProjectComponentStore.FIELD_NAME); String description = componentGV.getString(OfBizProjectComponentStore.FIELD_DESCRIPTION); String lead = componentGV.getString(OfBizProjectComponentStore.FIELD_LEAD); Long projectId = componentGV.getLong(OfBizProjectComponentStore.FIELD_PROJECT); Long assigneeTypeLong = componentGV.getLong(OfBizProjectComponentStore.FIELD_ASSIGNEE_TYPE); long assigneeType; if (assigneeTypeLong != null) { assigneeType = assigneeTypeLong; } else { assigneeType = AssigneeTypes.PROJECT_DEFAULT; } MutableProjectComponent mutableProjectComponent = new MutableProjectComponent(id, name, description, lead, assigneeType, projectId); mutableProjectComponent.setGenericValue(componentGV); return mutableProjectComponent; }
component.setGenericValue(componentGV);