Commit baed56a3 by Nilu

make job count and draft job count integer values in intercom

parent dec39df6
package performa.intercom.utils;
import static java.lang.System.currentTimeMillis;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
......@@ -14,6 +15,7 @@ import oneit.utils.filter.CollectionFilter;
import oneit.utils.filter.Filter;
import performa.intercom.resources.Company;
import performa.intercom.resources.CustomAttribute;
import performa.intercom.resources.Event;
import performa.intercom.resources.Intercom;
import performa.intercom.resources.User;
import performa.orm.Job;
......@@ -114,8 +116,8 @@ public class IntercomUtils
Filter filter = Job.SearchByAll().andJobStatus(new EqualsFilter<>(JobStatus.DRAFT));
Collection draftJobs = CollectionFilter.filter(Arrays.asList(jobs), filter);
intercomCompany.addCustomAttribute(CustomAttribute.newStringAttribute("job-count", jobs != null ? String.valueOf(jobs.length) : ""));
intercomCompany.addCustomAttribute(CustomAttribute.newStringAttribute("draft-job-count", String.valueOf(draftJobs.size())));
intercomCompany.addCustomAttribute(CustomAttribute.newIntegerAttribute("job-count", jobs != null ? jobs.length : 0));
intercomCompany.addCustomAttribute(CustomAttribute.newIntegerAttribute("draft-job-count", draftJobs.size()));
return Company.create(intercomCompany);
}
......@@ -165,8 +167,8 @@ public class IntercomUtils
Filter filter = Job.SearchByAll().andJobStatus(new EqualsFilter<>(JobStatus.DRAFT));
Collection draftJobs = CollectionFilter.filter(Arrays.asList(jobs), filter);
intercomCompany.addCustomAttribute(CustomAttribute.newStringAttribute("job-count", jobs != null ? String.valueOf(jobs.length) : ""));
intercomCompany.addCustomAttribute(CustomAttribute.newStringAttribute("draft-job-count", String.valueOf(draftJobs.size())));
intercomCompany.addCustomAttribute(CustomAttribute.newIntegerAttribute("job-count", jobs != null ? jobs.length : 0));
intercomCompany.addCustomAttribute(CustomAttribute.newIntegerAttribute("draft-job-count", draftJobs.size()));
Company.update(intercomCompany);
}
......@@ -190,4 +192,28 @@ public class IntercomUtils
return intercomCompany;
}
// public static void createAccessedJobEvent(Job job, User user)
// {
// try
// {
// Map<String, CustomAttribute> customAttributes = user.getCustomAttributes();
// customAttributes.get("shortlisted-count");
// Event event = new Event();
//
// event.setEventName("accessed-job");
// event.putMetadata("applicant-count", job.getNoOfCandidatesApplied());
// event.putMetadata("shortlisted-count", job.getNoOfCandidatesShortlisted());
// event.setUserID(user.getUserId());
// event.setCreatedAt(currentTimeMillis()/1000L);
//
// Event.create(event);
// }
// catch (Exception e)
// {
// LogMgr.log(LoggingArea.ALL, LogLevel.PROCESSING1, e, "Error while creating accessed job event in intercom");
//
// }
// }
}
<%@ page import="performa.orm.*, performa.orm.types.*, performa.form.*, performa.utils.*"%>
<%@ page import="performa.intercom.utils.*, performa.intercom.resources.User"%>
<%@ page import="oneit.objstore.rdbms.filters.*, oneit.security.jsp.SecUserToNameTransform, oneit.servlets.utils.*, oneit.utils.image.* "%>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment