Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getResourcePoolSet(searchKey: any) {
searchKey = typeof searchKey !== "undefined" ? searchKey : "";
var query = EntityQuery
.from("ResourcePool")
.expand(["User"])
.orderBy("Name");
if (searchKey !== "") {
var resourcePoolNamePredicate = new Predicate("Name", "contains", searchKey);
var userNamePredicate = new Predicate("User.UserName", "contains", searchKey);
query = query.where(resourcePoolNamePredicate.or(userNamePredicate));
}
// Prepare the query
//if (fetchFromServer) { // From remote
query = query.using(FetchStrategy.FromServer);
// fetchFromServer = false; // Do it only once per user
//}
//else { // From local
//query = query.using(FetchStrategy.FromLocalCache);
//}
return this.dataService.executeQuery(query)
.map((response: any) => {
return response.results;
});
// If it"s not newly created, check the fetched list
fetchedEarlier = fetchedList.some(fetched => (resourcePoolUniqueKey === fetched));
// Prepare the query
var query = breeze.EntityQuery.from("ResourcePool");
// Is authorized? No, then get only the public data, yes, then get include user"s own records
if (currentUser.isAuthenticated()) {
query = query.expand("User, UserResourcePoolSet, ElementSet.ElementFieldSet.UserElementFieldSet, ElementSet.ElementItemSet.ElementCellSet.UserElementCellSet");
} else {
query = query.expand("User, ElementSet.ElementFieldSet, ElementSet.ElementItemSet.ElementCellSet");
}
var userNamePredicate = new breeze.Predicate("User.UserName", "eq", resourcePoolUniqueKey.userName);
var resourcePoolKeyPredicate = new breeze.Predicate("Key", "eq", resourcePoolUniqueKey.resourcePoolKey);
query = query.where(userNamePredicate.and(resourcePoolKeyPredicate));
// From server or local?
if (!fetchedEarlier) {
query = query.using(breeze.FetchStrategy.FromServer);
} else {
query = query.using(breeze.FetchStrategy.FromLocalCache);
}
return dataContext.executeQuery(query)
.then(success)
.catch(failed);
function success(response: any) {
// If it's not newly created, check the fetched list
fetchedEarlier = this.fetchedList.some((item: any) => (resourcePoolUniqueKey.username === item.username
&& resourcePoolUniqueKey.resourcePoolKey === item.resourcePoolKey));
// Prepare the query
var query = EntityQuery.from("ResourcePool");
// Is authorized? No, then get only the public data, yes, then get include user's own records
if (this.dataService.currentUser.isAuthenticated()) {
query = query.expand("User, UserResourcePoolSet, ElementSet.ElementFieldSet.UserElementFieldSet, ElementSet.ElementItemSet.ElementCellSet.UserElementCellSet");
} else {
query = query.expand("User, ElementSet.ElementFieldSet, ElementSet.ElementItemSet.ElementCellSet");
}
var userNamePredicate = new Predicate("User.UserName", "eq", resourcePoolUniqueKey.username);
var resourcePoolKeyPredicate = new Predicate("Key", "eq", resourcePoolUniqueKey.resourcePoolKey);
query = query.where(userNamePredicate.and(resourcePoolKeyPredicate));
// From server or local?
if (!fetchedEarlier) {
query = query.using(FetchStrategy.FromServer);
} else {
query = query.using(FetchStrategy.FromLocalCache);
}
return this.dataService.executeQuery(query)
.map((response: any): any => {
// If there is no cmrp with this Id, return null
if (response.results.length === 0) {
getResourcePoolSet(searchKey: any) {
searchKey = typeof searchKey !== "undefined" ? searchKey : "";
var query = EntityQuery
.from("ResourcePool")
.expand(["User"])
.orderBy("Name");
if (searchKey !== "") {
var resourcePoolNamePredicate = new Predicate("Name", "contains", searchKey);
var userNamePredicate = new Predicate("User.UserName", "contains", searchKey);
query = query.where(resourcePoolNamePredicate.or(userNamePredicate));
}
// Prepare the query
//if (fetchFromServer) { // From remote
query = query.using(FetchStrategy.FromServer);
// fetchFromServer = false; // Do it only once per user
//}
//else { // From local
//query = query.using(FetchStrategy.FromLocalCache);
//}
return this.dataService.executeQuery(query)
.map((response: any) => {
return response.results;
// If it's not newly created, check the fetched list
fetchedEarlier = this.fetchedList.some((item: any) => (resourcePoolUniqueKey.username === item.username
&& resourcePoolUniqueKey.resourcePoolKey === item.resourcePoolKey));
// Prepare the query
var query = EntityQuery.from("ResourcePool");
// Is authorized? No, then get only the public data, yes, then get include user's own records
if (this.dataService.currentUser.isAuthenticated()) {
query = query.expand("User, UserResourcePoolSet, ElementSet.ElementFieldSet.UserElementFieldSet, ElementSet.ElementItemSet.ElementCellSet.UserElementCellSet");
} else {
query = query.expand("User, ElementSet.ElementFieldSet, ElementSet.ElementItemSet.ElementCellSet");
}
var userNamePredicate = new Predicate("User.UserName", "eq", resourcePoolUniqueKey.username);
var resourcePoolKeyPredicate = new Predicate("Key", "eq", resourcePoolUniqueKey.resourcePoolKey);
query = query.where(userNamePredicate.and(resourcePoolKeyPredicate));
// From server or local?
if (!fetchedEarlier) {
query = query.using(FetchStrategy.FromServer);
} else {
query = query.using(FetchStrategy.FromLocalCache);
}
return this.dataService.executeQuery(query)
.map((response: any): any => {
// If there is no cmrp with this Id, return null
if (response.results.length === 0) {
return null;
function getResourcePoolSet(searchKey: any) {
searchKey = typeof searchKey !== "undefined" ? searchKey : "";
var query = breeze.EntityQuery
.from("ResourcePool")
.expand(["User"]);
if (searchKey !== "") {
var resourcePoolNamePredicate = new breeze.Predicate("Name", "contains", searchKey);
var userNamePredicate = new breeze.Predicate("User.UserName", "contains", searchKey);
query = query.where(resourcePoolNamePredicate.or(userNamePredicate));
}
// Prepare the query
//if (fetchFromServer) { // From remote
query = query.using(breeze.FetchStrategy.FromServer);
// fetchFromServer = false; // Do it only once per user
//}
//else { // From local
//query = query.using(breeze.FetchStrategy.FromLocalCache);
//}
return dataContext.executeQuery(query)
.then(success).catch(failed);
function success(response: any) {
function getResourcePoolSet(searchKey: any) {
searchKey = typeof searchKey !== "undefined" ? searchKey : "";
var query = breeze.EntityQuery
.from("ResourcePool")
.expand(["User"]);
if (searchKey !== "") {
var resourcePoolNamePredicate = new breeze.Predicate("Name", "contains", searchKey);
var userNamePredicate = new breeze.Predicate("User.UserName", "contains", searchKey);
query = query.where(resourcePoolNamePredicate.or(userNamePredicate));
}
// Prepare the query
//if (fetchFromServer) { // From remote
query = query.using(breeze.FetchStrategy.FromServer);
// fetchFromServer = false; // Do it only once per user
//}
//else { // From local
//query = query.using(breeze.FetchStrategy.FromLocalCache);
//}
return dataContext.executeQuery(query)
.then(success).catch(failed);
var fetchedEarlier = false;
// If it"s not newly created, check the fetched list
fetchedEarlier = fetchedList.some(fetched => (resourcePoolUniqueKey === fetched));
// Prepare the query
var query = breeze.EntityQuery.from("ResourcePool");
// Is authorized? No, then get only the public data, yes, then get include user"s own records
if (currentUser.isAuthenticated()) {
query = query.expand("User, UserResourcePoolSet, ElementSet.ElementFieldSet.UserElementFieldSet, ElementSet.ElementItemSet.ElementCellSet.UserElementCellSet");
} else {
query = query.expand("User, ElementSet.ElementFieldSet, ElementSet.ElementItemSet.ElementCellSet");
}
var userNamePredicate = new breeze.Predicate("User.UserName", "eq", resourcePoolUniqueKey.userName);
var resourcePoolKeyPredicate = new breeze.Predicate("Key", "eq", resourcePoolUniqueKey.resourcePoolKey);
query = query.where(userNamePredicate.and(resourcePoolKeyPredicate));
// From server or local?
if (!fetchedEarlier) {
query = query.using(breeze.FetchStrategy.FromServer);
} else {
query = query.using(breeze.FetchStrategy.FromLocalCache);
}
return dataContext.executeQuery(query)
.then(success)
.catch(failed);
function success(response: any) {
getProjectSet(searchKey: string = "") {
let query = EntityQuery
.from("Project")
.expand(["User"])
.orderBy("Name");
if (searchKey !== "") {
const projectNamePredicate = new Predicate("Name", "contains", searchKey);
const userNamePredicate = new Predicate("User.UserName", "contains", searchKey);
query = query.where(projectNamePredicate.or(userNamePredicate));
}
return this.appEntityManager.executeQueryObservable(query).pipe(
map(response => {
return response.results;
}));
}
getProjectSet(searchKey: string = "") {
let query = EntityQuery
.from("Project")
.expand(["User"])
.orderBy("Name");
if (searchKey !== "") {
const projectNamePredicate = new Predicate("Name", "contains", searchKey);
const userNamePredicate = new Predicate("User.UserName", "contains", searchKey);
query = query.where(projectNamePredicate.or(userNamePredicate));
}
return this.appEntityManager.executeQueryObservable(query).pipe(
map(response => {
return response.results;
}));
}