public function build(Planning_Milestone $milestone) { $this->id = JsonCast::toInt($milestone->getArtifactId()); $this->uri = MilestoneRepresentation::ROUTE . '/' . $this->id; $this->tracker = new TrackerReference(); $this->tracker->build($milestone->getArtifact()->getTracker()); }
public function build(Tracker_FormElement_Field_OpenList $field, $type, array $permissions) { $this->field_id = JsonCast::toInt($field->getId()); $this->name = $field->getName(); $this->label = $field->getLabel(); $this->hint = $field->getProperty('hint'); if ($field instanceof Tracker_FormElement_Field) { $this->required = JsonCast::toBoolean($field->isRequired()); $this->collapsed = false; } else { $this->required = false; $this->collapsed = (bool) $field->isCollapsed(); } $this->default_value = $field->getDefaultRESTValue(); $this->type = $type; $this->values = null; if ($field->getRESTAvailableValues()) { $this->values = $field->getRESTAvailableValues(); } $bindings = $field->getSoapBindingProperties(); $this->bindings = array(self::BIND_TYPE => $bindings[Tracker_FormElement_Field_List_Bind::SOAP_TYPE_KEY], self::BIND_LIST => array_map(function ($binding) { return array(Tracker_REST_FieldRepresentation::BIND_ID => $binding[Tracker_FormElement_Field_List_Bind_Users::SOAP_BINDING_LIST_ID], Tracker_REST_FieldRepresentation::BIND_LABEL => $binding[Tracker_FormElement_Field_List_Bind_Users::SOAP_BINDING_LIST_LABEL]); }, $bindings[Tracker_FormElement_Field_List_Bind::SOAP_LIST_KEY])); $this->permissions = array_map(function ($permission) { switch ($permission) { case Tracker_FormElement::SOAP_PERMISSION_READ: return Tracker_REST_FieldRepresentation::PERM_READ; case Tracker_FormElement::SOAP_PERMISSION_UPDATE: return Tracker_REST_FieldRepresentation::PERM_UPDATE; case Tracker_FormElement::SOAP_PERMISSION_SUBMIT: return Tracker_REST_FieldRepresentation::PERM_CREATE; } }, $permissions); }
public function build($id, $is_used, WorkflowRulesRepresentation $rules, array $transitions) { $this->field_id = JsonCast::toInt($id); $this->is_used = $is_used; $this->rules = $rules; $this->transitions = $transitions; }
public function build($source_field_id, $source_value_id, $target_field_id, $target_value_id) { $this->source_field_id = JsonCast::toInt($source_field_id); $this->source_value_id = JsonCast::toInt($source_value_id); $this->target_field_id = JsonCast::toInt($target_field_id); $this->target_value_id = JsonCast::toInt($target_value_id); }
public function build($id, $label, array $granted_groups, array $granted_groups_details) { $this->field_id = JsonCast::toInt($id); $this->label = $label; $this->granted_groups = $granted_groups; $this->granted_groups_details = $granted_groups_details; }
public function build($id, $type, $label, array $granted_groups) { $this->field_id = JsonCast::toInt($id); $this->type = $type; $this->label = $label; $this->granted_groups = $granted_groups; }
public function build($id, $label, array $values, array $reverse_values) { $this->field_id = JsonCast::toInt($id); $this->label = $label; $this->links = $values; $this->reverse_links = $reverse_values; }
public function build($duration, $capacity, array $points) { $this->duration = JsonCast::toInt($duration); $this->capacity = JsonCast::toFloat($capacity); $this->points = array_map(array('\\Tuleap\\REST\\JsonCast', 'toFloat'), $points); return $this; }
public function build(Tracker_Report $report) { $this->id = JsonCast::toInt($report->getId()); $this->uri = self::ROUTE . '/' . $this->id; $this->label = $report->getName(); $this->resources = array(array('type' => 'artifacts', 'uri' => $this->uri . '/' . ArtifactRepresentation::ROUTE)); }
public function build($id, $type, $label, $value) { $this->field_id = JsonCast::toInt($id); $this->type = $type; $this->label = $label; $this->value = $value; }
public function build($id, $type, $label, array $values) { $this->field_id = JsonCast::toInt($id); $this->type = $type; $this->label = $label; $this->file_descriptions = $values; }
public function build(Planning_Milestone $milestone, array $status_count, array $backlog_trackers, $has_user_priority_change_permission, $representation_type) { $this->id = JsonCast::toInt($milestone->getArtifactId()); $this->uri = self::ROUTE . '/' . $this->id; $this->label = $milestone->getArtifactTitle(); $this->status_value = $milestone->getArtifact()->getStatus(); $this->semantic_status = $milestone->getArtifact()->getSemanticStatusValue(); $this->submitted_by = JsonCast::toInt($milestone->getArtifact()->getFirstChangeset()->getSubmittedBy()); $this->submitted_on = JsonCast::toDate($milestone->getArtifact()->getFirstChangeset()->getSubmittedOn()); $this->capacity = JsonCast::toFloat($milestone->getCapacity()); $this->remaining_effort = JsonCast::toFloat($milestone->getRemainingEffort()); $this->sub_milestone_type = $this->getSubmilestoneType($milestone); $this->planning = new PlanningReference(); $this->planning->build($milestone->getPlanning()); $this->project = new ProjectReference(); $this->project->build($milestone->getProject()); $this->artifact = new ArtifactReference(); $this->artifact->build($milestone->getArtifact()); $this->start_date = null; if ($milestone->getStartDate()) { $this->start_date = JsonCast::toDate($milestone->getStartDate()); if ($representation_type === self::ALL_FIELDS) { $this->number_days_since_start = JsonCast::toInt($milestone->getDaysSinceStart()); } } $this->end_date = null; if ($milestone->getEndDate()) { $this->end_date = JsonCast::toDate($milestone->getEndDate()); if ($representation_type === self::ALL_FIELDS) { $this->number_days_until_end = JsonCast::toInt($milestone->getDaysUntilEnd()); } } if ($representation_type === self::ALL_FIELDS) { $this->parent = null; $parent = $milestone->getParent(); if ($parent) { $this->parent = new MilestoneParentReference(); $this->parent->build($parent); } } $this->has_user_priority_change_permission = $has_user_priority_change_permission; $this->sub_milestones_uri = $this->uri . '/' . self::ROUTE; $this->backlog_uri = $this->uri . '/' . BacklogItemRepresentation::BACKLOG_ROUTE; $this->content_uri = $this->uri . '/' . BacklogItemRepresentation::CONTENT_ROUTE; $this->last_modified_date = JsonCast::toDate($milestone->getLastModifiedDate()); if ($representation_type === self::ALL_FIELDS && $status_count) { $this->status_count = $status_count; } $finder = new \AgileDashboard_Milestone_Pane_Planning_SubmilestoneFinder(\Tracker_HierarchyFactory::instance(), PlanningFactory::build()); $submilestone_tracker = $finder->findFirstSubmilestoneTracker($milestone); $submilestone_trackers = array(); if ($submilestone_tracker) { $submilestone_tracker_ref = new TrackerReference(); $submilestone_tracker_ref->build($finder->findFirstSubmilestoneTracker($milestone)); $submilestone_trackers = array($submilestone_tracker_ref); } $this->resources['milestones'] = array('uri' => $this->uri . '/' . self::ROUTE, 'accept' => array('trackers' => $submilestone_trackers)); $this->resources['backlog'] = array('uri' => $this->uri . '/' . BacklogItemRepresentation::BACKLOG_ROUTE, 'accept' => array('trackers' => $this->getTrackersRepresentation($backlog_trackers))); $this->resources['content'] = array('uri' => $this->uri . '/' . BacklogItemRepresentation::CONTENT_ROUTE, 'accept' => array('trackers' => $this->getContentTrackersRepresentation($milestone))); }
public function __construct(\Planning_Milestone $milestone) { $this->id = JsonCast::toInt($milestone->getArtifactId()); $this->label = $milestone->getArtifactTitle(); $this->last_modified = JsonCast::toDate($milestone->getLastModifiedDate()); $this->uri = self::ROUTE . '/' . $this->id; }
public function build(Tracker_Artifact $artifact) { $this->id = JsonCast::toInt($artifact->getId()); $this->uri = ArtifactRepresentation::ROUTE . '/' . $this->id; $this->tracker = new TrackerReference(); $this->tracker->build($artifact->getTracker()); $this->artifact = $artifact; }
public function build(Tracker_Artifact $backlog_item) { $this->id = JsonCast::toInt($backlog_item->getId()); $this->label = $backlog_item->getTitle(); $this->uri = ResourceReference::NO_ROUTE; $this->tracker = new TrackerReference(); $this->tracker->build($backlog_item->getTracker()); }
public function build($id, $type, $label, array $values, array $bind_value_ids) { $this->field_id = JsonCast::toInt($id); $this->type = $type; $this->label = $label; $this->values = $values; $this->bind_value_ids = $bind_value_ids; }
public function build(GitRepository $repository) { $this->id = JsonCast::toInt($repository->getId()); $this->uri = self::ROUTE . '/' . $this->id; $this->name = $repository->getName(); $this->path = $repository->getPath(); $this->description = $repository->getDescription(); }
public function build($id, $label, $bind_type, array $bind_value_objects, array $bind_value_ids) { $this->field_id = JsonCast::toInt($id); $this->label = $label; $this->bind_type = $bind_type; $this->bind_value_objects = $bind_value_objects; $this->bind_value_ids = $bind_value_ids; }
public function build(Tracker_Artifact $artifact, $timeinfo) { $this->id = JsonCast::toInt($artifact->getId()); $this->item_name = $artifact->getTracker()->getItemName(); $this->label = $artifact->getTitle(); $this->color = $artifact->getTracker()->getColor(); $this->card_fields = $this->getArtifactCardFields($artifact); $this->timeinfo = $timeinfo; }
public function build(Project $project, array $resources, array $informations) { $this->id = JsonCast::toInt($project->getId()); $this->uri = self::ROUTE . '/' . $this->id; $this->label = $project->getPublicName(); $this->shortname = $project->getUnixName(); $this->resources = $resources; $this->additional_informations = $informations; }
public function build(AgileDashboard_KanbanColumn $column, $user_can_add_in_place) { $this->id = JsonCast::toInt($column->getId()); $this->label = $column->getLabel(); $this->is_open = $column->isOpen(); $this->color = $column->getColor(); $this->limit = JsonCast::toInt($column->getLimit()); $this->user_can_add_in_place = $user_can_add_in_place; }
public function build(PFUser $user) { $this->id = JsonCast::toInt($user->getId()); $this->uri = UserRepresentation::ROUTE . '/' . $this->id; $this->real_name = $user->getRealName(); $this->username = $user->getUserName(); $this->ldap_id = $user->getLdapId(); $this->avatar_url = $user->getAvatarUrl(); return $this; }
public function build(Tracker_Artifact_Changeset $changeset, Tracker_Artifact_Changeset_Comment $last_comment, array $values) { $this->id = JsonCast::toInt($changeset->getId()); $this->submitted_by = JsonCast::toInt($changeset->getSubmittedBy()); $this->submitted_on = JsonCast::toDate($changeset->getSubmittedOn()); $this->email = $changeset->getEmail(); $this->last_comment = new ChangesetCommentRepresentation(); $this->last_comment->build($last_comment); $this->values = $values; $this->last_modified_date = JsonCast::toDate($last_comment->getSubmittedOn()); }
public function build(Tracker_Artifact $artifact, $format = '') { $this->id = JsonCast::toInt($artifact->getId()); $this->uri = ArtifactRepresentation::ROUTE . '/' . $this->id; if ($format) { $this->uri = $this->uri . "?values_format={$format}"; } $this->tracker = new TrackerReference(); $this->tracker->build($artifact->getTracker()); $this->artifact = $artifact; }
public function build($reference) { if ($reference instanceof Tracker_Artifact) { $this->id = JsonCast::toInt($reference->getId()); } elseif (is_int($reference)) { $this->id = JsonCast::toInt($reference); } else { throw new Exception('Unknown artifact reference'); } $this->uri = ArtifactRepresentation::ROUTE . '/' . $this->id; }
public function build($id, $submitted_by, $description, $name, $filesize, $filetype, $html_url, $html_preview_url) { $this->id = JsonCast::toInt($id); $this->submitted_by = JsonCast::toInt($submitted_by); $this->description = $description; $this->name = $name; $this->size = JsonCast::toInt($filesize); $this->type = $filetype; $this->html_url = $html_url; $this->html_preview_url = $html_preview_url; $this->uri = 'artifact_files/' . $this->id; return $this; }
public function build(PFUser $user) { $this->user_helper = UserHelper::instance(); $this->id = $user->isAnonymous() ? null : JsonCast::toInt($user->getId()); $this->uri = $user->isAnonymous() ? null : UserRepresentation::ROUTE . '/' . $this->id; $this->user_url = $user->isAnonymous() ? null : $this->user_helper->getUserUrl($user); $this->display_name = $this->getDisplayName($user); $this->real_name = $user->isAnonymous() ? null : $user->getRealName(); $this->username = $user->isAnonymous() ? null : $user->getUserName(); $this->ldap_id = $user->isAnonymous() ? null : $user->getLdapId(); $this->avatar_url = $user->getAvatarUrl(); $this->is_anonymous = (bool) $user->isAnonymous(); return $this; }
/** @return array */ public function getTimeInfo(Tracker_Artifact $artifact) { $timeinfo = array(); foreach ($this->dao->searchTimeInfoForItem($artifact->getTrackerId(), $artifact->getId()) as $row) { $timeinfo[$row['column_id']] = JsonCast::toDate($row['submitted_on']); } if (empty($timeinfo)) { $timeinfo['kanban'] = null; } else { $timeinfo['kanban'] = min($timeinfo); } $timeinfo['archive'] = JsonCast::toDate($this->dao->getTimeInfoForArchivedItem($artifact->getId())); return $timeinfo; }
public function build(Tracker_Artifact $artifact, array $values) { $this->id = JsonCast::toInt($artifact->getId()); $this->uri = self::ROUTE . '/' . $artifact->getId(); $this->tracker = new ResourceReference(); $this->tracker->build($artifact->getTrackerId(), TrackerRepresentation::ROUTE); $this->project = new ProjectReference(); $this->project->build($artifact->getTracker()->getProject()); $this->submitted_by = JsonCast::toInt($artifact->getSubmittedBy()); $this->submitted_on = JsonCast::toDate($artifact->getSubmittedOn()); $this->html_url = $artifact->getUri(); $this->changesets_uri = self::ROUTE . '/' . $this->id . '/' . ChangesetRepresentation::ROUTE; $this->values = $values; $this->last_modified_date = JsonCast::toDate($artifact->getLastUpdateDate()); }
public function build(Tracker_Artifact_Changeset $changeset, PFUser $user, Tracker_Artifact_Changeset_Comment $last_comment, array $values) { $this->id = JsonCast::toInt($changeset->getId()); $this->submitted_by = JsonCast::toInt($changeset->getSubmittedBy()); $this->submitted_by_details = new MinimalUserRepresentation(); $this->submitted_by_details->build($user); $this->submitted_on = JsonCast::toDate($changeset->getSubmittedOn()); $this->email = $changeset->getEmail(); $this->last_comment = new ChangesetCommentRepresentation(); $this->last_comment->build($last_comment); $this->values = $values; $this->last_modified_by = new MinimalUserRepresentation(); $this->last_modified_by->build(UserManager::instance()->getUserById($last_comment->getSubmittedBy())); $this->last_modified_date = JsonCast::toDate($last_comment->getSubmittedOn()); }