| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.student.core.organization.ui.server.gwt; |
| 17 | |
|
| 18 | |
import java.io.FileInputStream; |
| 19 | |
import java.io.FileNotFoundException; |
| 20 | |
import java.io.InputStream; |
| 21 | |
import java.util.ArrayList; |
| 22 | |
import java.util.HashMap; |
| 23 | |
import java.util.List; |
| 24 | |
import java.util.Map; |
| 25 | |
|
| 26 | |
import javax.xml.bind.JAXBContext; |
| 27 | |
import javax.xml.bind.JAXBElement; |
| 28 | |
import javax.xml.bind.JAXBException; |
| 29 | |
import javax.xml.bind.Unmarshaller; |
| 30 | |
|
| 31 | |
import org.apache.log4j.Logger; |
| 32 | |
import org.kuali.rice.core.api.criteria.QueryByCriteria; |
| 33 | |
import org.kuali.rice.kim.api.identity.IdentityService; |
| 34 | |
import org.kuali.rice.kim.api.identity.entity.EntityDefault; |
| 35 | |
import org.kuali.rice.kim.api.identity.entity.EntityDefaultQueryResults; |
| 36 | |
import org.kuali.student.common.assembly.data.AssemblyException; |
| 37 | |
import org.kuali.student.common.assembly.data.Data; |
| 38 | |
import org.kuali.student.common.dto.StatusInfo; |
| 39 | |
import org.kuali.student.common.ui.client.service.DataSaveResult; |
| 40 | |
import org.kuali.student.common.ui.server.gwt.old.AbstractBaseDataOrchestrationRpcGwtServlet; |
| 41 | |
import org.kuali.student.common.validation.dto.ValidationResultInfo; |
| 42 | |
import org.kuali.student.core.organization.dto.OrgHierarchyInfo; |
| 43 | |
import org.kuali.student.core.organization.dto.OrgInfo; |
| 44 | |
import org.kuali.student.core.organization.dto.OrgOrgRelationInfo; |
| 45 | |
import org.kuali.student.core.organization.dto.OrgOrgRelationTypeInfo; |
| 46 | |
import org.kuali.student.core.organization.dto.OrgPersonRelationInfo; |
| 47 | |
import org.kuali.student.core.organization.dto.OrgPersonRelationTypeInfo; |
| 48 | |
import org.kuali.student.core.organization.dto.OrgPositionRestrictionInfo; |
| 49 | |
import org.kuali.student.core.organization.dto.OrgTreeInfo; |
| 50 | |
import org.kuali.student.core.organization.dto.OrgTypeInfo; |
| 51 | |
import org.kuali.student.core.organization.dynamic.Field; |
| 52 | |
import org.kuali.student.core.organization.dynamic.Fields; |
| 53 | |
import org.kuali.student.core.organization.dynamic.MultipleField; |
| 54 | |
import org.kuali.student.core.organization.dynamic.Section; |
| 55 | |
import org.kuali.student.core.organization.dynamic.SectionConfig; |
| 56 | |
import org.kuali.student.core.organization.dynamic.SectionView; |
| 57 | |
import org.kuali.student.core.organization.service.OrganizationService; |
| 58 | |
import org.kuali.student.core.organization.ui.client.mvc.model.FieldInfo; |
| 59 | |
import org.kuali.student.core.organization.ui.client.mvc.model.FieldInfoImpl; |
| 60 | |
import org.kuali.student.core.organization.ui.client.mvc.model.MembershipInfo; |
| 61 | |
import org.kuali.student.core.organization.ui.client.mvc.model.MultipleFieldInfoImpl; |
| 62 | |
import org.kuali.student.core.organization.ui.client.mvc.model.OrgPositionPersonRelationInfo; |
| 63 | |
import org.kuali.student.core.organization.ui.client.mvc.model.SectionConfigInfo; |
| 64 | |
import org.kuali.student.core.organization.ui.client.mvc.model.SectionViewInfo; |
| 65 | |
import org.kuali.student.core.organization.ui.client.service.OrgRpcService; |
| 66 | |
|
| 67 | |
import static org.kuali.rice.core.api.criteria.PredicateFactory.and; |
| 68 | |
import static org.kuali.rice.core.api.criteria.PredicateFactory.equal; |
| 69 | |
import static org.kuali.rice.core.api.criteria.PredicateFactory.in; |
| 70 | |
|
| 71 | 0 | public class OrgRpcGwtServlet extends AbstractBaseDataOrchestrationRpcGwtServlet implements OrgRpcService{ |
| 72 | 0 | final Logger LOG = Logger.getLogger(OrgRpcGwtServlet.class); |
| 73 | |
private static final long serialVersionUID = 1L; |
| 74 | |
public static final String CONFIGURE_XML_PATH = "C:/org_configure.xml"; |
| 75 | |
private IdentityService identityServiceNonCached; |
| 76 | |
private OrganizationService service; |
| 77 | |
|
| 78 | |
public void setIdentityServiceNonCached(IdentityService identityServiceNonCached) { |
| 79 | 0 | this.identityServiceNonCached = identityServiceNonCached; |
| 80 | 0 | } |
| 81 | |
|
| 82 | |
public void setService(OrganizationService service){ |
| 83 | 0 | this.service=service; |
| 84 | 0 | } |
| 85 | |
|
| 86 | |
@Override |
| 87 | |
public StatusInfo removePositionRestrictionFromOrg(String orgId, String orgPersonRelationTypeKey){ |
| 88 | |
try { |
| 89 | 0 | return service.removePositionRestrictionFromOrg(orgId, orgPersonRelationTypeKey); |
| 90 | 0 | } catch (Exception e) { |
| 91 | 0 | LOG.error(e); |
| 92 | |
} |
| 93 | 0 | return null; |
| 94 | |
} |
| 95 | |
|
| 96 | |
@Override |
| 97 | |
public StatusInfo removeOrgOrgRelation(String orgOrgRelationId){ |
| 98 | |
try { |
| 99 | 0 | return service.removeOrgOrgRelation(orgOrgRelationId); |
| 100 | 0 | } catch (Exception e) { |
| 101 | 0 | LOG.error(e); |
| 102 | |
} |
| 103 | 0 | return null; |
| 104 | |
} |
| 105 | |
|
| 106 | |
@Override |
| 107 | |
public List<OrgHierarchyInfo> getOrgHierarchies() { |
| 108 | |
try { |
| 109 | 0 | return service.getOrgHierarchies(); |
| 110 | 0 | } catch (Exception e) { |
| 111 | 0 | LOG.error(e); |
| 112 | |
} |
| 113 | 0 | return null; |
| 114 | |
} |
| 115 | |
|
| 116 | |
@Override |
| 117 | |
public List<OrgOrgRelationInfo> getOrgOrgRelationsByOrg(String orgId) { |
| 118 | |
try { |
| 119 | 0 | return service.getOrgOrgRelationsByOrg(orgId); |
| 120 | 0 | } catch (Exception e) { |
| 121 | 0 | LOG.error(e); |
| 122 | |
} |
| 123 | 0 | return null; |
| 124 | |
} |
| 125 | |
|
| 126 | |
@Override |
| 127 | |
public List<OrgOrgRelationInfo> getOrgOrgRelationsByRelatedOrg(String orgId) { |
| 128 | |
|
| 129 | |
try { |
| 130 | 0 | return service.getOrgOrgRelationsByRelatedOrg(orgId); |
| 131 | 0 | } catch (Exception e) { |
| 132 | 0 | LOG.error(e); |
| 133 | |
} |
| 134 | 0 | return null; |
| 135 | |
} |
| 136 | |
|
| 137 | |
@Override |
| 138 | |
public List<OrgInfo> getOrganizationsByIdList(List<String> orgIdList) { |
| 139 | |
try { |
| 140 | 0 | return service.getOrganizationsByIdList(orgIdList); |
| 141 | 0 | } catch (Exception e) { |
| 142 | 0 | LOG.error(e); |
| 143 | |
} |
| 144 | 0 | return null; |
| 145 | |
} |
| 146 | |
|
| 147 | |
@Override |
| 148 | |
public List<String> getAllDescendants(String orgId, String orgHierarchy) { |
| 149 | |
try { |
| 150 | 0 | return service.getAllDescendants(orgId, orgHierarchy); |
| 151 | 0 | } catch (Exception e) { |
| 152 | 0 | LOG.error(e); |
| 153 | |
} |
| 154 | 0 | return null; |
| 155 | |
} |
| 156 | |
|
| 157 | |
@Override |
| 158 | |
public OrgPositionRestrictionInfo addPositionRestrictionToOrg(OrgPositionRestrictionInfo orgPositionRestrictionInfo) { |
| 159 | |
try { |
| 160 | 0 | return service.addPositionRestrictionToOrg(orgPositionRestrictionInfo.getOrgId(), orgPositionRestrictionInfo.getOrgPersonRelationTypeKey(), orgPositionRestrictionInfo); |
| 161 | 0 | } catch (Exception e) { |
| 162 | 0 | LOG.error(e); |
| 163 | |
} |
| 164 | 0 | return null; |
| 165 | |
} |
| 166 | |
|
| 167 | |
@Override |
| 168 | |
public OrgInfo createOrganization(OrgInfo orgInfo) { |
| 169 | |
try { |
| 170 | 0 | return service.createOrganization(orgInfo.getType(), orgInfo); |
| 171 | 0 | } catch (Exception e) { |
| 172 | 0 | LOG.error(e); |
| 173 | |
} |
| 174 | 0 | return null; |
| 175 | |
} |
| 176 | |
|
| 177 | |
@Override |
| 178 | |
public OrgOrgRelationInfo createOrgOrgRelation(OrgOrgRelationInfo orgOrgRelationInfo) { |
| 179 | |
try { |
| 180 | 0 | return service.createOrgOrgRelation(orgOrgRelationInfo.getOrgId(), orgOrgRelationInfo.getRelatedOrgId(), |
| 181 | |
orgOrgRelationInfo.getType(), orgOrgRelationInfo); |
| 182 | 0 | } catch (Exception e) { |
| 183 | 0 | LOG.error(e); |
| 184 | |
} |
| 185 | 0 | return null; |
| 186 | |
} |
| 187 | |
|
| 188 | |
|
| 189 | |
public List<OrgPersonRelationTypeInfo> getOrgPersonRelationTypes() { |
| 190 | |
try { |
| 191 | 0 | return service.getOrgPersonRelationTypes(); |
| 192 | 0 | } catch (Exception e) { |
| 193 | 0 | LOG.error(e); |
| 194 | |
} |
| 195 | 0 | return null; |
| 196 | |
} |
| 197 | |
|
| 198 | |
public List<OrgTypeInfo> getOrgTypes() { |
| 199 | |
try { |
| 200 | 0 | return service.getOrgTypes(); |
| 201 | 0 | } catch (Exception e) { |
| 202 | 0 | LOG.error(e); |
| 203 | |
} |
| 204 | 0 | return null; |
| 205 | |
} |
| 206 | |
|
| 207 | |
|
| 208 | |
public List<OrgOrgRelationTypeInfo> getOrgOrgRelationTypes() { |
| 209 | |
try { |
| 210 | 0 | return service.getOrgOrgRelationTypes(); |
| 211 | 0 | } catch (Exception e) { |
| 212 | 0 | LOG.error(e); |
| 213 | |
} |
| 214 | 0 | return null; |
| 215 | |
} |
| 216 | |
|
| 217 | |
@Override |
| 218 | |
public OrgOrgRelationTypeInfo getOrgOrgRelationType(String orgOrgRelationTypeKey) { |
| 219 | |
try { |
| 220 | 0 | return service.getOrgOrgRelationType(orgOrgRelationTypeKey); |
| 221 | 0 | } catch (Exception e) { |
| 222 | 0 | LOG.error(e); |
| 223 | |
} |
| 224 | 0 | return null; |
| 225 | |
} |
| 226 | |
|
| 227 | |
public List<OrgTreeInfo> getOrgDisplayTree(String orgId, String orgHierarchy, int maxLevels) { |
| 228 | |
try { |
| 229 | 0 | return service.getOrgTree(orgId, orgHierarchy, maxLevels); |
| 230 | 0 | } catch (Exception e) { |
| 231 | 0 | LOG.error(e); |
| 232 | |
} |
| 233 | 0 | return null; |
| 234 | |
} |
| 235 | |
|
| 236 | |
public OrgInfo getOrganization(String orgId) { |
| 237 | |
try { |
| 238 | 0 | return service.getOrganization(orgId); |
| 239 | 0 | } catch (Exception e) { |
| 240 | 0 | LOG.error(e); |
| 241 | |
} |
| 242 | 0 | return null; |
| 243 | |
} |
| 244 | |
|
| 245 | |
|
| 246 | |
public List<OrgPositionRestrictionInfo> getPositionRestrictionsByOrg(String orgId) { |
| 247 | |
try { |
| 248 | 0 | return service.getPositionRestrictionsByOrg(orgId); |
| 249 | 0 | } catch (Exception e) { |
| 250 | 0 | LOG.error(e); |
| 251 | |
} |
| 252 | 0 | return null; |
| 253 | |
} |
| 254 | |
|
| 255 | |
|
| 256 | |
public OrgInfo updateOrganization(OrgInfo orgInfo) { |
| 257 | |
try { |
| 258 | 0 | return service.updateOrganization(orgInfo.getId(), orgInfo); |
| 259 | 0 | } catch (Exception e) { |
| 260 | 0 | LOG.error(e); |
| 261 | |
} |
| 262 | 0 | return null; |
| 263 | |
} |
| 264 | |
|
| 265 | |
|
| 266 | |
public OrgPositionRestrictionInfo updatePositionRestrictionForOrg(OrgPositionRestrictionInfo orgPositionRestrictionInfo) { |
| 267 | |
try { |
| 268 | 0 | return service.updatePositionRestrictionForOrg(orgPositionRestrictionInfo.getOrgId(), orgPositionRestrictionInfo.getOrgPersonRelationTypeKey(), orgPositionRestrictionInfo); |
| 269 | 0 | } catch (Exception e) { |
| 270 | 0 | LOG.error(e); |
| 271 | |
} |
| 272 | 0 | return null; |
| 273 | |
} |
| 274 | |
|
| 275 | |
@Override |
| 276 | |
public OrgOrgRelationInfo updateOrgOrgRelation(OrgOrgRelationInfo orgOrgRelationInfo) { |
| 277 | |
try { |
| 278 | 0 | return service.updateOrgOrgRelation(orgOrgRelationInfo.getId(), orgOrgRelationInfo); |
| 279 | 0 | } catch (Exception e) { |
| 280 | 0 | LOG.error(e); |
| 281 | |
} |
| 282 | 0 | return null; |
| 283 | |
} |
| 284 | |
|
| 285 | |
@Override |
| 286 | |
public OrgPersonRelationInfo createOrgPersonRelation(String orgId, |
| 287 | |
String personId, String orgPersonRelationTypeKey, |
| 288 | |
OrgPersonRelationInfo orgPersonRelationInfo) { |
| 289 | |
|
| 290 | |
try { |
| 291 | 0 | return service.createOrgPersonRelation(orgId, personId, orgPersonRelationTypeKey, orgPersonRelationInfo); |
| 292 | 0 | } catch (Exception e) { |
| 293 | 0 | LOG.error(e); |
| 294 | |
} |
| 295 | 0 | return null; |
| 296 | |
} |
| 297 | |
|
| 298 | |
@Override |
| 299 | |
public List<OrgPersonRelationTypeInfo> getOrgPersonRelationTypesForOrgType( |
| 300 | |
String orgTypeKey) { |
| 301 | |
try { |
| 302 | 0 | return service.getOrgPersonRelationTypesForOrgType(orgTypeKey); |
| 303 | 0 | } catch (Exception e) { |
| 304 | 0 | LOG.error(e); |
| 305 | |
} |
| 306 | 0 | return null; |
| 307 | |
} |
| 308 | |
|
| 309 | |
@Override |
| 310 | |
public List<OrgPersonRelationInfo> getOrgPersonRelationsByOrg(String orgId) { |
| 311 | |
try { |
| 312 | 0 | return service.getOrgPersonRelationsByOrg(orgId); |
| 313 | 0 | } catch (Exception e) { |
| 314 | 0 | LOG.error(e); |
| 315 | |
} |
| 316 | 0 | return null; |
| 317 | |
} |
| 318 | |
|
| 319 | |
@Override |
| 320 | |
public StatusInfo removeOrgPersonRelation(String orgPersonRelationId) { |
| 321 | |
try { |
| 322 | 0 | return service.removeOrgPersonRelation(orgPersonRelationId); |
| 323 | 0 | } catch (Exception e) { |
| 324 | 0 | LOG.error(e); |
| 325 | |
} |
| 326 | 0 | return null; |
| 327 | |
} |
| 328 | |
|
| 329 | |
@Override |
| 330 | |
public OrgPersonRelationInfo updateOrgPersonRelation( |
| 331 | |
String orgPersonRelationId, |
| 332 | |
OrgPersonRelationInfo orgPersonRelationInfo) { |
| 333 | |
try { |
| 334 | 0 | return service.updateOrgPersonRelation(orgPersonRelationId, orgPersonRelationInfo); |
| 335 | 0 | } catch (Exception e) { |
| 336 | 0 | LOG.error(e); |
| 337 | |
} |
| 338 | 0 | return null; |
| 339 | |
} |
| 340 | |
|
| 341 | |
@Override |
| 342 | |
public DataSaveResult saveOrgProposal(Data proposal) throws AssemblyException, org.kuali.student.common.ui.client.service.exceptions.OperationFailedException { |
| 343 | |
|
| 344 | |
try { |
| 345 | 0 | DataSaveResult s = this.saveData(proposal); |
| 346 | 0 | if (s == null) { |
| 347 | 0 | return null; |
| 348 | |
} else { |
| 349 | |
Data sampdata; |
| 350 | 0 | sampdata = s.getValue(); |
| 351 | 0 | List<ValidationResultInfo> vsr = new ArrayList<ValidationResultInfo>(); |
| 352 | 0 | DataSaveResult dsr = new DataSaveResult(vsr,sampdata); |
| 353 | 0 | return dsr; |
| 354 | |
} |
| 355 | 0 | } catch(Exception e){ |
| 356 | 0 | throw new org.kuali.student.common.ui.client.service.exceptions.OperationFailedException("Unable to save"); |
| 357 | |
|
| 358 | |
} |
| 359 | |
|
| 360 | |
} |
| 361 | |
|
| 362 | |
@Override |
| 363 | |
public SectionConfigInfo getSectionConfig() throws org.kuali.student.common.ui.client.service.exceptions.OperationFailedException { |
| 364 | |
|
| 365 | 0 | SectionConfigInfo sectionConfigInfo = new SectionConfigInfo(); |
| 366 | 0 | String packageName = SectionConfig.class.getPackage().getName(); |
| 367 | |
JAXBContext jc; |
| 368 | |
try { |
| 369 | 0 | jc = JAXBContext.newInstance( packageName ); |
| 370 | 0 | Unmarshaller u = jc.createUnmarshaller(); |
| 371 | 0 | SectionConfig sectionConfig = null; |
| 372 | |
try{ |
| 373 | 0 | sectionConfig = (SectionConfig)((JAXBElement)u.unmarshal( |
| 374 | |
new FileInputStream( CONFIGURE_XML_PATH ))).getValue(); |
| 375 | |
} |
| 376 | 0 | catch(FileNotFoundException e){ |
| 377 | 0 | InputStream in = OrgRpcGwtServlet.class.getResourceAsStream("/org_configure.xml"); |
| 378 | 0 | sectionConfig = (SectionConfig)((JAXBElement)u.unmarshal(in)).getValue(); |
| 379 | 0 | } |
| 380 | 0 | List<SectionView> sectionViews = sectionConfig.getSectionView(); |
| 381 | 0 | List<SectionViewInfo> sectionViewInfoList = new ArrayList<SectionViewInfo>(); |
| 382 | 0 | for(SectionView sectionView:sectionViews){ |
| 383 | 0 | SectionViewInfo sectionViewInfo = new SectionViewInfo(); |
| 384 | 0 | sectionViewInfo.setViewName(sectionView.getViewName()); |
| 385 | 0 | sectionViewInfo.setTab(sectionView.getTab()); |
| 386 | 0 | sectionViewInfo.setMenu(sectionView.getMenu()); |
| 387 | 0 | Section section = sectionView.getSection(); |
| 388 | 0 | sectionViewInfo.setSectionName(section.getSectionName()); |
| 389 | 0 | sectionViewInfo.setSectionEnum(section.getEnum()); |
| 390 | 0 | Fields fields = sectionView.getFields(); |
| 391 | 0 | if (fields != null) { |
| 392 | 0 | List<Field> fieldList = fields.getField(); |
| 393 | |
|
| 394 | 0 | List<MultipleField> multipleFieldList = fields.getMultipleField(); |
| 395 | 0 | List<FieldInfo> fieldInfoList = new ArrayList<FieldInfo>(); |
| 396 | 0 | for (Field field : fieldList) { |
| 397 | 0 | FieldInfo fieldInfo = new FieldInfoImpl(); |
| 398 | 0 | fieldInfo.setLabel(field.getLabel()); |
| 399 | 0 | fieldInfo.setKey(field.getKey()); |
| 400 | 0 | fieldInfo.setWidget(field.getWidget()); |
| 401 | 0 | fieldInfoList.add(fieldInfo); |
| 402 | 0 | } |
| 403 | 0 | for (MultipleField multipleField : multipleFieldList) { |
| 404 | 0 | MultipleFieldInfoImpl fieldInfo = new MultipleFieldInfoImpl(); |
| 405 | 0 | fieldInfo.setKey(multipleField.getKey()); |
| 406 | 0 | fieldInfo.setLabel(multipleField.getItemLabel()); |
| 407 | 0 | fieldInfo.setAddItemLabel(multipleField.getAddItemLabel()); |
| 408 | 0 | List<Field> fieldMultiList = multipleField.getFields().getField(); |
| 409 | 0 | List<FieldInfo> fieldMultiInfoList = new ArrayList<FieldInfo>(); |
| 410 | 0 | for (Field field : fieldMultiList) { |
| 411 | 0 | FieldInfo fieldMultiInfo = new FieldInfoImpl(); |
| 412 | 0 | fieldMultiInfo.setLabel(field.getLabel()); |
| 413 | 0 | fieldMultiInfo.setKey(field.getKey()); |
| 414 | 0 | fieldMultiInfo.setWidget(field.getWidget()); |
| 415 | 0 | fieldMultiInfoList.add(fieldMultiInfo); |
| 416 | 0 | } |
| 417 | 0 | fieldInfo.setFields(fieldMultiInfoList); |
| 418 | 0 | fieldInfoList.add(fieldInfo); |
| 419 | 0 | } |
| 420 | |
|
| 421 | 0 | sectionViewInfo.setfields(fieldInfoList); |
| 422 | |
} |
| 423 | 0 | sectionViewInfoList.add(sectionViewInfo); |
| 424 | |
|
| 425 | 0 | } |
| 426 | 0 | sectionConfigInfo.setSectionViewInfoList(sectionViewInfoList); |
| 427 | |
|
| 428 | 0 | } catch (JAXBException e) { |
| 429 | 0 | LOG.error(e); |
| 430 | 0 | throw new org.kuali.student.common.ui.client.service.exceptions.OperationFailedException("Org Screen XML Cnfig file: recources/org_configure.xml parse exception"); |
| 431 | 0 | } |
| 432 | |
|
| 433 | 0 | return sectionConfigInfo; |
| 434 | |
} |
| 435 | |
|
| 436 | |
@Override |
| 437 | |
public Data fetchOrg(String orgId) { |
| 438 | |
try { |
| 439 | 0 | return (Data)this.getData(orgId); |
| 440 | |
} |
| 441 | 0 | catch(Exception e){ |
| 442 | 0 | LOG.error(e); |
| 443 | |
} |
| 444 | 0 | return null; |
| 445 | |
} |
| 446 | |
|
| 447 | |
@Override |
| 448 | |
public List<OrgPositionPersonRelationInfo> getOrgPositionPersonRelation(String orgId) { |
| 449 | 0 | ArrayList<OrgPositionPersonRelationInfo> relations = new ArrayList<OrgPositionPersonRelationInfo>(); |
| 450 | 0 | OrgPositionPersonRelationInfo personRelationInfo = null; |
| 451 | |
try{ |
| 452 | 0 | List<OrgPersonRelationInfo> orgPersonRelations = service.getAllOrgPersonRelationsByOrg(orgId); |
| 453 | 0 | List<OrgPositionRestrictionInfo> orgPositionRestrictions = service.getPositionRestrictionsByOrg(orgId); |
| 454 | |
|
| 455 | 0 | for(OrgPositionRestrictionInfo position:orgPositionRestrictions){ |
| 456 | 0 | personRelationInfo = new OrgPositionPersonRelationInfo(); |
| 457 | 0 | personRelationInfo.setOrgPersonRelationTypeKey(position.getOrgPersonRelationTypeKey()); |
| 458 | 0 | personRelationInfo.setTitle(position.getTitle()); |
| 459 | 0 | personRelationInfo.setDesc(position.getDesc()); |
| 460 | 0 | personRelationInfo.setMinNumRelations(position.getMinNumRelations().toString()); |
| 461 | 0 | personRelationInfo.setMaxNumRelations(position.getMaxNumRelations()); |
| 462 | 0 | ArrayList<String> names = new ArrayList<String>(); |
| 463 | 0 | for(OrgPersonRelationInfo relation: orgPersonRelations){ |
| 464 | 0 | if(position.getOrgPersonRelationTypeKey().equals(relation.getType())){ |
| 465 | 0 | names.add(relation.getPersonId()); |
| 466 | |
} |
| 467 | |
} |
| 468 | 0 | personRelationInfo.setPersonId(names); |
| 469 | 0 | relations.add(personRelationInfo); |
| 470 | 0 | } |
| 471 | |
|
| 472 | |
} |
| 473 | 0 | catch(Exception e){ |
| 474 | 0 | LOG.error(e); |
| 475 | 0 | } |
| 476 | 0 | return relations; |
| 477 | |
} |
| 478 | |
|
| 479 | |
|
| 480 | |
@Override |
| 481 | |
public Map<String, MembershipInfo> getNamesForPersonIds(List<String> personIds) { |
| 482 | |
|
| 483 | 0 | QueryByCriteria.Builder builder = QueryByCriteria.Builder.create(); |
| 484 | 0 | builder.setPredicates(and(in("id", personIds.toArray()), |
| 485 | |
equal("active", "Y"), |
| 486 | |
and( |
| 487 | |
equal("names.active", "Y"), |
| 488 | |
equal("names.defaultValue", "Y")))); |
| 489 | 0 | EntityDefaultQueryResults qr = identityServiceNonCached.findEntityDefaults(builder.build()); |
| 490 | |
|
| 491 | 0 | Map<String, MembershipInfo> identities = new HashMap<String, MembershipInfo>(); |
| 492 | |
|
| 493 | 0 | for(EntityDefault entityDefault : qr.getResults()) { |
| 494 | 0 | MembershipInfo memeberEntity = new MembershipInfo(); |
| 495 | 0 | memeberEntity.setFirstName(entityDefault.getName().getFirstName()); |
| 496 | 0 | memeberEntity.setLastName(entityDefault.getName().getLastName()); |
| 497 | 0 | identities.put(entityDefault.getEntityId(), memeberEntity); |
| 498 | 0 | } |
| 499 | |
|
| 500 | 0 | return identities; |
| 501 | |
} |
| 502 | |
|
| 503 | |
@Override |
| 504 | |
protected String deriveAppIdFromData(Data data) { |
| 505 | 0 | return null; |
| 506 | |
} |
| 507 | |
|
| 508 | |
@Override |
| 509 | |
protected String deriveDocContentFromData(Data data) { |
| 510 | 0 | return null; |
| 511 | |
} |
| 512 | |
|
| 513 | |
@Override |
| 514 | |
protected String getDefaultMetaDataState() { |
| 515 | 0 | return null; |
| 516 | |
} |
| 517 | |
|
| 518 | |
@Override |
| 519 | |
protected String getDefaultMetaDataType() { |
| 520 | 0 | return null; |
| 521 | |
} |
| 522 | |
|
| 523 | |
@Override |
| 524 | |
protected String getDefaultWorkflowDocumentType() { |
| 525 | 0 | return null; |
| 526 | |
} |
| 527 | |
|
| 528 | |
} |