use of org.haiku.haikudepotserver.dataobjects.auto._User in project IR_Base by Linda-sunshine.
the class CLinAdaptWithHDP method loadUsers.
@Override
public void loadUsers(ArrayList<_User> userList) {
m_userList = new ArrayList<_AdaptStruct>();
// Init each user.
for (_User user : userList) m_userList.add(new _HDPAdaptStruct(user, m_dim));
m_pWeights = new double[m_gWeights.length];
}
use of org.haiku.haikudepotserver.dataobjects.auto._User in project IR_Base by Linda-sunshine.
the class CoLinAdaptWithDiffFeatureGroups method constructUserList.
@Override
void constructUserList(ArrayList<_User> userList) {
int ASize = 2 * m_dimA;
int BSize = 2 * m_dimB;
// step 1: create space
m_userList = new ArrayList<_AdaptStruct>();
for (int i = 0; i < userList.size(); i++) {
_User user = userList.get(i);
m_userList.add(new _CoLinAdaptDiffFvGroupsStruct(user, m_dimA, i, m_topK, m_dimB));
}
m_pWeights = new double[m_gWeights.length];
// huge space consumption
_CoLinAdaptDiffFvGroupsStruct.sharedA = new double[getASize()];
_CoLinAdaptDiffFvGroupsStruct.sharedB = new double[getBSize()];
// step 2: copy each user's A and B to shared A and B in _CoLinAdaptStruct
_CoLinAdaptDiffFvGroupsStruct user;
for (int i = 0; i < m_userList.size(); i++) {
user = (_CoLinAdaptDiffFvGroupsStruct) m_userList.get(i);
System.arraycopy(user.m_A, 0, _CoLinAdaptDiffFvGroupsStruct.sharedA, ASize * i, ASize);
System.arraycopy(user.m_B, 0, _CoLinAdaptDiffFvGroupsStruct.sharedB, BSize * i, BSize);
}
}
use of org.haiku.haikudepotserver.dataobjects.auto._User in project haikudepotserver by haiku.
the class PkgJobApiImpl method queuePkgIconArchiveImportJob.
@Override
public QueuePkgIconArchiveImportJobResult queuePkgIconArchiveImportJob(QueuePkgIconArchiveImportJobRequest request) {
Preconditions.checkArgument(null != request, "the request must be supplied");
Preconditions.checkArgument(!Strings.isNullOrEmpty(request.inputDataGuid), "the input data must be identified by guid");
final ObjectContext context = serverRuntime.newContext();
Optional<User> user = tryObtainAuthenticatedUser(context);
if (!permissionEvaluator.hasPermission(SecurityContextHolder.getContext().getAuthentication(), null, Permission.BULK_PKGICONIMPORTARCHIVE)) {
throw new AccessDeniedException("attempt to import package icons, but was not authorized");
}
// now check that the data is present.
jobService.tryGetData(request.inputDataGuid).orElseThrow(() -> new ObjectNotFoundException(JobData.class.getSimpleName(), request.inputDataGuid));
// setup and go
PkgIconImportArchiveJobSpecification spec = new PkgIconImportArchiveJobSpecification();
spec.setOwnerUserNickname(user.map(_User::getNickname).orElse(null));
spec.setInputDataGuid(request.inputDataGuid);
return new QueuePkgIconArchiveImportJobResult(jobService.submit(spec, JobSnapshot.COALESCE_STATUSES_NONE));
}
use of org.haiku.haikudepotserver.dataobjects.auto._User in project haikudepotserver by haiku.
the class PkgJobApiImpl method queuePkgScreenshotArchiveImportJob.
@Override
public QueuePkgScreenshotArchiveImportJobResult queuePkgScreenshotArchiveImportJob(QueuePkgScreenshotArchiveImportJobRequest request) {
Preconditions.checkArgument(null != request, "the request must be supplied");
Preconditions.checkArgument(StringUtils.isNotBlank(request.inputDataGuid), "the data guid must be supplied");
Preconditions.checkArgument(null != request.importStrategy, "the import strategy must be supplied");
final ObjectContext context = serverRuntime.newContext();
Optional<User> user = tryObtainAuthenticatedUser(context);
if (!permissionEvaluator.hasPermission(SecurityContextHolder.getContext().getAuthentication(), null, Permission.BULK_PKGSCREENSHOTIMPORTARCHIVE)) {
throw new AccessDeniedException("attempt to import package screenshots, but was not authorized");
}
// now check that the data is present.
jobService.tryGetData(request.inputDataGuid).orElseThrow(() -> new ObjectNotFoundException(JobData.class.getSimpleName(), request.inputDataGuid));
// setup and go
PkgScreenshotImportArchiveJobSpecification spec = new PkgScreenshotImportArchiveJobSpecification();
spec.setOwnerUserNickname(user.map(_User::getNickname).orElse(null));
spec.setInputDataGuid(request.inputDataGuid);
spec.setImportStrategy(PkgScreenshotImportArchiveJobSpecification.ImportStrategy.valueOf(request.importStrategy.name()));
return new QueuePkgScreenshotArchiveImportJobResult(jobService.submit(spec, JobSnapshot.COALESCE_STATUSES_NONE));
}
Aggregations