本文整理汇总了Java中com.owera.xaps.dbi.Profile类的典型用法代码示例。如果您正苦于以下问题:Java Profile类的具体用法?Java Profile怎么用?Java Profile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Profile类属于com.owera.xaps.dbi包,在下文中一共展示了Profile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateFromSyslog
import com.owera.xaps.dbi.Profile; //导入依赖的package包/类
public Report<RecordProvisioning> generateFromSyslog(PeriodType periodType, Date start, Date end, List<Unittype> uts, List<Profile> prs, String unitId, Group group)
throws NoAvailableConnectionException, SQLException, IOException {
Map<String, Report<RecordProvisioning>> unitReportMap = generateFromSyslogImpl(periodType, start, end, uts, prs, unitId, group);
Report<RecordProvisioning> endReport = new Report<RecordProvisioning>(RecordProvisioning.class, periodType);
for (Report<RecordProvisioning> report : unitReportMap.values()) {
for (RecordProvisioning record : report.getMap().values()) {
RecordProvisioning endRecord = endReport.getRecord(record.getKey());
if (endRecord == null)
endReport.setRecord(record.getKey(), record);
else
endRecord.add(record);
}
}
return endReport;
}
示例2: generateFromSyslog
import com.owera.xaps.dbi.Profile; //导入依赖的package包/类
public Report<RecordVoipCall> generateFromSyslog(PeriodType periodType, Date start, Date end, List<Unittype> uts, List<Profile> prs, String unitId, String line, Group group)
throws NoAvailableConnectionException, SQLException, IOException {
Report<RecordVoipCall> report = new Report<RecordVoipCall>(RecordVoipCall.class, periodType);
logInfo("VoipCallReport", null, uts, prs, start, end);
if (unitId != null)
unitId = "^" + unitId + "$";
List<SyslogEntry> entries = readSyslog(start, end, uts, prs, unitId, line);
Map<String, Unit> unitsInGroup = getUnitsInGroup(group);
for (SyslogEntry entry : entries) {
if (group != null && unitsInGroup.get(entry.getUnitId()) == null)
continue;
addToReport(report, entry, periodType);
}
logger.info(logPrefix + "HardwareReport: Have read " + entries.size() + " rows from syslog, report is now " + report.getMap().size() + " entries");
return report;
}
示例3: readSyslog
import com.owera.xaps.dbi.Profile; //导入依赖的package包/类
private List<SyslogEntry> readSyslog(Date start, Date end, List<Unittype> uts, List<Profile> prs, String unitId, String line) throws SQLException, NoAvailableConnectionException {
Syslog syslog = new Syslog(sysCp, id);
SyslogFilter filter = new SyslogFilter();
filter.setFacility(16); // Only messages from device
if (line == null)
filter.setMessage("MOS Report:");
else
filter.setMessage("MOS Report: Channel " + line);
filter.setUnitId(unitId);
filter.setProfiles(prs);
filter.setUnittypes(uts);
filter.setCollectorTmsStart(start);
filter.setCollectorTmsEnd(end);
filter.setFacilityVersion(swVersion);
return syslog.read(filter, xaps);
}
示例4: getProfileFromXAPS
import com.owera.xaps.dbi.Profile; //导入依赖的package包/类
/**
* This method will return the object from DBI if it can find it. Reasons
* for not finding it is wrong name specified by the clients or no access
* to the object for this user. However, returning the object does not implicate
* all actions are allowed on this object (like add/change/delete). This
* permission check is performed in DBI, and will throw IllegalArgumentExceptions
* if it occur.
* @param unittypeName
* @param profileName
* @return
* @throws RemoteException
*/
protected Profile getProfileFromXAPS(String unittypeName, String profileName) throws RemoteException {
Unittype unittype = getUnittypeFromXAPS(unittypeName);
if (profileName == null)
throw error("The profile name is not specified");
Profile profile = unittype.getProfiles().getByName(profileName);
if (profile == null)
throw error("The profile " + profileName + " is not found/allowed in xAPS");
// Permissions permissions = id.getUser().getPermissions();
// if (permissions.getPermissions().length == 0) {
//
// return profile;
// }
// if (permissions.getByUnittypeProfile(unittype.getId(), profile.getId()) == null)
// if (permissions.getByUnittypeProfile(unittype.getId(), null) == null)
// throw error("The login " + id.getUser().getUsername() + " does not have full access to profile " + profileName);
return profile;
}
示例5: writeUnitSessionParams
import com.owera.xaps.dbi.Profile; //导入依赖的package包/类
public void writeUnitSessionParams(SessionData sessionData) throws TR069DatabaseException {
try {
List<ParameterValueStruct> parameterValuesToDB = sessionData.getToDB();
Unittype unittype = sessionData.getUnittype();
Profile profile = sessionData.getProfile();
List<UnitParameter> unitSessionParameters = new ArrayList<UnitParameter>();
for (ParameterValueStruct pvs : parameterValuesToDB) {
UnittypeParameter utp = unittype.getUnittypeParameters().getByName(pvs.getName());
if (utp != null) {
UnitParameter up = new UnitParameter(utp, sessionData.getUnitId(), pvs.getValue(), profile);
if (utp.getName().startsWith("Device.") || utp.getName().startsWith("InternetGatewayDevice."))
unitSessionParameters.add(up);
} else
Log.warn(DBAccessSession.class, "\t" + pvs.getName() + " : does not exist, cannot write session value " + pvs.getValue());
}
if (unitSessionParameters.size() > 0) {
XAPSUnit xapsUnit = DBAccess.getXAPSUnit(xaps);
xapsUnit.addOrChangeSessionUnitParameters(unitSessionParameters, profile);
}
} catch (SQLException sqle) {
throw new TR069DatabaseException("Not possible to write session parameters to database", sqle);
}
}
示例6: logInfo
import com.owera.xaps.dbi.Profile; //导入依赖的package包/类
protected void logInfo(String reportType, String unitId, List<Unittype> uts, List<Profile> prs, Date start, Date end) {
String msg = logPrefix + reportType + ": Will generate from syslog (";
if (unitId != null)
msg += "unitId: " + unitId + ", ";
if (uts != null)
msg += "unittypes: " + uts.size() + ", ";
if (prs != null)
msg += "profile: " + prs.size() + ", ";
msg += start + " - " + end + ")";
logger.info(msg);
}
示例7: getUnittypeForParameters
import com.owera.xaps.dbi.Profile; //导入依赖的package包/类
private Unittype getUnittypeForParameters(List<Profile> allowedProfiles) throws RemoteException {
Unittype unittype = allowedProfiles.get(0).getUnittype();
for (Profile p : allowedProfiles) {
if (!p.getUnittype().getName().equals(unittype.getName()))
throw XAPSWS.error(logger, "Cannot specify parameters or SerialNumber without specifying Unittype"); // there are more than 1 unittype - indicating no unittype has been specified
}
return unittype;
}
示例8: validateParameters
import com.owera.xaps.dbi.Profile; //导入依赖的package包/类
private List<Parameter> validateParameters(com.owera.xapsws.Unit unitWS, List<Profile> allowedProfiles) throws RemoteException {
if (allowedProfiles == null || allowedProfiles.size() == 0)
throw XAPSWS.error(logger, "Unittype and profiles are not specified, not possible to make parameter-search");
List<Parameter> parameters = new ArrayList<Parameter>();
if (unitWS.getParameters() != null && unitWS.getParameters().getParameterArray() != null) {
Unittype unittype = getUnittypeForParameters(allowedProfiles);
for (com.owera.xapsws.Parameter pWS : unitWS.getParameters().getParameterArray()) {
UnittypeParameter utp = unittype.getUnittypeParameters().getByName(pWS.getName());
if (utp == null)
throw XAPSWS.error(logger, "Unittype parameter " + pWS.getName() + " is not found in unittype " + unittype.getName());
// boolean equal = true;
ParameterDataType pdt = ParameterDataType.TEXT;
Operator op = Operator.EQ;
if (pWS.getFlags() != null) {
String[] opTypeArr = pWS.getFlags().split(",");
try {
op = Operator.getOperatorFromLiteral(opTypeArr[0]);
if (opTypeArr.length == 2)
pdt = ParameterDataType.getDataType(opTypeArr[1]);
} catch (IllegalArgumentException iae) {
throw XAPSWS.error(logger, "An error occurred in flag (" + pWS.getFlags() + "): " + iae.getMessage());
}
}
Parameter pXAPS = new Parameter(utp, pWS.getValue(), op, pdt);
parameters.add(pXAPS);
}
}
// if (unitWS.getSerialNumber() != null) {
// Unittype unittype = getUnittypeForParameters(allowedProfiles);
// UnittypeParameter serialNumberUtp = getSerialNumberUtp(unittype);
// if (serialNumberUtp == null)
// throw XAPSWS.error(logger, "SerialNumber unittype parameter does not exist!");
// parameters.add(new Parameter(serialNumberUtp, unitWS.getSerialNumber(), true));
// }
return parameters;
}
示例9: validateUnitId
import com.owera.xaps.dbi.Profile; //导入依赖的package包/类
private String validateUnitId(Unit unitWS, Unittype unittype, Profile profile) throws SQLException, NoAvailableConnectionException, RemoteException {
if (unitWS.getUnitId() == null) {
if (unitWS.getSerialNumber() != null) {
com.owera.xaps.dbi.Unit unitXAPS = xapsWS.getUnitByMAC(xapsUnit, unittype, profile, unitWS.getSerialNumber());
if (unitXAPS != null) {
unitWS.setUnitId(unitXAPS.getId());
}
}
if (unitWS.getUnitId() == null)
XAPSWS.error(logger, "No unitId or serial number is supplied to the service");
}
return unitWS.getUnitId();
}
示例10: validateDeleteUnitParameters
import com.owera.xaps.dbi.Profile; //导入依赖的package包/类
private List<UnitParameter> validateDeleteUnitParameters(Unit unitWS, Unittype unittype, Profile profile) throws RemoteException {
List<UnitParameter> unitParams = new ArrayList<UnitParameter>();
Parameter[] parameters = unitWS.getParameters().getParameterArray();
for (Parameter p : parameters) {
UnittypeParameter utp = unittype.getUnittypeParameters().getByName(p.getName());
if (utp == null) {
throw XAPSWS.error(logger, "Unittype parameter " + p.getName() + " is not found in unittype " + unittype.getName());
} else {
if (p.getFlags() != null && p.getFlags().equals("D")) {
unitParams.add(new UnitParameter(utp, unitWS.getUnitId(), p.getValue(), profile));
}
}
}
return unitParams;
}
示例11: validateAddOrChangeUnitParameters
import com.owera.xaps.dbi.Profile; //导入依赖的package包/类
private List<UnitParameter> validateAddOrChangeUnitParameters(Unit unitWS, Unittype unittype, Profile profile) throws RemoteException {
List<UnitParameter> unitParams = new ArrayList<UnitParameter>();
Parameter[] parameters = unitWS.getParameters().getParameterArray();
for (Parameter p : parameters) {
UnittypeParameter utp = unittype.getUnittypeParameters().getByName(p.getName());
if (utp == null) {
throw XAPSWS.error(logger, "Unittype parameter " + p.getName() + " is not found in unittype " + unittype.getName());
} else {
if (p.getFlags() == null || p.getFlags().equals("AC")) {
unitParams.add(new UnitParameter(utp, unitWS.getUnitId(), p.getValue(), profile));
}
}
}
return unitParams;
}
示例12: getProfiles
import com.owera.xaps.dbi.Profile; //导入依赖的package包/类
public GetProfilesResponse getProfiles(GetProfilesRequest gur) throws RemoteException {
try {
xapsWS = XAPSWSFactory.getXAPSWS(gur.getLogin());
if (gur.getUnittype() == null || gur.getUnittype().getName() == null)
throw XAPSWS.error(logger, "No unittype is specified");
Unittype unittype = xapsWS.getUnittypeFromXAPS(gur.getUnittype().getName());
com.owera.xapsws.Profile[] profileArray = null;
if (gur.getProfile() == null || gur.getProfile().getName() == null) {
Profile[] profileXAPSArr = unittype.getProfiles().getProfiles();
// List<Profile> allowedProfiles = xapsWS.getXAPS().getAllowedProfiles(unittype);
// profileArray = new com.owera.xapsws.Profile[allowedProfiles.size()];
profileArray = new com.owera.xapsws.Profile[profileXAPSArr.length];
int i = 0;
for (Profile profileXAPS : profileXAPSArr)
profileArray[i++] = ConvertXAPS2WS.convert(profileXAPS);
// for (int i = 0; i < allowedProfiles.size(); i++)
// profileArray[i] = ConvertXAPS2WS.convert(allowedProfiles.get(i));
} else {
profileArray = new com.owera.xapsws.Profile[1];
Profile p = xapsWS.getProfileFromXAPS(unittype.getName(), gur.getProfile().getName());
profileArray[0] = ConvertXAPS2WS.convert(p);
}
return new GetProfilesResponse(new ProfileList(profileArray));
} catch (Throwable t) {
if (t instanceof RemoteException)
throw (RemoteException) t;
else {
throw XAPSWS.error(logger, t);
}
}
}
示例13: getUnittypeForParameters
import com.owera.xaps.dbi.Profile; //导入依赖的package包/类
private Unittype getUnittypeForParameters(List<Profile> allowedProfiles) throws RemoteException {
Unittype unittype = allowedProfiles.get(0).getUnittype();
for (Profile p : allowedProfiles) {
if (!p.getUnittype().getName().equals(unittype.getName()))
// there are more than 1 unittype - indicating no unittype has been specified
throw XAPSWS.error(logger, "Cannot specify parameters or SerialNumber without specifying Unittype");
}
return unittype;
}
示例14: deleteProfile
import com.owera.xaps.dbi.Profile; //导入依赖的package包/类
public DeleteProfileResponse deleteProfile(DeleteProfileRequest dur) throws RemoteException {
try {
xapsWS = XAPSWSFactory.getXAPSWS(dur.getLogin());
xaps = xapsWS.getXAPS();
if (dur.getUnittype() == null)
throw XAPSWS.error(logger, "No unittype is specified");
Unittype unittype = xapsWS.getUnittypeFromXAPS(dur.getUnittype().getName());
if (dur.getProfile() == null)
throw XAPSWS.error(logger, "No profile name is specified");
Profile profile = xapsWS.getProfileFromXAPS(unittype.getName(), dur.getProfile().getName());
int rowsDeleted = unittype.getProfiles().deleteProfile(profile, xaps, true);
if (rowsDeleted > 0)
return new DeleteProfileResponse(true);
else
return new DeleteProfileResponse(false);
} catch (Throwable t) {
if (t instanceof RemoteException)
throw (RemoteException) t;
else {
String msg = "An exception occurred: " + t.getMessage();
logger.error(msg, t);
throw new RemoteException(msg, t);
}
}
}
示例15: getUnitByMAC
import com.owera.xaps.dbi.Profile; //导入依赖的package包/类
protected com.owera.xaps.dbi.Unit getUnitByMAC(XAPSUnit xapsUnit, Unittype unittype, Profile profile, String searchStr) throws RemoteException, SQLException, NoAvailableConnectionException {
com.owera.xaps.dbi.Unit unitFoundByMac = xapsUnit.getUnitByValue(searchStr, unittype, profile);
if (unitFoundByMac != null) {
return unitFoundByMac;
} else {
throw error("The serialNumber/unique value was not found in xAPS on unittype " + unittype.getName() + " and profile " + profile.getName());
}
}