Skip to content

Instantly share code, notes, and snippets.

@harishkrsingla
Created March 6, 2014 13:19
permission-addstudent-java
public Student addNewStudent(String studentName, String course, long companyId, long groupId, long userId) throws SystemException
{
long studentId = counterLocalService.increment(Student.class.getName());
Student student = studentPersistence.create(studentId);
student.setStudentName(studentName);
student.setCourse(course);
studentPersistence.update(student, false);
try {
resourceLocalService.addResources(companyId, groupId, userId, Student.class.getName(), studentId, false, true, true);
} catch (PortalException e) {
e.printStackTrace();
}
return student;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment