Search in sources :

Example 1 with DocumentSearch

use of com.autentia.tnt.dao.search.DocumentSearch in project TNTConcept by autentia.

the class ActivityBean method edit.

/**
 * Go to edit page
 *
 * @return forward to EDIT page
 */
public String edit() {
    ScheduleEntry entry = scheduleModel.getSelectedEntry();
    String tmpId = entry.getId();
    String[] tmpIdParts = tmpId.split("_");
    Integer id = Integer.parseInt(tmpIdParts[tmpIdParts.length - 1]);
    if (entry instanceof ActivityScheduleEntry) {
        activity = manager.getEntityById(id);
        selectedProject = activity.getRole().getProject();
        selectedOrganization = selectedProject.getClient();
        setDefaultBillable(selectedProject.getBillable());
        tabsRendered = EDIT_ACTIVITY;
    } else if (entry instanceof ExternalActivityScheduleEntry) {
        externalActivity = externalActivityManager.getEntityById(id);
        ArrayList<DocumentCategory> categories = new ArrayList<DocumentCategory>();
        categories.add(externalActivity.getDocumentCategory());
        docSearch = new DocumentSearch();
        docSearch.setCategories(categories);
        documents = docManager.getAllEntities(docSearch, null);
        tabsRendered = EDIT_EXTERNAL_ACTIVITY;
    } else {
        tabsRendered = NO_EDIT_SELECTED;
        return NavigationResults.LIST;
    }
    return NavigationResults.EDIT;
}
Also used : ScheduleEntry(org.apache.myfaces.custom.schedule.model.ScheduleEntry) ArrayList(java.util.ArrayList) DocumentSearch(com.autentia.tnt.dao.search.DocumentSearch) DocumentCategory(com.autentia.tnt.businessobject.DocumentCategory)

Aggregations

DocumentCategory (com.autentia.tnt.businessobject.DocumentCategory)1 DocumentSearch (com.autentia.tnt.dao.search.DocumentSearch)1 ArrayList (java.util.ArrayList)1 ScheduleEntry (org.apache.myfaces.custom.schedule.model.ScheduleEntry)1